Hive: MetaException: Hive Schema version does not match metastore's schema version
org.apache.hadoop.hive.metastore.api.MetaExceptionHive Schema version 4.2.0 does not match metastore's schema version 3.1.0 Metastore is not upgraded or corruptThe Hive binaries expect a different metastore database schema than the one installed. This happens after upgrading Hive without upgrading the metastore schema, or when an older client connects directly to a newer metastore database.
Common causes
- Hive was upgraded but schematool -upgradeSchema was not run.How to confirm: schematool -dbType <db> -info shows the database schema version below the Hive version.
- A client with older Hive libraries (for example Spark with bundled Hive jars) connects to the metastore database directly instead of through the metastore service.How to confirm: The client config has javax.jdo.option.ConnectionURL instead of hive.metastore.uris.
How to fix it
Upgrade the metastore schema with schematool after backing up the database.
schematool -dbType mysql -upgradeSchemaHave other engines connect through the metastore service (hive.metastore.uris) rather than to the database. Do not disable verification to hide the mismatch.
| Setting | Default | Note |
|---|---|---|
hive.metastore.schema.verification | true |
Where the message comes from
ObjectStore.javainapache/hiveatrel/release-4.2.1- Message checked in Hive 4.2.1
Message template in the source: Hive Schema version %s does not match metastore's schema version %s Metastore is not upgraded or corrupt