|
@@ -1793,16 +1793,16 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
|
|
|
void createSymlink(String target, String link,
|
|
|
PermissionStatus dirPerms, boolean createParent)
|
|
|
throws IOException, UnresolvedLinkException {
|
|
|
- CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
|
|
|
- if (cacheEntry != null && cacheEntry.isSuccess()) {
|
|
|
- return; // Return previous response
|
|
|
- }
|
|
|
if (!DFSUtil.isValidName(link)) {
|
|
|
throw new InvalidPathException("Invalid link name: " + link);
|
|
|
}
|
|
|
if (FSDirectory.isReservedName(target)) {
|
|
|
throw new InvalidPathException("Invalid target name: " + target);
|
|
|
}
|
|
|
+ CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
|
|
|
+ if (cacheEntry != null && cacheEntry.isSuccess()) {
|
|
|
+ return; // Return previous response
|
|
|
+ }
|
|
|
boolean success = false;
|
|
|
try {
|
|
|
createSymlinkInt(target, link, dirPerms, createParent, cacheEntry != null);
|
|
@@ -3023,10 +3023,6 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
|
|
|
/** Rename src to dst */
|
|
|
void renameTo(String src, String dst, Options.Rename... options)
|
|
|
throws IOException, UnresolvedLinkException {
|
|
|
- CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
|
|
|
- if (cacheEntry != null && cacheEntry.isSuccess()) {
|
|
|
- return; // Return previous response
|
|
|
- }
|
|
|
if (NameNode.stateChangeLog.isDebugEnabled()) {
|
|
|
NameNode.stateChangeLog.debug("DIR* NameSystem.renameTo: with options - "
|
|
|
+ src + " to " + dst);
|
|
@@ -3034,8 +3030,13 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
|
|
|
if (!DFSUtil.isValidName(dst)) {
|
|
|
throw new InvalidPathException("Invalid name: " + dst);
|
|
|
}
|
|
|
- FSPermissionChecker pc = getPermissionChecker();
|
|
|
+ final FSPermissionChecker pc = getPermissionChecker();
|
|
|
+
|
|
|
checkOperation(OperationCategory.WRITE);
|
|
|
+ CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
|
|
|
+ if (cacheEntry != null && cacheEntry.isSuccess()) {
|
|
|
+ return; // Return previous response
|
|
|
+ }
|
|
|
byte[][] srcComponents = FSDirectory.getPathComponentsForReservedPath(src);
|
|
|
byte[][] dstComponents = FSDirectory.getPathComponentsForReservedPath(dst);
|
|
|
HdfsFileStatus resultingStat = null;
|
|
@@ -4249,12 +4250,13 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
|
|
|
* @throws IOException if
|
|
|
*/
|
|
|
void saveNamespace() throws AccessControlException, IOException {
|
|
|
+ checkOperation(OperationCategory.UNCHECKED);
|
|
|
+ checkSuperuserPrivilege();
|
|
|
+
|
|
|
CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
|
|
|
if (cacheEntry != null && cacheEntry.isSuccess()) {
|
|
|
return; // Return previous response
|
|
|
}
|
|
|
- checkSuperuserPrivilege();
|
|
|
- checkOperation(OperationCategory.UNCHECKED);
|
|
|
boolean success = false;
|
|
|
readLock();
|
|
|
try {
|
|
@@ -5140,11 +5142,11 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
|
|
|
|
|
|
void endCheckpoint(NamenodeRegistration registration,
|
|
|
CheckpointSignature sig) throws IOException {
|
|
|
+ checkOperation(OperationCategory.CHECKPOINT);
|
|
|
CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
|
|
|
if (cacheEntry != null && cacheEntry.isSuccess()) {
|
|
|
return; // Return previous response
|
|
|
}
|
|
|
- checkOperation(OperationCategory.CHECKPOINT);
|
|
|
boolean success = false;
|
|
|
readLock();
|
|
|
try {
|
|
@@ -5676,11 +5678,11 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
|
|
|
void updatePipeline(String clientName, ExtendedBlock oldBlock,
|
|
|
ExtendedBlock newBlock, DatanodeID[] newNodes)
|
|
|
throws IOException {
|
|
|
+ checkOperation(OperationCategory.WRITE);
|
|
|
CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
|
|
|
if (cacheEntry != null && cacheEntry.isSuccess()) {
|
|
|
return; // Return previous response
|
|
|
}
|
|
|
- checkOperation(OperationCategory.WRITE);
|
|
|
LOG.info("updatePipeline(block=" + oldBlock
|
|
|
+ ", newGenerationStamp=" + newBlock.getGenerationStamp()
|
|
|
+ ", newLength=" + newBlock.getNumBytes()
|
|
@@ -6614,12 +6616,13 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
|
|
|
*/
|
|
|
String createSnapshot(String snapshotRoot, String snapshotName)
|
|
|
throws SafeModeException, IOException {
|
|
|
+ checkOperation(OperationCategory.WRITE);
|
|
|
+ final FSPermissionChecker pc = getPermissionChecker();
|
|
|
CacheEntryWithPayload cacheEntry = RetryCache.waitForCompletion(retryCache,
|
|
|
null);
|
|
|
if (cacheEntry != null && cacheEntry.isSuccess()) {
|
|
|
return (String) cacheEntry.getPayload();
|
|
|
}
|
|
|
- final FSPermissionChecker pc = getPermissionChecker();
|
|
|
writeLock();
|
|
|
String snapshotPath = null;
|
|
|
try {
|
|
@@ -6666,11 +6669,12 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
|
|
|
*/
|
|
|
void renameSnapshot(String path, String snapshotOldName,
|
|
|
String snapshotNewName) throws SafeModeException, IOException {
|
|
|
+ checkOperation(OperationCategory.WRITE);
|
|
|
+ final FSPermissionChecker pc = getPermissionChecker();
|
|
|
CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
|
|
|
if (cacheEntry != null && cacheEntry.isSuccess()) {
|
|
|
return; // Return previous response
|
|
|
}
|
|
|
- final FSPermissionChecker pc = getPermissionChecker();
|
|
|
writeLock();
|
|
|
boolean success = false;
|
|
|
try {
|
|
@@ -6711,10 +6715,10 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
|
|
|
public SnapshottableDirectoryStatus[] getSnapshottableDirListing()
|
|
|
throws IOException {
|
|
|
SnapshottableDirectoryStatus[] status = null;
|
|
|
+ final FSPermissionChecker checker = getPermissionChecker();
|
|
|
readLock();
|
|
|
try {
|
|
|
checkOperation(OperationCategory.READ);
|
|
|
- FSPermissionChecker checker = getPermissionChecker();
|
|
|
final String user = checker.isSuperUser()? null : checker.getUser();
|
|
|
status = snapshotManager.getSnapshottableDirListing(user);
|
|
|
} finally {
|
|
@@ -6782,13 +6786,14 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
|
|
|
*/
|
|
|
void deleteSnapshot(String snapshotRoot, String snapshotName)
|
|
|
throws SafeModeException, IOException {
|
|
|
+ checkOperation(OperationCategory.WRITE);
|
|
|
final FSPermissionChecker pc = getPermissionChecker();
|
|
|
+
|
|
|
CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
|
|
|
if (cacheEntry != null && cacheEntry.isSuccess()) {
|
|
|
return; // Return previous response
|
|
|
}
|
|
|
boolean success = false;
|
|
|
- checkOperation(OperationCategory.WRITE);
|
|
|
writeLock();
|
|
|
try {
|
|
|
checkOperation(OperationCategory.WRITE);
|