You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ha...@apache.org on 2018/04/17 16:57:26 UTC

hive git commit: HIVE-19164 : TestMetastoreVersion failures (Vihang Karajgaonkar via Ashutosh Chauhan)

Repository: hive
Updated Branches:
  refs/heads/master fedb03aba -> d3be2086a


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/d3be2086
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/d3be2086
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/d3be2086

Branch: refs/heads/master
Commit: d3be2086afb3a8d7180a6135d450a21485476fe6
Parents: fedb03a
Author: Vihang Karajgaonkar <vi...@cloudera.com>
Authored: Tue Apr 17 09:56:15 2018 -0700
Committer: Ashutosh Chauhan <ha...@apache.org>
Committed: Tue Apr 17 09:57:10 2018 -0700

----------------------------------------------------------------------
 .../hive/metastore/TestMetastoreVersion.java    | 22 +++++++++-----------
 1 file changed, 10 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/d3be2086/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);
     }
   }
-
-
 }