zhangshenghang opened a new pull request, #13500:
URL: https://github.com/apache/seatunnel/pull/13500
Yes, I am contributing to Apache SeaTunnel. This change fixes the
checkpoint-scheduling regression reported in #13497 and adds the Zeta engine
E2E coverage that reproduces it.
### What this PR does
- `CheckpointCoordinator#restoreCoordinator(boolean)` now triggers the first
periodic `CHECKPOINT_TYPE` checkpoint after a master failover only when
`coordinatorConfig.isCheckpointEnable()` is true. The final
`COMPLETED_POINT_TYPE` branch for sources that already finished is unchanged.
- `CheckpointCoordinator#tryTriggerPendingCheckpoint(CheckpointType)` now
defensively rejects a general periodic checkpoint when the job has
checkpointing disabled, so the restore entry point cannot bypass the job-level
flag again.
- Adds
`CheckpointCoordinatorFailoverIT#testCheckpointDisabledBatchJobDoesNotCheckpointAfterMasterFailover`
plus a dedicated BATCH fixture
(`batch_fake_to_console_checkpoint_disabled.conf`) whose env intentionally
omits `checkpoint.interval`.
### Why this boundary has real regression risk
A BATCH job without `checkpoint.interval` has checkpointing disabled for the
whole job (`JobMaster#createJobCheckpointConfig`), but the engine still carries
a configured default interval for jobs that do enable checkpoints. The healthy
path honours the flag in `CheckpointCoordinator#allTaskReady`; the failover
path is a different entry point. When `restoreCoordinator(true)` rebuilds the
coordinator on the new active master while the tasks still run on a surviving
worker, it used to call `tryTriggerPendingCheckpoint(CHECKPOINT_TYPE)`
unconditionally. The restored coordinator's `latestTriggerTimestamp` starts at
`0`, so the checkpoint fired immediately and rescheduled itself every
engine-default interval. Worse, the checkpoint timeout future is only armed
when `isCheckpointEnable()` is true, so these illegal periodic checkpoints ran
without any timeout: a stalled subtask leaves `pendingCounter > 0` and can hang
the job's final close barrier indefinitely. The job looks healthy and `R
UNNING` the whole time; the damage only shows up as spurious checkpoint
storage writes and a possible hang.
### Why existing coverage does not reach it
`CheckpointCoordinatorFailoverIT`'s failover tests all use jobs that
explicitly set `checkpoint.interval`, so a periodic checkpoint after failover
is legitimate there and cannot distinguish an enabled schedule from an illegal
one. `CheckpointEnableIT` only covers BATCH jobs with checkpoints disabled on
the normal (no-failover) path. No existing test combines "checkpointing
disabled for the job" with "master failover while tasks are already running".
### How this patch was tested
The new test uses two dedicated master-only nodes and a separate worker that
is never killed, so the failover exercises coordinator recovery while the task
keeps running (`alreadyStarted == true`). The job runs a slow `FakeSource ->
Console` pipeline and the engine default interval is set to 1s to make an
illegal schedule visible.
- On unmodified `dev`, the test fails with three illegal checkpoints
persisted by the restored coordinator:
`A batch job with checkpointing disabled must not persist any checkpoint
after master failover, but found 3: [pipeline=1, checkpoint=3, pipeline=1,
checkpoint=2, pipeline=1, checkpoint=1]`
- With this fix, the same test passes and asserts, across several default
intervals on the new master, that the job stays `RUNNING` and keeps reading
rows, no checkpoint is persisted, and the per-pipeline checkpoint id counter
stays at its initial value.
Commands run (JDK 17, embedded Hazelcast cluster, no containers):
```
./mvnw -pl
seatunnel-engine/seatunnel-engine-server,seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base
\
-DskipUT=true -DskipIT=false \
-Dit.test='CheckpointCoordinatorFailoverIT#testCheckpointDisabledBatchJobDoesNotCheckpointAfterMasterFailover'
\
-DfailIfNoTests=false verify
```
Also re-ran the existing checkpoint-enabled failover coverage and the
coordinator unit tests with the fix:
```
./mvnw -pl
seatunnel-engine/seatunnel-engine-server,seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base
\
-DskipUT=true -DskipIT=false \
-Dit.test='CheckpointCoordinatorFailoverIT#testBatchJobCompletesAfterMasterFailover+testStreamJobContinuesAfterMasterFailover+testCheckpointCompletesAfterMasterFailoverWithIdleClosedReader'
\
-DfailIfNoTests=false verify
./mvnw -pl seatunnel-engine/seatunnel-engine-server
-Dtest=CheckpointCoordinatorTest test
```
All pass (`3/3` E2E, `19/19` unit tests).
### Does this PR introduce _any_ user-facing change?
Yes: a BATCH job with checkpointing disabled no longer writes periodic
checkpoints after a master failover. This matches the documented behavior on
the healthy-master path; no configuration or data format changes.
### Check list
* [x] Added E2E coverage for the fixed behavior.
* [ ] No new Jar binary package.
* [ ] No documentation change needed (behavior now matches the existing
`checkpoint.interval` contract).
* [ ] No `incompatible-changes.md` entry needed.
--
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]