From 1f30fd6f46fd884854adb0ce0ed2dfbad6f21788 Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Wed, 14 Aug 2013 06:10:20 +0000 Subject: [PATCH] HBASE-9160 TestNamespaceUpgrade fails on hadoop 2.1 due to existence of .snapshot directory in tar ball git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1513733 13f79535-47bb-0310-9956-ffa450edef68 --- .../hadoop/hbase/migration/TestNamespaceUpgrade.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/migration/TestNamespaceUpgrade.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/migration/TestNamespaceUpgrade.java index bd19d9c2ae4..b927d3897b9 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/migration/TestNamespaceUpgrade.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/migration/TestNamespaceUpgrade.java @@ -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"});