zhangshenghang opened a new pull request, #13751:
URL: https://github.com/apache/seatunnel/pull/13751

   Yes, this change contributes to Apache SeaTunnel.
   
   ### What this adds
   
   A Zeta engine E2E guard for the recovery path of a **permanently failed 
job**:
   
   1. When a job exhausts `job.retry.times` and ends `FAILED`, the checkpoints 
it completed before the failure must be **kept** (they are the operator's only 
recovery point), and the failed job must **stop scheduling checkpoints**.
   2. A new job id must be able to restore from that checkpoint with 
`RestoreMode.CHECKPOINT`, reach `RUNNING`, and continue the checkpoint id 
sequence **above the source's last completed checkpoint** instead of silently 
starting from scratch.
   
   ### Why this is a boundary with real regression risk
   
   All of this runs only on the failure path, which is the least exercised 
terminal transition:
   
   - The cleanup decision lives in 
`CheckpointManager#clearCheckpointIfNeed(JobStatus)` and is keyed on the 
terminal status: only `FINISHED`/`CANCELED` delete checkpoint data (subject to 
savepoint/retain handling). Adding `FAILED` to that list looks like plausible 
cleanup hardening but destroys every failure recovery, and the client-visible 
status does not change.
   - If the checkpoint coordinator is not torn down with the failed job, it 
keeps writing checkpoints under the failed job id while a restored job consumes 
an older one; the stale-file churn is invisible through the client API.
   - If the restore path stops seeding its checkpoint-id counter from the 
loaded checkpoint, the destination job still reports `RUNNING` and still 
completes checkpoints, so the mistake only surfaces when the next restore reads 
an overwritten id.
   
   ### Why existing coverage does not reach it
   
   - `CheckpointRestoreWithStopIT` restores from a checkpoint of a job stopped 
as `CANCELED` with `checkpoint.retain-after-job-cancelled=true`; its retention 
decision is the explicit-retain branch, not the failure branch.
   - `CheckpointRestoreRunningSourceIT` guards the terminal-source precondition 
against a live source, and restores from a cancelled job.
   - `SavepointClusterRestartRestoreIT` and `SavepointRestoreRetryIT` restore 
savepoints.
   
   No E2E currently fails a job, checks that its checkpoint data survives the 
failure cleanup, and restores from it.
   
   ### How the test pins the contract
   
   `FailedJobCheckpointRestoreIT` runs a real single-node Zeta cluster with 
local-file checkpoint storage and a slow test-only sink:
   
   - Waits for several completed periodic checkpoints, then arms the sink to 
throw once, so the failure is strictly **after** an observed checkpoint.
   - With `job.retry.times=0`, the job must reach terminal `FAILED`.
   - Requires the failed job's checkpoint directory to still contain files 
whose name set stops changing (no zombie coordinator; names carry the 
checkpoint id and a timestamp, so churn is detected even when retention keeps 
the count constant).
   - Restores a fresh destination job id from the failed job's checkpoint and 
requires `RUNNING`, new rows consumed, and the earliest retained destination 
checkpoint id to be greater than the source's last completed checkpoint id. A 
from-scratch restore starts near id 1 and is caught by that assertion.
   
   ### Verification
   
   - `FailedJobCheckpointRestoreIT` green on dev `1e7e29a75b` (single targeted 
run, `verify` including `spotless:check`).
   - Negative control: adding `JobStatus.FAILED` to 
`CheckpointManager#clearCheckpointIfNeed` makes the run fail at the retention 
assertion (`... holds no checkpoint file`) in ~30s; mutation reverted and the 
pristine `seatunnel-engine-server` jar reinstalled (sha256 
`e3687ea6c3c4ebc9caffa94e8ad57c5d7dc5df90dcfa93ed219d91ce1339137a`), green 
rerun.
   - `ImportClassCheckTest` 8/8.
   
   Test-only change; no production code or connector behavior is modified.
   


-- 
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]

Reply via email to