commit fc0aad8d7b0543514ce5dd24cf7f837c0e4f2525 Author: Daniel Dai Date: Thu Sep 3 21:30:40 2015 -0700 HIVE-11731: Exclude hbase-metastore in itests for hadoop-1 diff --git a/itests/hive-unit/pom.xml b/itests/hive-unit/pom.xml index 26b5751..5295840 100644 --- a/itests/hive-unit/pom.xml +++ b/itests/hive-unit/pom.xml @@ -173,6 +173,20 @@ hadoop-1 + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + + **/metastore/hbase/** + + + + + org.apache.hadoop diff --git a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/hbase/HBaseIntegrationTests.java b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/hbase/HBaseIntegrationTests.java index c369058..02e481a 100644 --- a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/hbase/HBaseIntegrationTests.java +++ b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/hbase/HBaseIntegrationTests.java @@ -64,18 +64,7 @@ protected static void startMiniCluster() throws Exception { utility.startMiniCluster(); conf = new HiveConf(utility.getConfiguration(), HBaseIntegrationTests.class); admin = utility.getHBaseAdmin(); - for (String tableName : HBaseReadWrite.tableNames) { - List families = HBaseReadWrite.columnFamilies.get(tableName); - HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(tableName)); - for (byte[] family : families) { - HColumnDescriptor columnDesc = new HColumnDescriptor(family); - if (testingTephra) columnDesc.setMaxVersions(Integer.MAX_VALUE); - desc.addFamily(columnDesc); - } - if (testingTephra) desc.addCoprocessor(TransactionProcessor.class.getName()); - admin.createTable(desc); - } - admin.close(); + HBaseStoreTestUtil.initHBaseMetastore(admin, null); } protected static void shutdownMiniCluster() throws Exception { diff --git a/itests/qtest/pom.xml b/itests/qtest/pom.xml index 122e3f6..739d06a 100644 --- a/itests/qtest/pom.xml +++ b/itests/qtest/pom.xml @@ -80,6 +80,13 @@ org.apache.hive + hive-it-unit + ${project.version} + tests + test + + + org.apache.hive hive-it-util ${project.version} test diff --git a/itests/util/pom.xml b/itests/util/pom.xml index b0818d6..fdab72c 100644 --- a/itests/util/pom.xml +++ b/itests/util/pom.xml @@ -97,6 +97,20 @@ hadoop-1 + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + + **/metastore/hbase/** + + + + + org.apache.hadoop @@ -120,6 +134,12 @@ org.apache.hbase + hbase-common + ${hbase.hadoop1.version} + tests + + + org.apache.hbase hbase-server ${hbase.hadoop1.version} diff --git a/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java b/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java index 70df41e..24a85cf 100644 --- a/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java +++ b/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java @@ -18,7 +18,6 @@ package org.apache.hadoop.hive.ql; -import static org.apache.hadoop.hive.metastore.MetaStoreUtils.DEFAULT_DATABASE_COMMENT; import static org.apache.hadoop.hive.metastore.MetaStoreUtils.DEFAULT_DATABASE_NAME; import java.io.BufferedInputStream; @@ -67,9 +66,6 @@ import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.HBaseTestingUtility; -import org.apache.hadoop.hbase.HColumnDescriptor; -import org.apache.hadoop.hbase.HTableDescriptor; -import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.HBaseAdmin; import org.apache.hadoop.hbase.zookeeper.MiniZooKeeperCluster; import org.apache.hadoop.hive.cli.CliDriver; @@ -81,9 +77,7 @@ import org.apache.hadoop.hive.conf.HiveConf; import org.apache.hadoop.hive.conf.HiveConf.ConfVars; import org.apache.hadoop.hive.metastore.MetaStoreUtils; -import org.apache.hadoop.hive.metastore.Warehouse; import org.apache.hadoop.hive.metastore.api.Index; -import org.apache.hadoop.hive.metastore.hbase.HBaseReadWrite; import org.apache.hadoop.hive.ql.exec.FunctionRegistry; import org.apache.hadoop.hive.ql.exec.Task; import org.apache.hadoop.hive.ql.exec.Utilities; @@ -357,19 +351,14 @@ private void startMiniHBaseCluster() throws Exception { utility = new HBaseTestingUtility(); utility.startMiniCluster(); conf = new HiveConf(utility.getConfiguration(), Driver.class); - conf = new HiveConf(utility.getConfiguration(), Driver.class); HBaseAdmin admin = utility.getHBaseAdmin(); - for (String tableName : HBaseReadWrite.tableNames) { - List families = HBaseReadWrite.columnFamilies.get(tableName); - HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(tableName)); - for (byte[] family : families) { - HColumnDescriptor columnDesc = new HColumnDescriptor(family); - desc.addFamily(columnDesc); - } - admin.createTable(desc); - } - admin.close(); - HBaseReadWrite.getInstance(conf); + // Need to use reflection here to make compilation pass since HBaseIntegrationTests + // is not compiled in hadoop-1. All HBaseMetastore tests run under hadoop-2, so this + // guarantee HBaseIntegrationTests exist when we hitting this code path + java.lang.reflect.Method initHBaseMetastoreMethod = Class.forName( + "org.apache.hadoop.hive.metastore.hbase.HBaseStoreTestUtil") + .getMethod("initHBaseMetastore", HBaseAdmin.class, HiveConf.class); + initHBaseMetastoreMethod.invoke(null, admin, conf); } public QTestUtil(String outDir, String logDir, MiniClusterType clusterType,