diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java b/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java index fcaffc7..3a7fcc9 100644 --- a/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java +++ b/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java @@ -161,6 +161,10 @@ private static PersistenceManagerFactory pmf = null; private static Lock pmfPropLock = new ReentrantLock(); + /** + * Verify the schema only once per JVM since the db connection info is static + */ + private final static AtomicBoolean isSchemaVerified = new AtomicBoolean(false); private static final Log LOG = LogFactory.getLog(ObjectStore.class.getName()); private static enum TXN_STATUS { @@ -189,7 +193,6 @@ int openTrasactionCalls = 0; private Transaction currentTransaction = null; private TXN_STATUS transactionStatus = TXN_STATUS.NO_STATE; - private final AtomicBoolean isSchemaVerified = new AtomicBoolean(false); private Pattern partitionValidationPattern; @@ -6605,19 +6608,17 @@ private synchronized void checkSchema() throws MetaException { } } else { // metastore schema version is different than Hive distribution needs - if (strictValidation) { - if (!schemaVer.equalsIgnoreCase(MetaStoreSchemaInfo.getHiveSchemaVersion())) { + if (!schemaVer.equalsIgnoreCase(MetaStoreSchemaInfo.getHiveSchemaVersion())) { + if (strictValidation) { throw new MetaException("Hive Schema version " + MetaStoreSchemaInfo.getHiveSchemaVersion() + " does not match metastore's schema version " + schemaVer + " Metastore is not upgraded or corrupt"); } else { - LOG.warn("Metastore version was " + schemaVer + " " + - HiveConf.ConfVars.METASTORE_SCHEMA_VERIFICATION.toString() + - " is not enabled so recording the new schema version " + - MetaStoreSchemaInfo.getHiveSchemaVersion()); - setMetaStoreSchemaVersion(MetaStoreSchemaInfo.getHiveSchemaVersion(), - "Set by MetaStore"); + LOG.error("Version information found in metastore differs " + schemaVer + + " from expected schema version " + MetaStoreSchemaInfo.getHiveSchemaVersion() + + ". Schema verififcation is disabled " + + HiveConf.ConfVars.METASTORE_SCHEMA_VERIFICATION + " so continuing."); } } }