Announcement Announcement Module
Collapse
No announcement yet.
Deadlocked Participatin Transaction causes partial commit Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Deadlocked Participatin Transaction causes partial commit

    Hi all,

    I'm came across a very strange behaviour using spring 3.2.4, iBatis and MySql.
    I use DataSourceTransactionManager with globalRollbackOnParticipationFailure attribute set to false.
    My workflow involves doing a somewhat complex chain of actions on an external trigger. Some of the actions are mandatory, some are optional. Optional in this case means if it fails, it is not a reason for rolling back the entire chain, nevertheless the try should be done in the same transaction.

    What I experienced is:
    - the chain executes normally
    - during an "optional" step, the transaction deadlocks
    - as the step is optional, we wrap the entire logic in a try-catch to avoid rolling back the entire stacktrace
    - the chain goes on normally and commits at the end

    As deadlocks are handled by MySql by rolling back one of the transactions, the above means that the transaction is rolled back up until the deadlock occurs, but the remaining logic is executed and committed. So it is basically a partial commit.

    Of course, I need to solve the deadlock situation and I think I can do a refactoring so that this doesn't happen, still we rely heavily on this construct in our application, so I would like to hear if Spring tx has a solution for this.

    In my view, in this case the Spring Transaction Manager is not really in charge of taking the decision to commit the transaction, as the DB already took the decision. So in this case, it should set the globalRollbackOnly flag regardless of the globalRollbackOnParticipationFailure flag. Wouldn't you agree?

Working...
X