Skip to content

Supports to create step execution with context - #5184

Closed
quaff wants to merge 1 commit into
spring-projects:mainfrom
quaff:patch-43
Closed

quaff wants to merge 1 commit into
spring-projects:mainfrom
quaff:patch-43

Conversation

@quaff

@quaff quaff commented Dec 24, 2025

Copy link
Copy Markdown
Contributor

After this commit, step execution context can be created with actual context instead of creating empty one then updating it.

@fmbenhassine

Copy link
Copy Markdown
Contributor

Thank you for the PR, @quaff! Creating the step execution with its actual context in a single write makes sense: it saves a DB write per partition and avoids persisting an empty context first. I added a couple of inline comments for you to review.

Moreover, SimpleStepHandler and SimpleStepExecutionSplitter now copy the context (new ExecutionContext(...)). Previously they shared the instance, and on restart BATCH_EXECUTED was removed from the previous execution's context. That seems like a good change, but it is a behavior change and we need a test for it.

Could you rework the PR along these lines? Happy to discuss if you see it differently.

@fmbenhassine fmbenhassine added the status: waiting-for-reporter Issues for which we are waiting for feedback from the reporter label Oct 12, 2026
@quaff

quaff commented Oct 13, 2026

Copy link
Copy Markdown
Contributor Author

Updated, please review.

@quaff
quaff force-pushed the patch-43 branch 2 times, most recently from 58fcda8 to 674dd24 Compare October 13, 2026 06:30
After this commit, step execution context can be created with actual context instead of creating empty one then updating it.

Signed-off-by: Yanming Zhou <zhouyanming@gmail.com>
@fmbenhassine fmbenhassine removed the status: waiting-for-reporter Issues for which we are waiting for feedback from the reporter label Oct 13, 2026
fmbenhassine added a commit that referenced this pull request Oct 13, 2026
- Add the missing `@since 6.1` tag to the new `createStepExecution`
  method of `JobRepository` and document the default behavior and the
  non-null context. Add javadoc and `@Override` to the implementation in
  `SimpleJobRepository`.
- Add a test for the default fallback of the new method, for repositories
  that only implement `createStepExecution(String, JobExecution)`.
- Add a test to `SimpleStepHandlerTests` that checks that on restart the
  new step execution gets a copy of the previous context without
  `BATCH_EXECUTED`, and that the previous context is left untouched.
- Add a test to `SimpleStepExecutionSplitterTests` for the restart of a
  partition.
- Revert the unrelated import changes in the tests.
@fmbenhassine

Copy link
Copy Markdown
Contributor

LGTM now 👍 Thank you for the updates!

Rebased and merged as 3b963a0. Refined in de91ffc (minor changes: Javadoc updates + additional tests).

Thank you for all your contributions! Really appreciated 🙏

@fmbenhassine fmbenhassine modified the milestones: 6.1.0, 6.1.0-RC1 Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants