zhangshenghang opened a new pull request, #13720:
URL: https://github.com/apache/seatunnel/pull/13720
Yes — this change contributes to Apache SeaTunnel.
### What this PR does
Extends the existing `MultiPipelineSavepointRestoreIT` with a second
end-to-end case for a multi-pipeline savepoint whose pipelines checkpoint at
**different rates**, so their checkpoint ids diverge before the savepoint. The
restored pipelines must each continue from **their own** savepoint id + 1.
The existing case in this class uses two pipelines with the same checkpoint
cadence, so their ids stay aligned; its post-restore assertion only requires
every pipeline to be above its savepoint id. A regression that seeds the
checkpoint-id counters job-wide (or selects one job-wide savepoint) would
advance the slow pipeline past its own sequence and still satisfy that
assertion. The new case makes the difference observable:
- pipeline 1's test sink holds every checkpoint barrier for `1200ms`;
pipeline 2's holds it for `300ms` (checkpoint interval is `500ms`), so pipeline
1 provably lags and its latest id is at least 3 lower before the savepoint;
- a real stop-with-savepoint produces one `SAVEPOINT_TYPE` entry per
pipeline at different ids;
- after restoring the same job id, each pipeline's first post-restore
barrier is exactly its own savepoint id + 1, and the slow pipeline's first id
is still lower than the sibling's savepoint id;
- the job stays `RUNNING` while both pipelines checkpoint and still cancels
cleanly.
### Why this boundary has real regression risk
`CheckpointManager` creates one `CheckpointCoordinator` and one persisted
`StateStoreCheckpointIDCounter` per `(job, pipeline)`, and
`CheckpointService#getLatestCheckpointsForRestore` groups candidates by
pipeline id before selecting the newest per pipeline. If either half regressed
to a job-wide notion of "latest checkpoint" or a shared counter, a savepoint
restore would still reach `RUNNING`, still checkpoint, and still look healthy —
only the persisted ids of the slower pipeline would show that it resumed from
the wrong savepoint or skipped ids. The engine's client checkpoint-history
protocol cannot serve this observation on current `dev` (issue #13504), so the
fixture records every barrier that reaches each pipeline's sink in a test-local
registry and reads the first id above the savepoint from it.
### Why the existing coverage does not reach it
-
`MultiPipelineSavepointRestoreIT#testSavepointIsPersistedPerPipelineAndRestoredForBothPipelines`
(the existing case in this class) runs both pipelines at the same cadence and
asserts only `checkpointId > savepointId` after restore, so a job-wide counter
still passes.
- `SavepointRestoreIT` / `CheckpointRestoreWithStopIT` drive single-pipeline
jobs; `SavepointBusySourceBarrierIT` owns one pipeline;
`SavepointClusterRestartRestoreIT` restarts the cluster for a single-pipeline
savepoint.
- No existing engine E2E restores a multi-pipeline savepoint with divergent
ids and checks the exact first id of each restored pipeline.
### Files
- `MultiPipelineSavepointRestoreIT`: new
`testDivergentCheckpointIdsKeepPerPipelineCountersOnRestore` plus two helpers
(`awaitDivergentCheckpointIds`, `firstBarrierAfter`); the existing test is
unchanged.
- `org.apache.seatunnel.engine.e2e.snapshotdelay`: test-only sink that
delays `snapshotState` and records every barrier id per record key
(`SnapshotDelaySink`, `SnapshotDelaySinkWriter`, `SnapshotDelaySinkFactory`,
`SnapshotDelayProbe`).
- `multi_pipeline_savepoint_divergent_ids.conf`: two `FakeSource` pipelines,
both sinking into the test sink with different hold times.
Source and sink are fixtures only; no transform, SQL, connector or format
behavior is exercised.
### Negative control
Seeding the counter with `checkpointId + 2` instead of `+ 1` in
`CheckpointManager` (temporary local mutation, not part of this PR) leaves the
existing case green, while the new case fails in 17.4s with:
```
The slow pipeline must continue its own checkpoint-id sequence from its
savepoint (3),
not from the sibling's savepoint (7) or from a job-wide counter ==>
expected: <4> but was: <5>
```
The mutation was reverted and the pristine `seatunnel-engine-server` jar
reinstalled (sha256
`ea13c9dec606d695c124c90ed2b786e0855b4d91a502ca51285162fafed7d2e8`), and the
class was rerun green.
### How this was 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:check
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=MultiPipelineSavepointRestoreIT \
-DfailIfNoTests=false verify
```
Both tests in the class pass together in ~36s; the new case alone passes in
~14.7s repeatedly on `origin/dev` `0bef81d003`. `spotless:check` passes.
### Does this PR introduce any user-facing change?
No. Test-only change: no production code, configuration default, REST/API or
data format is modified. No issue was filed because the contract holds on
`dev`; this is a regression guard, not a bug fix.
--
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]