|
@@ -610,7 +610,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();
|
|
@@ -641,6 +641,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()) {
|
|
@@ -810,6 +811,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
|
|
@@ -854,7 +856,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
|
|
@@ -875,6 +877,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
|
|
@@ -900,6 +903,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
|
|
@@ -937,6 +941,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
|
|
@@ -1221,6 +1226,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
|
|
@@ -1552,6 +1558,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()) {
|
|
@@ -1573,6 +1580,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()) {
|
|
@@ -1611,6 +1619,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()) {
|
|
@@ -1650,6 +1659,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()) {
|
|
@@ -1671,6 +1681,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;
|
|
@@ -1688,6 +1699,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;
|
|
@@ -1714,6 +1726,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
|
|
@@ -1730,6 +1743,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
|
|
@@ -1746,6 +1760,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;
|
|
@@ -1808,6 +1823,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;
|
|
@@ -1839,6 +1855,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
|
|
@@ -1868,6 +1885,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
|