Explorar o código

HDFS-2775. Fix TestStandbyCheckpoints.testBothNodesInStandbyState failing intermittently. Contributed by Todd Lipcon.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-1623@1229901 13f79535-47bb-0310-9956-ffa450edef68
Todd Lipcon %!s(int64=13) %!d(string=hai) anos
pai
achega
a4f4becf52

+ 2 - 0
hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-1623.txt

@@ -97,3 +97,5 @@ HDFS-2724. NN web UI can throw NPE after startup, before standby state is entere
 HDFS-2753. Fix standby getting stuck in safemode when blocks are written while SBN is down. (Hari Mankude and todd via todd)
 
 HDFS-2773. Reading edit logs from an earlier version should not leave blocks in under-construction state. (todd)
+
+HDFS-2775. Fix TestStandbyCheckpoints.testBothNodesInStandbyState failing intermittently. (todd)

+ 3 - 0
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java

@@ -1134,4 +1134,7 @@ public class FSImage implements Closeable {
     this.lastAppliedTxId = editLog.getLastWrittenTxId();
   }
 
+  public synchronized long getMostRecentCheckpointTxId() {
+    return storage.getMostRecentCheckpointTxId();
+  }
 }

+ 2 - 2
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestStandbyCheckpoints.java

@@ -121,9 +121,9 @@ public class TestStandbyCheckpoints {
     waitForCheckpoint(1, ImmutableList.of(0, 12));
     waitForCheckpoint(0, ImmutableList.of(0, 12));
     
-    assertEquals(12, nn0.getNamesystem().getFSImage().getStorage()
+    assertEquals(12, nn0.getNamesystem().getFSImage()
         .getMostRecentCheckpointTxId());
-    assertEquals(12, nn1.getNamesystem().getFSImage().getStorage()
+    assertEquals(12, nn1.getNamesystem().getFSImage()
         .getMostRecentCheckpointTxId());
     
     List<File> dirs = Lists.newArrayList();