Troubleshooting Hive Upgrade Issues

This section describes how to troubleshoot inconsistencies in an underlying database after creating tables with the datanucleus.schema.autoCreateAll property.

Procedure

  1. Determine the version from which you are upgrading.
  2. Start MySQL:
    mysql -u <user> -p <password>
  3. Run the following commands in your MySQL command line.
    USE metastore; 
    SOURCE /opt/mapr/hive/hive-2.1/scripts/metastore/upgrade/mysql/hive-schema
            -1.2.0.mysql.sql;
    SOURCE /opt/mapr/hive/hive-2.1/scripts/metastore/upgrade/mysql/hive-txn-schema
            -0.13.0.mysql.sql;                     
    USE metastore; 
    SOURCE /opt/mapr/hive/hive-2.1/scripts/metastore/upgrade/mysql/hive-schema-0.14.0.
    mysql.sql;                     
    USE metastore;
    SOURCE /opt/mapr/hive/hive-2.1/scripts/metastore/upgrade/mysql/
    hive-schema-0.13.0.mysql.sql;                                

Results

Running SOURCE for the version before the upgrade makes the underlying database consistent for running schematool command with the -upgradeSchema option.