zhangshenghang opened a new pull request, #13456:
URL: https://github.com/apache/seatunnel/pull/13456
### Purpose of this pull request
Yes, I am contributing to Apache SeaTunnel.
Adds a Zeta engine E2E regression test for **cancelling a job while a
savepoint checkpoint is still being snapshotted**.
The test pins down one engine contract with real regression risk:
* a cancel that arrives while the job is `DOING_SAVEPOINT` must win: the job
leaves `DOING_SAVEPOINT` immediately and ends `CANCELED`, never
`SAVEPOINT_DONE` or `FINISHED`;
* the in-flight savepoint request must resolve as a failure, not report
success for a checkpoint that was aborted;
* the aborted savepoint must not be recorded as a completed checkpoint and
must not consume a `job.retry.times` restore attempt;
* a late savepoint request against the resulting terminal job must be
rejected within a bounded time without reopening/altering the job;
* the cancelled job must release its slots and coordinator so a follow-up
job on the same cluster still schedules and cancels normally.
Why this is a real boundary: `JobMaster#savePoint()` first moves the plan to
`DOING_SAVEPOINT` and then blocks on every pipeline's checkpoint coordinator,
while `PhysicalPlan#cancelJob()` moves the same plan to `CANCELING` and cancels
the very coordinator the savepoint thread is waiting on. The savepoint failure
path is also allowed to restore the job to `RUNNING` or force a
savepoint-failure stop. Each of those hops is silent when it regresses: a
cancel can lose the race, an aborted savepoint can be recorded as a recovery
point, or the cancel can block on the unacknowledged barrier.
Existing coverage does not reach it:
* `SavepointPreconditionRecoveryIT` covers a savepoint whose start
preconditions are rejected and the job stays `RUNNING` (no cancel);
* `SavepointBusySourceBarrierIT` covers a busy source delaying the barrier,
but never cancels the job;
* `SavepointRestoreIT` / `CheckpointRestoreWithStopIT` only exercise the
happy path (savepoint completes, then restore);
* `PendingJobsRestIT` / `SplitClusterPendingJobLifecycleFailoverIT` cover
cancelling a pending job before any task runs;
* the stop-with-savepoint hang fixed in #11489 covers leaving
`DOING_SAVEPOINT` on savepoint failure, but not a concurrent client cancel.
How the window is pinned: the test-only `SavepointCancelHoldSink` consumes
every row but parks the acknowledgement of its first checkpoint snapshot in
`SavepointCancelGate`. The job uses `checkpoint.interval = 600000` (so the
first snapshot is exactly the requested savepoint) and `checkpoint.timeout =
120000` (so the parked savepoint cannot expire while the cancel is driven). The
test cancels only after the master's checkpoint overview reports that
checkpoint id as an in-progress `SAVEPOINT_TYPE` checkpoint and the job is
`DOING_SAVEPOINT`, then releases the gate only after the job has left
`DOING_SAVEPOINT`.
No production code is changed. `FakeSource` and the test-only sink are
simple fixtures; the assertions are all about engine job lifecycle, savepoint
scheduling and checkpoint history.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
```bash
./mvnw -pl seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base
verify \
-DskipUT=true -DskipIT=false \
-Dit.test=CancelDuringSavepointIT \
-DfailIfNoTests=false -Dskip.spotless=true
```
Result: `Tests run: 1, Failures: 0, Errors: 0, Skipped: 0` (~14s). Executed
five consecutive times locally with the same result.
`./mvnw -pl seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base
spotless:check` passes.
--
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]