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

   Yes, I am contributing to Apache SeaTunnel. This change only adds regression 
coverage to the Zeta engine E2E suite; no production code is modified.
   
   ### Purpose of this pull request
   
   Adds 
`SavepointSnapshotFailureIT#testSavepointFailureIsNotPublishedAndReleasesSlots`,
 an end-to-end test for what a `STREAMING` Zeta job does when the **sink itself 
cannot snapshot** while a stop-with-savepoint request is in flight.
   
   Contract under test:
   
   1. A single-pipeline job runs on a two-slot worker; the only barrier that 
ever reaches the sink writer is the final one of a real client 
`savePointJob(jobId)` request (`checkpoint.interval` is far longer than the 
test budget).
   2. The sink writer rejects that snapshot. The client request must settle 
with a failure instead of hanging in `DOING_SAVEPOINT`.
   3. The job must reach a terminal state (`FAILED` with `job.retry.times = 0`) 
and must never be reported as `SAVEPOINT_DONE`.
   4. The failed savepoint must not be published: the checkpoint storage must 
hold no checkpoint for the job, so a later restore cannot pick up a half-built 
savepoint.
   5. Both fixed slots of the worker must be released: a replacement batch job 
can only start and finish if the failed job no longer owns them.
   6. The sink writer's snapshot counter proves the barrier really reached the 
sink, so the request did not fail on an unrelated precondition.
   
   ### Why this boundary has real regression risk
   
   Stop-with-savepoint is the only way to stop a Zeta job while keeping a 
restore point. When a sink cannot produce writer state (object-store upload 
failure, a commit token that cannot be obtained, a rejected snapshot query), 
the engine owns invariants no connector test can check: the request must 
settle, the engine must not publish a savepoint it never completed, and the 
slots of the failed job must come back so the cluster keeps scheduling.
   
   Each hop of that chain fails silently when it regresses:
   
   - a failed snapshot treated as valid state completes the barrier and reports 
`SAVEPOINT_DONE` for a savepoint that cannot restore the sink;
   - a request that never leaves `DOING_SAVEPOINT` occupies the job's slots 
forever with no error visible to the user;
   - a published but partial checkpoint poisons the next restore with state the 
failed run never committed;
   - slots not released after the terminal state strand the fixed-slot capacity 
of the worker.
   
   The negative control below shows the first failure mode is reachable with a 
one-line regression: swallowing the writer snapshot exception in 
`SinkFlowLifeCycle#processCheckpointBarrier` makes the request succeed with 
`SAVEPOINT_DONE` and this test fails at the "reported success" assertion.
   
   ### Why existing coverage does not reach it
   
   - `SavepointBusySourceBarrierIT` starves the savepoint barrier on the 
**source** side (#11473) and asserts the request does not hang; the sink 
snapshot succeeds there.
   - `SavepointPreconditionRecoveryIT` rejects the request **before** it starts 
(`TASK_NOT_ALL_READY_WHEN_SAVEPOINT`).
   - `SavepointSnapshotFailureIT`'s sibling open PR `CancelDuringSavepointIT` 
injects a **cancellation** during the savepoint; here the savepoint itself 
fails inside the sink while the job keeps running.
   - `CheckpointTimeoutPipelineRestoreIT` expires a **periodic** checkpoint and 
asserts the pipeline restores; this test covers the final savepoint barrier and 
checkpoint publication.
   - No existing engine E2E makes the sink writer reject the savepoint barrier 
and then inspects checkpoint storage, terminal status, and fixed-slot reuse 
together.
   
   ### Validation
   
   - `./mvnw -o -q -pl 
seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base spotless:check` 
→ exit 0.
   - `./mvnw -o -pl 
seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base -DskipUT=true 
-DskipIT=false -Dit.test=SavepointSnapshotFailureIT -DfailIfNoTests=false 
verify` → 5 consecutive green runs with the final assertions (13.6s, 13.8s, 
13.9s, 13.9s, 14.3s), engine-server built from `origin/dev` `5cf050be3f`.
   - Negative control: in `SinkFlowLifeCycle#processCheckpointBarrier`, the 
writer snapshot exception was replaced with `Collections.emptyList()`. The test 
fails in 12.2s at `The stop-with-savepoint request reported success ... job 
status is SAVEPOINT_DONE`. The mutation was reverted, the pristine 
`seatunnel-engine-server` jar was reinstalled with SHA-256 
`97dd3e224d0e08a6317132c93e274fcbc61db56ea59c3fdb5ab150bec06dd312`, and the 
test was green again.
   
   ### Scope
   
   Test-only: `SavepointSnapshotFailureIT`, the `savepointfail` sink fixture 
(factory/sink/writer), and one job conf under `savepoint-snapshot-failure/`. 
`FakeSource` is only the fixture; all assertions are about Zeta savepoint 
publication, job status, checkpoint storage and slot reuse. No engine code 
changed, no issue filed.
   


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