You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "zhangbutao (Jira)" <ji...@apache.org> on 2021/06/02 02:45:00 UTC

[jira] [Commented] (HIVE-25186) Drop database fails with excetion 'Cannot delete or update a parent row: a foreign key constraint fails'

    [ https://issues.apache.org/jira/browse/HIVE-25186?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17355461#comment-17355461 ] 

zhangbutao commented on HIVE-25186:
-----------------------------------

This exception looks like  HIVE-23756 which failed to delete a table intermittently.

> Drop database fails with excetion 'Cannot delete or update a parent row: a foreign key constraint fails'
> --------------------------------------------------------------------------------------------------------
>
>                 Key: HIVE-25186
>                 URL: https://issues.apache.org/jira/browse/HIVE-25186
>             Project: Hive
>          Issue Type: Bug
>          Components: Standalone Metastore
>    Affects Versions: 4.0.0
>            Reporter: zhangbutao
>            Priority: Major
>         Attachments: drop_database_exception.txt
>
>
> We use Hive master branch  (HiveMetastoreClient Api) to create and drop database. 
>  When we drop database with following sample code, some exceptions will occur occasionally.
> {code:java}
>  HiveMetaStoreClient hiveMetaClient = new HiveMetaStoreClient(hiveConf); 
>  hiveMetaClient.dropDatabase("testdb", true, true, true);
> {code}
> {code:java}
> java.sql.BatchUpdateException: Cannot delete or update a parent row: a foreign key constraint fails ("hive"."tbls", CONSTRAINT "FKdg0lkp80iro5fs41hyvi9ox43" FOREIGN KEY ("DB_ID") REFERENCES "dbs" ("DB_ID"))
>         at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:2058)
>         at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1471)
>         at org.apache.hive.com.zaxxer.hikari.pool.ProxyStatement.executeBatch(ProxyStatement.java:125)
>         at org.apache.hive.com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeBatch(HikariProxyPreparedStatement.java)
>         at org.datanucleus.store.rdbms.ParamLoggingPreparedStatement.executeBatch(ParamLoggingPreparedStatement.java:366)
>         at org.datanucleus.store.rdbms.SQLController.processConnectionStatement(SQLController.java:667)
>         at org.datanucleus.store.rdbms.SQLController.processStatementsForConnection(SQLController.java:635)
>         at org.datanucleus.store.rdbms.SQLController$1.transactionFlushed(SQLController.java:721)
>         at org.datanucleus.store.connection.AbstractManagedConnection.transactionFlushed(AbstractManagedConnection.java:95)
>         at org.datanucleus.store.connection.ConnectionManagerImpl$2.transactionFlushed(ConnectionManagerImpl.java:528)
>         at org.datanucleus.TransactionImpl.flush(TransactionImpl.java:222)
>         at org.datanucleus.TransactionImpl.commit(TransactionImpl.java:286)
>         at org.datanucleus.api.jdo.JDOTransaction.commit(JDOTransaction.java:107)
>         at org.apache.hadoop.hive.metastore.ObjectStore.commitTransaction(ObjectStore.java:598)
>         at sun.reflect.GeneratedMethodAccessor103.invoke(Unknown Source)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:498)
>         at org.apache.hadoop.hive.metastore.RawStoreProxy.invoke(RawStoreProxy.java:97)
>         at com.sun.proxy.$Proxy27.commitTransaction(Unknown Source)
>         at org.apache.hadoop.hive.metastore.HMSHandler.drop_database_core(HMSHandler.java:1898)
>         at org.apache.hadoop.hive.metastore.HMSHandler.drop_database(HMSHandler.java:1954)
>         at sun.reflect.GeneratedMethodAccessor219.invoke(Unknown Source)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:498)
>         at org.apache.hadoop.hive.metastore.RetryingHMSHandler.invokeInternal(RetryingHMSHandler.java:147)
>         at org.apache.hadoop.hive.metastore.RetryingHMSHandler.invoke(RetryingHMSHandler.java:108)
>         at com.sun.proxy.$Proxy28.drop_database(Unknown Source)
>         at org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$Processor$drop_database.getResult(ThriftHiveMetastore.java:17577)
>         at org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$Processor$drop_database.getResult(ThriftHiveMetastore.java:17556)
>         at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:38)
>         at org.apache.hadoop.hive.metastore.TUGIBasedProcessor$1.run(TUGIBasedProcessor.java:111)
>         at org.apache.hadoop.hive.metastore.TUGIBasedProcessor$1.run(TUGIBasedProcessor.java:107)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at javax.security.auth.Subject.doAs(Subject.java:422)
>         at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1685)
>         at org.apache.hadoop.hive.metastore.TUGIBasedProcessor.process(TUGIBasedProcessor.java:119)
>         at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:313)
>         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>         at java.lang.Thread.run(Thread.java:748)
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)