boolean validateSchemaVersions() throws HiveMetaException { System.out.println("Validating schema version"); try { String hiveSchemaVersion = schemaTool.getMetaStoreSchemaInfo().getHiveSchemaVersion(); MetaStoreConnectionInfo connectionInfo = schemaTool.getConnectionInfo(false); String newSchemaVersion = schemaTool.getMetaStoreSchemaInfo().getMetaStoreSchemaVersion(connectionInfo); schemaTool.assertCompatibleVersion(hiveSchemaVersion, newSchemaVersion); } catch (HiveMetaException hme) { if (hme.getMessage().contains("Metastore schema version is not compatible") || hme.getMessage().contains("Multiple versions were found in metastore") || hme.getMessage().contains("Could not find version info in metastore VERSION table")) { System.err.println(hme.getMessage()); System.out.println("[FAIL]\n"); return false; } else { throw hme; } } System.out.println("[SUCCESS]\n"); return true; }
version = schemaTool.getMetaStoreSchemaInfo().getMetaStoreSchemaVersion(connectionInfo); } catch (HiveMetaException he) { System.err.println("Failed to determine schema version from Hive Metastore DB. " + he.getMessage()); System.out.println("Failed in schema table validation."); LOG.debug("Failed to determine schema version from Hive Metastore DB," + he.getMessage(), he); return false;
@Override void execute() throws HiveMetaException { HiveSchemaHelper.MetaStoreConnectionInfo connectionInfo = schemaTool.getConnectionInfo(true); String dbVersion = null; try { dbVersion = schemaTool.getMetaStoreSchemaInfo().getMetaStoreSchemaVersion(connectionInfo); } catch (HiveMetaException e) { LOG.info("Exception getting db version:" + e.getMessage()); LOG.info("Try to initialize db schema"); } SchemaToolTask task; if (dbVersion == null) { task = new SchemaToolTaskInit(); } else { task = new SchemaToolTaskUpgrade(); } task.setHiveSchemaTool(schemaTool); task.setCommandLineArguments(cl); task.execute(); } }
return 0; } catch (HiveMetaException e) { logAndPrintToError(e.getMessage()); if (e.getCause() != null) { Throwable t = e.getCause();
Assert.fail("did not get expected exception"); } catch (HiveMetaException hme) { String message = hme.getMessage(); Assert.assertTrue("Bad HiveMetaException message :" + message, message.contains("Failed to retrieve schema tables from Hive Metastore DB"));
boolean validateSchemaVersions() throws HiveMetaException { System.out.println("Validating schema version"); try { String newSchemaVersion = metaStoreSchemaInfo.getMetaStoreSchemaVersion(getConnectionInfo(false)); assertCompatibleVersion(metaStoreSchemaInfo.getHiveSchemaVersion(), newSchemaVersion); } catch (HiveMetaException hme) { if (hme.getMessage().contains("Metastore schema version is not compatible") || hme.getMessage().contains("Multiple versions were found in metastore") || hme.getMessage().contains("Could not find version info in metastore VERSION table")) { System.err.println(hme.getMessage()); System.out.println("Failed in schema version validation."); return false; } else { throw hme; } } System.out.println("Succeeded in schema version validation."); return true; }
version = metaStoreSchemaInfo.getMetaStoreSchemaVersion(getConnectionInfo(false)); } catch (HiveMetaException he) { System.err.println("Failed to determine schema version from Hive Metastore DB. " + he.getMessage()); System.out.println("Failed in schema table validation."); LOG.debug("Failed to determine schema version from Hive Metastore DB," + he.getMessage()); return false;