zhangshenghang opened a new pull request, #13446:
URL: https://github.com/apache/seatunnel/pull/13446
Yes, I am contributing to Apache SeaTunnel. This change only adds regression
coverage to the Zeta engine E2E suite; no production code is modified.
### What this PR does
Adds
`SplitClusterPendingJobLifecycleFailoverIT#testSavepointStopReleasesFixedSlotsSoQueuedJobRuns`,
an end-to-end test for a job that ends in `SAVEPOINT_DONE` while another job
is queued behind it on a fixed-slot worker.
The cluster is a real split master/worker pair, the worker has exactly two
fixed slots (`dynamic-slot=false`, `slot-num=2`), scheduling is `WAIT`, and
both jobs use the same minimal two-slot streaming job (one split enumerator
plus one fused reader/writer task, no committer, `checkpoint.interval=5000`).
Contract under test:
1. The holder owns both fixed slots and runs. The victim (same two-slot
shape) is queued as `PENDING`, is present in the master's pending queue, and
owns no slot in `engine_ownedSlotProfilesIMap`.
2. A real client stop-with-savepoint request completes, the holder reaches
`SAVEPOINT_DONE`, the coordinator releases its `JobMaster`, and its slot
ownership disappears.
3. Without any further trigger, the queued job is dispatched: it reaches
`RUNNING`, leaves the pending queue, and owns the two fixed slots.
4. Cancelling the dispatched job is still a normal terminal transition:
`CANCELED` and both slots are released again.
### Why this boundary has real regression risk
`SAVEPOINT_DONE` is the one terminal state that deliberately keeps its
checkpoint data: `CheckpointManager#clearCheckpointIfNeed` skips
`deleteCheckpoint` while `isSavePointEnd()` is true, and the pipelines end
through `stopPipelineWithCheckpointFallback` rather than the cancel/force-stop
paths. That makes the resource release of a savepoint-ended job a separate code
path from every other terminal transition, and the two concerns are easy to
entangle: a change that ties slot release to checkpoint cleanup (so that
retaining the savepoint also retains the slots), or that keeps the finished
`JobMaster` registered in `runningJobMasterMap` because the savepoint must stay
usable, silently strands every queued job. Fixed-slot capacity is inelastic, so
the leak is permanent until the worker restarts, and the victim does not fail —
it just sits `PENDING` forever while the coordinator keeps retrying it (the
class of problem tracked in #13344 for a different, pre-application path).
### Why existing coverage does not reach it
- `SavepointBusySourceBarrierIT` and `SavepointRestoreIT` exercise
stop-with-savepoint on dynamic slots with a single job, so a leaked slot is
invisible and there is never a waiter whose dispatch depends on the release.
-
`SplitClusterFaultToleranceIT#testFixedSlotStreamJobReusesSlotsAfterMasterDown`
uses fixed slots, but the terminal transition there is a master failover
restore, not `SAVEPOINT_DONE`.
- This class's own queue-dispatch tests
(`testPendingJobScheduledAfterRunningJobCanceled`,
`testSavepointOnPendingJobIsRejectedWithoutTouchingLifecycle`) free capacity by
cancelling the holder or never reach the savepoint terminal state, respectively.
- No test asserts that a savepoint-ended job is released by the coordinator
(`CoordinatorService#getJobMaster` no longer resolves it), which is the
precondition for the queue to make progress.
### Verification
```
mvn -pl seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base
verify \
-DskipUT=true -DskipIT=false \
-Dit.test='SplitClusterPendingJobLifecycleFailoverIT' \
-DfailIfNoTests=false
```
- New test alone on `dev` (85c150df16): passes, ~14s.
- Full `SplitClusterPendingJobLifecycleFailoverIT` class on this branch:
`Tests run: 7, Failures: 0, Errors: 0` (~273s), so the new scenario does not
interfere with the existing failover, churn, head-of-line and savepoint cases.
- `spotless:apply` produces no changes.
- Sensitivity is built into the test rather than simulated: the first phase
proves the victim is held back by the holder's slot ownership (it is `PENDING`
and owns nothing while the holder owns both slots), so the second phase can
only pass if the savepoint-ended job actually returned the fixed slots and was
released by the coordinator.
- Searched open and closed issues/PRs for an equivalent scenario ("savepoint
slots", "SAVEPOINT_DONE slot", "savepoint pending job scheduled", "stop with
savepoint release"); none found. Related but distinct work: #11458 (fixed-slot
reuse after master failover), #12134 (redriving a savepoint dropped by a master
failover), #13344 (pre-applied slot leak when a pending job is cancelled).
### Does this PR need Docs?
- [x] No. This PR only adds engine E2E coverage.
### Does this PR need any UT/E2E?
- [x] Yes. This PR is the E2E coverage.
--
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]