|
@@ -576,6 +576,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
throw new IOException("create: Pathname too long. Limit "
|
|
throw new IOException("create: Pathname too long. Limit "
|
|
+ MAX_PATH_LENGTH + " characters, " + MAX_PATH_DEPTH + " levels.");
|
|
+ MAX_PATH_LENGTH + " characters, " + MAX_PATH_DEPTH + " levels.");
|
|
}
|
|
}
|
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
HdfsFileStatus fileStatus = namesystem.startFile(src, new PermissionStatus(
|
|
HdfsFileStatus fileStatus = namesystem.startFile(src, new PermissionStatus(
|
|
getRemoteUser().getShortUserName(), null, masked),
|
|
getRemoteUser().getShortUserName(), null, masked),
|
|
clientName, clientMachine, flag.get(), createParent, replication,
|
|
clientName, clientMachine, flag.get(), createParent, replication,
|
|
@@ -594,6 +595,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
stateChangeLog.debug("*DIR* NameNode.append: file "
|
|
stateChangeLog.debug("*DIR* NameNode.append: file "
|
|
+src+" for "+clientName+" at "+clientMachine);
|
|
+src+" for "+clientName+" at "+clientMachine);
|
|
}
|
|
}
|
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
LocatedBlock info = namesystem.appendFile(src, clientName, clientMachine);
|
|
LocatedBlock info = namesystem.appendFile(src, clientName, clientMachine);
|
|
metrics.incrFilesAppended();
|
|
metrics.incrFilesAppended();
|
|
return info;
|
|
return info;
|
|
@@ -749,6 +751,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
ExtendedBlock newBlock, DatanodeID[] newNodes, String[] newStorageIDs)
|
|
ExtendedBlock newBlock, DatanodeID[] newNodes, String[] newStorageIDs)
|
|
throws IOException {
|
|
throws IOException {
|
|
checkNNStartup();
|
|
checkNNStartup();
|
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
namesystem.updatePipeline(clientName, oldBlock, newBlock, newNodes, newStorageIDs);
|
|
namesystem.updatePipeline(clientName, oldBlock, newBlock, newNodes, newStorageIDs);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -781,6 +784,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
throw new IOException("rename: Pathname too long. Limit "
|
|
throw new IOException("rename: Pathname too long. Limit "
|
|
+ MAX_PATH_LENGTH + " characters, " + MAX_PATH_DEPTH + " levels.");
|
|
+ MAX_PATH_LENGTH + " characters, " + MAX_PATH_DEPTH + " levels.");
|
|
}
|
|
}
|
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
boolean ret = namesystem.renameTo(src, dst);
|
|
boolean ret = namesystem.renameTo(src, dst);
|
|
if (ret) {
|
|
if (ret) {
|
|
metrics.incrFilesRenamed();
|
|
metrics.incrFilesRenamed();
|
|
@@ -791,6 +795,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
@Override // ClientProtocol
|
|
@Override // ClientProtocol
|
|
public void concat(String trg, String[] src) throws IOException {
|
|
public void concat(String trg, String[] src) throws IOException {
|
|
checkNNStartup();
|
|
checkNNStartup();
|
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
namesystem.concat(trg, src);
|
|
namesystem.concat(trg, src);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -805,6 +810,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
throw new IOException("rename: Pathname too long. Limit "
|
|
throw new IOException("rename: Pathname too long. Limit "
|
|
+ MAX_PATH_LENGTH + " characters, " + MAX_PATH_DEPTH + " levels.");
|
|
+ MAX_PATH_LENGTH + " characters, " + MAX_PATH_DEPTH + " levels.");
|
|
}
|
|
}
|
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
namesystem.renameTo(src, dst, options);
|
|
namesystem.renameTo(src, dst, options);
|
|
metrics.incrFilesRenamed();
|
|
metrics.incrFilesRenamed();
|
|
}
|
|
}
|
|
@@ -816,6 +822,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
stateChangeLog.debug("*DIR* Namenode.delete: src=" + src
|
|
stateChangeLog.debug("*DIR* Namenode.delete: src=" + src
|
|
+ ", recursive=" + recursive);
|
|
+ ", recursive=" + recursive);
|
|
}
|
|
}
|
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
boolean ret = namesystem.delete(src, recursive);
|
|
boolean ret = namesystem.delete(src, recursive);
|
|
if (ret)
|
|
if (ret)
|
|
metrics.incrDeleteFileOps();
|
|
metrics.incrDeleteFileOps();
|
|
@@ -1088,6 +1095,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
public void createSymlink(String target, String link, FsPermission dirPerms,
|
|
public void createSymlink(String target, String link, FsPermission dirPerms,
|
|
boolean createParent) throws IOException {
|
|
boolean createParent) throws IOException {
|
|
checkNNStartup();
|
|
checkNNStartup();
|
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
metrics.incrCreateSymlinkOps();
|
|
metrics.incrCreateSymlinkOps();
|
|
/* We enforce the MAX_PATH_LENGTH limit even though a symlink target
|
|
/* We enforce the MAX_PATH_LENGTH limit even though a symlink target
|
|
* URI may refer to a non-HDFS file system.
|
|
* URI may refer to a non-HDFS file system.
|
|
@@ -1408,6 +1416,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
throw new IOException("createSnapshot: Pathname too long. Limit "
|
|
throw new IOException("createSnapshot: Pathname too long. Limit "
|
|
+ MAX_PATH_LENGTH + " characters, " + MAX_PATH_DEPTH + " levels.");
|
|
+ MAX_PATH_LENGTH + " characters, " + MAX_PATH_DEPTH + " levels.");
|
|
}
|
|
}
|
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
metrics.incrCreateSnapshotOps();
|
|
metrics.incrCreateSnapshotOps();
|
|
return namesystem.createSnapshot(snapshotRoot, snapshotName);
|
|
return namesystem.createSnapshot(snapshotRoot, snapshotName);
|
|
}
|
|
}
|
|
@@ -1416,6 +1425,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
public void deleteSnapshot(String snapshotRoot, String snapshotName)
|
|
public void deleteSnapshot(String snapshotRoot, String snapshotName)
|
|
throws IOException {
|
|
throws IOException {
|
|
checkNNStartup();
|
|
checkNNStartup();
|
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
metrics.incrDeleteSnapshotOps();
|
|
metrics.incrDeleteSnapshotOps();
|
|
namesystem.deleteSnapshot(snapshotRoot, snapshotName);
|
|
namesystem.deleteSnapshot(snapshotRoot, snapshotName);
|
|
}
|
|
}
|
|
@@ -1444,6 +1454,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
if (snapshotNewName == null || snapshotNewName.isEmpty()) {
|
|
if (snapshotNewName == null || snapshotNewName.isEmpty()) {
|
|
throw new IOException("The new snapshot name is null or empty.");
|
|
throw new IOException("The new snapshot name is null or empty.");
|
|
}
|
|
}
|
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
metrics.incrRenameSnapshotOps();
|
|
metrics.incrRenameSnapshotOps();
|
|
namesystem.renameSnapshot(snapshotRoot, snapshotOldName, snapshotNewName);
|
|
namesystem.renameSnapshot(snapshotRoot, snapshotOldName, snapshotNewName);
|
|
}
|
|
}
|
|
@@ -1472,6 +1483,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
public long addCacheDirective(
|
|
public long addCacheDirective(
|
|
CacheDirectiveInfo path, EnumSet<CacheFlag> flags) throws IOException {
|
|
CacheDirectiveInfo path, EnumSet<CacheFlag> flags) throws IOException {
|
|
checkNNStartup();
|
|
checkNNStartup();
|
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
return namesystem.addCacheDirective(path, flags);
|
|
return namesystem.addCacheDirective(path, flags);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1479,12 +1491,14 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
public void modifyCacheDirective(
|
|
public void modifyCacheDirective(
|
|
CacheDirectiveInfo directive, EnumSet<CacheFlag> flags) throws IOException {
|
|
CacheDirectiveInfo directive, EnumSet<CacheFlag> flags) throws IOException {
|
|
checkNNStartup();
|
|
checkNNStartup();
|
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
namesystem.modifyCacheDirective(directive, flags);
|
|
namesystem.modifyCacheDirective(directive, flags);
|
|
}
|
|
}
|
|
|
|
|
|
@Override // ClientProtocol
|
|
@Override // ClientProtocol
|
|
public void removeCacheDirective(long id) throws IOException {
|
|
public void removeCacheDirective(long id) throws IOException {
|
|
checkNNStartup();
|
|
checkNNStartup();
|
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
namesystem.removeCacheDirective(id);
|
|
namesystem.removeCacheDirective(id);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1501,18 +1515,21 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
@Override //ClientProtocol
|
|
@Override //ClientProtocol
|
|
public void addCachePool(CachePoolInfo info) throws IOException {
|
|
public void addCachePool(CachePoolInfo info) throws IOException {
|
|
checkNNStartup();
|
|
checkNNStartup();
|
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
namesystem.addCachePool(info);
|
|
namesystem.addCachePool(info);
|
|
}
|
|
}
|
|
|
|
|
|
@Override // ClientProtocol
|
|
@Override // ClientProtocol
|
|
public void modifyCachePool(CachePoolInfo info) throws IOException {
|
|
public void modifyCachePool(CachePoolInfo info) throws IOException {
|
|
checkNNStartup();
|
|
checkNNStartup();
|
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
namesystem.modifyCachePool(info);
|
|
namesystem.modifyCachePool(info);
|
|
}
|
|
}
|
|
|
|
|
|
@Override // ClientProtocol
|
|
@Override // ClientProtocol
|
|
public void removeCachePool(String cachePoolName) throws IOException {
|
|
public void removeCachePool(String cachePoolName) throws IOException {
|
|
checkNNStartup();
|
|
checkNNStartup();
|
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
namesystem.removeCachePool(cachePoolName);
|
|
namesystem.removeCachePool(cachePoolName);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1565,6 +1582,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
public void createEncryptionZone(String src, String keyName)
|
|
public void createEncryptionZone(String src, String keyName)
|
|
throws IOException {
|
|
throws IOException {
|
|
checkNNStartup();
|
|
checkNNStartup();
|
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
namesystem.createEncryptionZone(src, keyName);
|
|
namesystem.createEncryptionZone(src, keyName);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1586,6 +1604,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
public void setXAttr(String src, XAttr xAttr, EnumSet<XAttrSetFlag> flag)
|
|
public void setXAttr(String src, XAttr xAttr, EnumSet<XAttrSetFlag> flag)
|
|
throws IOException {
|
|
throws IOException {
|
|
checkNNStartup();
|
|
checkNNStartup();
|
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
namesystem.setXAttr(src, xAttr, flag);
|
|
namesystem.setXAttr(src, xAttr, flag);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1605,6 +1624,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
@Override // ClientProtocol
|
|
@Override // ClientProtocol
|
|
public void removeXAttr(String src, XAttr xAttr) throws IOException {
|
|
public void removeXAttr(String src, XAttr xAttr) throws IOException {
|
|
checkNNStartup();
|
|
checkNNStartup();
|
|
|
|
+ namesystem.checkOperation(OperationCategory.WRITE);
|
|
namesystem.removeXAttr(src, xAttr);
|
|
namesystem.removeXAttr(src, xAttr);
|
|
}
|
|
}
|
|
|
|
|