[
https://issues.apache.org/jira/browse/HIVE-15373?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15727175#comment-15727175
]
Alexander Kolbasov commented on HIVE-15373:
-------------------------------------------
Here is the code for openTransaction():
{code}
public boolean openTransaction() {
openTrasactionCalls++;
if (openTrasactionCalls == 1) {
currentTransaction = pm.currentTransaction();
currentTransaction.begin();
transactionStatus = TXN_STATUS.OPEN;
} else {
// openTransactionCalls > 1 means this is an interior transaction
// We should already have a transaction created that is active.
if ((currentTransaction == null) || (!currentTransaction.isActive())){
throw new RuntimeException("openTransaction called in an interior"
+ " transaction scope, but currentTransaction is not active.");
}
}
boolean result = currentTransaction.isActive();
debugLog("Open transaction: count = " + openTrasactionCalls + ", isActive =
" + result);
return result;
}
{code}
So variables
* openTrasactionCalls (obviously misspelled)
* currentTransaction
* transactionStatus
are not protected by anything and in case of concurrent access may
accessed/modified concurrently causing all sorts of inconsistent behavior.
> Transaction management isn't thread-safe
> ----------------------------------------
>
> Key: HIVE-15373
> URL: https://issues.apache.org/jira/browse/HIVE-15373
> Project: Hive
> Issue Type: Bug
> Components: Hive
> Reporter: Alexander Kolbasov
>
> ObjectStore.java has several important calls which are not thread-safe:
> * openTransaction()
> * commitTransaction()
> * rollbackTransaction()
> These should be made thread-safe.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)