SEPURI-SAI-KRISHNA commented on issue #13324:
URL: https://github.com/apache/seatunnel/issues/13324#issuecomment-7180863526

   Proposal below. I first measured the failover side on dev `3eefbe6f08` 
(in-process probe: real `CheckpointCoordinator` constructor, mocked IMap):
   
   - On a new master, `isNoErrorCompleted()` is false even with FINISHED 
persisted: its checkpoint is restored (a `COMPLETED_POINT` is never stored).
   - If the pipeline is still RUNNING in the IMap, `restorePipelineState` 
reports it running and `restoreCoordinator` overwrites the persisted FINISHED 
with RUNNING and replaces the completed future.
   
   So durability alone is not enough; restore must honor it.
   
   **1. Record and ordering.** `checkpoint_state_<job>_<pipeline>` stays the 
authoritative record. On success: `notifyCompleted` (tasks commit) succeeds, 
then FINISHED or SUSPEND is persisted, then the future completes, then SubPlan 
persists the pipeline state. A persisted FINISHED or SUSPEND thus means the 
commit happened. FAILED and CANCELED are persisted before the future completes, 
as now.
   
   **2. Retry exhaustion.** A terminal write that still fails throws instead of 
returning. For FINISHED or SUSPEND the commit is already done, so a restore 
would replay data: the coordinator completes FAILED with the cause and calls 
`handleCheckpointError(pipelineId, true)`, so the job ends FAILED without a 
restore. FAILED and CANCELED keep their outcome; the error is logged.
   
   **3. Restore side and tests.** With a persisted FINISHED or SUSPEND, 
`restoreCoordinator` keeps it and the completed future and triggers nothing, 
`isNoErrorCompleted()` accepts it for a restored coordinator, and 
`restorePipelineState` finishes the pipeline instead of reporting it running. 
Tests (`CheckpointCoordinatorTest`, `SubPlanTest`):
   - the FINISHED write throws: the future is FAILED and restore is disabled;
   - new master, persisted FINISHED, pipeline RUNNING: no RUNNING write, no 
checkpoint, the pipeline ends FINISHED;
   - a lost FAILED write: restore is unchanged; `checkNeedRestore` reads the 
pipeline state, restore count and `needRestore`, not this record.
   
   **4. Retry and errors.** Keep the existing bound (about a minute): 30 
attempts 2 s apart for the exceptions `isOperationNeedRetryException` accepts; 
others fail at once. On exhaustion, an ERROR log and the job error name the 
key, the target status and the cause.
   
   Not covered: if the IMap stays unwritable through a master failover, the new 
master sees only the state before completion, as today. `neverNeedRestore` is 
not persisted either.
   
   Does this direction work? Happy to post the probe.
   


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