|
@@ -616,7 +616,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();
|
|
@@ -647,6 +647,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()) {
|
|
@@ -794,6 +795,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
|
|
@@ -838,7 +840,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
|
|
@@ -859,6 +861,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
|
|
@@ -884,6 +887,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
|
|
@@ -922,6 +926,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
|
|
@@ -1207,6 +1212,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
|
|
@@ -1537,6 +1543,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()) {
|
|
@@ -1558,6 +1565,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()) {
|
|
@@ -1596,6 +1604,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()) {
|
|
@@ -1635,6 +1644,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()) {
|
|
@@ -1656,6 +1666,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;
|
|
@@ -1673,6 +1684,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;
|
|
@@ -1699,6 +1711,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
|
|
@@ -1715,6 +1728,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
|
|
@@ -1731,6 +1745,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;
|
|
@@ -1793,6 +1808,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;
|
|
@@ -1824,6 +1840,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
|
|
@@ -1853,6 +1870,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
|