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

   ### 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 a regression E2E for the boundary between the **pending-job queue** and 
the **stop-with-savepoint** path in Zeta: a job that is still queued for fixed 
slots must be refused when it is asked for a savepoint, and that refusal must 
leave it untouched.
   
   `JobMaster#savePoint()` moves a job to `DOING_SAVEPOINT` before it asks 
every pipeline checkpoint coordinator for a final checkpoint. A queued job has 
no deployed task, so its coordinator can only answer 
`TASK_NOT_ALL_READY_WHEN_SAVEPOINT`. The only thing that decides whether such a 
job is rolled back to its previous state or left in a state nobody can leave is 
the start-precondition recovery in 
`JobMaster#restoreRunningAfterSavepointStartFailure()`, which writes `RUNNING` 
unconditionally. A queued job that is silently reported `RUNNING` owns no slot 
and runs no task: the operator's stop request does nothing, the CLI and REST 
views call the job healthy, and the pending scheduler no longer has the 
`PENDING` entry it was supposed to hand the released slots to. The same 
recovery also walks the coordinator out of its rejected savepoint, so a wrong 
verdict can additionally leave the job unable to take a savepoint once it does 
run.
   
   ### What the test pins
   
   
`SeaTunnelSlotIT#testStopWithSavepointOnQueuedJobKeepsItQueuedAndSchedulable` 
builds a fixed three-slot in-JVM cluster. A streaming holder fills the pool, so 
a second identical job is queued as `PENDING`. The test then sends a real 
client `savePointJob` request for the **queued** job and requires that:
   
   - the request fails with the dedicated `SavePointFailedException` naming 
that job, instead of being reported as a completed savepoint;
   - the job stays `PENDING` (not `DOING_SAVEPOINT`, not `RUNNING`, not 
terminal) and keeps reading zero rows for longer than a full scheduler retry 
cycle;
   - after the holder is cancelled the untouched job is dispatched by the 
normal scheduler and really reads rows;
   - a real stop-with-savepoint for the now running job still completes and 
ends it in `SAVEPOINT_DONE`, which is what proves the refused request did not 
poison the checkpoint machinery it walked through.
   
   I verified the guard is not vacuous: with the queued-job check in 
`CoordinatorService#savePoint` temporarily bypassed (`getJobMaster(jobId)` 
instead of `runningJobMasterMap.containsKey(jobId)`), the test fails — the 
request then reaches the coordinator and surfaces `Task not all ready, 
savepoint error` instead of the dedicated refusal. With the check in place the 
test passes.
   
   ### Existing coverage
   
   
`SeaTunnelSlotIT#testCanceledQueuedJobIsNeverDispatchedAfterCapacityIsReleased` 
covers the cancel side of a queued job and never sends a savepoint. 
`SplitClusterPendingJobLifecycleFailoverIT#testSavepointStopReleasesFixedSlotsSoQueuedJobRuns`
 takes the savepoint for the **running** holder and only observes that the 
queued job is dispatched afterwards. `SavepointPreconditionRecoveryIT` races a 
savepoint against the deployment of a job that was already dispatched. No 
existing E2E sends a stop-with-savepoint request for a job that is still 
waiting for slots.
   
   ### Scope
   
   - Test-only change, no production code modified.
   - Extends the existing `SeaTunnelSlotIT` instead of adding a new class, and 
reuses the existing `cancel_queued_job_stream.conf` fixture (unbounded 
FakeSource → Console is just a simple fixture; the scenario is engine 
pending-queue and savepoint lifecycle, not connector semantics).
   - `./mvnw spotless:check` passes.
   
   ### How validated
   
   ```bash
   ./mvnw -o -pl 
seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base verify \
     -DskipUT=true -DskipIT=false -Dit.test=SeaTunnelSlotIT 
-DfailIfNoTests=false
   ```
   
   Result: `Tests run: 5, Failures: 0, Errors: 0` (about 40 s on JDK 17); the 
new test alone passes in about 11 s and was repeated three times.
   


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