zhangshenghang opened a new pull request, #13496:
URL: https://github.com/apache/seatunnel/pull/13496
Yes, I am contributing to Apache SeaTunnel. This change only adds regression
coverage to the Zeta engine E2E suite; no production code is modified.
### Purpose of this pull request
Adds
`CheckpointRestoreRunningSourceIT#testCheckpointRestoreOfRunningSourceIsRejectedAndSourceStaysIntact`,
an end-to-end test for the terminal-source precondition of
`RestoreMode.CHECKPOINT` (`--restore-with-checkpoint`).
Contract under test:
1. A `STREAMING` checkpointing job is `RUNNING` and has completed at least
one periodic checkpoint.
2. A `RestoreMode.CHECKPOINT` restore that names that live job as its source
is rejected by the master with the `terminal source job` precondition, and the
failure names the live `RUNNING` status.
3. The rejected attempt is a no-op for the source: the job is still
`RUNNING`, keeps advancing its checkpoint sequence, and still owns its
checkpoint data.
4. The destination job id of the rejected attempt has no `JobMaster` (and no
pending-queue entry), so the id is still usable.
5. After cancelling the source with checkpoints retained, restoring from its
last checkpoint into **the same destination id** reaches `RUNNING`, keeps the
single pipeline, and continues the checkpoint id sequence above the source's
last checkpoint.
### Why this boundary has real regression risk
`CoordinatorService#resolveSourceJobStatusForRestore` resolves the source
status from the pending queue, the running `JobMaster` map and the persisted
job-state map. If any of those lookups regresses to returning `null`,
`CheckpointRestoreValidator` silently admits the restore: a second job then
starts from a checkpoint of the live source and consumes the same offsets while
the source keeps writing. Nothing the client observes changes — the source
stays `RUNNING` and the restore may even report success — so the duplicate
consumption only surfaces downstream. The opposite regression is equally
silent: a rejection path that has already created
`JobMaster`/checkpoint-counter state for the destination id wedges a later,
valid restore of that id with "already been submitted" instead of succeeding.
### Why existing coverage does not reach it
- `CheckpointRestoreValidatorTest` covers the predicate itself with a
stubbed status lambda; it never runs a real `JobMaster`, checkpoint storage, or
client submission.
- `CheckpointRestoreWithStopIT` restores only after the source job has been
stopped and does not exercise the rejection path.
- `SavepointClusterRestartRestoreIT` restores a savepoint on a cold cluster
(`RestoreMode.SAVEPOINT`, same job id).
- No existing E2E submits a checkpoint restore while the source job is still
running, so the status resolution against a real master and the "no side effect
on either side" guarantee are unpinned.
The test reuses the rejected attempt's destination id for the later valid
restore deliberately: that assertion is what catches leaked destination-side
state.
### Does this PR introduce _any_ user-facing change?
No. Test-only coverage; no engine behaviour, configuration option or API is
changed.
### How was this patch tested?
```bash
JAVA_HOME=/Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home \
./mvnw -nsu -pl
seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base \
-Dtest=CheckpointRestoreRunningSourceIT -DfailIfNoTests=false test
```
- Built the reactor dependencies from `dev` HEAD, then ran the new test
twice: `Tests run: 1, Failures: 0, Errors: 0` (~14s each).
- Negative control: bypassing the
`validateCheckpointRestoreSourceJobIsTerminal` call makes the test fail at the
first assertion (`Expected java.lang.Exception to be thrown, but nothing was
thrown`), confirming it guards the real submission path rather than a tautology.
- `./mvnw -pl
seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base spotless:apply`
produces no changes; `spotless:check` and `git diff --check` pass.
### Check list
* [ ] If any new Jar binary package adding in your PR, please add License
Notice according
[New License
Guide](https://github.com/apache/seatunnel/blob/dev/docs/en/developer/new-license.md)
* [ ] If necessary, please update the documentation to describe the new
feature. https://github.com/apache/seatunnel/tree/dev/docs
* [ ] If necessary, please update `incompatible-changes.md` to describe the
incompatibility caused by this PR.
* [ ] If you are contributing the connector code, please check that the
following files are updated:
1. Update
[plugin-mapping.properties](https://github.com/apache/seatunnel/blob/dev/plugin-mapping.properties)
and add new connector information in it
2. Update the pom file of
[seatunnel-dist](https://github.com/apache/seatunnel/blob/dev/seatunnel-dist/pom.xml)
3. Add ci label in
[label-scope-conf](https://github.com/apache/seatunnel/blob/dev/.github/workflows/labeler/label-scope-conf.yml)
4. Add e2e testcase in
[seatunnel-e2e](https://github.com/apache/seatunnel/tree/dev/seatunnel-e2e/seatunnel-connector-v2-e2e/)
--
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]