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

   ### Contribution acknowledgement
   
   Yes — I am contributing this change to **Apache SeaTunnel**, and I confirm 
it follows the project's contribution conventions (English PR 
title/description, one focused change, formatting and E2E validated locally). 
This is a test-only change: no production code, configuration default, REST/API 
or data format is modified.
   
   ### What this PR does
   
   Adds `SavepointCheckpointPacingIT`, an E2E regression guard for the 
**interaction between an explicit stop-with-savepoint and the job-level 
checkpoint pacing** in the Zeta engine.
   
   `CheckpointCoordinator#tryTriggerPendingCheckpoint` applies the 
`checkpoint.interval` and `min-pause` gates only to periodic checkpoints 
(`CheckpointType#notFinalCheckpoint()`). An explicit savepoint is created by 
`CheckpointCoordinator#startSavepoint` and dispatched directly, so it must 
**not** inherit the pacing window. The test runs a real streaming job on an 
in-JVM Zeta node with `checkpoint.interval = 1000` and the job-level `min-pause 
= 120000`, lets one periodic checkpoint complete, then requests a savepoint 
inside that 120 s window and requires that:
   
   - the fixture is still inside the enforced min-pause window when the 
savepoint is requested (no second periodic checkpoint appears after more than 
two interval periods), so the following assertions are not vacuous;
   - the client-triggered savepoint completes within its own bounded wait, the 
job reaches `SAVEPOINT_DONE`, and the savepoint is persisted as a 
`SAVEPOINT_TYPE` record of the pipeline with an id newer than the periodic 
checkpoint;
   - both the client-observed completion time and the monitor's 
`completedTimestamp` stay far inside the min-pause window, i.e. the final 
checkpoint bypassed the pacing gate instead of waiting for it.
   
   The Fixture uses only `FakeSource`/`Console` as simple data fixtures; no 
Transform, SQL semantics, connector or format behavior is exercised.
   
   ### Why this is a boundary with real regression risk
   
   Both gates live in the same "is this checkpoint allowed to run now" block, 
and `min-pause` is an operator-visible storage-protection knob that can 
legitimately be minutes long. If a future change hoists either gate above the 
`notFinalCheckpoint()` guard, every savepoint / `stop -s` call silently blocks 
for the remainder of the pacing window while the client waits in 
`DOING_SAVEPOINT`. Nothing fails, no task errors, and the savepoint itself is 
still correct — so neither job status nor checkpoint counts expose the 
regression; only a savepoint requested inside a deliberately oversized window 
catches it.
   
   Conversely the fixture also fails if the window stops being enforced at all 
(for example when a config source is read incorrectly), which shows the guard 
is not vacuous.
   
   ### Why existing coverage does not reach it
   
   - `CheckpointMinPauseIT` (a separate PR, #13475) pins the periodic side of 
the knob — the spacing between regular checkpoints — but never creates a 
savepoint.
   - `CheckpointCoordinatorTest#testCheckpointMinPause` only asserts that a 
fabricated coordinator reschedules a periodic trigger; it never creates a 
savepoint.
   - `SavepointRestoreIT`, `CheckpointRestoreWithStopIT` and 
`MultiPipelineSavepointRestoreIT` take savepoints with default pacing, so an 
inherited wait would stay below their timeouts and be invisible.
   - `CheckpointEnableIT` only toggles whether periodic checkpoints exist.
   
   No existing test combines an oversized `min-pause` with a savepoint request.
   
   Note for users: the job-level env key is the documented plain `min-pause` 
(see `docs/en/architecture/fault-tolerance/checkpoint-mechanism.md`); a 
`checkpoint.min-pause` spelling is not read by 
`JobMaster#createJobCheckpointConfig` and leaves pacing disabled. The fixture 
uses the documented spelling.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. Test-only change: one E2E class and one job fixture.
   
   ### How was this patch tested?
   
   ```
   ./mvnw -o -pl 
seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base spotless:apply
   ./mvnw -o -pl 
seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base \
     -DskipUT=true -DskipIT=false -Dit.test=SavepointCheckpointPacingIT \
     -DfailIfNoTests=false verify
   ```
   
   Result: `Tests run: 1, Failures: 0, Errors: 0` (about 8 s on JDK 17).
   
   Negative control: with the fixture's `min-pause` temporarily set to `-1` 
(disabled), the in-window precondition fails with
   
   ```
   the fixture must still be inside the min-pause window before the savepoint 
is requested:
   [{id=2,type=CHECKPOINT_TYPE,status=COMPLETED,...}, 
{id=1,type=CHECKPOINT_TYPE,status=COMPLETED,...}]
   ==> expected: <1> but was: <2>
   ```
   
   after which the fixture value was restored and the test passes again.
   


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