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

Partitioned step is not re-executed when Exception was thrown in Partitioner

Open sbklahr opened this issue 11 months ago • 0 comments

Bug description

A partitioned Step fails if an Exception is thrown from Partitioner.partition(). On retry Partitioner.partition() does not throw an exception and returns a valid partition map, but the partitioned Step does not run.

Environment Spring Batch 5.1.2

Steps to reproduce

Define a partitioned step like this:

return new StepBuilder("partitionStep", jobRepository)
                .partitioner("myPartitioner", myPartitioner)
                .step(myStep)
                .gridSize(10)
                .build();

Implement a custom myPartitioner. It is possible that an Exception ist thrown from its partition() method.

After the retry the contents of BATCH_STEP_EXECUTION looks like this

  • STEP_NAME: partitionStep, JOB_EXECUTION_ID: 1, EXIT_CODE: FAILED
  • STEP_NAME: partitionStep, JOB_EXECUTION_ID: 2, EXIT_CODE: COMPLETED

Expected behavior myStep should be executed on retry. After the retry the contents of BATCH_STEP_EXECUTION should look like this

  • STEP_NAME: partitionStep, JOB_EXECUTION_ID: 1, EXIT_CODE: FAILED
  • STEP_NAME: partitionStep, JOB_EXECUTION_ID: 2, EXIT_CODE: COMPLETED
  • STEP_NAME: myStep:partition-0, JOB_EXECUTION_ID: 2, EXIT_CODE: COMPLETED
  • STEP_NAME: myStep:partition-1, JOB_EXECUTION_ID: 2, EXIT_CODE: COMPLETED
  • ...

sbklahr avatar Dec 20 '24 10:12 sbklahr