Author: jing9 Date: Fri Apr 11 16:47:59 2014 New Revision: 1586716 URL: http://svn.apache.org/r1586716 Log: HDFS-6229. Merge r1586715 from branch-2.
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/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.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=1586716&r1=1586715&r2=1586716&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 Fri Apr 11 16:47:59 2014 @@ -43,6 +43,9 @@ Release 2.4.1 - UNRELEASED HDFS-6235. TestFileJournalManager can fail on Windows due to file locking if tests run out of order. (cnauroth) + HDFS-6229. Race condition in failover can cause RetryCache fail to work. + (jing9) + Release 2.4.0 - 2014-04-07 INCOMPATIBLE CHANGES 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=1586716&r1=1586715&r2=1586716&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 Fri Apr 11 16:47:59 2014 @@ -791,7 +791,19 @@ public class FSNamesystem implements Nam public RetryCache getRetryCache() { return retryCache; } - + + void lockRetryCache() { + if (retryCache != null) { + retryCache.lock(); + } + } + + void unlockRetryCache() { + if (retryCache != null) { + retryCache.unlock(); + } + } + /** Whether or not retry cache is enabled */ boolean hasRetryCache() { return retryCache != null; @@ -6917,8 +6929,8 @@ public class FSNamesystem implements Nam if (cacheEntry != null && cacheEntry.isSuccess()) { return (String) cacheEntry.getPayload(); } - writeLock(); String snapshotPath = null; + writeLock(); try { checkOperation(OperationCategory.WRITE); checkNameNodeSafeMode("Cannot create snapshot for " + snapshotRoot); Modified: hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.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/NameNode.java?rev=1586716&r1=1586715&r2=1586716&view=diff ============================================================================== --- hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java (original) +++ hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java Fri Apr 11 16:47:59 2014 @@ -1569,10 +1569,12 @@ public class NameNode implements NameNod @Override public void writeLock() { namesystem.writeLock(); + namesystem.lockRetryCache(); } @Override public void writeUnlock() { + namesystem.unlockRetryCache(); namesystem.writeUnlock(); }