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

TRUNCATE TABLE fails due MySQL limitations on limit value

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 4.0.0-alpha-1
    • None
    • None

    Description

      HMS currently has some APIs that accepts an integer limit value. Prior to the change in HIVE-21734, HMS was silently converting this int to short and thus we havent seen this issue. But semantically, its incorrect to do so quietly.

      at java.lang.Thread.run(Thread.java:748) [?:1.8.0_191]
      Caused by: java.sql.SQLException: setMaxRows() out of range. 2147483647 > 50000000.
      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:996) ~[mysql-
      connector-java.jar:5.1.33]
      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:935) ~[mysql-
      connector-java.jar:5.1.33]
      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:924) ~[mysql-
      connector-java.jar:5.1.33]
      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:870) ~[mysql-
      connector-java.jar:5.1.33]
      at com.mysql.jdbc.StatementImpl.setMaxRows(StatementImpl.java:2525) ~[mysql-
      connector-java.jar:5.1.33]
      at 
      com.zaxxer.hikari.pool.HikariProxyPreparedStatement.setMaxRows(HikariProxyPreparedS
      tatement.java) ~[HikariCP-2.6.1.jar:?]
      

      We cannot change the RawStore api to accept shorts instead of ints.
      So we have to fix the caller to use a lower limit instead of Integer.MAX_VALUE.

      Caused by: org.apache.hadoop.hive.metastore.api.MetaException: Exception thrown when executing query : SELECT DISTINCT 'org.apache.hadoop.hive.metastore.model.MPartition' AS `NUCLEUS_TYPE`,`A0`.`CREATE_TIME`,`A0`.`LAST_ACCESS_TIME`,`A0`.`PART_NAME`,`A0`.`WRITE_ID`,`A0`.`PART_ID`,`A0`.`PART_NAME` AS `NUCORDER0` FROM `PARTITIONS` `A0` LEFT OUTER JOIN `TBLS` `B0` ON `A0`.`TBL_ID` = `B0`.`TBL_ID` LEFT OUTER JOIN `DBS` `C0` ON `B0`.`DB_ID` = `C0`.`DB_ID` WHERE `B0`.`TBL_NAME` = ? AND `C0`.`NAME` = ? AND `C0`.`CTLG_NAME` = ? ORDER BY `NUCORDER0` LIMIT 0,2147483647
              at org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$truncate_table_req_result$truncate_table_req_resultStandardScheme.read(ThriftHiveMetastore.java) ~[hive-exec-3.1.0.3.1.5.0-17.jar:3.1.0.3.1.5.0-17]
              at org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$truncate_table_req_result$truncate_table_req_resultStandardScheme.read(ThriftHiveMetastore.java) ~[hive-exec-3.1.0.3.1.5.0-17.jar:3.1.0.3.1.5.0-17]
              at org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$truncate_table_req_result.read(ThriftHiveMetastore.java) ~[hive-exec-3.1.0.3.1.5.0-17.jar:3.1.0.3.1.5.0-17]
              at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:86) ~[hive-exec-3.1.0.3.1.5.0-17.jar:3.1.0.3.1.5.0-17]
              at org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$Client.recv_truncate_table_req(ThriftHiveMetastore.java:1999) ~[hive-exec-3.1.0.3.1.5.0-17.jar:3.1.0.3.1.5.0-17]
              at org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$Client.truncate_table_req(ThriftHiveMetastore.java:1986) ~[hive-exec-3.1.0.3.1.5.0-17.jar:3.1.0.3.1.5.0-17]
              at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.truncateTableInternal(HiveMetaStoreClient.java:1450) ~[hive-exec-3.1.0.3.1.5.0-17.jar:3.1.0.3.1.5.0-17]
              at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.truncateTable(HiveMetaStoreClient.java:1427) ~[hive-exec-3.1.0.3.1.5.0-17.jar:3.1.0.3.1.5.0-17]
              at org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient.truncateTable(SessionHiveMetaStoreClient.java:171) ~[hive-exec-3.1.0.3.1.5.0-17.jar:3.1.0.3.1.5.0-17]
              at sun.reflect.GeneratedMethodAccessor112.invoke(Unknown Source) ~[?:?]
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_191]
              at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_191]
              at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.invoke(RetryingMetaStoreClient.java:212) ~[hive-exec-3.1.0.3.1.5.0-17.jar:3.1.0.3.1.5.0-17]
              at com.sun.proxy.$Proxy59.truncateTable(Unknown Source) ~[?:?]
              at sun.reflect.GeneratedMethodAccessor112.invoke(Unknown Source) ~[?:?]
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_191]
              at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_191]
              at org.apache.hadoop.hive.metastore.HiveMetaStoreClient$SynchronizedHandler.invoke(HiveMetaStoreClient.java:3122) ~[hive-exec-3.1.0.3.1.5.0-17.jar:3.1.0.3.1.5.0-17]
              at com.sun.proxy.$Proxy59.truncateTable(Unknown Source) ~[?:?]
              at org.apache.hadoop.hive.ql.metadata.Hive.truncateTable(Hive.java:1277) ~[hive-exec-3.1.0.3.1.5.0-17.jar:3.1.0.3.1.5.0-17]
              at org.apache.hadoop.hive.ql.exec.DDLTask.truncateTable(DDLTask.java:5111) ~[hive-exec-3.1.0.3.1.5.0-17.jar:3.1.0.3.1.5.0-17]
      

      Attachments

        1. HIVE-22406.patch
          2 kB
          Naveen Gangam
        2. HIVE-22406.patch
          2 kB
          Naveen Gangam

        Activity

          People

            ngangam Naveen Gangam
            ngangam Naveen Gangam
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: