|
@@ -611,7 +611,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
|
throw new IOException("create: Pathname too long. Limit "
|
|
|
+ MAX_PATH_LENGTH + " characters, " + MAX_PATH_DEPTH + " levels.");
|
|
|
}
|
|
|
-
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
|
CacheEntryWithPayload cacheEntry = RetryCache.waitForCompletion(retryCache, null);
|
|
|
if (cacheEntry != null && cacheEntry.isSuccess()) {
|
|
|
return (HdfsFileStatus) cacheEntry.getPayload();
|
|
@@ -642,6 +642,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
|
stateChangeLog.debug("*DIR* NameNode.append: file "
|
|
|
+src+" for "+clientName+" at "+clientMachine);
|
|
|
}
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
|
CacheEntryWithPayload cacheEntry = RetryCache.waitForCompletion(retryCache,
|
|
|
null);
|
|
|
if (cacheEntry != null && cacheEntry.isSuccess()) {
|
|
@@ -789,6 +790,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
|
ExtendedBlock newBlock, DatanodeID[] newNodes, String[] newStorageIDs)
|
|
|
throws IOException {
|
|
|
checkNNStartup();
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
|
CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
|
|
|
if (cacheEntry != null && cacheEntry.isSuccess()) {
|
|
|
return; // Return previous response
|
|
@@ -833,7 +835,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
|
throw new IOException("rename: Pathname too long. Limit "
|
|
|
+ MAX_PATH_LENGTH + " characters, " + MAX_PATH_DEPTH + " levels.");
|
|
|
}
|
|
|
-
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
|
CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
|
|
|
if (cacheEntry != null && cacheEntry.isSuccess()) {
|
|
|
return true; // Return previous response
|
|
@@ -854,6 +856,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
|
@Override // ClientProtocol
|
|
|
public void concat(String trg, String[] src) throws IOException {
|
|
|
checkNNStartup();
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
|
CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
|
|
|
if (cacheEntry != null && cacheEntry.isSuccess()) {
|
|
|
return; // Return previous response
|
|
@@ -879,6 +882,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
|
throw new IOException("rename: Pathname too long. Limit "
|
|
|
+ MAX_PATH_LENGTH + " characters, " + MAX_PATH_DEPTH + " levels.");
|
|
|
}
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
|
CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
|
|
|
if (cacheEntry != null && cacheEntry.isSuccess()) {
|
|
|
return; // Return previous response
|
|
@@ -916,6 +920,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
|
stateChangeLog.debug("*DIR* Namenode.delete: src=" + src
|
|
|
+ ", recursive=" + recursive);
|
|
|
}
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
|
CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
|
|
|
if (cacheEntry != null && cacheEntry.isSuccess()) {
|
|
|
return true; // Return previous response
|
|
@@ -1200,6 +1205,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
|
public void createSymlink(String target, String link, FsPermission dirPerms,
|
|
|
boolean createParent) throws IOException {
|
|
|
checkNNStartup();
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
|
CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
|
|
|
if (cacheEntry != null && cacheEntry.isSuccess()) {
|
|
|
return; // Return previous response
|
|
@@ -1531,6 +1537,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
|
throw new IOException("createSnapshot: Pathname too long. Limit "
|
|
|
+ MAX_PATH_LENGTH + " characters, " + MAX_PATH_DEPTH + " levels.");
|
|
|
}
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
|
CacheEntryWithPayload cacheEntry = RetryCache.waitForCompletion(retryCache,
|
|
|
null);
|
|
|
if (cacheEntry != null && cacheEntry.isSuccess()) {
|
|
@@ -1552,6 +1559,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
|
public void deleteSnapshot(String snapshotRoot, String snapshotName)
|
|
|
throws IOException {
|
|
|
checkNNStartup();
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
|
metrics.incrDeleteSnapshotOps();
|
|
|
CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
|
|
|
if (cacheEntry != null && cacheEntry.isSuccess()) {
|
|
@@ -1590,6 +1598,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
|
if (snapshotNewName == null || snapshotNewName.isEmpty()) {
|
|
|
throw new IOException("The new snapshot name is null or empty.");
|
|
|
}
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
|
metrics.incrRenameSnapshotOps();
|
|
|
CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
|
|
|
if (cacheEntry != null && cacheEntry.isSuccess()) {
|
|
@@ -1629,6 +1638,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
|
public long addCacheDirective(
|
|
|
CacheDirectiveInfo path, EnumSet<CacheFlag> flags) throws IOException {
|
|
|
checkNNStartup();
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
|
CacheEntryWithPayload cacheEntry = RetryCache.waitForCompletion
|
|
|
(retryCache, null);
|
|
|
if (cacheEntry != null && cacheEntry.isSuccess()) {
|
|
@@ -1650,6 +1660,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
|
public void modifyCacheDirective(
|
|
|
CacheDirectiveInfo directive, EnumSet<CacheFlag> flags) throws IOException {
|
|
|
checkNNStartup();
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
|
CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
|
|
|
if (cacheEntry != null && cacheEntry.isSuccess()) {
|
|
|
return;
|
|
@@ -1667,6 +1678,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
|
@Override // ClientProtocol
|
|
|
public void removeCacheDirective(long id) throws IOException {
|
|
|
checkNNStartup();
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
|
CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
|
|
|
if (cacheEntry != null && cacheEntry.isSuccess()) {
|
|
|
return;
|
|
@@ -1693,6 +1705,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
|
@Override //ClientProtocol
|
|
|
public void addCachePool(CachePoolInfo info) throws IOException {
|
|
|
checkNNStartup();
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
|
CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
|
|
|
if (cacheEntry != null && cacheEntry.isSuccess()) {
|
|
|
return; // Return previous response
|
|
@@ -1709,6 +1722,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
|
@Override // ClientProtocol
|
|
|
public void modifyCachePool(CachePoolInfo info) throws IOException {
|
|
|
checkNNStartup();
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
|
CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
|
|
|
if (cacheEntry != null && cacheEntry.isSuccess()) {
|
|
|
return; // Return previous response
|
|
@@ -1725,6 +1739,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
|
@Override // ClientProtocol
|
|
|
public void removeCachePool(String cachePoolName) throws IOException {
|
|
|
checkNNStartup();
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
|
CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
|
|
|
if (cacheEntry != null && cacheEntry.isSuccess()) {
|
|
|
return;
|
|
@@ -1787,6 +1802,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
|
public void createEncryptionZone(String src, String keyName)
|
|
|
throws IOException {
|
|
|
checkNNStartup();
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
|
final CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
|
|
|
if (cacheEntry != null && cacheEntry.isSuccess()) {
|
|
|
return;
|
|
@@ -1818,6 +1834,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
|
public void setXAttr(String src, XAttr xAttr, EnumSet<XAttrSetFlag> flag)
|
|
|
throws IOException {
|
|
|
checkNNStartup();
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
|
CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
|
|
|
if (cacheEntry != null && cacheEntry.isSuccess()) {
|
|
|
return; // Return previous response
|
|
@@ -1847,6 +1864,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
|
@Override // ClientProtocol
|
|
|
public void removeXAttr(String src, XAttr xAttr) throws IOException {
|
|
|
checkNNStartup();
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
|
CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
|
|
|
if (cacheEntry != null && cacheEntry.isSuccess()) {
|
|
|
return; // Return previous response
|