protected void assertCompatibleVersion(String hiveSchemaVersion, String dbSchemaVersion) throws HiveMetaException { if (!metaStoreSchemaInfo.isVersionCompatible(hiveSchemaVersion, dbSchemaVersion)) { throw new HiveMetaException("Metastore schema version is not compatible. Hive Version: " + hiveSchemaVersion + ", Database Schema Version: " + dbSchemaVersion); } }
@Test public void testIsVersionCompatible() throws Exception { // first argument is hiveVersion, it is compatible if 2nd argument - dbVersion is // greater than or equal to it // check the compatible case IMetaStoreSchemaInfo metastoreSchemaInfo = MetaStoreSchemaInfoFactory.get(MetastoreConf.newMetastoreConf()); Assert.assertTrue(metastoreSchemaInfo.isVersionCompatible("0.0.1", "0.0.1")); Assert.assertTrue(metastoreSchemaInfo.isVersionCompatible("0.0.1", "0.0.2")); Assert.assertTrue(metastoreSchemaInfo.isVersionCompatible("1.0.2", "2.0.1")); Assert.assertTrue(metastoreSchemaInfo.isVersionCompatible("0.0.9", "9.0.0")); // check equivalent versions, should be compatible Assert.assertTrue(metastoreSchemaInfo.isVersionCompatible("0.13.0", "0.13.1")); Assert.assertTrue(metastoreSchemaInfo.isVersionCompatible("0.13.1", "0.13.0")); // check incompatible versions Assert.assertFalse(metastoreSchemaInfo.isVersionCompatible("0.1.1", "0.1.0")); Assert.assertFalse(metastoreSchemaInfo.isVersionCompatible("4.0.1", "0.1.0")); }
if (metastoreSchemaInfo.isVersionCompatible(hiveSchemaVer, dbSchemaVer)) { LOG.debug("Found expected HMS version of {}", dbSchemaVer); } else {
private void assertCompatibleVersion(String hiveSchemaVersion, String dbSchemaVersion) throws HiveMetaException { if (!metaStoreSchemaInfo.isVersionCompatible(hiveSchemaVersion, dbSchemaVersion)) { throw new HiveMetaException("Metastore schema version is not compatible. Hive Version: " + hiveSchemaVersion + ", Database Schema Version: " + dbSchemaVersion); } }
if (metastoreSchemaInfo.isVersionCompatible(hiveSchemaVer, dbSchemaVer)) { LOG.debug("Found expected HMS version of {}", dbSchemaVer); } else {