zhangshenghang opened a new issue, #13782:
URL: https://github.com/apache/seatunnel/issues/13782

   ### Search before asking
   
   - [X] I searched existing issues and PRs before filing this report. Related 
but different: #13497 (a master failover of a checkpoint-disabled BATCH job 
starts periodic checkpoints) and #13439 (a client restore silently starts a new 
job when *no* checkpoint data exists). This report is about a savepoint that 
**does** exist and is silently ignored by the server-side restore path.
   
   ### What happened + what you expected to happen
   
   On `dev` (a760d1f3), a BATCH job that does not configure 
`env.checkpoint.interval` has periodic checkpointing disabled by 
`JobMaster#createJobCheckpointConfig`. A client stop-with-savepoint request is 
still accepted for such a job: `CheckpointCoordinator#startSavepoint` has no 
checkpoint-enable gate, so the barrier is injected, the task states are 
collected and the savepoint is written to the checkpoint storage (and is 
readable through `JobClient#getCheckpointData`).
   
   Restoring that savepoint, however, does not use it. `CheckpointManager` 
loads the restore base only when periodic checkpointing is enabled:
   
   ```java
   // CheckpointManager constructor
   if (checkpointConfig.isCheckpointEnable() && isRestoreJob) {
       ... checkpointStorage.getLatestCheckpointByJobIdAndPipelineId(...)
   }
   ```
   
   For a checkpoint-disabled job the `PipelineState` therefore stays `null`, 
`CheckpointCoordinator#latestCompletedCheckpoint` stays `null`, 
`restoreTaskState()` sends an empty state list to every task, and the restored 
job starts from scratch.
   
   **Expected:** a savepoint is an explicit user-requested recovery point. 
Restoring it must resume the source from the saved split state, regardless of 
whether *periodic* checkpoints are enabled.
   
   **Actual:** the restored job replays the whole source split and re-writes 
every row that the original run had already produced. On my reproduction the 
original run wrote 4096 of 6000 rows, then stop-with-savepoint stored the 
remaining split; the restored run wrote all 6000 rows, i.e. the 4096 rows were 
produced twice. No warning, error or metric shows that the savepoint was 
ignored.
   
   ### To reproduce
   
   1. One master and one worker 
(`SeaTunnelServerStarter.createMasterHazelcastInstance` / 
`createWorkerHazelcastInstance`), dynamic slots.
   2. Submit a BATCH job `FakeSource(row.num = 6000, split.num = 1) -> test 
sink with 1 ms delay per row`; the job config deliberately has **no** 
`env.checkpoint.interval`.
   3. While the job is running, call `SeaTunnelClient#savePointJob(jobId)`. It 
completes; the job ends `SAVEPOINT_DONE`; `JobClient#getCheckpointData(jobId, 
RestoreMode.SAVEPOINT)` returns the savepoint.
   4. Call `restoreExecutionContext(confPath, new JobConfig(), ...)` with the 
same job id.
   5. The restored job finishes, but its rows alone are 6000 (the whole 
source), instead of only the rows the savepoint did not cover.
   
   The E2E test `BatchSavepointRestoreCheckpointDisabledIT` (attached PR) 
performs exactly these steps and fails on current `dev` with:
   
   ```
   The restored job re-read the whole source split instead of resuming from the 
savepoint:
   restored rows=6000, source rows=6000
   ```
   
   With the one-line load-gate fix it passes: original run 4096 rows, restored 
run 1904 rows.
   
   ### Anything else
   
   `CheckpointManager#clearCheckpointIfNeed` is also gated on 
`isCheckpointEnable()`, so the savepoint of such a job is never deleted and 
remains a valid recovery point — which makes the silent replay worse, because 
the recovery data is present but unused.
   
   I will open a PR with the fix and the E2E guard.
   


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