zhangshenghang opened a new pull request, #13460: URL: https://github.com/apache/seatunnel/pull/13460
Yes, I am contributing to Apache SeaTunnel. ### Purpose of this pull request Adds an E2E regression guard for the second branch fixed by #12387: a job that was **started from a savepoint** and later loses its master must re-initialize its checkpoint coordinator from its **own latest periodic checkpoint**, not from the savepoint it was originally restored from. `JobImmutableInformation` keeps `restoreSourceJobId` / `restoreMode=SAVEPOINT` for a savepoint-restored job, and a master switch re-initializes the same job with `restart = true`. For a same-id `--restore`, the source job id is the job id itself, so a fallback to the old lookup silently *succeeds*: the new coordinator loads the older savepoint and restarts the checkpoint id counter there. The job keeps reporting RUNNING and checkpoints keep completing, but every record consumed since the savepoint is replayed, breaking exactly-once output. Only the checkpoint id sequence exposes it. #12387 fixed this with mocked unit tests in `CheckpointManagerTest`; there is still no end-to-end coverage. ### Why existing E2E coverage does not reach it - `CheckpointCoordinatorFailoverIT` covers a normally submitted job (`restoreSourceJobId == null`) and only asserts that the checkpoint id keeps growing, which the buggy path also does. - `ClusterFaultToleranceIT` covers automatic restore of an interrupted job, and PR #13102 adds a row-count guard for the `restoreSourceJobId == null` branch. Neither exercises a job whose immutable information still points at a savepoint. - `SavepointRestoreIT` / `SavepointClusterRestartRestoreIT` cover restore, but never a master failover after the restore. ### What the test does New `SavepointRestoreMasterFailoverIT` (in-JVM two-node cluster, single streaming FakeSource -> Console pipeline, checkpoint interval 2 s): 1. Run the job, wait for a periodic checkpoint, stop it with a savepoint, assert `SAVEPOINT_DONE`. 2. Restore with the same job id (the normal `seatunnel.sh --restore <jobId>` flow) and wait for six new periodic checkpoints. The last one is the recovery point a correct failover must use. 3. Shut down the master member (not a random node) and wait for the surviving member to take over. 4. Immediately request another savepoint. Its id is allocated from the re-initialized coordinator's checkpoint id counter, so it must be greater than the last pre-failover periodic checkpoint. An id inside the pre-failover range proves the coordinator fell back to the original savepoint. 5. Assert the job ends `SAVEPOINT_DONE` with the expected savepoint record. The six-checkpoint gap is deliberately wider than one interval so a fallback cannot hide behind checkpoints that complete while the test waits for the failover to settle. ### Verification - Current `dev`: passes (`Tests run: 1, Failures: 0`). - With the `masterFailoverRestore` own-checkpoint preference disabled locally (simulating the pre-#12387 behavior): fails as intended with `resume from periodic checkpoint 8`, `savepoint=2`, `observed post-failover savepoint id 3`. - `./mvnw -pl seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base spotless:check` passes. Test-only change; no engine behavior is modified. No new issue is needed because this guards already-merged behavior from #12387. -- 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]
