From a4f4becf52b3fb9199812dfa06e6acb461ee47d6 Mon Sep 17 00:00:00 2001 From: Todd Lipcon Date: Wed, 11 Jan 2012 06:14:13 +0000 Subject: [PATCH] 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 --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-1623.txt | 2 ++ .../java/org/apache/hadoop/hdfs/server/namenode/FSImage.java | 3 +++ .../hdfs/server/namenode/ha/TestStandbyCheckpoints.java | 4 ++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-1623.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-1623.txt index 0b01c22d541..55939fe34d4 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-1623.txt +++ b/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) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java index 8eb4dede34c..ce1abe82bbb 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java +++ b/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(); + } } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestStandbyCheckpoints.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestStandbyCheckpoints.java index 336c427fea9..b02ac5cdac2 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestStandbyCheckpoints.java +++ b/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 dirs = Lists.newArrayList();