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

ACID table creation fails on mysql with MySQLIntegrityConstraintViolationException

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.3.0, 2.1.0
    • Fix Version/s: 1.3.0, 2.1.1, 2.2.0
    • Component/s: Transactions
    • Labels:
      None
    • Environment:

      MySQL

      Description

      While creating a ACID table ran into the following error:

      >>>  create table acidcount1 (id int) 
      clustered by (id) into 2 buckets 
      stored as orc 
      tblproperties('transactional'='true');
      INFO  : Compiling command(queryId=hive_20160719105944_bfe65377-59fa-4e17-941e-1f86b8daca15): create table acidcount1 (id int) 
      clustered by (id) into 2 buckets 
      stored as orc 
      tblproperties('transactional'='true')
      INFO  : Semantic Analysis Completed
      INFO  : Returning Hive schema: Schema(fieldSchemas:null, properties:null)
      INFO  : Completed compiling command(queryId=hive_20160719105944_bfe65377-59fa-4e17-941e-1f86b8daca15); Time taken: 0.111 seconds
      Error: Error running query: java.lang.RuntimeException: Unable to lock 'CheckLock' due to: Duplicate entry 'CheckLock-0' for key 'PRIMARY' (SQLState=23000, ErrorCode=1062) (state=,code=0)
      Aborting command set because "force" is false and command failed: "create table acidcount1 (id int) 
      clustered by (id) into 2 buckets 
      stored as orc 
      tblproperties('transactional'='true');"
      

      Saw the following detailed stack in the server log:

      2016-07-19T10:59:46,213 ERROR [HiveServer2-Background-Pool: Thread-463]: metastore.RetryingHMSHandler (RetryingHMSHandler.java:invokeInternal(196)) - java.lang.RuntimeException: Unable to lock 'CheckLock' due to: Duplicate entry 'CheckLock-0' for key 'PRIMARY' (SQLState=23000, ErrorCode=1062)
              at org.apache.hadoop.hive.metastore.txn.TxnHandler.acquireLock(TxnHandler.java:3235)
              at org.apache.hadoop.hive.metastore.txn.TxnHandler.checkLock(TxnHandler.java:2309)
              at org.apache.hadoop.hive.metastore.txn.TxnHandler.checkLockWithRetry(TxnHandler.java:1012)
              at org.apache.hadoop.hive.metastore.txn.TxnHandler.lock(TxnHandler.java:784)
              at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.lock(HiveMetaStore.java:5941)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:606)
              at org.apache.hadoop.hive.metastore.RetryingHMSHandler.invokeInternal(RetryingHMSHandler.java:140)
              at org.apache.hadoop.hive.metastore.RetryingHMSHandler.invoke(RetryingHMSHandler.java:99)
              at com.sun.proxy.$Proxy26.lock(Unknown Source)
              at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.lock(HiveMetaStoreClient.java:2109)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:606)
              at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.invoke(RetryingMetaStoreClient.java:154)
              at com.sun.proxy.$Proxy28.lock(Unknown Source)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:606)
              at org.apache.hadoop.hive.metastore.HiveMetaStoreClient$SynchronizedHandler.invoke(HiveMetaStoreClient.java:2259)
              at com.sun.proxy.$Proxy28.lock(Unknown Source)
              at org.apache.hadoop.hive.ql.lockmgr.DbTxnManager$SynchronizedMetaStoreClient.lock(DbTxnManager.java:740)
              at org.apache.hadoop.hive.ql.lockmgr.DbLockManager.lock(DbLockManager.java:103)
              at org.apache.hadoop.hive.ql.lockmgr.DbTxnManager.acquireLocks(DbTxnManager.java:341)
              at org.apache.hadoop.hive.ql.lockmgr.DbTxnManager.acquireLocksWithHeartbeatDelay(DbTxnManager.java:357)
              at org.apache.hadoop.hive.ql.lockmgr.DbTxnManager.acquireLocks(DbTxnManager.java:167)
              at org.apache.hadoop.hive.ql.Driver.acquireLocksAndOpenTxn(Driver.java:980)
              at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1316)
              at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1090)
              at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1083)
              at org.apache.hive.service.cli.operation.SQLOperation.runQuery(SQLOperation.java:242)
              at org.apache.hive.service.cli.operation.SQLOperation.access$800(SQLOperation.java:91)
              at org.apache.hive.service.cli.operation.SQLOperation$BackgroundWork$1.run(SQLOperation.java:334)
              at java.security.AccessController.doPrivileged(Native Method)
              at javax.security.auth.Subject.doAs(Subject.java:415)
              at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1724)
              at org.apache.hive.service.cli.operation.SQLOperation$BackgroundWork.run(SQLOperation.java:347)
              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
              at java.util.concurrent.FutureTask.run(FutureTask.java:262)
              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
              at java.util.concurrent.FutureTask.run(FutureTask.java:262)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
              at java.lang.Thread.run(Thread.java:745)
      Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry 'CheckLock-0' for key 'PRIMARY'
              at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
              at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
              at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
              at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
              at com.mysql.jdbc.Util.handleNewInstance(Util.java:377)
              at com.mysql.jdbc.Util.getInstance(Util.java:360)
              at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:971)
              at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3887)
              at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3823)
              at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2435)
              at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2582)
              at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2526)
              at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1618)
              at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1549)
              at com.jolbox.bonecp.StatementHandle.executeUpdate(StatementHandle.java:497)
              at org.apache.hadoop.hive.metastore.txn.TxnHandler.acquireLock(TxnHandler.java:3231)
              ... 47 more
      

        Attachments

        1. HIVE-14292.2.patch
          0.8 kB
          Eugene Koifman
        2. HIVE-14292.3.patch
          0.8 kB
          Eugene Koifman
        3. HIVE-14292.patch
          0.8 kB
          Eugene Koifman

          Activity

            People

            • Assignee:
              ekoifman Eugene Koifman
              Reporter:
              deepesh Deepesh Khandelwal
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: