Geronimo
  1. Geronimo
  2. GERONIMO-4471

improve heuristic exception handling in rollback when txmanager.commit is called

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.4, 2.2
    • Fix Version/s: 2.1.4, 2.2
    • Component/s: transaction manager
    • Security Level: public (Regular issues)
    • Labels:
      None

      Description

      Improve heuristic exception handling during rollback, when txmanager.commit is called by providing a rollbackResourcesDuringCommit method to throw appropriate heuristic exceptions. The logic is:

      1. If XAException.XA_HEURRB arisen from XAResource rollback, this means transaction has been heuristically rolled back, thus we just throw normal RollbackException.
      2. If XAException.XA_HEURMIX arisen from XAResource rollback, this means transaction has been heuristically rolled back and committed, thus we just throw HeuristicMixedException.
      3. If XAException.XA_HEURCOM arisen from XAResource rollback, this means transaction has been heuristically committed. In this case, if transaction has ever been committed (via other XAResources enlisted), then we throw HeuristicMixedException.
      4. Other XAExceptions, throw SystemExceptions.
      5. If no specific XAException or only XAException.XA_HEURRB, throw RollbackException.

      The rollbackResourcesDuringCommit method will be used during the commit context instead of the current rollbackResources method.

        Activity

        Lin Sun made changes -
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Lin Sun made changes -
        Affects Version/s 2.1.4 [ 12313380 ]
        Fix Version/s 2.1.4 [ 12313380 ]
        Lin Sun made changes -
        Field Original Value New Value
        Description Improve heuristic exception handling during rollback, when txmanager.commit is called by providing a rollbackResourcesDuringCommit method to throw appropriate heuristic exceptions. The logic is:

        1. If XAException.XA_HEURRB arisen from XAResource rollback, this means transaction has been heuristically rolled back, thus we just throw normal RollbackException.
        2. If XAException.XA_HEURMIX arisen from XAResource rollback, this means transaction has been heuristically rolled back and committed, thus we just throw HeuristicMixedException.
        3. If XAException.XA_HEURCOM arisen from XAResource rollback, this means transaction has been heuristically committed. In this case, if transaction has ever been committed (via other XAResources enlisted), then we throw HeuristicMixedException.
        4. Other XAExceptions, throw SystemExceptions.
        5. If no specific XAException or only XAException.XA_HEURRB, throw RollbackException.

        The rollbackResourcesDuringCommit method will be used during the commit context instead of the current rollbackResources method.

        Also, during the internalPrepare method, it has:

                           //TODO document why this is true from the spec.
                           //XAException during prepare means we can assume resource is rolled back.
                           rms.remove();

        I don't think this is correct. Per jta spec page 50, If the resource manager wants to roll back the transaction,
        it should do so by throwing an appropriate XAException in the prepare method. With that, I think we cannot assume resource is already rolled back. It is just the resource manager wants to roll back the transaction. thus I propose us remove the "rms.remove()" here, so that this rm can be included in the rollback action.
        Improve heuristic exception handling during rollback, when txmanager.commit is called by providing a rollbackResourcesDuringCommit method to throw appropriate heuristic exceptions. The logic is:

        1. If XAException.XA_HEURRB arisen from XAResource rollback, this means transaction has been heuristically rolled back, thus we just throw normal RollbackException.
        2. If XAException.XA_HEURMIX arisen from XAResource rollback, this means transaction has been heuristically rolled back and committed, thus we just throw HeuristicMixedException.
        3. If XAException.XA_HEURCOM arisen from XAResource rollback, this means transaction has been heuristically committed. In this case, if transaction has ever been committed (via other XAResources enlisted), then we throw HeuristicMixedException.
        4. Other XAExceptions, throw SystemExceptions.
        5. If no specific XAException or only XAException.XA_HEURRB, throw RollbackException.

        The rollbackResourcesDuringCommit method will be used during the commit context instead of the current rollbackResources method.

        Lin Sun created issue -

          People

          • Assignee:
            Lin Sun
            Reporter:
            Lin Sun
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development