zhangshenghang opened a new pull request, #13509:
URL: https://github.com/apache/seatunnel/pull/13509

   Yes, I am contributing to Apache SeaTunnel. This change fixes #13481.
   
   ### What this PR does
   
   `CheckpointManager#triggerSavePointsAndWaitComplete()` fanned a 
stop-with-savepoint request out to **every** pipeline coordinator of a job, 
including pipelines that had already completed cleanly. A multi-pipeline job 
stays `RUNNING` while one pipeline is `FINISHED`, so this is a normal state, 
not an error state. A completed coordinator rejects `startSavepoint()` with 
`CHECKPOINT_COORDINATOR_SHUTDOWN` by contract:
   
   - the still-running pipeline took its savepoint and suspended;
   - the finished pipeline's rejection made `JobMaster` treat the whole 
savepoint as failed (`isSavepointStartPreconditionFailure` is false once any 
pipeline suspended);
   - `PhysicalPlan#savepointFailed()` then force-stopped the healthy pipeline 
and `SeaTunnelEngineException(CheckpointException: CheckpointCoordinator 
shutdown.)` was thrown to the client;
   - `isSavePointEnd()` also stayed false, because it required *every* 
coordinator's latest checkpoint to be a savepoint.
   
   The fix:
   
   1. `triggerSavePointsAndWaitComplete()` snapshots which coordinators are 
already completed, skips them in the fan-out, and records their pipeline ids.
   2. `triggerSavePoints()` applies the same skip (it has no job-level state to 
record).
   3. `isSavePointEnd()` accepts a pipeline that was already complete when the 
savepoint was triggered, while still requiring savepoint-ended state from every 
pipeline that took part. This keeps an ordinary `FINISHED` job (no savepoint 
ever requested) on the existing cleanup path, which the existing 
`CheckpointManagerTest` cases already pin.
   4. `isPipelineSavePointEnd()` is unchanged: a finished pipeline still needs 
its normal terminal cleanup, only the job-level check treats it as satisfied.
   
   No public API, configuration, checkpoint format or job semantics are 
changed; this only makes an already-documented recovery operation work for a 
multi-pipeline job whose sibling pipeline has ended.
   
   ### The E2E test
   
   `MultiPipelineSavepointFinishedPipelineIT` runs a real in-JVM master/worker 
Zeta cluster and a two-pipeline batch job (`FakeSource`/`Console` fixtures 
only):
   
   - the fast pipeline reads one split and `FINISHED`; the slow pipeline reads 
one split every two seconds, so it is still `RUNNING` for roughly 40 seconds — 
a deterministic window instead of a sleep race;
   - the test asserts the exact asymmetric state (`FINISHED` + `RUNNING`), that 
the finished pipeline's coordinator is completed and the sibling's is not, and 
that `isSavePointEnd()` is false before the request;
   - it then triggers a real client stop-with-savepoint and requires: the call 
succeeds, the job ends `SAVEPOINT_DONE`, the running pipeline's coordinator 
ends in savepoint, the finished pipeline has no savepoint checkpoint, 
`isSavePointEnd()` becomes true, the savepoint is persisted in checkpoint 
storage, the finished pipeline's final checkpoint is not deleted, and the job 
master is released.
   
   ### Verification
   
   - New E2E on unpatched `dev` (`ee0fb0d72f`): **fails** in 7.6 s with 
`SeaTunnelEngineException: ... CheckpointException: CheckpointCoordinator 
shutdown.` — the exact reported failure.
   - New E2E with the fix: **passes twice back to back**, 8.7 s and 8.6 s.
   - `CheckpointManagerTest`, `CheckpointCoordinatorTest`, 
`StateStoreCheckpointIDCounterTest`: 31 tests pass.
   - `SavepointPreconditionRecoveryIT`: passes (13.2 s), so the 
not-all-tasks-ready recovery path is unaffected.
   - `spotless:check` passes for both touched modules.
   
   ### Why existing coverage did not catch it
   
   `MultiPipelineSavepointRestoreIT` and `SavepointRestoreIT` take savepoints 
only while every pipeline is still running; `SavepointBusySourceBarrierIT` and 
`SavepointPreconditionRecoveryIT` use a single pipeline. No E2E triggered a 
savepoint on a multi-pipeline job with a cleanly finished sibling pipeline.
   


-- 
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]

Reply via email to