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

   The probe, as asked. It is in process, builds the coordinator a new master 
builds (real constructor, restored from stored checkpoint 3; IMap, plan and 
storage mocked) and ran on the classes of dev `4cc5a10f4a`:
   
   ```java
   CheckpointCoordinator c = spy(new CheckpointCoordinator(
           mock(CheckpointManager.class), mock(CheckpointStorage.class), new 
CheckpointConfig(),
           JOB, plan, mock(CheckpointIDCounter.class), stored(3), pool, imap, 
false, null));
   doReturn(true).when(c).notifyCompleted(any());
   doNothing().when(c).tryTriggerPendingCheckpoint(any());
   
   // A: imap.get("checkpoint_state_7_1") returns FINISHED
   
check(c.waitCheckpointCoordinatorComplete().join().getCheckpointCoordinatorStatus()
 == FINISHED);
   check(!c.isNoErrorCompleted());
   
   // B: same, with one starting subtask, as SubPlan does when the pipeline is 
RUNNING in the IMap
   c.restoreCoordinator(alreadyStarted);
   verify(imap).set("checkpoint_state_7_1", 
CheckpointCoordinatorStatus.RUNNING);
   check(!c.waitCheckpointCoordinatorComplete().isDone());
   
   // C: RUNNING persisted and all sources in the ready-to-close record
   c.restoreCoordinator(true);
   verify(c).tryTriggerPendingCheckpoint(CheckpointType.COMPLETED_POINT_TYPE);
   ```
   
   Output:
   
   ```
   A: FINISHED persisted before failover
     ok: latest checkpoint is the restored regular checkpoint 3
     ok: constructor completes the future with the persisted FINISHED
     ok: isNoErrorCompleted() is false although FINISHED is persisted
   B: FINISHED persisted, then restoreCoordinator(true)
     ok: persisted FINISHED is overwritten with RUNNING
     ok: the FINISHED future is replaced by a new, open future
     ok: ready-to-close record was removed at completion: a regular checkpoint 
is triggered, not COMPLETED_POINT
   B: FINISHED persisted, then restoreCoordinator(false)
     ok: persisted FINISHED is overwritten with RUNNING
     ok: the FINISHED future is replaced by a new, open future
     ok: nothing is triggered; the coordinator waits for tasks to report ready
   C: RUNNING persisted, all sources ready to close, restoreCoordinator(true)
     ok: COMPLETED_POINT is triggered again from the restored ready-to-close 
record
   ALL PROBES PASSED
   ```
   
   A and B are why case 1 of the contract needs both a stored final checkpoint 
and changes to `restoreCoordinator` and `isNoErrorCompleted`. The full source 
(190 lines) is ready to share as a gist or in the PR.
   


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