hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ji...@apache.org
Subject svn commit: r1572337 - in /hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs: CHANGES_HDFS-5535.txt src/main/java/org/apache/hadoop/hdfs/server/namenode/NNStorage.java src/test/java/org/apache/hadoop/hdfs/TestRollingUpgrade.java
Date Wed, 26 Feb 2014 23:17:53 GMT
Author: jing9
Date: Wed Feb 26 23:17:53 2014
New Revision: 1572337

URL: http://svn.apache.org/r1572337
Log:
HDFS-6023. Test whether the standby NN continues to checkpoint after the prepare stage. Contributed
by Haohui Mai.

Modified:
    hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/CHANGES_HDFS-5535.txt
    hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NNStorage.java
    hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestRollingUpgrade.java

Modified: hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/CHANGES_HDFS-5535.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/CHANGES_HDFS-5535.txt?rev=1572337&r1=1572336&r2=1572337&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/CHANGES_HDFS-5535.txt
(original)
+++ hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/CHANGES_HDFS-5535.txt
Wed Feb 26 23:17:53 2014
@@ -108,3 +108,6 @@ HDFS-5535 subtasks:
 
     HDFS-6019. Standby NN might not checkpoint when processing the rolling
     upgrade marker. (Haohui Mai via jing9)
+
+    HDFS-6023. Test whether the standby NN continues to checkpoint after the
+    prepare stage. (Haohui Mai via jing9)

Modified: hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NNStorage.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NNStorage.java?rev=1572337&r1=1572336&r2=1572337&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NNStorage.java
(original)
+++ hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NNStorage.java
Wed Feb 26 23:17:53 2014
@@ -676,7 +676,6 @@ public class NNStorage extends Storage i
     return getNameNodeFileName(NameNodeFile.IMAGE_ROLLBACK, txid);
   }
 
-  @VisibleForTesting
   private static String getNameNodeFileName(NameNodeFile nnf, long txid) {
     return String.format("%s_%019d", nnf.getName(), txid);
   }

Modified: hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestRollingUpgrade.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestRollingUpgrade.java?rev=1572337&r1=1572336&r2=1572337&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestRollingUpgrade.java
(original)
+++ hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestRollingUpgrade.java
Wed Feb 26 23:17:53 2014
@@ -34,6 +34,7 @@ import org.apache.hadoop.hdfs.qjournal.M
 import org.apache.hadoop.hdfs.server.common.HdfsServerConstants.StartupOption;
 import org.apache.hadoop.hdfs.server.datanode.DataNode;
 import org.apache.hadoop.hdfs.server.namenode.FSImage;
+import org.apache.hadoop.hdfs.server.namenode.NNStorage;
 import org.apache.hadoop.hdfs.tools.DFSAdmin;
 import org.junit.Assert;
 import org.junit.Test;
@@ -467,17 +468,66 @@ public class TestRollingUpgrade {
     }
   }
 
+  @Test(timeout = 300000)
+  public void testCheckpoint() throws IOException, InterruptedException {
+    final Configuration conf = new Configuration();
+    conf.setInt(DFSConfigKeys.DFS_HA_TAILEDITS_PERIOD_KEY, 1);
+    conf.setInt(DFSConfigKeys.DFS_NAMENODE_CHECKPOINT_PERIOD_KEY, 1);
+
+    MiniQJMHACluster cluster = null;
+    final Path foo = new Path("/foo");
+
+    try {
+      cluster = new MiniQJMHACluster.Builder(conf).build();
+      MiniDFSCluster dfsCluster = cluster.getDfsCluster();
+      dfsCluster.waitActive();
+
+      dfsCluster.transitionToActive(0);
+      DistributedFileSystem dfs = dfsCluster.getFileSystem(0);
+
+      // start rolling upgrade
+      RollingUpgradeInfo info = dfs
+          .rollingUpgrade(RollingUpgradeAction.PREPARE);
+      Assert.assertTrue(info.isStarted());
+
+      queryForPreparation(dfs);
+
+      dfs.mkdirs(foo);
+      long txid = dfs.rollEdits();
+      Assert.assertTrue(txid > 0);
+
+      int retries = 0;
+      while (++retries < 5) {
+        NNStorage storage = dfsCluster.getNamesystem(1).getFSImage()
+            .getStorage();
+        if (storage.getFsImageName(txid - 1) != null) {
+          return;
+        }
+        Thread.sleep(1000);
+      }
+      Assert.fail("new checkpoint does not exist");
+
+    } finally {
+      if (cluster != null) {
+        cluster.shutdown();
+      }
+    }
+  }
+
   static void queryForPreparation(DistributedFileSystem dfs) throws IOException,
       InterruptedException {
     RollingUpgradeInfo info;
     int retries = 0;
-    while (retries < 10) {
+    while (++retries < 10) {
       info = dfs.rollingUpgrade(RollingUpgradeAction.QUERY);
       if (info.createdRollbackImages()) {
         break;
       }
       Thread.sleep(1000);
-      ++retries;
+    }
+
+    if (retries >= 10) {
+      Assert.fail("Query return false");
     }
   }
 }



Mime
View raw message