void checkSuperuserPrivilege(String operationName) throws IOException { try { checkSuperuserPrivilege(); } catch (AccessControlException ace) { logAuditEvent(false, operationName, null); throw ace; } }
@Override // TraceAdminProtocol public void removeSpanReceiver(long id) throws IOException { checkNNStartup(); namesystem.checkSuperuserPrivilege(); nn.tracerConfigurationManager.removeSpanReceiver(id); }
synchronized void transitionToStandby() throws ServiceFailedException, AccessControlException { namesystem.checkSuperuserPrivilege(); if (!haEnabled) { throw new ServiceFailedException("HA for namenode is not enabled"); } state.setState(haContext, STANDBY_STATE); }
@Override // NamenodeProtocol public boolean isRollingUpgrade() throws IOException { checkNNStartup(); namesystem.checkSuperuserPrivilege(); return namesystem.isRollingUpgrade(); }
@Override // NamenodeProtocol public boolean isUpgradeFinalized() throws IOException { checkNNStartup(); namesystem.checkSuperuserPrivilege(); return namesystem.isUpgradeFinalized(); }
@Override // TraceAdminProtocol public SpanReceiverInfo[] listSpanReceivers() throws IOException { checkNNStartup(); namesystem.checkSuperuserPrivilege(); return nn.tracerConfigurationManager.listSpanReceivers(); }
synchronized void transitionToActive() throws ServiceFailedException, AccessControlException { namesystem.checkSuperuserPrivilege(); if (!haEnabled) { throw new ServiceFailedException("HA for namenode is not enabled"); } state.setState(haContext, ACTIVE_STATE); }
@Override // NamenodeProtocol public CheckpointSignature rollEditLog() throws IOException { checkNNStartup(); namesystem.checkSuperuserPrivilege(); return namesystem.rollEditLog(); }
@Override // TraceAdminProtocol public long addSpanReceiver(SpanReceiverInfo info) throws IOException { checkNNStartup(); namesystem.checkSuperuserPrivilege(); return nn.tracerConfigurationManager.addSpanReceiver(info); }
@Override // ReconfigurationProtocol public List<String> listReconfigurableProperties() throws IOException { checkNNStartup(); String operationName = "listNamenodeReconfigurableProperties"; namesystem.checkSuperuserPrivilege(operationName); List<String> result = Lists.newArrayList(nn.getReconfigurableProperties()); namesystem.logAuditEvent(true, operationName, null); return result; }
@Override // ReconfigurationProtocol public void startReconfiguration() throws IOException { checkNNStartup(); String operationName = "startNamenodeReconfiguration"; namesystem.checkSuperuserPrivilege(operationName); nn.startReconfigurationTask(); namesystem.logAuditEvent(true, operationName, null); }
@Override // ReconfigurationProtocol public ReconfigurationTaskStatus getReconfigurationStatus() throws IOException { checkNNStartup(); String operationName = "getNamenodeReconfigurationStatus"; namesystem.checkSuperuserPrivilege(operationName); ReconfigurationTaskStatus status = nn.getReconfigurationTaskStatus(); namesystem.logAuditEvent(true, operationName, null); return status; }
@Override // NamenodeProtocol public ExportedBlockKeys getBlockKeys() throws IOException { checkNNStartup(); namesystem.checkSuperuserPrivilege(); return namesystem.getBlockManager().getBlockKeys(); }
@Override // NamenodeProtocol public long getTransactionID() throws IOException { checkNNStartup(); namesystem.checkOperation(OperationCategory.UNCHECKED); namesystem.checkSuperuserPrivilege(); return namesystem.getFSImage().getCorrectLastAppliedOrWrittenTxId(); }
@Override // NamenodeProtocol public RemoteEditLogManifest getEditLogManifest(long sinceTxId) throws IOException { checkNNStartup(); namesystem.checkOperation(OperationCategory.READ); namesystem.checkSuperuserPrivilege(); return namesystem.getEditLog().getEditLogManifest(sinceTxId); }
@Override // NamenodeProtocol public long getMostRecentCheckpointTxId() throws IOException { checkNNStartup(); namesystem.checkOperation(OperationCategory.UNCHECKED); namesystem.checkSuperuserPrivilege(); return namesystem.getFSImage().getMostRecentCheckpointTxId(); }
void setBalancerBandwidth(long bandwidth) throws IOException { String operationName = "setBalancerBandwidth"; checkOperation(OperationCategory.WRITE); checkSuperuserPrivilege(operationName); getBlockManager().getDatanodeManager().setBalancerBandwidth(bandwidth); logAuditEvent(true, operationName, null); }
@Override // NamenodeProtocol public NamenodeRegistration registerSubordinateNamenode( NamenodeRegistration registration) throws IOException { checkNNStartup(); namesystem.checkSuperuserPrivilege(); verifyLayoutVersion(registration.getVersion()); NamenodeRegistration myRegistration = nn.setRegistration(); namesystem.registerBackupNode(registration, myRegistration); return myRegistration; }
@Override // ClientProtocol public long getCurrentEditLogTxid() throws IOException { checkNNStartup(); namesystem.checkOperation(OperationCategory.READ); // only active namesystem.checkSuperuserPrivilege(); // if it's not yet open for write, we may be in the process of transitioning // from standby to active and may not yet know what the latest committed // txid is return namesystem.getEditLog().isOpenForWrite() ? namesystem.getEditLog().getLastWrittenTxId() : -1; }
void refreshNodes() throws IOException { String operationName = "refreshNodes"; checkOperation(OperationCategory.UNCHECKED); checkSuperuserPrivilege(operationName); getBlockManager().getDatanodeManager().refreshNodes(new HdfsConfiguration()); logAuditEvent(true, operationName, null); }