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

   Yes, I am glad to contribute this test-only guard to Apache SeaTunnel.
   
   ## What this PR adds
   
   A test-only Zeta E2E (`CheckpointTimeoutRecoveryIT`) that pins the 
`checkpoint.timeout` contract of the checkpoint coordinator: a periodic 
checkpoint whose barrier stays unacknowledged past `checkpoint.timeout` must be 
failed, must never be published, must cancel the pipeline, and the job must 
restore from the **last completed** checkpoint and keep checkpointing above the 
expired id.
   
   No production code is changed.
   
   ## Contract under test
   
   `CheckpointCoordinator#startTriggerPendingCheckpoint` arms a scheduler task 
after every triggered checkpoint. If the barrier is still unacknowledged when 
the timeout elapses, the coordinator fails with `CHECKPOINT_EXPIRED`, aborts 
the pending checkpoint, cancels the pipeline, and the job restores. The test 
asserts the whole path:
   
   1. **Pre-timeout window** - while the sink parks inside 
`SinkWriter#snapshotState`, the checkpoint is registered in progress, the job 
is `RUNNING`, no checkpoint has failed and no pipeline restore has happened yet.
   2. **Expiry** - the checkpoint is recorded as `FAILED` with the 
checkpoint-expired reason, while the barrier is still provably held; it is 
never recorded as completed.
   3. **Recovery point** - the restored writer receives exactly the writer 
state of the last completed checkpoint, so the expired checkpoint was not used 
as a recovery point.
   4. **Late acknowledgment** - releasing the parked barrier after the expiry 
does not publish the expired checkpoint, does not trigger a second restore and 
does not take the job out of `RUNNING`.
   5. **Continuity** - checkpointing resumes with an id above the expired one, 
the resumed state still contains the restored rows, and the job cancels to 
`CANCELED`.
   
   ## Why the existing coverage missed it
   
   The existing engine E2E tests assert checkpoint intervals, retention 
windows, single-flight, savepoint behavior and restore-from-stop. None of them 
makes a periodic checkpoint *expire*: `RestApiIT` only feeds 
`CHECKPOINT_EXPIRED` into the monitor service, and the batch timeout fixture 
only asserts that a batch job ignores the timeout. No test asserts which 
checkpoint a pipeline restores from after a timeout, and none asserts that a 
late acknowledgment of an expired barrier is ignored.
   
   The failure mode is silent: without (or with a broken) expiry, a streaming 
job keeps reporting `RUNNING` while no checkpoint can ever complete again, so 
the recovery point silently ages and every later barrier queues behind the 
stuck one.
   
   ## Fixtures
   
   - `FakeSource` (plain fixture) -> test-only stateful sink 
(`CheckpointTimeoutTest`) that counts rows and parks one `snapshotState` call 
until the test releases it.
   - One in-JVM Zeta hybrid node (fixed slots, `dynamic-slot=false`, 
`slot-num=4`), `checkpoint.interval=1000`, `checkpoint.timeout=3000`, 
`job.retry.times=3`.
   - No transform, SQL, connector or format semantics are exercised, and no 
business logic is modified.
   
   ## Verification
   
   Green on `origin/dev` `939a8f7f16` (4 runs; last three on the final fixture):
   
   ```
   JAVA_HOME=/Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home \
   ./mvnw -pl seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base \
     -DskipUT=true -DskipIT=false -Dit.test=CheckpointTimeoutRecoveryIT 
-DfailIfNoTests=false verify
   ```
   
   Observed contract line: held checkpoint `3`, last completed checkpoint `2` 
(rows `561152`), checkpoint `3` expired while its barrier was still 
unacknowledged, pipeline restored from checkpoint `2` with rows `561152`, then 
checkpointing resumed above `3`; total runtime ~13.9s per run.
   
   Negative control: forcing the timeout arming to a one-hour deadline in 
`CheckpointCoordinator` makes the test fail in 36s with `checkpoint 3 did not 
expire while its barrier stayed unacknowledged`; mutation reverted, pristine 
`seatunnel-engine-server` reinstalled (sha256 
`e3687ea6c3c4ebc9caffa94e8ad57c5d7dc5df90dcfa93ed219d91ce1339137a`) and the 
test green again.
   
   Also verified:
   
   ```
   ./mvnw -q -pl 
seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base spotless:check  
 # exit 0
   ./mvnw -q -pl seatunnel-ci-tools -Dtest=ImportClassCheckTest 
-DfailIfNoTests=false test      # exit 0
   ```
   
   No engine defect was found, so no issue is filed; this PR is a regression 
guard only.
   


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