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

   ### Search before asking
   
   - [x] I searched the [issues](https://github.com/apache/seatunnel/issues) 
and found no similar bug report.
   
   ### What happened
   
   A checkpoint restore submitted through the **client API** silently turns 
into a fresh execution when the referenced source job has no restore-eligible 
checkpoint data.
   
   `SeaTunnelClient#restoreFromCheckpointExecutionContext` (the entry point 
behind `bin/seatunnel.sh --restore-with-checkpoint`) calls 
`JobClient#getCheckpointData` for the `restoreSourceJobId` and then passes the 
result to `MultipleTableJobConfigParser`. When that list is empty, the parser 
simply skips the restore branch and builds a brand-new source, so a destination 
job is submitted and starts from offset zero. No exception, no warning: the job 
looks `RUNNING`, and non-idempotent sinks replay rows that were already 
committed.
   
   This contradicts the documented contract in 
`docs/en/engines/zeta/rest-api-job-lifecycle.md` (lines 281-282):
   
   > If the checkpoint data for `restoreSourceJobId` is missing, already 
cleaned up, or incompatible, the submission fails fast.
   
   and the same statement in `docs/zh/engines/zeta/rest-api-job-lifecycle.md`.
   
   The server-side restore entry points already enforce this; only the client 
path is missing the guard.
   
   ### Steps to reproduce
   
   1. Start a Zeta cluster (2 embedded nodes are enough; no connector container 
needed).
   2. Submit a `STREAMING` job with `checkpoint.interval = 2000` and the 
default `checkpoint.retain-after-job-cancelled = false`.
   3. Wait until at least one periodic checkpoint exists.
   4. Cancel the job and wait until its checkpoint data has been deleted from 
checkpoint storage.
   5. Call `restoreFromCheckpointExecutionContext(configFile, variables, 
jobConfig, seaTunnelConfig, sourceJobId, destinationJobId).execute()` with a 
new destination job id.
   
   **Actual:** no exception is thrown. The destination job is submitted and 
runs from the beginning of the source (it is observable as a newly created job 
with status `CREATED`/`RUNNING`).
   
   **Expected:** the submission fails before any job is created, with a message 
such as:
   
   ```
   java.lang.IllegalArgumentException: No checkpoint found for 
jobId=<destinationJobId>, restoreMode=CHECKPOINT, 
restoreSourceJobId=<sourceJobId>
   ```
   
   The same silent fallback happens for `restoreMode=SAVEPOINT` through 
`SeaTunnelClient#restoreExecutionContext` (`bin/seatunnel.sh -r/--restore`) 
when the source job has no savepoint.
   
   ### Root cause
   
   - 
`seatunnel-engine/seatunnel-engine-client/src/main/java/org/apache/seatunnel/engine/client/job/ClientJobExecutionEnvironment.java`
 (`getJobConfigParser`): `pipelineCheckpoints` is loaded from 
`JobClient#getCheckpointData` but an empty result is accepted.
   - 
`seatunnel-engine/seatunnel-engine-core/src/main/java/org/apache/seatunnel/engine/core/parse/MultipleTableJobConfigParser.java`
 line 446: the restore branch is only taken when `pipelineCheckpoints` is 
non-empty; otherwise `createAndPrepareSource` builds a fresh source.
   - The equivalent server-side paths already fail fast:
     - `RestJobExecutionEnvironment.java` lines 152-158 (`No checkpoint found 
for jobId=...`), covered by `RestApiSubmitJobStartWithSavePointTest` (HTTP 400).
     - `ApplicationJobExecutionEnvironment.java` lines 76-83.
   
   ### Impact
   
   Silent data duplication / data loss of recovery position for every 
client-based restore (`--restore-with-checkpoint`, `--restore`) whose source 
checkpoint data was cleaned up, for example after a cancel with the default 
retention setting. The operator has no signal that the requested recovery point 
was discarded.
   
   ### Suggested fix
   
   Add the same empty-checkpoint guard to 
`ClientJobExecutionEnvironment#getJobConfigParser()` that the REST and 
application environments already have, so a client restore without checkpoint 
data throws `IllegalArgumentException` before a job is submitted. I will submit 
a PR with the fix, a client unit test and an E2E regression test.
   
   ### Version
   
   - Apache SeaTunnel `dev` at commit `f08c722acb` (`3.1.1-SNAPSHOT`)
   - JDK 17, Zeta embedded cluster (2 nodes)
   


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