zhangshenghang opened a new pull request, #13581:
URL: https://github.com/apache/seatunnel/pull/13581
Yes. I am contributing to Apache SeaTunnel.
### Purpose of this change
Add an engine E2E regression guard for the cancellation boundary of an
unacknowledged checkpoint: cancelling a RUNNING job must abort the checkpoint
in flight, must never persist it when the sink finally acknowledges it, and
must still drive the job to CANCELED and return its capacity.
### Contract under test
A streaming job (one FakeSource reader -> a test sink without committer)
runs on an in-process Zeta node with `checkpoint.interval = 2000`,
`checkpoint.timeout = 100000` and `checkpoint.retain-after-job-cancelled =
true`. After a periodic checkpoint completed, the test arms a sink gate that
parks the writer inside `snapshotState(long)`: the barrier reached every task,
but the checkpoint is unacknowledged and nothing is durable. The client then
cancels the job while that writer is still held.
The test asserts:
1. The accepted cancel moves the job to `CANCELING` while the sink still
holds the barrier, and `cancelJob()` returns within a bounded window.
2. After the writer is released, the aborted checkpoint is never persisted:
the checkpoint data selectable for the job is still the last completed
checkpoint before the cancel. If the stale checkpoint were completed by the
late acknowledgement, a later restore would replay rows the cancelled run never
committed.
3. The job reaches `CANCELED` after the held task returns and stays
`CANCELED` for a 5 s window (no revival by the late acknowledgement).
4. The cancelled job's capacity is reusable: a replacement job with the same
footprint reaches `RUNNING`, completes a checkpoint, and cancels cleanly.
### Why existing coverage does not reach it
`CancelDuringMasterFailoverIT` crashes the master during an accepted cancel
but no checkpoint is in flight; `SavepointBusySourceBarrierIT` covers
stop-with-savepoint while the source is busy and lets the checkpoint complete;
`SplitClusterFaultToleranceIT#testStreamJobCancelResolvesWhenWorkerCrashesBeforeCancelAck`
kills a worker rather than a checkpoint; `CheckpointExpiryPipelineScopeIT`
expires checkpoints with the master alive. No existing engine E2E cancels a job
while a periodic checkpoint is provably unacknowledged at the sink and then
inspects storage and capacity.
### Test
```
./mvnw -pl seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base \
-DskipUT=true -DskipIT=false -Dit.test=CancelWhileCheckpointInFlightIT
verify
```
Result on dev `5cf050be3f`: three consecutive green runs, 14.4 s / 15.4 s /
15.5 s (the last runs include `spotless:check`).
### Negative control
Removing `cleanPendingCheckpoint(PIPELINE_END)` from
`CheckpointCoordinator#cancelCheckpoint` (so a late acknowledgement may
complete the checkpoint of a cancelled run) fails the test in 12.4 s with:
```
The aborted checkpoint must never be persisted, and the last completed
checkpoint must stay
the only stored one ==> expected: <[1]> but was: <[2]>
```
The mutation was reverted and the pristine `seatunnel-engine-server` jar
reinstalled (SHA-256
`97dd3e224d0e08a6317132c93e274fcbc61db56ea59c3fdb5ab150bec06dd312`) before the
green runs.
### Scope
Test-only: five new files under
`seatunnel-e2e/.../engine/e2e/cancelcheckpoint` and one job template. No engine
production code, configuration option, REST API or public signature changes.
--
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]