Ivan-gfan opened a new issue, #13421: URL: https://github.com/apache/seatunnel/issues/13421
### Search before asking - [x] I had searched in the [issues](https://github.com/apache/seatunnel/issues?q=is%3Aissue+label%3A%22bug%22) and found no similar issues. ### What happened A transform may set its own `parallelism` (the job parser reads it in `MultipleTableJobConfigParser`, and `docs/en/architecture/engine/dag-execution.md` shows a transform with its own parallelism). When that parallelism is **smaller than the source's**, the first checkpoint fails and the job fails with: ``` java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1 ``` With `job.retry.times` > 0 the pipeline is restarted instead, and a batch job writes its rows more than once (in our run, 6 source rows ended up as 24 sink rows). Root cause: the transform is chained into the source task, so it runs in **every** source subtask, and each of those subtasks acknowledges the checkpoint with its own index (0 .. source parallelism - 1). `CheckpointCoordinator#getActionStates` sizes each `ActionState` by the parallelism the action **declares** (`CheckpointPlan#getPipelineActions`, i.e. `Action#getParallelism`), so the state of a transform declaring parallelism 1 has a single slot, and `ActionState#reportState` fails for the acknowledgement of subtask 1. The coordinator already knows how many subtasks really run each action: `actionParallelism` (`CheckpointCoordinator#getActionParallelism`) is derived from the subtask-to-action mapping, but it is only used by the restore remap, not when the checkpoint states are created. ### SeaTunnel Version 3.1.0, and current `dev` (3.1.1-SNAPSHOT); `CheckpointCoordinator` is unchanged between them. ### SeaTunnel Config ```conf env { job.mode = "BATCH" job.retry.times = 0 checkpoint.interval = 1000 } source { FakeSource { plugin_output = "fake" row.num = 20 split.num = 5 split.read-interval = 1000 parallelism = 2 schema = { fields { c_string = string c_int = int } } } } transform { Copy { plugin_input = "fake" plugin_output = "copied" parallelism = 1 fields { c_string_copy = c_string } } } sink { Console { plugin_input = "copied" } } ``` ### Running Command ```shell ./bin/seatunnel.sh --config transform_parallelism.conf -m local ``` ### Error Exception ```log java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1 at java.util.Arrays$ArrayList.set(Arrays.java:4356) at org.apache.seatunnel.engine.server.checkpoint.ActionState.reportState(ActionState.java:69) at org.apache.seatunnel.engine.server.checkpoint.PendingCheckpoint.acknowledgeTask(PendingCheckpoint.java:140) at org.apache.seatunnel.engine.server.checkpoint.CheckpointCoordinator.acknowledgeTask(CheckpointCoordinator.java:1340) at org.apache.seatunnel.engine.server.checkpoint.CheckpointManager.acknowledgeTask(CheckpointManager.java:389) at org.apache.seatunnel.engine.server.checkpoint.operation.TaskAcknowledgeOperation.runInternal(TaskAcknowledgeOperation.java:84) ``` ### Zeta or Flink or Spark Version Zeta ### Java or Scala Version Java 11 / 17 ### Screenshots _No response_ ### Are you willing to submit PR? - [x] Yes I am willing to submit a PR! ### Code of Conduct - [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
