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

   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 `JobCheckpointIsolationIT`, an E2E regression guard for the 
**checkpoint and lifecycle isolation between two jobs of the same Zeta 
cluster**.
   
   The fixture is one in-JVM master plus one worker with a fixed slot budget 
(`dynamic-slot=false`, `slot-num=4`) and two STREAMING jobs, each a `FakeSource 
-> CheckpointIsolationProbe` pipeline. The test-only sink discards rows, keeps 
a row counter as its writer state, appends every checkpoint lifecycle event to 
a probe file and can fail exactly one `snapshotState`.
   
   1. Both jobs reach `RUNNING` and complete two checkpoints.
   2. The faulty job's sink is armed through a marker file; its next 
`snapshotState` deletes the marker and throws, which is the ordinary task-side 
checkpoint error reported through `CheckpointErrorReportOperation`. The 
pipeline is failed and restored from its last completed checkpoint, and the 
restored writer parks inside `SeaTunnelSink#restoreWriter` for a fixed 10 s 
gate so the neighbour can be observed while the restore is still in flight.
   3. Assertions, all read from the probe files (i.e. the real coordinator -> 
barrier -> task path, not an engine-internal counter):
      - the injected failure fired exactly once, the faulty job was restored 
exactly once (`WRITER` x2 plus `RESTORE`/`RESTORED`) and it resumes 
checkpointing and is `RUNNING` again;
      - the neighbour job never sees the failure, its writer is never 
re-created, and its job status stays `RUNNING`;
      - the neighbour's checkpoint ids stay **strictly consecutive** for the 
whole run, so no checkpoint id was consumed, skipped or reused on behalf of the 
other job;
      - the neighbour keeps triggering checkpoints **while** the faulty job is 
parked inside its restore gate (9 checkpoints inside the 10 s gate, ids 7..15, 
in the local run);
      - cancelling the faulty job does not stop the neighbour's checkpoint 
stream, and cancelling the neighbour afterwards closes both writers cleanly.
   
   ### Why this boundary has real regression risk
   
   Checkpoint bookkeeping is per `JobMaster` today, but three pieces are 
cluster-wide and easy to centralise in a refactor:
   
   1. the checkpoint id counter lives in a shared `CounterStateStore` and is 
only separated by its `(jobId, pipelineId)` key;
   2. checkpoint coordinators run their scheduling and error handling on 
executor services handed out by the coordinator/worker infrastructure;
   3. one worker's task-execution service runs the tasks of every job on that 
worker.
   
   If any of these becomes shared, nothing fails loudly: the neighbouring job 
keeps reporting `RUNNING`, its checkpoint history stays internally consistent, 
and the only symptom is that its ids get consumed by another job or its 
checkpoint trigger silently stops. That failure mode is invisible in logs, 
metrics and the REST overview unless a healthy job is observed *while* another 
job is failing, which is exactly what this test pins.
   
   ### Why the existing coverage does not reach it
   
   - `SeaTunnelSlotIT`, `SplitClusterPendingJobLifecycleFailoverIT` and 
`SystemLoadAllocateStrategyIT` do submit a second job, but only to check 
slot/queue handoff; they never let one job's checkpoint fail while observing 
the other's checkpoint stream.
   - `CheckpointCoordinatorFailoverIT`, `CheckpointRestoreWithStopIT`, 
`SavepointRestoreIT`, `MultiPipelineSavepointRestoreIT`, `CheckpointEnableIT` 
and `CommittedMetricsIT` all drive a single job.
   - No existing test pins cross-job checkpoint scheduling, checkpoint-id 
allocation, restore isolation or cancellation isolation.
   
   ### Negative control
   
   Keying `StateStoreCheckpointIDCounter` by `(0, pipelineId)` instead of 
`(jobId, pipelineId)` — the classic "centralise the id counter" refactor — 
makes the same test fail in 45 s:
   
   ```
   the neighbour job's checkpoint id sequence has a gap: [1, 3, 5, 7, 8, 9, 10, 
11, 12, 13, 14, 15, 16, 17, 18, 19, 21, 23]
   ==> expected: <2> but was: <3>
   ```
   
   The mutation was reverted, the pristine `seatunnel-engine-server` was 
reinstalled (`sha256 
3bb02e1b68c3dae988c59bd501426c637b5f8e044ec4392058126a557e7cc45a`) and the test 
is green again.
   
   ### Does this PR introduce any _user-facing_ change?
   
   No. Test-only change: one IT class, one test-tree sink family and two job 
fixtures.
   
   ### How was this patch tested?
   
   ```bash
   JAVA_HOME=/Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home \
     ./mvnw -o -q -pl 
seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base spotless:apply
   
   JAVA_HOME=/Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home \
     ./mvnw -o -pl 
seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base \
     -DskipUT=true -DskipIT=false -Dit.test=JobCheckpointIsolationIT \
     -DfailIfNoTests=false -Dskip.spotless=true -Drat.skip=true 
-Dmaven.javadoc.skip=true verify
   ```
   
   Result on `origin/dev` at `0bef81d003`: `Tests run: 1, Failures: 0, Errors: 
0, Skipped: 0` in 27.4 s, three consecutive green runs (initial run plus two 
stability runs), and `spotless:apply` leaves no changes.
   
   Only `FakeSource` and a test-tree sink are used as fixtures; no Transform, 
SQL, connector or format behaviour is exercised, and no engine code is changed.
   


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