MetaStore does not detect and rollback failed transactions
----------------------------------------------------------

                 Key: HIVE-1679
                 URL: https://issues.apache.org/jira/browse/HIVE-1679
             Project: Hadoop Hive
          Issue Type: Bug
          Components: Metastore
    Affects Versions: 0.5.0, 0.6.0, 0.7.0
            Reporter: Carl Steinbach


Most of the methods in HiveMetaStore and ObjectStore adhere to the following 
idiom when 
interacting with the ObjectStore:

{code}
boolean success = false;
try {
  ms.openTransaction();
  /* do some stuff */
  success = ms.commitTransaction();
} finally {
  if (!success) {
    ms.rollbackTransaction();
  }
}
{code}

The problem with this is that ObjectStore.commitTransaction() always returns 
TRUE:

{code}
  public boolean commitTransaction() {
    assert (openTrasactionCalls >= 1);
    if (!currentTransaction.isActive()) {
      throw new RuntimeException(
          "Commit is called, but transaction is not active. Either there are"
              + " mismatching open and close calls or rollback was called in 
the same trasaction");
    }
    openTrasactionCalls--;
    if ((openTrasactionCalls == 0) && currentTransaction.isActive()) {
      transactionStatus = TXN_STATUS.COMMITED;
      currentTransaction.commit();
    }
    return true;
  }
{code}


Consequently, the transaction appears to always succeed and ObjectStore is never
directed to rollback transactions that have actually failed. 



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to