Skip to content

Commit

Permalink
JBERET-597 skippable exception thrown in ItemWriter triggers new chun…
Browse files Browse the repository at this point in the history
…k within the old transaction
  • Loading branch information
chengfang committed Oct 10, 2023
1 parent 4eb3578 commit a3cbe8e
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -642,7 +642,12 @@ private void doCheckpoint(final ProcessingInfo processingInfo) throws Exception

//usually the transaction should not be rolled back upon skippable exception, but if the transaction
//is marked rollback only by other parties, it's no longer usable and so roll it back.
if (tm.getStatus() == Status.STATUS_MARKED_ROLLBACK || tm.getStatus() == Status.STATUS_ROLLEDBACK) {
//
//JBERET-597 (skippable exception thrown in ItemWriter triggers new chunk within the old transaction)
//The skippable exception is from ItemWriter so the current chunk will be skipped.
//There is no reason to keep active transactions as they may linger around after this skipped chunk.
if (tm.getStatus() == Status.STATUS_ACTIVE ||
tm.getStatus() == Status.STATUS_MARKED_ROLLBACK || tm.getStatus() == Status.STATUS_ROLLEDBACK) {
tm.rollback();
}

Expand Down

0 comments on commit a3cbe8e

Please sign in to comment.