You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by vg...@apache.org on 2018/04/20 05:47:22 UTC
[2/2] hive git commit: HIVE-19164 : TestMetastoreVersion failures
(Vihang Karajgaonkar via Ashutosh Chauhan)
HIVE-19164 : TestMetastoreVersion failures (Vihang Karajgaonkar via Ashutosh Chauhan)
Signed-off-by: Ashutosh Chauhan <ha...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/cfd43a33
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/cfd43a33
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/cfd43a33
Branch: refs/heads/branch-3
Commit: cfd43a33e3e4d02dfec5d59c5f6ece68c3628d71
Parents: a2e5d8b
Author: Vihang Karajgaonkar <vi...@cloudera.com>
Authored: Tue Apr 17 09:56:15 2018 -0700
Committer: Vineet Garg <vg...@apache.org>
Committed: Thu Apr 19 22:47:07 2018 -0700
----------------------------------------------------------------------
.../hive/metastore/TestMetastoreVersion.java | 22 +++++++++-----------
1 file changed, 10 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/cfd43a33/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestMetastoreVersion.java
----------------------------------------------------------------------
diff --git a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestMetastoreVersion.java b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestMetastoreVersion.java
index 6015405..4d26f3e 100644
--- a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestMetastoreVersion.java
+++ b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestMetastoreVersion.java
@@ -142,6 +142,7 @@ public class TestMetastoreVersion extends TestCase {
ObjectStore.setSchemaVerified(false);
hiveConf.setBoolVar(HiveConf.ConfVars.METASTORE_SCHEMA_VERIFICATION, true);
+ hiveConf = new HiveConf(this.getClass());
setVersion(hiveConf, metastoreSchemaInfo.getHiveSchemaVersion());
driver = DriverFactory.newDriver(hiveConf);
CommandProcessorResponse proc = driver.run("show tables");
@@ -191,37 +192,34 @@ public class TestMetastoreVersion extends TestCase {
}
// write the given version to metastore
- private String getVersion(HiveConf conf) throws HiveMetaException {
+ private String getVersion(HiveConf conf) throws Exception {
return getMetaStoreVersion();
}
// write the given version to metastore
- private void setVersion(HiveConf conf, String version) throws HiveMetaException {
+ private void setVersion(HiveConf conf, String version) throws Exception {
setMetaStoreVersion(version, "setVersion test");
}
// Load the version stored in the metastore db
- public String getMetaStoreVersion() throws HiveMetaException {
- ObjectStore objStore = new ObjectStore();
- objStore.setConf(hiveConf);
+ public String getMetaStoreVersion() throws HiveMetaException, MetaException {
+ RawStore ms = HiveMetaStore.HMSHandler.getMSForConf(hiveConf);
try {
- return objStore.getMetaStoreSchemaVersion();
+ return ms.getMetaStoreSchemaVersion();
} catch (MetaException e) {
throw new HiveMetaException("Failed to get version", e);
}
}
// Store the given version and comment in the metastore
- public void setMetaStoreVersion(String newVersion, String comment) throws HiveMetaException {
- ObjectStore objStore = new ObjectStore();
- objStore.setConf(hiveConf);
+ public void setMetaStoreVersion(String newVersion, String comment)
+ throws HiveMetaException, MetaException {
+ RawStore ms = HiveMetaStore.HMSHandler.getMSForConf(hiveConf);
try {
- objStore.setMetaStoreSchemaVersion(newVersion, comment);
+ ms.setMetaStoreSchemaVersion(newVersion, comment);
} catch (MetaException e) {
throw new HiveMetaException("Failed to set version", e);
}
}
-
-
}