[ https://issues.apache.org/jira/browse/HIVE-19164?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16438018#comment-16438018 ]
Vihang Karajgaonkar commented on HIVE-19164: -------------------------------------------- These are my diffs in case anyone is interested. {noformat} 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 void testVersionMatching () throws Exception { 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 void testVersionCompatibility () throws Exception { } // 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); } } - - } {noformat} > TestMetastoreVersion failures > ----------------------------- > > Key: HIVE-19164 > URL: https://issues.apache.org/jira/browse/HIVE-19164 > Project: Hive > Issue Type: Sub-task > Components: Test > Reporter: Vineet Garg > Assignee: Alan Gates > Priority: Major > Fix For: 3.0.0 > > Attachments: HIVE-19164.patch > > > Following tests are failing consistently and are reproducible on master: > * testVersionMatching > * testMetastoreVersion > I tried debugging it and found that ObjectStore.getMSSchemaVersion() throws > an exception {{No matching version found}}. > To fetch schema version this method executes {code:sql} SELECT FROM > org.apache.hadoop.hive.metastore.model.MVersionTable {code} but for whatever > reason execution returns empty result set resulting in the exception. Both > test failures are due to this exception. I tried debugging the query > execution but didn't really go nowhere with it. I suspect this could be due > to recent metastore changes. I tried reproducing this outside test but with > no success. -- This message was sent by Atlassian JIRA (v7.6.3#76005)