You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2013/08/14 08:10:20 UTC

svn commit: r1513733 - /hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/migration/TestNamespaceUpgrade.java

Author: stack
Date: Wed Aug 14 06:10:20 2013
New Revision: 1513733

URL: http://svn.apache.org/r1513733
Log:
HBASE-9160 TestNamespaceUpgrade fails on hadoop 2.1 due to existence of .snapshot directory in tar ball

Modified:
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/migration/TestNamespaceUpgrade.java

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/migration/TestNamespaceUpgrade.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/migration/TestNamespaceUpgrade.java?rev=1513733&r1=1513732&r2=1513733&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/migration/TestNamespaceUpgrade.java (original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/migration/TestNamespaceUpgrade.java Wed Aug 14 06:10:20 2013
@@ -103,10 +103,18 @@ public class TestNamespaceUpgrade {
       // mkdir at first
       fs.mkdirs(hbaseRootDir.getParent());
     }
+    if(org.apache.hadoop.util.VersionInfo.getVersion().startsWith("2.")) {
+      LOG.info("Hadoop version is 2.x, pre-migrating snapshot dir");
+      FileSystem localFS = FileSystem.getLocal(conf);
+      if(!localFS.rename(new Path(untar.toString(), HConstants.OLD_SNAPSHOT_DIR_NAME),
+          new Path(untar.toString(), HConstants.SNAPSHOT_DIR_NAME))) {
+        throw new IllegalStateException("Failed to move snapshot dir to 2.x expectation");
+      }
+    }
     doFsCommand(shell,
       new String [] {"-put", untar.toURI().toString(), hbaseRootDir.toString()});
-    // See whats in minihdfs.
     doFsCommand(shell, new String [] {"-lsr", "/"});
+    // See whats in minihdfs.
     Configuration toolConf = TEST_UTIL.getConfiguration();
     conf.set(HConstants.HBASE_DIR, TEST_UTIL.getDefaultRootDirPath().toString());
     ToolRunner.run(toolConf, new NamespaceUpgrade(), new String[]{"--upgrade"});