|
@@ -353,9 +353,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
|
public void errorReport(NamenodeRegistration registration,
|
|
|
int errorCode,
|
|
|
String msg) throws IOException {
|
|
|
- // nn.checkOperation(OperationCategory.WRITE);
|
|
|
- // TODO: I dont think this should be checked - it's just for logging
|
|
|
- // and dropping backups
|
|
|
+ namesystem.checkOperation(OperationCategory.UNCHECKED);
|
|
|
verifyRequest(registration);
|
|
|
LOG.info("Error report from " + registration + ": " + msg);
|
|
|
if(errorCode == FATAL)
|
|
@@ -707,8 +705,8 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
|
|
|
|
@Override // ClientProtocol
|
|
|
public DatanodeInfo[] getDatanodeReport(DatanodeReportType type)
|
|
|
- throws IOException {
|
|
|
- // TODO(HA): decide on OperationCategory for this
|
|
|
+ throws IOException {
|
|
|
+ namesystem.checkOperation(OperationCategory.UNCHECKED);
|
|
|
DatanodeInfo results[] = namesystem.datanodeReport(type);
|
|
|
if (results == null ) {
|
|
|
throw new IOException("Cannot find datanode report");
|
|
@@ -718,32 +716,32 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
|
|
|
|
@Override // ClientProtocol
|
|
|
public boolean setSafeMode(SafeModeAction action) throws IOException {
|
|
|
- // TODO:HA decide on OperationCategory for this
|
|
|
+ namesystem.checkOperation(OperationCategory.UNCHECKED);
|
|
|
return namesystem.setSafeMode(action);
|
|
|
}
|
|
|
+
|
|
|
@Override // ClientProtocol
|
|
|
- public boolean restoreFailedStorage(String arg)
|
|
|
- throws AccessControlException {
|
|
|
- // TODO:HA decide on OperationCategory for this
|
|
|
+ public boolean restoreFailedStorage(String arg) throws IOException {
|
|
|
+ namesystem.checkOperation(OperationCategory.UNCHECKED);
|
|
|
return namesystem.restoreFailedStorage(arg);
|
|
|
}
|
|
|
|
|
|
@Override // ClientProtocol
|
|
|
public void saveNamespace() throws IOException {
|
|
|
- // TODO:HA decide on OperationCategory for this
|
|
|
+ namesystem.checkOperation(OperationCategory.UNCHECKED);
|
|
|
namesystem.saveNamespace();
|
|
|
}
|
|
|
|
|
|
@Override // ClientProtocol
|
|
|
public void refreshNodes() throws IOException {
|
|
|
- // TODO:HA decide on OperationCategory for this
|
|
|
+ namesystem.checkOperation(OperationCategory.UNCHECKED);
|
|
|
namesystem.getBlockManager().getDatanodeManager().refreshNodes(
|
|
|
new HdfsConfiguration());
|
|
|
}
|
|
|
|
|
|
@Override // NamenodeProtocol
|
|
|
- public long getTransactionID() {
|
|
|
- // TODO:HA decide on OperationCategory for this
|
|
|
+ public long getTransactionID() throws IOException {
|
|
|
+ namesystem.checkOperation(OperationCategory.CHECKPOINT);
|
|
|
return namesystem.getEditLog().getSyncTxId();
|
|
|
}
|
|
|
|
|
@@ -755,28 +753,29 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
|
@Override // NamenodeProtocol
|
|
|
public RemoteEditLogManifest getEditLogManifest(long sinceTxId)
|
|
|
throws IOException {
|
|
|
- // TODO:HA decide on OperationCategory for this
|
|
|
+ namesystem.checkOperation(OperationCategory.READ);
|
|
|
return namesystem.getEditLog().getEditLogManifest(sinceTxId);
|
|
|
}
|
|
|
|
|
|
@Override // ClientProtocol
|
|
|
public void finalizeUpgrade() throws IOException {
|
|
|
- // TODO:HA decide on OperationCategory for this
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
|
namesystem.finalizeUpgrade();
|
|
|
}
|
|
|
|
|
|
@Override // ClientProtocol
|
|
|
public UpgradeStatusReport distributedUpgradeProgress(UpgradeAction action)
|
|
|
throws IOException {
|
|
|
- // TODO:HA decide on OperationCategory for this
|
|
|
+ namesystem.checkOperation(OperationCategory.READ);
|
|
|
return namesystem.distributedUpgradeProgress(action);
|
|
|
}
|
|
|
|
|
|
@Override // ClientProtocol
|
|
|
public void metaSave(String filename) throws IOException {
|
|
|
- // TODO:HA decide on OperationCategory for this
|
|
|
+ namesystem.checkOperation(OperationCategory.UNCHECKED);
|
|
|
namesystem.metaSave(filename);
|
|
|
}
|
|
|
+
|
|
|
@Override // ClientProtocol
|
|
|
public CorruptFileBlocks listCorruptFileBlocks(String path, String cookie)
|
|
|
throws IOException {
|
|
@@ -795,12 +794,12 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
|
/**
|
|
|
* Tell all datanodes to use a new, non-persistent bandwidth value for
|
|
|
* dfs.datanode.balance.bandwidthPerSec.
|
|
|
- * @param bandwidth Blanacer bandwidth in bytes per second for all datanodes.
|
|
|
+ * @param bandwidth Balancer bandwidth in bytes per second for all datanodes.
|
|
|
* @throws IOException
|
|
|
*/
|
|
|
@Override // ClientProtocol
|
|
|
public void setBalancerBandwidth(long bandwidth) throws IOException {
|
|
|
- // TODO:HA decide on OperationCategory for this
|
|
|
+ namesystem.checkOperation(OperationCategory.UNCHECKED);
|
|
|
namesystem.getBlockManager().getDatanodeManager().setBalancerBandwidth(bandwidth);
|
|
|
}
|
|
|
|