zhangshenghang opened a new pull request, #13717:
URL: https://github.com/apache/seatunnel/pull/13717
Yes, I am contributing to **Apache SeaTunnel**.
## What this changes
Fixes the restore behaviour reported in #13321: one stored checkpoint whose
payload cannot be deserialized aborts the whole `RestoreMode.CHECKPOINT`
restore even when older healthy checkpoints are still stored. A truncated
`CompletedCheckpoint` payload (interrupted or partially published write,
damaged block) makes the eager `map(deserializeCheckpoint)` in both selection
paths throw, so the job cannot be restored from any checkpoint.
Both selection paths now evaluate candidates one by one:
- `CheckpointService#getLatestCheckpointsForRestore` — the master-side
selection the client calls before submitting a restore (also used by REST
restore).
- `CheckpointManager#getLatestCheckpointStateByType` — the server-side
selection that rebuilds the checkpoint coordinator.
For each candidate that cannot be deserialized, the restore logs a WARN with
the source job id, pipeline id and checkpoint id and states explicitly that the
job will restore from an older checkpoint if one is available and that data
after that checkpoint may be reprocessed. The newest remaining restore-eligible
healthy candidate is selected.
When candidates exist but none of them is healthy, the restore now fails
with an explicit `SeaTunnelEngineException` that names the job/pipeline and the
corrupted candidates. Returning no state (today's effect of a `null` selection)
would silently start the job from scratch with the source's initial state,
losing the recovery point the operator asked for. Jobs whose pipeline never
checkpointed keep the existing behaviour (no candidate → no restored state).
Unreadable checkpoint files that storage itself cannot return remain visible
failures; this change only skips candidates whose envelope was read
successfully but whose payload cannot be decoded.
## Semantics of the fallback
Restoring from an older checkpoint replays the data produced after it. That
is the same at-least-once window every checkpoint restore already has, and it
is strictly better than failing the whole job or silently starting from
scratch. The WARN makes the reprocessing window explicit to the operator.
## Tests
- New E2E `CheckpointCorruptCandidateRestoreIT` on a real in-process Zeta
node with a test-only local-file storage plugin that truncates the payload of
one job's newest checkpoints while keeping the `PipelineState` envelope
readable:
- sources commits checkpoints 1–2 healthy and 3–4 corrupted, cancels while
`checkpoint.retain-after-job-cancelled` keeps the files, then restores through
the real client API: the client selects checkpoint 2, the restored job reaches
RUNNING, its first own checkpoint is 3 (server-side selection used checkpoint 2
as well), and it keeps checkpointing;
- when every candidate of the source pipeline is corrupted, the restore
request fails with the explicit diagnostic, no job is submitted (no job master,
no slots, no checkpoint directory), so it cannot silently run from scratch.
- New unit tests in `CheckpointServiceTest` and `CheckpointManagerTest` for
the fallback and for the all-corrupted failure.
- Negative control: with the engine changes reverted, the new E2E fails in
both cases — `the client could not select a checkpoint ... RuntimeException:
Truncated` and `the restore must be rejected with an explicit diagnostic ...
RuntimeException: Truncated`. With the fix, four consecutive E2E runs are green
(12.821s, 12.869s, 12.819s and an earlier 13.221s run), `CheckpointManagerTest`
11/11 and `CheckpointServiceTest` 4/4 are green, and `spotless:check` passes
for both modules.
Closes #13321.
--
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]