diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-4949.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-4949.txt index db8e2762e5..e9f9902122 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-4949.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-4949.txt @@ -118,3 +118,6 @@ HDFS-4949 (Unreleased) HDFS-5404. Resolve regressions in Windows compatibility on HDFS-4949 branch. (Chris Nauroth via Andrew Wang) + HDFS-5405. Fix possible RetryCache hang for caching RPC handlers in + FSNamesystem. (wang) + diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java index 1ad745607f..7f58a20f0f 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java @@ -6922,16 +6922,16 @@ void removeSnapshottableDirs(List toRemove) { PathBasedCacheDescriptor addPathBasedCacheDirective( PathBasedCacheDirective directive) throws IOException { + checkOperation(OperationCategory.WRITE); + final FSPermissionChecker pc = isPermissionEnabled ? + getPermissionChecker() : null; CacheEntryWithPayload cacheEntry = RetryCache.waitForCompletion(retryCache, null); if (cacheEntry != null && cacheEntry.isSuccess()) { return (PathBasedCacheDescriptor) cacheEntry.getPayload(); } - final FSPermissionChecker pc = isPermissionEnabled ? - getPermissionChecker() : null; boolean success = false; PathBasedCacheDescriptor result = null; - checkOperation(OperationCategory.WRITE); writeLock(); try { checkOperation(OperationCategory.WRITE); @@ -6957,14 +6957,14 @@ PathBasedCacheDescriptor addPathBasedCacheDirective( } void removePathBasedCacheDescriptor(Long id) throws IOException { + checkOperation(OperationCategory.WRITE); + final FSPermissionChecker pc = isPermissionEnabled ? + getPermissionChecker() : null; CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache); if (cacheEntry != null && cacheEntry.isSuccess()) { return; } - final FSPermissionChecker pc = isPermissionEnabled ? - getPermissionChecker() : null; boolean success = false; - checkOperation(OperationCategory.WRITE); writeLock(); try { checkOperation(OperationCategory.WRITE); @@ -6988,10 +6988,10 @@ void removePathBasedCacheDescriptor(Long id) throws IOException { BatchedListEntries listPathBasedCacheDescriptors( long startId, String pool, String path) throws IOException { + checkOperation(OperationCategory.READ); final FSPermissionChecker pc = isPermissionEnabled ? getPermissionChecker() : null; BatchedListEntries results; - checkOperation(OperationCategory.READ); readLock(); boolean success = false; try { @@ -7010,13 +7010,13 @@ BatchedListEntries listPathBasedCacheDescriptors( } public void addCachePool(CachePoolInfo req) throws IOException { + checkOperation(OperationCategory.WRITE); final FSPermissionChecker pc = isPermissionEnabled ? getPermissionChecker() : null; CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache); if (cacheEntry != null && cacheEntry.isSuccess()) { return; // Return previous response } - checkOperation(OperationCategory.WRITE); writeLock(); boolean success = false; try { @@ -7043,13 +7043,13 @@ public void addCachePool(CachePoolInfo req) throws IOException { } public void modifyCachePool(CachePoolInfo req) throws IOException { + checkOperation(OperationCategory.WRITE); final FSPermissionChecker pc = isPermissionEnabled ? getPermissionChecker() : null; CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache); if (cacheEntry != null && cacheEntry.isSuccess()) { return; // Return previous response } - checkOperation(OperationCategory.WRITE); writeLock(); boolean success = false; try { @@ -7076,13 +7076,13 @@ public void modifyCachePool(CachePoolInfo req) throws IOException { } public void removeCachePool(String cachePoolName) throws IOException { + checkOperation(OperationCategory.WRITE); final FSPermissionChecker pc = isPermissionEnabled ? getPermissionChecker() : null; CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache); if (cacheEntry != null && cacheEntry.isSuccess()) { return; // Return previous response } - checkOperation(OperationCategory.WRITE); writeLock(); boolean success = false; try {