Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-22268

schematool references wrong scripts directory

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Not A Problem
    • 2.3.6, 3.1.2
    • None
    • Metastore
    • None

    Description

      When running schematool on 2.3.6, 3.1.2 (no standalone metastore) and possibly others, the schematool uses a Java class org.apache.hadoop.hive.metastore.MetaStoreSchemaInfo where it checks for metastore script dirs `getMetaStoreScriptDir()`.

      This function returns (essentially) scripts/metastore/upgrade/<FILE_NAME> whereas in 2.3.6 and 3.1.2 now it is *metastore/*scripts/upgrade/<FILE_NAME>.

       

      // OLD
      public String getMetaStoreScriptDir() {
          return  hiveHome + File.separatorChar +
              "scripts" + File.separatorChar + "metastore" +
      	File.separatorChar + "upgrade" + File.separatorChar + dbType;
      }
      
      // NEW (tested only with schematool mysql)
      public String getMetaStoreScriptDir() {
          return  hiveHome + File.separatorChar +
              "metastore" + File.separatorChar + "scripts" +
      	File.separatorChar + "upgrade" + File.separatorChar + dbType;
      }
      

      I did test it by changing the code and swapping metastore/scripts in the method and it did work.

      org.apache.hadoop.hive.metastore.HiveMetaException: File /opt/apache-hive-2.3.6-src/scripts/metastore/upgrade/mysql/upgrade.order.mysqlnot found 
       at org.apache.hadoop.hive.metastore.MetaStoreSchemaInfo.<init>(MetaStoreSchemaInfo.java:69)
       at org.apache.hive.beeline.HiveSchemaTool.<init>(HiveSchemaTool.java:92)
       at org.apache.hive.beeline.HiveSchemaTool.<init>(HiveSchemaTool.java:82)
       at org.apache.hive.beeline.HiveSchemaTool.main(HiveSchemaTool.java:1117)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.lang.reflect.Method.invoke(Method.java:498)
       at org.apache.hadoop.util.RunJar.run(RunJar.java:244)
       at org.apache.hadoop.util.RunJar.main(RunJar.java:158)
      Caused by: java.io.FileNotFoundException: /opt/apache-hive-2.3.6-src/scripts/metastore/upgrade/mysql/upgrade.order.mysql (No such file or directory)
       at java.io.FileInputStream.open0(Native Method)
       at java.io.FileInputStream.open(FileInputStream.java:195)
       at java.io.FileInputStream.<init>(FileInputStream.java:138)
       at java.io.FileInputStream.<init>(FileInputStream.java:93)
       at java.io.FileReader.<init>(FileReader.java:58)
       at org.apache.hadoop.hive.metastore.MetaStoreSchemaInfo.<init>(MetaStoreSchemaInfo.java:62)
       ... 9 more
      *** schemaTool failed ***
      

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            cjmoberg Cameron Moberg
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: