spring-batch icon indicating copy to clipboard operation
spring-batch copied to clipboard

Step never launched when restarting a failed loop flow job [BATCH-2703]

Open spring-projects-issues opened this issue 7 years ago • 0 comments
trafficstars

Damien Lenci opened BATCH-2703 and commented

My job is using a flow of 3 steps (A, B, C) in a loop. When no error occurs, the job executes fine : A -> B -> C -> A -> B -> C ->... If an error occurs on step B and I try to restart the job, I would expect the following execution : B -> C -> A -> B -> C ->... Instead, step A is never executed again, resulting in the execution B -> C -> B -> C -> ...

Looking at SimpleStepHandler, maybe the following behaviour shoud be extended to remove the last execution of an already skipped step :

if (stepExecutionPartOfExistingJobExecution(execution, lastStepExecution)) {
	// If the last execution of this step was in the same job, it's
	// probably intentional so we want to run it again...
	logger.info(String.format("Duplicate step [%s] detected in execution of job=[%s]. "
					+ "If either step fails, both will be executed again on restart.", step.getName(), jobInstance
					.getJobName()));
	lastStepExecution = null;
}

Affects: 3.0.7

Issue Links:

  • BATCH-2533 Restarting a job that failed before going back to a previous step is not working well

spring-projects-issues avatar Mar 13 '18 11:03 spring-projects-issues