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

Szehon Ho commented on HIVE-4996:
---------------------------------

I put some instrumentation code and saw the following in one instance of this 
exception:

1.  HMSHandler.create_table_with_core makes a series of calls to the RawStore: 
{open, call1, call2, call3, commmit}

2.  Suddenly there is a strange BoneCP message saying it is closing the 
connection.
{code}
2014-01-28 22:50:34,565 WARN  bonecp.ConnectionPartition 
(ConnectionPartition.java:finalizeReferent(162)) - BoneCP detected an unclosed 
connection and will now attempt to close it for you. You should be closing this 
connection in your application - enable connectionWatch for additional 
debugging assistance or set disableConnectionTracking to true to disable this 
feature entirely.
{code}

3.  This causes a certain RawStore operation {calln} to fail on commit, and 
rollback to occur.  In this case, failing operation is in nested-transaction 
(openTransactions > 1)

4.  This RawStore operation {calln} is re-tried by virtue of the retrying 
metastore client, and succeeds (using perhaps another BoneCP connection).

5.  But there is still the final commit() call of HMSHandler operation in step 
1, and it will be unbalanced.

So there are two issues, one is BoneCP randomly closing the connection, and 
also the design of RetryingRawStore. 

In my opinion, we should rely on RetryingHMSHandler and get rid of 
RetryingRawStore, as we should always retry the whole transaction as a unit.  
It doesn't make sense too much sense to me to retry individual operations, 
within a nested transaction, unless I am missing something.  I could take a 
stab, what do people think?

> unbalanced calls to openTransaction/commitTransaction
> -----------------------------------------------------
>
>                 Key: HIVE-4996
>                 URL: https://issues.apache.org/jira/browse/HIVE-4996
>             Project: Hive
>          Issue Type: Bug
>          Components: Metastore
>    Affects Versions: 0.10.0, 0.11.0, 0.12.0
>         Environment: hiveserver1  Java HotSpot(TM) 64-Bit Server VM (build 
> 20.6-b01, mixed mode)
>            Reporter: wangfeng
>            Priority: Critical
>              Labels: hive, metastore
>         Attachments: hive-4996.path
>
>   Original Estimate: 504h
>  Remaining Estimate: 504h
>
> when we used hiveserver1 based on hive-0.10.0, we found the Exception 
> thrown.It was:
> FAILED: Error in metadata: MetaException(message:java.lang.RuntimeException: 
> commitTransaction was called but openTransactionCalls = 0. This probably 
> indicates that the
> re are unbalanced calls to openTransaction/commitTransaction)
> FAILED: Execution Error, return code 1 from 
> org.apache.hadoop.hive.ql.exec.DDLTask
> help



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to