HIVE-11731: Exclude hbase-metastore in itests for hadoop-1
Project: http://git-wip-us.apache.org/repos/asf/hive/repo Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/848b9770 Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/848b9770 Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/848b9770 Branch: refs/heads/master Commit: 848b9770acb5cf47dd1f7307c88a1f80490fcf76 Parents: 8b0eded Author: Daniel Dai <da...@hortonworks.com> Authored: Thu Sep 3 21:56:59 2015 -0700 Committer: Daniel Dai <da...@hortonworks.com> Committed: Thu Sep 3 21:56:59 2015 -0700 ---------------------------------------------------------------------- itests/hive-unit/pom.xml | 14 +++++++++++ .../metastore/hbase/HBaseIntegrationTests.java | 13 +--------- itests/qtest/pom.xml | 7 ++++++ itests/util/pom.xml | 20 ++++++++++++++++ .../org/apache/hadoop/hive/ql/QTestUtil.java | 25 ++++++-------------- 5 files changed, 49 insertions(+), 30 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hive/blob/848b9770/itests/hive-unit/pom.xml ---------------------------------------------------------------------- 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 @@ </profile> <profile> <id>hadoop-1</id> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>2.3.2</version> + <configuration> + <testExcludes> + <exclude>**/metastore/hbase/**</exclude> + </testExcludes> + </configuration> + </plugin> + </plugins> + </build> <dependencies> <dependency> <groupId>org.apache.hadoop</groupId> http://git-wip-us.apache.org/repos/asf/hive/blob/848b9770/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/hbase/HBaseIntegrationTests.java ---------------------------------------------------------------------- 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 @@ public class HBaseIntegrationTests { utility.startMiniCluster(); conf = new HiveConf(utility.getConfiguration(), HBaseIntegrationTests.class); admin = utility.getHBaseAdmin(); - for (String tableName : HBaseReadWrite.tableNames) { - List<byte[]> 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 { http://git-wip-us.apache.org/repos/asf/hive/blob/848b9770/itests/qtest/pom.xml ---------------------------------------------------------------------- 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 @@ </dependency> <dependency> <groupId>org.apache.hive</groupId> + <artifactId>hive-it-unit</artifactId> + <version>${project.version}</version> + <classifier>tests</classifier> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.hive</groupId> <artifactId>hive-it-util</artifactId> <version>${project.version}</version> <scope>test</scope> http://git-wip-us.apache.org/repos/asf/hive/blob/848b9770/itests/util/pom.xml ---------------------------------------------------------------------- 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 @@ <profiles> <profile> <id>hadoop-1</id> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>2.3.2</version> + <configuration> + <excludes> + <exclude>**/metastore/hbase/**</exclude> + </excludes> + </configuration> + </plugin> + </plugins> + </build> <dependencies> <dependency> <groupId>org.apache.hadoop</groupId> @@ -120,6 +134,12 @@ </dependency> <dependency> <groupId>org.apache.hbase</groupId> + <artifactId>hbase-common</artifactId> + <version>${hbase.hadoop1.version}</version> + <classifier>tests</classifier> + </dependency> + <dependency> + <groupId>org.apache.hbase</groupId> <artifactId>hbase-server</artifactId> <version>${hbase.hadoop1.version}</version> </dependency> http://git-wip-us.apache.org/repos/asf/hive/blob/848b9770/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java ---------------------------------------------------------------------- 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.FileStatus; 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.common.io.SortPrintStream; 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 @@ public class QTestUtil { 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<byte[]> 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,