spring-projects / spring-projects/spring-batch
StepExecutionContext gets updated on transaction rollback
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 3k
- Forks
- 2.5k
- Avg merge
- 6d 53m
- Merged PRs (30d)
- 3
Description
Daniel Stuckert opened BATCH-2457 and commented
When an exception is thrown in a chunked step and the execution context has been updated while processing items the execution context gets updated. This causes a problem when information about the processed items has been stored in the context. The business transaction has been rolled back and the items have not been committed to the database, but the execution context does not reflect the rollback.
The expectation is that the execution context gets rolled back.
To reproduce the problem run the attached test
The read and write-count have a similar problem. They get updated as well when the transaction is rolled back.
Affects: 3.0.5
Attachments:
- batch-execution-context-test.zip (14.13 kB)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the attached batch-execution-context-test.zip test to reproduce the rollback behavior. Check how the execution context, read-count, and write-count change when a chunk transaction fails; done means they reflect the rollback and no longer retain updates for uncommitted items.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100