zhangshenghang opened a new pull request, #13524:
URL: https://github.com/apache/seatunnel/pull/13524
Yes - this is a test contribution to Apache SeaTunnel.
## What this PR does
Adds `SavepointRestoreCapacityAdmissionIT`, a Zeta engine E2E that restores
a stop-with-savepoint while the cluster has no free fixed slots, then verifies
the restore is admitted from the pending queue and resumes from the savepoint
once capacity is freed.
The test uses one in-process hybrid node with `dynamic-slot = false`,
`slot-num = 3` and `job-schedule-strategy = WAIT`. A streaming `FakeSource ->
InMemory` job occupies all three slices (split enumerator, fused reader/writer,
sink task group) and first takes a savepoint. A second job takes the whole pool
again, and the savepoint restore is submitted against that full pool.
## Why this is a boundary with real regression risk
A Zeta restore is not a separate scheduling path:
`CoordinatorService#submitJob` puts the restored `JobMaster` into the same
`pendingJobQueue` and `pendingJobSchedule` runs the same `preApplyResources`
capacity check. The restore path additionally rehydrates checkpoint state,
restores checkpoint-id counters and resets pipelines
(`PendingSourceState.RESTORE`). A regression can:
- dispatch restored pipelines before the resource pre-apply succeeds, so the
job owns a partial slot set;
- leave the restore `PENDING` forever because the scheduler mishandles a
restore entry;
- reset the checkpoint sequence to id 1 and overwrite the savepoint the
restore was selected from.
None of these is visible in the existing restore tests, which all restore
into a cluster that already has free capacity.
## Contract asserted
1. With all fixed slices occupied, the restore must report `PENDING` to both
the coordinator and the client, own no slice, keep the occupying job's slices
untouched, and neither complete nor start any checkpoint for a 10 s stability
window (three scheduler retries).
2. When the occupying job is cancelled, the pending restore is dispatched
onto the freed slices, reaches `RUNNING` and keeps the source job id.
3. The restored run continues the savepoint checkpoint sequence: its first
completed periodic checkpoint id is greater than the savepoint id, and the
savepoint remains the single selectable savepoint.
4. Cancelling the restored job releases its slices and returns the whole
fixed pool to unassigned.
## Existing coverage
- `SavepointRestoreIT`, `SavepointClusterRestartRestoreIT`,
`MultiPipelineSavepointRestoreIT` and `RecoveryLifecycleRestApiIT` restore onto
free capacity.
- `JobRestoreIT` only checks that automatic restore re-applies resources
inside a container.
- `SplitClusterPendingJobLifecycleFailoverIT` covers pending *fresh* jobs,
and the pending-savepoint guard covers a savepoint request aimed at a pending
job - neither restores a savepoint into a starved pool.
## Validation
```
./mvnw -o -q -pl
seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base \
-DskipUT=true -DskipIT=false -Dit.test=SavepointRestoreCapacityAdmissionIT
\
-DfailIfNoTests=false verify
```
Passed five times on dev `ee0fb0d72f` (21.7 s, 20.7 s, 22.2 s, 21.8 s, 21.7
s).
Negative control: making `JobMaster#preApplyResources` return `true` for
restore jobs (i.e. bypassing capacity admission) makes the test fail at the
first assertion:
```
a restore that cannot fit must be admitted as pending ==> expected:
<PENDING> but was: <FAILED>
```
The control was reverted, the pristine `seatunnel-engine-server`
re-installed (jar checksum restored) and the final run passed against clean
code.
Also run:
```
./mvnw -o -q -pl
seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base spotless:apply
./mvnw -o -q -pl seatunnel-ci-tools -Dtest=ImportClassCheckTest test
git diff --check
```
## Scope
Test-only: one new IT class and one new fixture config. No production code,
connector, transform, SQL or format changes.
--
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]