Skip to content

Spring Batch Partitioned Approach: Multiple batches if triggered together-serialize access due to read/write dependencies among transactions error #4693

Closed Answered by fmbenhassine
PSHREYASHOLLA asked this question in Q&A
Discussion options

You must be logged in to vote

This is similar to Spring Batch - could not serialize access due to read/write dependencies among transactions.

You need to lower the isolation level of the transaction at the job repository to ISOLATION_READ_COMMITTED (or lower if needed). The reason is that the default value of ISOLATION_SERIALIZABLE is aggressive for setups where multiple jobs are launched simultaneously (or at a very high frequency).

Edit: based on previous comments

So shall I add hikariDatsource.setTransactionIsolation("ISOLATION_READ_COMMITTED"); inside batchDataSource method. Because this is where I am creating datasource for batch

no, you set it on the job repository factory bean: see setIsolationLevelForCreate

H…

Replies: 3 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
5 replies
@PSHREYASHOLLA
Comment options

@fmbenhassine
Comment options

@PSHREYASHOLLA
Comment options

@fmbenhassine
Comment options

@fmbenhassine
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by fmbenhassine
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
status: waiting-for-reporter Issues for which we are waiting for feedback from the reporter
2 participants