zhangshenghang opened a new pull request, #13476:
URL: https://github.com/apache/seatunnel/pull/13476
Yes, contributing to Apache SeaTunnel.
### Purpose of this change
Add an engine E2E that pins the stop-with-savepoint path when the savepoint
is the **first checkpoint the job ever allocates**. The test-only change does
not modify engine business logic.
### Why this boundary has regression risk
A savepoint is a checkpoint of type `SAVEPOINT_TYPE` allocated from the
pipeline checkpoint id counter. When a job has never completed a periodic
checkpoint:
- the counter is still at its initial value and the first savepoint must get
checkpoint id `1`;
- the checkpoint storage contains no state for the job, so the savepoint is
the only recovery point that will ever exist;
- the restore path must find that savepoint in storage, re-seed the counter
to `savepointId + 1` without a previous completed checkpoint to compare
against, and keep savepoint-type filtering intact.
A change in counter initialisation, savepoint precondition handling,
`CheckpointManager` restore filtering or storage cleanup can silently break
this: either no savepoint is written, or the restore starts the job from
scratch while still reporting `RUNNING`. Neither is visible from the client,
because the job status is `RUNNING` in both cases.
### Why the existing coverage does not reach it
`SavepointRestoreIT`, `SavepointClusterRestartRestoreIT`,
`SavepointRestoreMasterFailoverIT` and `SavepointRestoreRetryIT` all wait for a
completed periodic checkpoint before requesting the savepoint (the retry test
additionally requires a checkpoint above the savepoint id). They always
exercise a counter that has already advanced and a storage that already holds
periodic checkpoints. No E2E requests a savepoint on a job with zero completed
checkpoints.
### What the test pins
`SavepointBeforeFirstCheckpointIT` runs a streaming `FakeSource -> Console`
fixture whose `checkpoint.interval` is longer than the whole test, waits for
`RUNNING`, and asserts the job has no checkpoint data at all. It then:
1. stops the job with a savepoint and requires checkpoint id `1`, and
requires it not to be reported as a periodic checkpoint;
2. waits for the stopped job's `JobMaster` to be cleaned up, restores from
the savepoint and requires the same job id and `RUNNING`;
3. requires the savepoint to still be visible after restore and no periodic
checkpoint to be fabricated;
4. stops the restored job with a second savepoint and requires its id to be
exactly the restored savepoint id + 1, proving the counter was re-seeded rather
than restarted.
A savepoint issued in the same instant the job turns `RUNNING` can race with
the coordinator recording every subtask as `READY_START`. The engine rejects
that request as a retryable precondition and returns the job to `RUNNING`; the
test retries and also asserts that a rejected attempt leaves the job `RUNNING`
(no wedge, no savepoint).
### Verification
```bash
export
JAVA_HOME=/Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home
# formatting
mvn -o -q -pl
seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base spotless:apply
# new test
mvn -o -pl seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base \
-Dit.test=SavepointBeforeFirstCheckpointIT -DskipIT=false
-DfailIfNoTests=false \
-Dspotless.check.skip=true -Dcheckstyle.skip=true failsafe:integration-test
```
Result (run twice, including after formatting):
```
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 13.093 s
```
No defect was found, so no issue is filed for this change.
--
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]