Stamatis Zampetakis created HIVE-28834:
------------------------------------------

             Summary: HMS swallows original failure when the rollback of a 
transaction fails
                 Key: HIVE-28834
                 URL: https://issues.apache.org/jira/browse/HIVE-28834
             Project: Hive
          Issue Type: Bug
          Components: Metastore
            Reporter: Stamatis Zampetakis
            Assignee: Stamatis Zampetakis


The problem mainly affects {{HMSHandler}} and {{ObjectStore}} but can be 
generalized to any client that is executing rollback in a {{finally}} block.

Some very frequent problematic patterns are outlined below.
+Pattern in ObjectStore+
{code:java}
    boolean committed = false;
    try {
      openTransaction();
      // some operations
      committed = commitTransaction();
    } finally {
      rollbackAndCleanup(committed, null);
    }
{code}
 
+Pattern in HMSHandler+
{code:java}
    boolean success = false;
    RawStore ms = getMS();
    try {
      ms.openTransaction();
      // some operations
      success = ms.commitTransaction();
    } finally {
       if (!success) {
        ms.rollbackTransaction();
      }
    }
{code}
The problem is that whatever failure/exception is raised inside the {{try}} 
block between the open and commit transaction will be completely lost if the 
rollback fails. The exception from the rollback masks the original error.

Most of the time the initial failure is far more important than the failure 
inside the rollback so losing it is major issue when trying to diagnose a 
problem in HMS.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to