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

   ### Contribution acknowledgement
   
   Yes — I am contributing this change to **Apache SeaTunnel**, and I confirm 
it follows the project's contribution conventions (English PR 
title/description, one focused change, formatting and E2E validated locally).
   
   ### What this PR does
   
   Adds `SavepointRestoreRetryIT`, an E2E regression guard for a **retried 
savepoint restore submission** while the first restore is already running.
   
   `--restore` resolves the job id from the savepoint, so a client that retries 
a restore after a timeout sends a second submission with the **same job id**. 
The engine's documented answer to that is "the job is already running": 
`CoordinatorService#submitJob` returns early when `getJobMaster(jobId) != null` 
specifically to avoid redundant restores. If that early return is ever lost or 
bypassed, the second submission builds a second `JobMaster`, re-runs 
`CheckpointManager`'s savepoint restore path (resetting the per-pipeline 
checkpoint counter to `savepointId + 1`), and redeploys task groups on top of 
tasks that are already committing output. Exactly-once output is then broken 
while the job still reports `RUNNING`, and the client cannot tell the 
difference — both submissions return a proxy for the same job id.
   
   ### What the test pins
   
   The test runs one long streaming job on an in-JVM master + worker cluster, 
stops it with a real savepoint, restores it through the normal 
`RestoreMode.SAVEPOINT` flow, lets periodic checkpoints resume above the 
savepoint id, and then submits the **identical restore again**. It requires 
that:
   
   - the retried submission returns a proxy for the same job id and observes 
`RUNNING` instead of failing;
   - the engine's `JobMaster` instance for that job id is the **same object** 
before and after the retry (a second instance would replace it);
   - completed checkpoint ids keep increasing from the restored instance 
instead of falling back into the savepoint range;
   - the job is still fully operable afterwards: stopping it with another 
savepoint through the retried proxy produces a savepoint id newer than every 
checkpoint seen before the retry.
   
   I verified the guard is not vacuous: with the `getJobMaster(jobId) != null` 
early return temporarily disabled, the test fails (`expected: <RUNNING> but 
was: <PENDING>` — a second job master was created); with the guard in place it 
passes.
   
   ### Existing coverage
   
   `SavepointRestoreIT` and `SavepointClusterRestartRestoreIT` restore once and 
then inspect the job. `CheckpointCoordinatorFailoverIT` / 
`SplitClusterFaultToleranceIT` exercise recovery through a master or worker 
loss, not a repeated client submission. No existing E2E submits the same 
restore twice, so this branch was only covered by unit tests that fabricate the 
job-master map.
   
   ### Scope
   
   - Test-only change, no production code modified.
   - Reuses the existing 
`stream_fake_to_console_savepoint_cluster_restart.conf` fixture (FakeSource → 
Console is just a simple fixture; the scenario is engine restore/lifecycle, not 
connector semantics).
   - `./mvnw spotless:apply` and `spotless:check` pass.
   
   ### How validated
   
   ```bash
   ./mvnw -o -pl 
seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base verify \
     -DskipUT=true -DskipIT=false -Dit.test=SavepointRestoreRetryIT 
-DfailIfNoTests=false
   ```
   
   Result: `Tests run: 1, Failures: 0, Errors: 0` (about 17 s on JDK 17).
   


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