diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/StandbyCheckpointer.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/StandbyCheckpointer.java index 5c09043c3f6..c5c2ef3c3f5 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/StandbyCheckpointer.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/StandbyCheckpointer.java @@ -193,7 +193,7 @@ public class StandbyCheckpointer { try { img.saveLegacyOIVImage(namesystem, outputDir, canceler); } catch (IOException ioe) { - LOG.error("Exception encountered while saving legacy OIV image; " + LOG.warn("Exception encountered while saving legacy OIV image; " + "continuing with other checkpointing steps", ioe); } } 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 a2eea096fe0..0a4e4d107fa 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 @@ -27,6 +27,7 @@ import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.FSDataOutputStream; +import org.apache.hadoop.fs.FileUtil; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hdfs.DFSConfigKeys; import org.apache.hadoop.hdfs.DFSTestUtil; @@ -485,6 +486,25 @@ public class TestStandbyCheckpoints { t.join(); } + /** + * Test that checkpointing is still successful even if an issue + * was encountered while writing the legacy OIV image. + */ + @Test(timeout=300000) + public void testCheckpointSucceedsWithLegacyOIVException() throws Exception { + // Delete the OIV image dir to cause an IOException while saving + FileUtil.fullyDelete(tmpOivImgDir); + + doEdits(0, 10); + HATestUtil.waitForStandbyToCatchUp(nn0, nn1); + // Once the standby catches up, it should notice that it needs to + // do a checkpoint and save one to its local directories. + HATestUtil.waitForCheckpoint(cluster, 1, ImmutableList.of(12)); + + // It should also upload it back to the active. + HATestUtil.waitForCheckpoint(cluster, 0, ImmutableList.of(12)); + } + private void doEdits(int start, int stop) throws IOException { for (int i = start; i < stop; i++) { Path p = new Path("/test" + i);