Author: jing9 Date: Wed Mar 5 18:26:22 2014 New Revision: 1574609 URL: http://svn.apache.org/r1574609 Log: HDFS-5167. Merge change r1574608 from branch-2.
Added: hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNameNodeRetryCacheMetrics.java - copied unchanged from r1574608, hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNameNodeRetryCacheMetrics.java Modified: hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestRetryCacheWithHA.java Modified: hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt?rev=1574609&r1=1574608&r2=1574609&view=diff ============================================================================== --- hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt (original) +++ hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt Wed Mar 5 18:26:22 2014 @@ -116,6 +116,9 @@ Release 2.4.0 - UNRELEASED HDFS-6046. add dfs.client.mmap.enabled (cmccabe) + HDFS-5167. Add metrics about the NameNode retry cache. (Tsuyoshi OZAWA via + jing9) + OPTIMIZATIONS HDFS-5790. LeaseManager.findPath is very slow when many leases need recovery Modified: hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java?rev=1574609&r1=1574608&r2=1574609&view=diff ============================================================================== --- hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java (original) +++ hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java Wed Mar 5 18:26:22 2014 @@ -794,7 +794,7 @@ public class FSNamesystem implements Nam retryCache.addCacheEntry(clientId, callId); } } - + @VisibleForTesting static RetryCache initRetryCache(Configuration conf) { boolean enable = conf.getBoolean(DFS_NAMENODE_ENABLE_RETRY_CACHE_KEY, @@ -811,7 +811,7 @@ public class FSNamesystem implements Nam + " of total heap and retry cache entry expiry time is " + entryExpiryMillis + " millis"); long entryExpiryNanos = entryExpiryMillis * 1000 * 1000; - return new RetryCache("Namenode Retry Cache", heapPercent, + return new RetryCache("NameNodeRetryCache", heapPercent, entryExpiryNanos); } return null; Modified: hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestRetryCacheWithHA.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestRetryCacheWithHA.java?rev=1574609&r1=1574608&r2=1574609&view=diff ============================================================================== --- hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestRetryCacheWithHA.java (original) +++ hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestRetryCacheWithHA.java Wed Mar 5 18:26:22 2014 @@ -1181,6 +1181,26 @@ public class TestRetryCacheWithHA { LOG.info("Got the result of " + op.name + ": " + results.get(op.name)); } + + // Waiting for failover. + while (cluster.getNamesystem(1).isInStandbyState()) { + Thread.sleep(10); + } + + long hitNN0 = cluster.getNamesystem(0).getRetryCache().getMetricsForTests() + .getCacheHit(); + long hitNN1 = cluster.getNamesystem(1).getRetryCache().getMetricsForTests() + .getCacheHit(); + assertTrue("CacheHit: " + hitNN0 + ", " + hitNN1, + hitNN0 + hitNN1 > 0); + long updatedNN0 = cluster.getNamesystem(0).getRetryCache() + .getMetricsForTests().getCacheUpdated(); + long updatedNN1 = cluster.getNamesystem(1).getRetryCache() + .getMetricsForTests().getCacheUpdated(); + // Cache updated metrics on NN0 should be >0 since the op was process on NN0 + assertTrue("CacheUpdated on NN0: " + updatedNN0, updatedNN0 > 0); + // Cache updated metrics on NN0 should be >0 since NN1 applied the editlog + assertTrue("CacheUpdated on NN1: " + updatedNN1, updatedNN1 > 0); } /**