Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Best to distinguish CreateTime and StartTime in StepExecution #4049

Closed
lcmarvin opened this issue Jan 24, 2022 · 3 comments
Closed

Best to distinguish CreateTime and StartTime in StepExecution #4049

lcmarvin opened this issue Jan 24, 2022 · 3 comments
Assignees
Milestone

Comments

@lcmarvin
Copy link
Contributor

I need to record create time of StepExecution, but I found it only has a filed startTime, though this field has been assigned value when StepExecution is created.

private volatile Date startTime = new Date(System.currentTimeMillis());

But its value will be updated when StepExecution gets started in AbstractStep.

stepExecution.setStartTime(new Date());
stepExecution.setStatus(BatchStatus.STARTED);

So, maybe an individual createTime field is more suitable, just like what it is in JobExecution.

private volatile Date startTime = null;
private volatile Date createTime = new Date(System.currentTimeMillis());
@lcmarvin lcmarvin added the status: waiting-for-triage Issues that we did not analyse yet label Jan 24, 2022
@lcmarvin
Copy link
Contributor Author

lcmarvin commented Jan 26, 2022

This requires following changes at least:

  1. Schema updates, table bath_step_execution needs a new column create_time.
  2. Class StepExecution needs a new filed createTime.
  3. SQL in org.springframework.batch.core.repository.dao.JdbcStepExecutionDao#SAVE_STEP_EXECUTION, org.springframework.batch.core.repository.dao.JdbcStepExecutionDao#GET_RAW_STEP_EXECUTIONS, and org.springframework.batch.core.repository.dao.JdbcStepExecutionDao#GET_LAST_STEP_EXECUTION need to be updated to include create_time.

@cppwfs cppwfs removed the status: waiting-for-triage Issues that we did not analyse yet label Feb 2, 2022
@cppwfs cppwfs assigned cppwfs and unassigned cppwfs Feb 2, 2022
@lcmarvin
Copy link
Contributor Author

lcmarvin commented Feb 8, 2022

Please refer to PR #4057

@lcmarvin
Copy link
Contributor Author

Could you please link another pull request #4099 to this issue? Since a wrong rebase was done by mistake in #4057, so I close it.

Sorry for that, Thanks!

@fmbenhassine fmbenhassine linked a pull request Apr 25, 2022 that will close this issue
@fmbenhassine fmbenhassine modified the milestones: 5.0.0, 5.0.0-M3 Apr 27, 2022
fmbenhassine pushed a commit to fmbenhassine/spring-batch that referenced this issue May 9, 2022
- Add field createTime for StepExecution.
- Add column create_time for batch_step_execution and make start_time default null.
- Make getLastStepExecution order by createTime instead of startTime.
- Add migration scripts for 5.0

Resolves spring-projects#4049
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment