Skip to content

[Fix][Zeta] Redrive dropped savepoint after master failover during shutdown (apache/seatunnel#10834) - #12134

Open
DanielLeens wants to merge 17 commits into
apache:devfrom
DanielLeens:zeta-cancel-savepoint-failover-race
Open

DanielLeens wants to merge 17 commits into
apache:devfrom
DanielLeens:zeta-cancel-savepoint-failover-race

Conversation

@DanielLeens

@DanielLeens DanielLeens commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Yes, contributing to Apache SeaTunnel.

Purpose of this pull request

Closes the remaining gap in #10834 ("Job stuck permanently after master failover, unable to complete") that #10836 did not actually cover.

#10834 named three affected scenarios; #10836 fixed one root cause (readyToCloseStartingTask not surviving failover) and added CheckpointCoordinatorFailoverIT tests for it. But those tests only cover:

  • testBatchJobCompletesAfterMasterFailover: BATCH natural completion after failover.
  • testStreamJobContinuesAfterMasterFailover: streaming checkpoint-id continuity after failover (job is manually cancelJob()'d at the end, never actually completes).

Neither exercises the third scenario #10834's own text calls out: "a Streaming job triggers a cancel or savepoint and master failover happens during the shutdown phase." Investigating this gap (as part of a broader initiative auditing Zeta failover edge cases this week) found that the savepoint variant is a real, currently-unfixed regression, confirmed both by reading the source and by reproducing it with a new E2E test before the fix was in place.

Root cause

  • JobMaster#savePoint() sets JobStatus#DOING_SAVEPOINT and triggers a SAVEPOINT_TYPE checkpoint via CheckpointManager#triggerSavePointsAndWaitComplete().
  • If the master dies before that checkpoint is fully acknowledged, CoordinatorService#restoreJobFromMasterActiveSwitch unconditionally calls PhysicalPlan#updateJobState(JobStatus.PENDING). PhysicalPlan#stateProcess()'s PENDING case cascades this straight through to RUNNING — nothing anywhere in that path checks whether the job's status was DOING_SAVEPOINT before the failover, so that marker is silently lost.
  • CheckpointCoordinator#restoreCoordinator independently discards the in-flight SAVEPOINT_TYPE PendingCheckpoint via cleanPendingCheckpoint(CHECKPOINT_COORDINATOR_RESET), and once the pipeline's tasks are confirmed running again, re-triggers only a regular CHECKPOINT_TYPE checkpoint. Nothing re-derives "a savepoint was requested" from anywhere, and startSavepoint() is never called again.

Net effect: the client's savepoint request is silently and permanently dropped. The job keeps running and periodically checkpointing as if the savepoint had never been requested — exactly the "stuck permanently, unable to complete" signature #10834 describes, for the one scenario its own fix and tests never actually exercised.

This is unlike the plain cancelJob() path (already covered by testStreamJobContinuesAfterMasterFailover): SubPlan has a real PipelineStatus#CANCELING that survives the same restore (SubPlan#restorePipelineState's CANCELING handling in stateProcess() simply re-sends task.cancel() to every task). Savepoint has no pipeline-level equivalent of CANCELING to survive on — the only markers that a savepoint was in progress were the job-level DOING_SAVEPOINT status and the transient, in-memory PendingCheckpoint, and both are discarded unconditionally by the restore path above.

How was this patch tested?

New E2E test (CheckpointCoordinatorFailoverIT#testStreamJobResolvesToSavepointDoneAfterMasterFailoverDuringSavepointShutdown): submits a STREAMING job, waits for it to be RUNNING with output flowing, triggers a client savepoint asynchronously, then white-box polls CheckpointCoordinator's private pendingCheckpoints field (same reflection idiom this module's own CheckpointCoordinatorTest unit tests already use, via ReflectionUtils) until the job's status has flipped to DOING_SAVEPOINT and the coordinator holds a savepoint checkpoint that has been dispatched but not yet fully acknowledged — i.e. genuinely mid-shutdown, neither un-started nor already complete. It kills the master at exactly that instant (mirroring the master-kill technique of the two existing tests in this file) and asserts the job resolves to SAVEPOINT_DONE within a bounded wait.

Before the fix, this test reliably (not flakily) reproduced the job getting stuck at RUNNING — confirmed by running it against the unpatched restore path first.

Fix (mirroring #10836's own persist-then-redrive pattern):

  • JobMaster gains a redriveSavepointAfterRestore flag, set by CoordinatorService when a restored job's prior status was DOING_SAVEPOINT.
  • CoordinatorService#redriveSavepointAfterMasterFailover consumes that flag concurrently with JobMaster#run() (which blocks until the job ends, so scheduling this after run() returns would never run while the job is active) and retries JobMaster#savePoint() until it succeeds, the job reaches a terminal state some other way, or a 5-minute budget elapses.
  • A single, unretried attempt gated only on the job's top-level status reaching RUNNING is not sufficient: CheckpointCoordinator's own isAllTaskReady flag can still be false at that point (reset by restoreCoordinator whenever a task needed redeployment) until every task independently re-reports READY_START — which happens strictly after the coarser job-level status already cascaded to RUNNING. This was also confirmed empirically: a first version of the fix without retry still failed intermittently, hitting TASK_NOT_ALL_READY_WHEN_SAVEPOINT on its single attempt. JobMaster#savePoint() already recovers from that precondition without failing the job, so retrying is safe and never leaves the job worse off than before this fix.

Verification evidence:

A rarer (~10% in repeated stress-runs, not reproduced after system load dropped), apparently pre-existing race was also observed during this investigation: runningJobStateIMap.get(jobId) can occasionally read back as effectively bypassed (the job already present in runningJobMasterMap before restoreJobFromMasterActiveSwitch would run for it), skipping the restore-and-redrive path for that attempt. This reproduced identically whether the new test's fix was present or not (i.e. it is not something this PR introduces), affects the general master-switch restore reconciliation rather than anything savepoint-specific, and was not chased further to keep this PR's scope to the confirmed, well-understood savepoint gap. Flagging it here for awareness in case it is worth a dedicated investigation.

Note on the widened assertion in testStreamJobFailsAfterCheckpointTriggerDispatchFailure

This test is a separate copy of the one added in #12288 and flaked the same way on this branch: CheckpointManager#sendOperationToMemberNode serves both triggerCheckpoint's barrier dispatch and notifyCompleted's post-completion notify, so the injected ownedSlotProfilesIMap fault can surface through either call depending on timing. Both paths fail the job through handleCoordinatorError; only the CheckpointCloseReason label differs (CHECKPOINT_INSIDE_ERROR or CHECKPOINT_NOTIFY_COMPLETE_FAILED). The assertion now accepts either. This is test-only; the deterministic approach in #12288 needs a production-code addition and is out of scope here. See commit 872701e.

Multi-pipeline behavior

The redrive is job-level: CheckpointManager fans the retried savePoint() out to every pipeline, so a job with several pipelines is covered by the same path. If a sibling pipeline already finished before the failover, its TASK_NOT_ALL_READY_WHEN_SAVEPOINT is a precondition rejection that JobMaster#savePoint() recovers from; once the remaining pipeline completes, savepointFailed() falls back to the normal stop-with-checkpoint path and the job ends SAVEPOINT_DONE. The only visible cost is the INFO "retrying" log. The E2E covers the single-pipeline shape; a partially completed multi-pipeline job is not deterministically producible with the existing fixtures, so that case is documented here rather than tested. See #12134 (comment) for the source trace.

Savepoint redrive limits

The redrive deadline is checked between attempts; it does not bound a blocking savePoint().get() call. The redrive intent is held only in the new master’s in-memory JobMaster. A second master failover after the first restore has re-persisted PENDING/RUNNING but before the redriven savepoint persists DOING_SAVEPOINT can therefore lose that intent. Persisting the intent and bounding each attempt are follow-up work; this PR covers a single master failover.

Does this PR introduce any user-facing change?

No. This restores the originally-intended behavior of a client-triggered savepoint surviving a master failover during its shutdown phase.

Check list

  • If any new Jar binary package adding in your PR, please add License Notice
  • If necessary, please update the documentation
  • If necessary, please update incompatible-changes.md

🤖 Generated with Claude Code

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What Problem Does This PR Solve?

Issue #10834 reports that a stop-with-savepoint request can get stuck "permanently, unable to complete" if a Zeta master failover happens while the savepoint is in flight. This PR traces the root cause independently (rather than trusting the issue text) to the generic master-failover restore path in CoordinatorService#restoreJobFromMasterActiveSwitch, and adds a targeted redrive mechanism so a job that was DOING_SAVEPOINT at the moment of failover gets its savepoint re-issued once it stabilizes back to RUNNING.

Complete Runtime Path Trace

Client -> SeaTunnelClient#savePointJob(jobId)
       -> JobMaster#savePoint() [pre-existing]
          -> PhysicalPlan#savepointJob() -> updateJobState(DOING_SAVEPOINT)
             -> runningJobStateIMap.set(jobId, DOING_SAVEPOINT)   [persisted, Hazelcast IMap]
          -> CheckpointManager#triggerSavePointsAndWaitComplete()
             -> CheckpointCoordinator#startSavepoint() -> barrier dispatched to all subtasks

--- Master node dies here, barrier acknowledged by only some subtasks ---

New active master:
CoordinatorService#restoreAllJobFromMasterActiveSwitch (pre-existing driver loop)
  -> restoreJobFromMasterActiveSwitch(jobId, jobInfo)                         [CoordinatorService.java:1117]
     -> jobState = runningJobStateIMap.get(jobId)   == JobStatus.DOING_SAVEPOINT
     -> new JobMaster(...) ; jobMaster.init(..., true)
     -> [NEW] if (jobState == DOING_SAVEPOINT) jobMaster.markRedriveSavepointAfterRestore()   [:1168-1180]
     -> pendingJobQueue.put(RESTORE, jobMaster)
     -> jobMaster.getPhysicalPlan().updateJobState(PENDING)   <- generic path unconditionally
        overwrites DOING_SAVEPOINT; PhysicalPlan#stateProcess() cascades PENDING -> SCHEDULED ->
        DEPLOYING -> RUNNING as tasks redeploy and confirm ready.
        Separately, CheckpointCoordinator#restoreCoordinator (existing code, ~line 673) discards the
        in-flight SAVEPOINT_TYPE PendingCheckpoint and, once tasks are ready, only re-arms periodic
        CHECKPOINT_TYPE checkpointing -- never re-derives "a savepoint was requested".

CoordinatorService's pending-queue consumer thread (runPendingJob, per-job worker in the bounded
coordinator ThreadPoolExecutor):                                              [CoordinatorService.java:481-508]
  -> jobStatus read from runningJobStateIMap (now PENDING, since the write above already happened)
  -> [NEW] if (jobMaster.consumeRedriveSavepointAfterRestore())               [:499-501]
         redriveSavepointAfterMasterFailover(jobMaster, mdcExecutorService)   [async, non-blocking]
  -> jobMaster.run()   [blocks this worker thread until job reaches terminal state]

redriveSavepointAfterMasterFailover (new background task, its OWN thread from the same pool):
  -> poll every 500ms, up to REDRIVE_SAVEPOINT_WAIT_MILLIS (5 min):
     - if status.isEndState() -> give up (job resolved some other way, e.g. genuine failure)
     - if status == RUNNING -> jobMaster.savePoint().get()
         -> PhysicalPlan#savepointJob() -> DOING_SAVEPOINT (persisted again)
         -> CheckpointCoordinator#startSavepoint(); if it fails precondition
            TASK_NOT_ALL_READY_WHEN_SAVEPOINT (isAllTaskReady still false because tasks haven't
            all reported READY_START yet -- pre-existing CheckpointCoordinator#restoreCoordinator
            behavior), pre-existing JobMaster#restoreRunningAfterSavepointStartFailure() reverts
            status to RUNNING and the redrive loop retries.
         -> on success, pipeline stops and job reaches JobStatus.SAVEPOINT_DONE (terminal)
  -> on timeout, logs a warning and gives up; job is left RUNNING, no worse than pre-fix behavior.

Core Logic Analysis

Two persistent additions in JobMaster.java (+45 lines, all additive):

  • redriveSavepointAfterRestore (volatile boolean) + markRedriveSavepointAfterRestore() / consumeRedriveSavepointAfterRestore() (both synchronized, consume-once semantics to prevent duplicate redrive for the same restore).

CoordinatorService.java (+134 lines, all additive):

  • Sets the flag when jobState == JobStatus.DOING_SAVEPOINT is observed during restore (:1168).
  • Consumes it and kicks off redriveSavepointAfterMasterFailover concurrently with, not after, jobMaster.run() (:499-501) -- this ordering is correct and necessary, since run() blocks until the job terminates.
  • The redrive submission is wrapped in try/catch for RejectedExecutionException; the shared ThreadPoolExecutor uses AbortPolicy-derived RejectionCountingHandler (confirmed in ThreadPoolStatus.java), so a rejection is a real synchronous exception here, correctly caught without blocking the subsequent jobMaster.run() call.

Compatibility Classification: Fully compatible

  • No new/removed/renamed JobStatus enum values, no new fields written to any IMap (the redrive flag lives purely on the in-heap JobMaster object and is never serialized), no checkpoint/savepoint on-disk format change, no public API/SPI change, no new user-facing Option.
  • Diff is 100% additive (0 deletions across all 4 files) -- no existing registration, mapper, or connector entries were touched or removed.
  • A rolling upgrade where an old-code master fails over to this new-code master, or vice versa, is safe: the flag is purely local bookkeeping on one master's in-memory object graph and does not need to survive across code versions, only within one failover's in-process lifetime.

Side-Effect Analysis

  • Threads: redriveSavepointAfterMasterFailover consumes a second thread from the same bounded CoordinatorService ThreadPoolExecutor (SynchronousQueue-backed, core-thread-num default 10, max-thread-num default Integer.MAX_VALUE) for as long as 5 minutes, in addition to the one thread already held by jobMaster.run() for that job. Under the default unbounded max-thread-num this is not a practical starvation risk. Deployments that intentionally cap max-thread-num for capacity planning, however, now need N_running_jobs + N_jobs_mid_savepoint_at_failover worker slots instead of N_running_jobs during a mass-restore event; the RejectedExecutionException path degrades gracefully (logs and drops the redrive, job stays as before the fix) rather than blocking run(), so this is a capacity/tuning consideration rather than a stability bug.
  • CPU/memory: negligible -- a 500ms-interval poll loop, no unbounded allocation.
  • A second failover mid-redrive: race-traced explicitly, see Issue #1 below -- this is the one gap not fully closed.
  • Duplicate-restore / double-redrive: not possible for a single failover. consumeRedriveSavepointAfterRestore() is synchronized and consume-once, and each failover constructs a brand-new JobMaster instance, so there is no shared mutable state across instances that could double-fire.
  • Distinguishing "dropped by failover" from "genuinely failed/cancelled": handled correctly for the common cases -- if the underlying failure is real (e.g. a task cannot redeploy), the job resolves to an end state before the redrive loop's RUNNING branch is ever reached, and the loop exits via status.isEndState(). The design deliberately keys off durable server-side JobStatus rather than any client-side signal, so it isn't confused by the original client RPC timing out for unrelated reasons -- that's a good design property.

Error Handling & Logging

INFO/WARNING levels are used appropriately (progress vs. give-up); no secrets or credentials logged; no silent exception swallowing in the sense of dropping information -- every catch branch logs before retrying or returning. One improvement worth considering (non-blocking): the retry loop's catch (Exception e) treats any exception from savePoint() identically to the documented TASK_NOT_ALL_READY_WHEN_SAVEPOINT precondition case, only distinguishable later by a human reading log text. An unexpected defect (e.g. NPE from a future bug elsewhere) would be silently retried for up to 5 minutes indistinguishably from the expected "not ready yet" case.

Test Coverage

Excellent for the redrive path specifically: testStreamJobResolvesToSavepointDoneAfterMasterFailoverDuringSavepointShutdown does not use a wall-clock sleep to approximate the race -- it uses Awaitility to poll (10ms interval) a white-box helper (isSavepointGenuinelyMidShutdown, reflecting into CheckpointCoordinator#pendingCheckpoints, the same idiom the module's own unit tests already use) until the job is genuinely DOING_SAVEPOINT and has an unacknowledged SAVEPOINT_TYPE PendingCheckpoint in flight, before killing the master. It then asserts the job resolves to JobStatus.SAVEPOINT_DONE specifically (not just any end state), which is the correct assertion to rule out "silently resumed running." This is a genuine regression test that exercises the actual interleaving, not a happy-path test. Rating: Stable -- deterministic condition-based waiting throughout, no fixed sleeps for timing-sensitive steps. The two supporting tests (testBatchJobCompletesAfterMasterFailover, testStreamJobContinuesAfterMasterFailover) cover adjacent restore paths (natural completion, cancel) for context/regression-safety but are not new behavior introduced by this PR.

Documentation

No docs/en/docs/zh update needed: no new Option, no CLI/API surface change, no default-value change. This is an internal correctness fix that makes savepoint behavior match its already-documented contract (a requested savepoint stops the job) rather than introducing new user-facing behavior.

CI Status

Apache-side "Build" check is a pointer into the contributor's fork Actions run (run 33989430223 in DanielLeens/seatunnel), which is still in progress at review time. Within that run: license header, code style, dead links, dependency licenses, all unit-test matrix cells, and engine-v2-it (both JDK 8 and 11 -- the exact module (connector-seatunnel-e2e-base) that carries this PR's new E2E test) have completed successfully on the JDK 11 leg, with the JDK 8 leg of engine-v2-it still running. Two unrelated jobs (rocketmq-connector-it on both JDKs, all-connectors-it-7 on JDK 8) show failure; neither touches any file this PR changes (seatunnel-engine-server, engine E2E test resources), so they read as pre-existing/environmental flakes rather than a regression from this change. Final CI conclusion is not yet available.

Issue Summary

# Location Issue Risk Severity Raised by another reviewer
1 CoordinatorService.java:1168-1180, :1183-1186 (restore path) The "must redrive" signal only exists as (a) the in-heap redriveSavepointAfterRestore boolean on a specific JobMaster instance, consumed immediately, and (b) the persisted DOING_SAVEPOINT JobStatus, which is overwritten to PENDING by the very next line and only becomes DOING_SAVEPOINT again once the redrive thread actually reaches its savePoint() call. If a second master failover occurs after the first restore begins but before the redrive thread's status reaches RUNNING (i.e. while the job is still PENDING/SCHEDULED/redeploying), the new master reads a status that is neither DOING_SAVEPOINT nor an end state, so it does not re-arm the redrive flag -- the original client's savepoint intent is silently and permanently dropped a second time, reproducing the exact bug this PR fixes. The window is the time for all subtasks to redeploy and report READY_START, which is not always negligible for larger jobs. Reproduces the original #10834 symptom under a rarer but realistic cascading-failover scenario Medium No
2 CoordinatorService.java:1261 (redrive poll loop, inside redriveSavepointAfterMasterFailover, method starts :1226) catch (Exception e) treats the documented TASK_NOT_ALL_READY_WHEN_SAVEPOINT precondition failure and any unexpected defect identically -- both are logged at INFO and retried for up to 5 minutes with no distinguishing metric/counter. An unrelated bug elsewhere would be masked as "still not ready" for the full retry window instead of surfacing quickly. Slower detection of real defects in production; not a data-safety issue Low No
3 CoordinatorService.java (thread pool usage) The redrive task borrows a second thread from the same bounded CoordinatorService executor used by jobMaster.run(), for up to 5 minutes per redriven job. Default max-thread-num is unbounded so this is not an issue out of the box, but deployments that pin max-thread-num for capacity planning need to budget for N_running + N_mid_savepoint_at_failover slots during a mass-restore event; rejection is handled gracefully but means the redrive silently gives up under exactly the load conditions where a production operator would most want it to still work. Reduced redrive reliability specifically under tuned, resource-constrained deployments Low No

Merge Recommendation

Conclusion: Ready to merge after fixes

Blockers (must-fix):

  • None strictly required for correctness in the common case, but Issue #1 (cascading-failover window) should at minimum be explicitly acknowledged: either close it by persisting the redrive intent somewhere that survives a second failover (e.g. deriving "redrive owed" from something durable rather than a one-shot in-heap flag plus a transient status value), or, if left as a known limitation, document it in the method's own javadoc (which currently reads as if the fix is complete) so a future reader doesn't have to re-derive this from source the way this review did.

Recommended fixes (non-blocking):

  • Issue #2: consider narrowing the retry loop's catch to exceptions known to represent "not ready yet," or add a counter/metric so an unexpected exception type is visibly distinguishable from the expected precondition case in production.
  • Issue #3: consider documenting the extra-thread-per-redrive cost in the core-thread-num/max-thread-num config descriptions, or moving the poll loop off the shared per-job executor onto a lightweight dedicated scheduler (similar to pipelineCleanupScheduler) so it never competes with job-running threads for the same bounded pool.

Overall this is a well-traced, narrowly-scoped, fully-additive fix with a genuinely strong regression test that exercises the real race rather than the happy path. The remaining gap (Issue #1) narrows the original bug's window substantially without fully closing it for the double-failover case; given how much harder that case is to trigger and how graceful the failure mode remains (job keeps running normally, exactly as it did before this fix), I'd be comfortable merging once that limitation is at least documented, or in a fast follow-up if the maintainers agree the residual window is acceptable for now.

…utdown (apache#10834)

apache#10834 ("Job stuck permanently after master failover") named
three affected scenarios and was fixed by apache#10836, but apache#10836's own tests
(CheckpointCoordinatorFailoverIT) only cover BATCH completion and streaming
checkpoint-id continuity after failover -- neither exercises a client-
triggered savepoint racing a master failover, the third scenario the issue
named. Investigating that gap surfaced a real, currently-unfixed regression:

- JobMaster#savePoint() sets JobStatus#DOING_SAVEPOINT and triggers a
  SAVEPOINT_TYPE checkpoint. If the master dies before that checkpoint is
  fully acknowledged, CoordinatorService#restoreJobFromMasterActiveSwitch
  unconditionally calls PhysicalPlan#updateJobState(PENDING), which
  PhysicalPlan#stateProcess() cascades straight through to RUNNING with no
  check for whether the job was DOING_SAVEPOINT beforehand.
- CheckpointCoordinator#restoreCoordinator independently discards the
  in-flight SAVEPOINT_TYPE PendingCheckpoint and, once tasks are confirmed
  running again, re-triggers only a regular periodic checkpoint. Nothing
  anywhere re-derives "a savepoint was requested" or calls startSavepoint()
  again.

Net effect: the client's savepoint request was silently and permanently
dropped. The job kept running and checkpointing normally forever, exactly
the "stuck permanently, unable to complete" symptom apache#10834 described, for
the one scenario its own fix never actually exercised. This was confirmed
empirically, not just by reading the code: a first version of the new E2E
test reliably reproduced the job resolving to RUNNING instead of
SAVEPOINT_DONE.

Fix, mirroring apache#10836's own persist-then-redrive pattern:
- JobMaster gains a redriveSavepointAfterRestore flag, set by
  CoordinatorService when a restored job's prior status was
  DOING_SAVEPOINT.
- CoordinatorService#redriveSavepointAfterMasterFailover consumes that flag
  concurrently with JobMaster#run() (which blocks until the job ends) and
  retries JobMaster#savePoint() until it succeeds, the job reaches a
  terminal state some other way, or a 5-minute budget elapses. A single,
  unretried attempt gated only on the job's top-level status reaching
  RUNNING is not sufficient: CheckpointCoordinator's own isAllTaskReady
  flag can still be false at that point (reset by restoreCoordinator
  whenever any task needed redeployment) until every task independently
  re-reports READY_START, so the first attempt commonly still hits
  TASK_NOT_ALL_READY_WHEN_SAVEPOINT -- a precondition JobMaster#savePoint()
  already recovers from without failing the job, so retrying is safe and
  keeps the job no worse off than before this fix on any attempt that
  doesn't eventually succeed.

This does not affect the plain cancelJob() path: SubPlan has a real
PipelineStatus#CANCELING that survives the same restore via
SubPlan#restorePipelineState/stateProcess, re-sending task.cancel() to
every task. Savepoint has no pipeline-level equivalent to survive on --
only the job-level DOING_SAVEPOINT status and the transient
PendingCheckpoint marked it, and the restore path discarded both.

New E2E test testStreamJobResolvesToSavepointDoneAfterMasterFailoverDuringSavepointShutdown
white-box polls CheckpointCoordinator's pendingCheckpoints field (same
reflection idiom CheckpointCoordinatorTest already uses) to find the exact
moment a savepoint's checkpoint has been dispatched but not yet fully
acknowledged, then kills the master at that instant, mirroring the
master-kill pattern of the two existing tests in this file. Verified
passing repeatedly (20+ runs) after the fix, including the two pre-existing
tests in the same file together with the new one to confirm no regression
to the batch-completion and stream-continuation scenarios apache#10836 already
covers.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@DanielLeens
DanielLeens force-pushed the zeta-cancel-savepoint-failover-race branch from 08c6f89 to c331296 Compare September 8, 2026 02:41
# Conflicts:
#	seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/java/org/apache/seatunnel/engine/e2e/CheckpointCoordinatorFailoverIT.java

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What Problem Does This PR Solve?

#10834 reports a stop-with-savepoint request that can get stuck "permanently, unable to complete" if a Zeta master failover happens while the savepoint is in flight. This PR adds a redrive mechanism so a job that was DOING_SAVEPOINT at the moment of failover gets its savepoint re-issued once it stabilizes back to RUNNING, closing a gap in #10836's own fix (whose tests never exercised the client-triggered-savepoint-racing-failover scenario). I re-checked the entire current head from scratch rather than trusting my 2026-09-06 conclusion.

1. Code Change Review

1.1 Core Logic Analysis

The branch was rebased since my last review: git compare between the commit I reviewed (08c6f89, 2026-09-06) and the commit currently at the tip of the PR's own work (c331296, 2026-09-08) reports the two as "diverged" (34 ahead / 1 behind), which is exactly the signature of a rebase onto a newer dev base rather than new authored changes. To confirm the PR's own logic didn't change during that rebase, I compared the current PR's file-level diff (gh api pulls/12134/files) against my prior review: it is still exactly the same 4 files with exactly the same line counts I reviewed on 09-06 (CheckpointCoordinatorFailoverIT.java +306/-0, the new .conf +75/-0, CoordinatorService.java +134/-0, JobMaster.java +45/-0). That is strong evidence the redrive logic itself — the redriveSavepointAfterRestore flag/consume-once accessors on JobMaster, and CoordinatorService's restore-time flag-setting plus the redriveSavepointAfterMasterFailover poll loop — is byte-identical to what I already traced end-to-end last round. All of my prior runtime-path analysis (client → JobMaster#savePoint() → DOING_SAVEPOINT → master dies → restoreJobFromMasterActiveSwitch sets the flag → runPendingJob consumes it concurrently with jobMaster.run() → 500ms-interval retry of savePoint() until RUNNING+ready or a 5-minute budget) still holds.

What actually changed since my last review is not the PR's own code — it's dev. After my review, dev merged PR #11458 ([Fix][Zeta] Reuse fixed slots after master failover), and this PR's branch was subsequently merged-with-dev (commit a4f7682309eb, 2026-09-09) to catch up. I verified with a real local git merge (not just merge-tree, which reported no conflicts using a naive 3-way base and would have been a false negative here) that this PR's branch, if merged against the current dev tip, produces exactly one conflict, in exactly one file:

seatunnel-engine/seatunnel-engine-server/.../master/JobMaster.java:188-209 (CONFLICT: content)

Both PR #11458 and this PR independently add a new private volatile boolean field immediately after the existing needRestore field (JobMaster.java:185-186) — #11458 adds masterFailoverRestore (tracks slot-reuse eligibility across a failover), this PR adds redriveSavepointAfterRestore (tracks savepoint-redrive eligibility across a failover). They are semantically independent — one gates resource-slot reuse in preApplyResources(), the other gates the savepoint-redrive poll loop — so the correct resolution is trivial: keep both fields, not pick one. I did not find any other conflicting hunk in CoordinatorService.java, JobMaster.java's other methods, or either E2E file.

1.2 Compatibility Impact

Unchanged from prior review: fully compatible. No JobStatus enum change, no new field written to any IMap (the redrive flag lives purely on the in-heap JobMaster object), no checkpoint/savepoint on-disk format change, no public API/SPI change. The diff remains 100% additive.

1.3 Performance / Side-Effect Analysis

Unchanged from prior review: the redrive task borrows a second thread from the same bounded CoordinatorService executor for up to 5 minutes per redriven job — a real but bounded/tunable consideration under a pinned max-thread-num, not a stability bug (rejection degrades gracefully). No new unbounded collections, no leak.

1.4 Error Handling and Logging

No change since prior review. Issues #2 and #3 from my 09-06 review (broad catch (Exception e) masking unexpected defects as "not ready yet"; extra-thread cost undocumented in config descriptions) remain open and were explicitly non-blocking last round.

2. Code Quality Assessment

2.1 Coding Standards

Unchanged: good — new fields/methods carry Javadoc, including the exact block now sitting in the conflict region (JobMaster.java:189-205 in the conflict view above), which is itself a well-written "why" comment explaining the flag's lifecycle.

2.2 Test Coverage and Test Stability

Unchanged from prior review: testStreamJobResolvesToSavepointDoneAfterMasterFailoverDuringSavepointShutdown uses Awaitility-based polling against a white-box CheckpointCoordinator#pendingCheckpoints inspection (not a wall-clock sleep) to find the exact moment to kill the master, and asserts the specific terminal state (SAVEPOINT_DONE), correctly ruling out "silently resumed running." Rating: Stable — deterministic condition-based waiting throughout, consistent with the module's existing test idioms.

2.3 Documentation Updates

Unchanged: no docs/en/docs/zh update needed — no new Option, no default-value change, this is an internal correctness fix restoring already-documented savepoint semantics.

3. Architectural Soundness

3.1 Elegance of the Solution

Unchanged: a narrowly-scoped, fully-additive fix that mirrors #10836's own persist-then-redrive pattern rather than inventing a new mechanism.

3.2 Maintainability

Unchanged from last round, plus one new, mechanical, and easily-explained wrinkle: the field-placement collision with #11458 described above. Once resolved (by keeping both fields), there is no lasting maintainability concern — this is a byproduct of two unrelated PRs both choosing to insert a field right after the same existing field, not a sign of any deeper design overlap.

3.3 Extensibility

Unchanged from prior review.

3.4 Historical-Version Compatibility

Unchanged: no checkpoint/savepoint state, serialized split format, or protocol field touched by this PR.

4. Issue Summary

# Issue Location Severity
1 (new) Real merge conflict with current dev: this PR and already-merged #11458 both insert a new field immediately after needRestore; must keep both fields (masterFailoverRestore from #11458 and redriveSavepointAfterRestore from this PR), not pick one JobMaster.java:185-209 Medium
2 (carryover, still open, non-blocking) Cascading double-failover window: a second master failover between the first restore's PENDING state and the redrive thread reaching RUNNING silently re-drops the savepoint a second time CoordinatorService.java restore path Medium
3 (carryover, still open, non-blocking) Retry loop's broad catch (Exception e) treats the documented precondition failure and an unexpected defect identically CoordinatorService.java redrive poll loop Low
4 (carryover, still open, non-blocking) Redrive borrows a second thread from the shared bounded executor for up to 5 minutes; undocumented in core-thread-num/max-thread-num config descriptions CoordinatorService.java thread pool usage Low

Issues 2-4 are carried over verbatim from my 2026-09-06 review — nothing about them has changed since the underlying redrive logic is unmodified. Issue 1 is new this round and is purely a consequence of dev moving, not a defect in this PR's own design.

5. Merge Recommendation

Conclusion: Ready to merge after fixes

  1. Blockers — must be fixed

    • Issue 1 (Medium): resolve the merge conflict with current dev by keeping both the masterFailoverRestore field (from #11458) and this PR's redriveSavepointAfterRestore field in JobMaster.java. This is a one-file, single-hunk, mechanical conflict — I verified with a real local merge that no other file conflicts. mergeable: false / mergeable_state: dirty on the current PR head confirms this must be resolved (rebase/merge dev again and push) before this can be merged; it cannot land as-is regardless of review outcome.
    • Issue #2 (cascading double-failover) from my prior review should at minimum be explicitly acknowledged in a doc comment if not closed outright — see my 09-06 review for the full reasoning; I don't consider it a hard blocker on its own (the failure mode remains no worse than pre-fix behavior), but combined with needing a new push anyway to fix Issue 1, it's a good opportunity to close or document it in the same round.
  2. Recommended fixes — non-blocking

    • Issue #3: narrow the retry loop's catch clause or add a distinguishing metric/counter.
    • Issue #4: document the extra-thread-per-redrive cost, or move the poll loop onto a lightweight dedicated scheduler.

CI status: the fork's Build run for the current head (a4f7682309eb) is still queued at review time — no result available yet. Given the confirmed merge conflict, I would not expect this PR to be mergeable regardless of that run's outcome until the conflict is resolved and re-pushed, which will also trigger a fresh CI run.

Overall: the redrive design itself remains sound and unchanged from my last review — this is not a re-litigation of the logic, just a status update now that dev has moved. The one new item is a trivial, well-understood field-placement conflict with an unrelated already-merged PR; once resolved (keep both fields) and CI is green, I'd be comfortable with this going to a write-capable maintainer for final approval, ideally after Issue #2 is at least documented.

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What Problem Does This PR Solve?

#10834 reports that a stop-with-savepoint request can get stuck "permanently, unable to complete" if a Zeta master failover happens while the savepoint is in flight. This PR adds a redrive mechanism so a job that was DOING_SAVEPOINT at the moment of failover gets its savepoint re-issued once it stabilizes back to RUNNING, closing a gap in the generic master-failover restore path (CoordinatorService#restoreJobFromMasterActiveSwitch), which otherwise just overwrites the job's state to PENDING and lets it redeploy as an ordinary running job with no memory that a savepoint was ever requested.

I re-checked the entire current head (54fb1249e5f) from scratch rather than trusting my 09-10 conclusion. Since that review, dev merged an unrelated PR (#11458, "Reuse fixed slots after master failover") and this branch was subsequently merged with dev (the one new commit since my last review: 54fb1249e5f, "Merge branch 'dev' into zeta-cancel-savepoint-failover-race") to pick that up and resolve the field-placement conflict I flagged last round.

1. Code Change Review

1.1 Core Logic Analysis

I compared the current PR's file-level diff (gh api pulls/12134/files) against what I reviewed on 09-10: it is still exactly the same 4 files with exactly the same line counts (CheckpointCoordinatorFailoverIT.java +306/-0, the new .conf +75/-0, CoordinatorService.java +134/-0, JobMaster.java +45/-0, all pure additions, zero deletions). No line of this PR's own logic has changed since my last review — only the merge-with-dev commit landed, so all of my prior runtime-path analysis (client → JobMaster#savePoint() → DOING_SAVEPOINT → master dies → restoreJobFromMasterActiveSwitch sets the redriveSavepointAfterRestore flag → runPendingJob consumes it concurrently with jobMaster.run() → 500ms-interval retry of savePoint() until RUNNING+ready or a 5-minute budget) still holds. I re-fetched JobMaster.java and CoordinatorService.java at the current head directly and re-traced the flag lifecycle (markRedriveSavepointAfterRestore/consumeRedriveSavepointAfterRestore, JobMaster.java:204-207 and surrounding methods) and the redrive poll loop (CoordinatorService.java:1226-1291) — byte-identical to what I traced on 09-10.

What I specifically verified this round is the merge-conflict resolution itself, since my prior review's one blocker was a confirmed real conflict with dev's #11458 (both PRs insert a new field immediately after JobMaster's pre-existing needRestore field). I fetched JobMaster.java at the current head directly and confirmed both fields are present side by side and both are still wired into their own, independent call sites:

JobMaster.java:186   private volatile boolean needRestore = true;            (pre-existing)
JobMaster.java:204   private volatile boolean redriveSavepointAfterRestore;  (this PR)
JobMaster.java:207   private volatile boolean masterFailoverRestore;         (#11458, already merged to dev)

masterFailoverRestore is still read/written independently at :253, :626, :765 (gating resource-slot reuse in preApplyResources()), and redriveSavepointAfterRestore still has its own independent mark/consume accessors at :1607-1627 (gating the savepoint-redrive poll loop) — confirming the two fields are genuinely orthogonal and the conflict was resolved the correct way (keep both), not by one clobbering the other. I also confirmed the PR's diff stats (0 deletions across all 4 files) mean nothing from the prior round's analysis was silently dropped during the merge.

1.2 Compatibility Impact

Unchanged from my prior review: fully compatible. No JobStatus enum change, no new field written to any IMap (the redrive flag lives purely on the in-heap JobMaster object, never serialized), no checkpoint/savepoint on-disk format change, no public API/SPI change. The diff remains 100% additive across all 4 files. A rolling upgrade where an old-code master fails over to this new-code master, or vice versa, is still safe for the same reason as before: the flag is local, in-process bookkeeping that doesn't need to survive across code versions.

1.3 Performance / Side-Effect Analysis

Unchanged from my prior review: the redrive task borrows a second thread from the same bounded CoordinatorService executor for up to 5 minutes per redriven job — a real but bounded/tunable consideration under a pinned max-thread-num, not a stability bug (rejection is caught and degrades gracefully, logged and dropped rather than blocking jobMaster.run()). No new unbounded collections, no leak, no new locks beyond the existing synchronized consume-once accessors.

1.4 Error Handling and Logging

No change since my prior review. My Issue #2 from 09-06/09-10 (the redrive loop's catch (Exception e) at CoordinatorService.java:1269 treats the documented TASK_NOT_ALL_READY_WHEN_SAVEPOINT precondition failure and any unexpected defect identically, both retried for up to 5 minutes with no distinguishing metric) remains open and was explicitly non-blocking both prior rounds.

2. Code Quality Assessment

2.1 Coding Standards

Unchanged: good — new fields/methods still carry Javadoc, including the block now sitting right next to the #11458 field (JobMaster.java:198-205), which is itself a clear "why" comment explaining the flag's lifecycle and consume-once semantics.

2.2 Test Coverage and Test Stability

Unchanged from my prior reviews: testStreamJobResolvesToSavepointDoneAfterMasterFailoverDuringSavepointShutdown (CheckpointCoordinatorFailoverIT.java:934-) still uses Awaitility-based polling against a white-box CheckpointCoordinator#pendingCheckpoints inspection (isSavepointGenuinelyMidShutdown, 10ms poll interval) to find the exact moment to kill the master, rather than a wall-clock sleep, and asserts the specific terminal state SAVEPOINT_DONE — correctly ruling out "silently resumed running" as a false-pass. I re-read the full test method at the current head and confirmed it's unchanged from what I reviewed previously.

CI verification this round (I actually pulled and read the fork's logs rather than only checking pass/fail): the fork's Build run for the current head (34688375049, against 54fb1249e5f) is well underway. I downloaded and grepped the engine-v2-it (8, ubuntu-latest) and engine-v2-it (11, ubuntu-latest) job logs directly (the module carrying this PR's new E2E test):

  • JDK 8: Tests run: 204, Failures: 0, Errors: 1, Skipped: 6 for the whole connector-seatunnel-e2e-base module; CheckpointCoordinatorFailoverIT itself reports Tests run: 5, Failures: 0, Errors: 0, Skipped: 0 — this PR's own test and the four pre-existing tests in the same file all pass cleanly. The one error in the module is SplitClusterFaultToleranceIT.testStreamJobCancelResolvesWhenWorkerCrashesBeforeCancelAck (ConditionTimeout), a different, pre-existing test class this PR does not touch.
  • JDK 11: CheckpointCoordinatorFailoverIT reports Tests run: 5, Failures: 1 — I traced the actual JUnit failure attribution and confirmed it is not this PR's new test: the failure is CheckpointCoordinatorFailoverIT.testStreamJobFailsAfterCheckpointTriggerDispatchFailure:840, a different, pre-existing test method in the same file (assertion: "Expected the job failure to be attributed to the checkpoint coordinator's CHECKPOINT_INSIDE_ERROR path... but got: CheckpointException: Checkpoint notify complete failed"). I confirmed via gh api pulls/12134/files that this PR has zero deletions in CheckpointCoordinatorFailoverIT.java, meaning no existing test method's logic was touched — this failing test predates this PR entirely and its race-condition-flavored assertion message ("expected X but got a different exception type from a similar failure path") reads as a pre-existing flake in code this PR doesn't modify, not a regression. This PR's own new test (testStreamJobResolvesToSavepointDoneAfterMasterFailoverDuringSavepointShutdown) is not named in either JDK's failure list, so it passed on both runs.
  • The other CI failures I found in this run (all-connectors-it-2/6/7, iceberg-connector-it, rocketmq-connector-it, paimon-connector-it) are all in connector modules this PR's 4-file diff (2 files in seatunnel-engine-server, 2 test files in connector-seatunnel-e2e-base) cannot reach — consistent with pre-existing/environmental flakes rather than anything caused by this change.

Stability rating: Stable for this PR's own test — deterministic condition-based waiting throughout (no fixed sleeps for the timing-sensitive kill-the-master step), and it passed on both JDK matrix legs of the one CI run I could actually inspect end-to-end. I'd flag the unrelated testStreamJobFailsAfterCheckpointTriggerDispatchFailure failure as worth a rerun/separate look by whoever owns that test, since I don't have visibility into whether it's a known flake, but it is not this PR's responsibility to fix and should not block this PR.

2.3 Documentation Updates

Unchanged: no docs/en/docs/zh update needed — no new Option, no default-value change, this is an internal correctness fix restoring already-documented savepoint semantics.

3. Architectural Soundness

3.1 Elegance of the Solution

Unchanged: a narrowly-scoped, fully-additive fix that mirrors the existing persist-then-redrive pattern rather than inventing a new mechanism.

3.2 Maintainability

Unchanged from my 09-06 review, and the one new wrinkle from 09-10 (the field-placement collision with #11458) is now cleanly resolved — both fields coexist with their own independent lifecycles and no lasting maintainability concern remains from that merge.

3.3 Extensibility

Unchanged from prior reviews.

3.4 Historical-Version Compatibility

Unchanged: no checkpoint/savepoint state, serialized split format, or protocol field touched by this PR.

4. Issue Summary

# Issue Location Severity
1 (carryover, still open, non-blocking) Cascading double-failover window: a second master failover between the first restore's PENDING state and the redrive thread reaching RUNNING can still silently re-drop the savepoint a second time CoordinatorService.java restore path (:1168-1186) Medium
2 (carryover, still open, non-blocking) Retry loop's broad catch (Exception e) treats the documented precondition failure and an unexpected defect identically CoordinatorService.java:1269, redrive poll loop Low
3 (carryover, still open, non-blocking) Redrive borrows a second thread from the shared bounded executor for up to 5 minutes; undocumented in core-thread-num/max-thread-num config descriptions CoordinatorService.java thread pool usage Low

My prior blocker (the merge conflict with dev's #11458 over the JobMaster.java field placement) is now resolved as of 54fb1249e5f and is not carried forward as an issue — see 1.1 for the verification.

5. Merge Recommendation

Conclusion: Ready to merge after fixes

  1. Blockers — must be fixed

    • None from my own analysis this round: the one blocker from my 09-10 review (the merge conflict) is resolved and verified. I'd still ask that Issue #1 (cascading double-failover) be at minimum explicitly acknowledged in a doc comment on markRedriveSavepointAfterRestore/redriveSavepointAfterMasterFailover if not closed outright, since as written the method's own Javadoc reads as if the fix is complete for every failover count — but I'm not making this a hard blocker given the failure mode remains no worse than pre-fix behavior (job keeps running normally) and it requires a second failover in a narrow timing window to trigger.
  2. Recommended fixes — non-blocking

    • Issue #2: narrow the retry loop's catch clause or add a distinguishing metric/counter so an unexpected exception type doesn't hide behind the expected "not ready yet" case for up to 5 minutes.
    • Issue #3: document the extra-thread-per-redrive cost in the core-thread-num/max-thread-num config descriptions, or move the poll loop onto a lightweight dedicated scheduler so it never competes with job-running threads for the same bounded pool.

CI status: the fork's current Build run (34688375049, against 54fb1249e5f) has the module carrying this PR's new test (engine-v2-it) completed on both JDK 8 and JDK 11, and I directly verified from the raw logs that this PR's own regression test passes cleanly on both. The two engine-v2-it job-level failures come from a different, pre-existing test method this PR does not touch. Several other connector-module *-it jobs also failed in this same run, but none of them touch any file in this PR's 4-file diff. I did not exhaustively verify every one of those is a known flake, but by file-path reachability alone none of them can be attributed to this change. mergeable/mergeStateStatus briefly returned UNKNOWN while GitHub recomputes it right after the merge commit landed; the prior confirmed state (before this round) was MERGEABLE/ahead_by:3, behind_by:2 against dev, consistent with a clean, up-to-date merge.

Overall: the redrive design itself remains sound and unchanged in substance from my first review of it — this round was a genuine re-verification (full diff re-read, fresh worktree/branch created from the exact head SHA, merge-conflict resolution independently confirmed by reading the resulting source, and CI logs actually pulled and attributed rather than trusted at face value) rather than a rubber-stamp. With the merge conflict resolved and this PR's own test confirmed green on both JDK legs, I'd be comfortable with this going to a write-capable maintainer for final approval, ideally after Issue #1 is at least documented.

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What Problem Does This PR Solve?

#10834 reports that a stop-with-savepoint request can get stuck "permanently, unable to complete" if a Zeta master failover happens while the savepoint is in flight. This PR adds a redrive mechanism so a job that was DOING_SAVEPOINT at the moment of failover gets its savepoint re-issued once it stabilizes back to RUNNING, closing a gap in the generic master-failover restore path (CoordinatorService#restoreJobFromMasterActiveSwitch), which otherwise just overwrites the job's state to PENDING and lets it redeploy as an ordinary running job with no memory that a savepoint was ever requested.

This is my fourth pass on this PR. I re-checked the entire current head (f57ce8d40ffe) from scratch — including independently re-deriving the core race and re-verifying the code myself rather than trusting my own prior three rounds' conclusions — since this is exactly the kind of master-failover-during-shutdown recovery-path fix that warrants the strictest re-verification every time the head moves, per this project's own checkpoint/recovery review standard.

1. Code Change Review

1.1 Core Logic Analysis

What changed since my 09-13 review (head 54fb1249e5f): one new commit, another routine Merge branch 'dev'. I verified this the same way as the prior two rounds — not by trusting the commit message, but by diffing the PR's actual logical content: git diff <merge-base-with-dev> <current-head> -- <this PR's 4 files> reports exactly the same 4 files with exactly the same insertion counts as every prior round (CheckpointCoordinatorFailoverIT.java +306, the new .conf +75, CoordinatorService.java +134, JobMaster.java +45, zero deletions across all four). The raw two-head diff shows ~141 unrelated files changed, but every one of them is dev's own churn (new connectors, unrelated engine changes to TaskExecutionService.java/TaskGroupContext.java, transform changes, etc.) pulled in by the merge — including, this round, three lines touching CoordinatorService.java itself. I checked that specific overlap directly: git show <head>:.../CoordinatorService.java | grep -n '<<<<<<<\|=======\|>>>>>>>' finds no leftover conflict markers, and the file's redriveSavepointAfterMasterFailover method and the markRedriveSavepointAfterRestore() call site are byte-identical to what I traced in my last three reviews — the incoming dev hunk landed in a non-overlapping part of the file.

I independently re-traced the full mechanism from the current source rather than re-reading my own prior write-up, and it matches what I found before:

Client -> JobMaster#savePoint() -> PhysicalPlan#savepointJob() -> updateJobState(DOING_SAVEPOINT)  (persisted, IMap)
       -> CheckpointManager#triggerSavePointsAndWaitComplete() -> CheckpointCoordinator#startSavepoint()

--- master dies before the savepoint checkpoint is fully acknowledged ---

New master: CoordinatorService#restoreJobFromMasterActiveSwitch(jobId, jobInfo)     CoordinatorService.java:1119-1197
  -> jobState = runningJobStateIMap.get(jobId)  == JobStatus.DOING_SAVEPOINT
  -> new JobMaster(...); jobMaster.init(..., true)
  -> if (jobState == DOING_SAVEPOINT) jobMaster.markRedriveSavepointAfterRestore()          :1168-1180
  -> pendingJobQueue.put(pendingJobInfo)                                                    :1190-1195
  -> jobMaster.getPhysicalPlan().updateJobState(JobStatus.PENDING)                           :1196   <- same call, same thread,
                                                                                                          immediately after enqueueing

CoordinatorService's pending-queue consumer (runPendingJob, a pool worker):                 :481-508
  -> jobStatus read from runningJobStateIMap (already PENDING by the time this runs)
  -> if (jobMaster.consumeRedriveSavepointAfterRestore()) redriveSavepointAfterMasterFailover(...)   :499-501  (async, own thread)
  -> jobMaster.run()   (blocks this worker until the job reaches a terminal state)

redriveSavepointAfterMasterFailover (background task, its own thread, 500ms poll, 5-minute budget):  :1226-1291
  -> status.isEndState() -> give up
  -> status == RUNNING -> jobMaster.savePoint().get(); on TASK_NOT_ALL_READY_WHEN_SAVEPOINT
     (isAllTaskReady still false until every task independently re-reports READY_START), retry
  -> success -> job resolves to JobStatus.SAVEPOINT_DONE

I specifically re-derived, from the source and not from memory of my prior conclusion, the one open gap I flagged in rounds 2 and 3 (the cascading-double-failover window), to confirm it is still real and unchanged: the persisted job status transitions DOING_SAVEPOINT -> PENDING at CoordinatorService.java:1196, in the same restoreJobFromMasterActiveSwitch call, on the same master, immediately after the job is handed to the pending queue — well before any pool worker has even picked it up to call consumeRedriveSavepointAfterRestore(), let alone before the redrive thread's 500ms-interval loop has observed RUNNING. If a second master failover lands anywhere in the window between that updateJobState(PENDING) write and the redrive thread's own successful savePoint() call re-arming DOING_SAVEPOINT (i.e., while the persisted status is PENDING/SCHEDULED/DEPLOYING, which can span the time for every subtask to redeploy and report READY_START, not always negligible for a large pipeline), the next master's restoreJobFromMasterActiveSwitch reads a status that is neither DOING_SAVEPOINT nor an end state — so it does not call markRedriveSavepointAfterRestore(), and the original client's savepoint intent is silently and permanently dropped a second time, reproducing the exact #10834 symptom this PR exists to fix, just in a narrower, second-order scenario. I traced this myself end-to-end against the current source (not by re-quoting my earlier finding) and confirm it is unchanged and still open.

Critically, this gap is not a regression this PR introduces — before this PR, every single-failover-during-savepoint case hit this bug; after this PR, only a second failover landing in this specific sub-window still does. The failure mode also remains no worse than pre-fix behavior in the failing case: the job keeps running and checkpointing normally, it just doesn't complete the originally-requested savepoint. I looked specifically, per this round's brief, for whether the fix could introduce a new kind of race (a double-redrive, a lost update in the other direction, or the same savepoint being redriven twice across two masters) and found none: consumeRedriveSavepointAfterRestore() is synchronized and consume-once, each failover constructs a brand-new JobMaster object (so there is no shared mutable state across masters that could double-fire), and a genuinely successful redrive transitions the job to SAVEPOINT_DONE (a terminal state), which the next failover's restore path already special-cases via jobState.isEndState() at the top of restoreJobFromMasterActiveSwitch — so a completed savepoint can never be "re-redriven." The only failure mode is the one-directional "lost intent" window described above, not a duplicate-action one.

1.2 Compatibility Impact

Fully compatible, unchanged across all four of my reviews: no JobStatus enum change, no new field written to any IMap (the redrive flag lives purely on the in-heap JobMaster object, never serialized), no checkpoint/savepoint on-disk format change, no public API/SPI change. The diff remains 100% additive (0 deletions across all 4 files, confirmed again this round). A rolling upgrade where an old-code master fails over to a new-code master, or vice versa, remains safe for the same reason as before: the flag is local, in-process bookkeeping with no cross-version persistence requirement.

1.3 Performance / Side-Effect Analysis

Unchanged from my prior three reviews: the redrive task borrows a second thread from the same bounded CoordinatorService executor for up to 5 minutes per redriven job — a real, bounded, tunable consideration under a pinned max-thread-num (not the default, which is unbounded), and rejection degrades gracefully (logged and dropped, does not block jobMaster.run()). No new unbounded collections, no leak, no new locks beyond the pre-existing synchronized consume-once accessors. At the scale this review process holds Zeta to (trillions of records/day, single jobs up to tens of billions of rows), none of this logic sits anywhere near the per-record path — it is a control-plane-only mechanism gated on a job-level status transition, so its cost is independent of data volume.

1.4 Error Handling and Logging

No change since my prior reviews. My carryover Issue #2 (CoordinatorService.java:1269, the redrive loop's broad catch (Exception e) treats the documented TASK_NOT_ALL_READY_WHEN_SAVEPOINT precondition failure and any unexpected defect identically, both retried for up to 5 minutes with no distinguishing metric) remains open, unchanged, and was explicitly non-blocking in all three prior rounds.

2. Code Quality Assessment

2.1 Coding Standards

Unchanged: good. New fields/methods carry Javadoc explaining lifecycle and why (the redriveSavepointAfterRestore field's doc block in particular is a clear, complete "why" comment, not a restatement of the field name), consistent across all four heads I've reviewed.

2.2 Test Coverage and Test Stability

Unchanged in substance from my prior reviews: testStreamJobResolvesToSavepointDoneAfterMasterFailoverDuringSavepointShutdown uses Awaitility-based polling against a white-box CheckpointCoordinator#pendingCheckpoints inspection (isSavepointGenuinelyMidShutdown, 10ms poll interval) to find the exact moment a savepoint checkpoint has been dispatched but not yet acknowledged, then kills the master at that instant — not a wall-clock sleep approximating the race — and asserts the specific terminal state SAVEPOINT_DONE, correctly ruling out "silently resumed running" as a false pass.

CI verification this round, done directly against the current head rather than assumed from the prior round's result: the fork's Build run for f57ce8d40ffe (DanielLeens/seatunnel run 34763499015) was still completing its matrix at review time (48/93 jobs done, 4 in progress, 41 queued — a long-running matrix, not a stuck run). I pulled the actual log for the one completed, PR-relevant job that failed on this leg, engine-v2-it (8, ubuntu-latest) (job 103749718317), rather than treating "failure" as sufficient: Tests run: 5, Failures: 0, Errors: 0, Skipped: 0 for CheckpointCoordinatorFailoverIT specifically — this PR's own new test and all four pre-existing tests in the same file pass cleanly. The job-level failure is attributable to a single, unrelated test in the same module, BackpressureSlowSinkIT.testCheckpointsKeepCompletingUnderSustainedBackpressure (AssertionFailedError: expected at least 3 additional checkpoints to complete during the 90s sustained backpressure window, only observed 1) — a timing/throughput-sensitive assertion in a class this PR does not touch, reading as CI-load-sensitive rather than anything caused by this diff. The JDK 11 leg of engine-v2-it was still in progress; I did not wait for it to finish given the number of still-queued jobs, but the JDK 8 leg's direct confirmation that this PR's own test suite is green is consistent with every prior round's finding.

Stability rating: Stable. Deterministic condition-based waiting throughout (no fixed sleeps for the timing-sensitive kill-the-master step), confirmed passing on this exact head's JDK 8 leg by reading the actual test-runner output, not just the job-level conclusion.

2.3 Documentation Updates

Unchanged: no docs/en/docs/zh update needed — no new Option, no default-value change, this is an internal correctness fix restoring already-documented savepoint semantics.

3. Architectural Soundness

3.1 Elegance of the Solution

Unchanged: a narrowly-scoped, fully-additive fix that mirrors the project's existing persist-then-redrive pattern (the same shape as #10836's own fix for the batch/cancel scenarios) rather than inventing a new mechanism.

3.2 Maintainability

Unchanged from my 09-13 review: good, and the field-placement conflict with #11458 that I flagged and tracked through rounds 2-3 remains cleanly resolved (both masterFailoverRestore and redriveSavepointAfterRestore coexist with independent lifecycles, re-confirmed present and independently wired at their respective call sites this round).

3.3 Extensibility

Unchanged from prior reviews.

3.4 Historical-Version Compatibility

Unchanged: no checkpoint/savepoint state, serialized split format, or protocol field touched by this PR, including by this round's merge commit.

4. Issue Summary

# Issue Location Severity
1 (carryover, still open, non-blocking, independently re-derived this round) Cascading double-failover window: a second master failover between the first restore's PENDING write and the redrive thread reaching RUNNING+ready can still silently re-drop the savepoint a second time CoordinatorService.java:1168-1197 (restore path) Medium
2 (carryover, still open, non-blocking) Retry loop's broad catch (Exception e) treats the documented precondition failure and an unexpected defect identically CoordinatorService.java:1269, redrive poll loop Low
3 (carryover, still open, non-blocking) Redrive borrows a second thread from the shared bounded executor for up to 5 minutes; undocumented in core-thread-num/max-thread-num config descriptions CoordinatorService.java thread pool usage Low

All three issues are unchanged from my 09-10/09-13 rounds — nothing about the PR's own logic changed this round, only another dev sync landed.

5. Merge Recommendation

Conclusion: Ready to merge after fixes

  1. Blockers — must be fixed: none from source correctness — the merge-conflict blocker from my 09-10 round is resolved and re-confirmed stable across two subsequent dev syncs. I would still ask that Issue #1 (cascading double-failover) be at minimum explicitly acknowledged in the Javadoc on markRedriveSavepointAfterRestore/redriveSavepointAfterMasterFailover, which currently reads as if the fix is complete for any number of failovers — but per my prior three rounds, I am not treating this as a hard blocker given the failure mode is strictly no worse than pre-fix behavior and requires a second failover in a narrow timing window to trigger.
  2. Recommended fixes — non-blocking: Issue #2 (narrow the retry loop's catch clause or add a distinguishing metric), Issue #3 (document the extra-thread cost or move the poll loop to a dedicated lightweight scheduler).

CI status: current head f57ce8d40ffe's fork run (34763499015) was still in progress at review time (48/93 jobs complete). I directly confirmed, from the actual test-runner log rather than the job-level pass/fail alone, that this PR's own regression test (CheckpointCoordinatorFailoverIT, all 5 tests) passes cleanly on the completed JDK 8 engine-v2-it leg; that job's overall failure is attributable to an unrelated, pre-existing test (BackpressureSlowSinkIT) this PR does not touch. mergeable: MERGEABLE, mergeStateStatus: BLOCKED reflects pending required review, not a conflict.

Overall: four rounds in, the redrive design itself has not changed and remains sound — this round's job was to confirm that neither dev's continued movement nor the passage of time introduced anything new, and to independently re-derive (not just re-cite) the one known residual gap. Both hold: the merge is a clean no-op for this PR's own logic, and the cascading-double-failover window is unchanged, still narrow, and still no worse than the bug this PR fixes. I'd be comfortable with this going to a write-capable maintainer for final approval once the current CI run finishes green, ideally with Issue #1 documented in the same round.

…savepoint redrive

Javadoc-only follow-up to review Issue #1 on this PR: the redrive covers a single master failover during an in-flight savepoint, but a second failover landing after restoreJobFromMasterActiveSwitch has re-persisted the job as PENDING/RUNNING and before the redriven savePoint() has re-persisted DOING_SAVEPOINT will drop the request again, because the redrive flag lives only on the in-heap JobMaster. Acknowledge this on markRedriveSavepointAfterRestore and redriveSavepointAfterMasterFailover, note the shared-executor thread cost, and leave persisting the redrive intent itself as the follow-up. No executable code changed.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@DanielLeens

Copy link
Copy Markdown
Contributor Author

Per the 2026-09-14 review's Issue #1: added a Javadoc-only acknowledgement of the cascading double-failover limitation on JobMaster#markRedriveSavepointAfterRestore() and CoordinatorService#redriveSavepointAfterMasterFailover(...) in 8844f46.

The new paragraphs state that the redrive covers a single master failover during an in-flight savepoint: a second failover landing after restoreJobFromMasterActiveSwitch has re-persisted the job as PENDING/RUNNING but before the redriven savePoint() has re-persisted DOING_SAVEPOINT drops the request again, because the redrive flag lives only on the in-heap JobMaster. That window is narrow and no worse than the pre-fix behavior, and is left as a documented limitation rather than extended here; persisting the redrive intent itself would be the follow-up. The CoordinatorService Javadoc also notes the shared-executor thread cost (Issue #3).

No executable code changed; the diff is 16 inserted comment lines across the two files, spotless-applied.

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What Problem Does This PR Solve?

  • User pain point: when the Zeta master fails over while a job's savepoint is in flight, the in-flight savepoint request can be silently dropped — the job resumes as RUNNING, but the caller who asked for a savepoint gets no result and no error, and no savepoint is ever produced for that request.
  • Fix approach: CoordinatorService/JobMaster now detect this case during master-failover restore and redrive (re-issue) the dropped savepoint on a shared executor thread once the restored job reaches a ready state, using an in-heap flag (markRedriveSavepointAfterRestore) to remember that a redrive is owed.
  • One-sentence summary: this is a re-review of the new head after my 2026-09-14 round — the single new commit is a documentation-only Javadoc addition closing the one open (non-blocking) ask from that round, verified independently rather than taken on the author's word.

Re-review note: I independently diffed the new commit (8844f46b) against the previously-reviewed head (f57ce8d40ff) via git diff/GitHub compare rather than relying on the PR's own commit message. The diff touches exactly two files, CoordinatorService.java and JobMaster.java, both additions-only (9 and 7 lines respectively, 0 deletions) — pure Javadoc paragraphs added to redriveSavepointAfterMasterFailover's Javadoc block and JobMaster#markRedriveSavepointAfterRestore()'s Javadoc block. No executable code changed. This matches the diff I confirm holds against the actual GitHub API comparison of the two commits.

1. Code Change Review

1.1 Core Logic Analysis

No production logic changed in this round; my 2026-09-14 core-logic analysis (four rounds deep, re-derived independently each time against dev's continued movement) stands unchanged: CoordinatorService.restoreJobFromMasterActiveSwitch() is the only caller that can set the redrive flag, and redriveSavepointAfterMasterFailover(...) is the only consumer, invoked once the restored JobMaster reaches a ready state, borrowing one thread from the shared bounded executor for up to REDRIVE_SAVEPOINT_WAIT_MILLIS.

The new Javadoc, added specifically in response to my 2026-09-14 Issue #1, now explicitly documents the residual limitation I flagged: the redrive covers exactly one master failover during an in-flight savepoint. A second failover landing after restoreJobFromMasterActiveSwitch has re-persisted the job as PENDING/RUNNING but before the redriven savePoint() call has re-persisted DOING_SAVEPOINT will drop the request again, because the redrive intent lives only on the in-heap JobMaster and is not itself persisted. I re-confirm this window is narrow (requires a second failover racing a specific sub-window of the redrive's own execution) and is strictly no worse than the pre-fix behavior (where every failover during a savepoint dropped the request, not just a second one racing the redrive) — so documenting it as a known limitation, rather than extending the fix to cover it now, is a reasonable scoping choice for this PR.

1.2 Compatibility Impact

Unchanged from 2026-09-14: fully compatible. Javadoc-only changes in this round have no runtime effect whatsoever.

1.3 Performance / Side-Effect Analysis

Unchanged from 2026-09-14: no effect, this round is comments-only.

1.4 Error Handling and Logging

Unchanged from 2026-09-14.

2. Code Quality Assessment

2.1 Coding Standards

The new Javadoc is clear, explains the why and the exact precondition for the residual gap (not just "there's a limitation"), and correctly cross-references the two affected methods (CoordinatorService#redriveSavepointAfterMasterFailover, JobMaster#markRedriveSavepointAfterRestore) from each other. This is exactly the kind of documentation this project's own review policy asks for on a lifecycle/lock-ordering-adjacent method.

2.2 Test Coverage and Test Stability

Unchanged from 2026-09-14: CheckpointCoordinatorFailoverIT (5 tests) remains the regression coverage for this PR's core scenario; I previously confirmed via the actual CI log (not just job-level pass/fail) that all 5 tests pass on a completed engine-v2-it leg. No test code changed in this round. Stability rating: Stable (carried over from 2026-09-14 assessment; no new test-code changes to re-assess).

2.3 Documentation Updates

This round's change is the documentation update — Issue #1's ask is satisfied by this commit.

3. Architectural Soundness

3.1 Elegance of the Solution

Unchanged from 2026-09-14: a precise fix for the single-failover case, now honestly scoped in its own Javadoc rather than reading as if it handles an arbitrary number of failovers.

3.2 Maintainability

Improved by this round: the next engineer touching either method now has the cascading-failover edge case spelled out in the Javadoc itself instead of needing to reconstruct it from the PR history or a review thread.

3.3 Extensibility

Unchanged from 2026-09-14: persisting the redrive intent (rather than keeping it in-heap only) is correctly identified in the new Javadoc as the natural follow-up if the documented window ever needs closing.

3.4 Historical-Version Compatibility

Unchanged from 2026-09-14: no persisted state, protocol, or serialization format touched at any point across all four rounds of this PR.

4. Issue Summary

# Issue Location Severity
1 (from 2026-09-14, now resolved via documentation in this commit) Cascading double-failover window: a second master failover between the first restore's PENDING write and the redrive thread reaching RUNNING+ready can still silently re-drop the savepoint a second time CoordinatorService.java, JobMaster.java (Javadoc on redriveSavepointAfterMasterFailover/markRedriveSavepointAfterRestore) Low (documented limitation, not a blocker)
2 (carryover, still open, non-blocking) Retry loop's broad catch (Exception e) treats the documented precondition failure and an unexpected defect identically CoordinatorService.java, redrive poll loop Low
3 (carryover, still open, non-blocking) Redrive borrows a second thread from the shared bounded executor for up to 5 minutes; undocumented in core-thread-num/max-thread-num config descriptions CoordinatorService.java thread pool usage Low

5. Merge Recommendation

Conclusion: Ready to merge

  1. Blockers — must be fixed

    • None. All four rounds of review found no source-correctness blocker; the one open ask from 2026-09-14 (documenting the cascading-double-failover limitation) is closed by this commit.
  2. Recommended fixes — non-blocking

    • Issue #2: narrow the retry loop's catch clause or add a distinguishing metric between the documented precondition failure and an unexpected defect.
    • Issue #3: document the extra shared-executor-thread cost in the relevant core-thread-num/max-thread-num config descriptions.

Overall assessment: five rounds in (four full reviews plus this documentation-only follow-up), the redrive design has been independently re-derived against dev's continued movement each time and has held up consistently — the core fix is sound, its regression test passes on the real CI log, and the one residual gap is now honestly documented rather than silently left implicit. I'm upgrading my conclusion from "ready to merge after fixes" to a clean "ready to merge" now that the documentation ask is satisfied; the two remaining Low items are genuinely optional polish, not conditions for merge.

CI status: the apache-side Build check on the current head (8844f46b61d) is in_progress at review time. Since this round's diff is Javadoc-only, I would not expect the CI outcome to differ from the 2026-09-14 run other than by the normal variance already characterized in my prior rounds (that round's only failure was the pre-existing, unrelated BackpressureSlowSinkIT test on the JDK 8 engine-v2-it leg, not anything this PR touches). mergeable: MERGEABLE, mergeStateStatus: BLOCKED continues to reflect pending required review, not a conflict. I'd suggest routing this to a write-capable maintainer for final approval once the current run completes green.

… trigger-dispatch test

This PR's testStreamJobFailsAfterCheckpointTriggerDispatchFailure is a
separate copy of the same test independently added in apache#12288, and hits the
identical flake there: CheckpointManager#sendOperationToMemberNode is used
by both triggerCheckpoint's barrier dispatch and notifyCompleted's
post-completion notify, so the removed ownedSlotProfilesIMap entry can
surface via either call depending on scheduling timing once checkpoint id
1 has already been acknowledged. Both paths detect the same injected fault
and both correctly fail the job through handleCoordinatorError; only the
intermediate CheckpointCloseReason label differs, so asserting on only one
of them is flaky on nothing but timing.

Widen the assertion to accept CHECKPOINT_INSIDE_ERROR or
CHECKPOINT_NOTIFY_COMPLETE_FAILED, matching the interim fix already applied
in apache#12288 before that PR's later, fully deterministic fix (which instead
injects the fault right after checkpoint 1 completes, via a new
CheckpointCoordinator#getLatestCompletedCheckpointId() observability
method). That deterministic approach needs a src/main/java addition to the
engine and is out of scope for this PR, which is otherwise about the
cancel/savepoint-failover race; this test-only widening removes the flake
without touching production code.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@DanielLeens

Copy link
Copy Markdown
Contributor Author

Pushed 872701e: this PR's own CheckpointCoordinatorFailoverIT#testStreamJobFailsAfterCheckpointTriggerDispatchFailure hits the identical harmless race independently found and fixed in #12288 — CheckpointManager#sendOperationToMemberNode backs both the barrier-dispatch and the post-completion notify call, so the injected fault can surface via either path depending on scheduling. Widened the assertion to accept both CHECKPOINT_INSIDE_ERROR and CHECKPOINT_NOTIFY_COMPLETE_FAILED, same as #12288's interim fix. Note: #12288 later replaced that with a fully deterministic fix backed by a new CheckpointCoordinator#getLatestCompletedCheckpointId() src/main method — porting that here would mean duplicating an engine-side change into a PR that's otherwise about the cancel/savepoint-failover race, so I left it at the test-only widening pending a decision on whether to do that instead.

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What Problem Does This PR Solve?

  • User pain point: when the Zeta master fails over while a job's savepoint is in flight, the
    in-flight savepoint request can be silently and permanently dropped — the job just resumes
    RUNNING and keeps checkpointing normally, with no error and no savepoint ever produced for the
    caller's original request.
  • Fix approach: CoordinatorService/JobMaster now detect this specific case during
    master-failover restore and redrive (re-issue) the dropped savepoint on a shared executor thread
    once the restored job stabilizes back to RUNNING.
  • One-sentence summary: this is round six of review on this PR — my last round (2026-09-15)
    concluded "Ready to merge," but one new commit has landed since then that reopens the merge
    question, so this is a genuine re-review of the full current head, not a rubber stamp of my own
    prior conclusion.

1. Code Change Review

1.1 Core Logic Analysis

The redrive fix itself is unchanged since my last review and remains sound. I re-verified
CoordinatorService.java and JobMaster.java are byte-identical to the heads I traced in my
2026-09-14/09-15 rounds: the redriveSavepointAfterRestore flag lifecycle
(markRedriveSavepointAfterRestore()/consumeRedriveSavepointAfterRestore()), the restore-time
flag-setting, and the redriveSavepointAfterMasterFailover() poll loop all read the same as
before. I'm not re-litigating that logic here; see my prior rounds for the full runtime-path trace
if you're catching up on this thread for the first time.

What's new is a single commit that touches test code only: 872701ec8 widens
testStreamJobFailsAfterCheckpointTriggerDispatchFailure's assertion to accept either
CheckpointCloseReason.CHECKPOINT_INSIDE_ERROR or CHECKPOINT_NOTIFY_COMPLETE_FAILED. Two
important facts about this test method that are easy to miss: (1) it is not this PR's own
test
— it was added to dev by a separate, already-merged PR and picked up here through one of
the many dev merges on this branch, and (2) this is the first commit in six rounds of review
that touches an existing test method's assertion rather than adding purely new code.

I independently checked the technical claim behind the widening (that both CheckpointCloseReason
values are reachable from the same injected fault) and confirmed it's correct:
CheckpointManager#sendOperationToMemberNode is the shared dispatch primitive used by both
triggerCheckpoint's barrier dispatch (→ CHECKPOINT_INSIDE_ERROR on failure) and
notifyCheckpointCompleted/notifyCheckpointEnd's post-completion notify (→
CHECKPOINT_NOTIFY_COMPLETE_FAILED on failure). So the race is real, not imagined.

However, this exact fix has already been tried and reverted elsewhere for a good reason.
apache/seatunnel#12288 (still open) hit the identical race on the identical test method and
initially applied the identical "accept either reason" widening. A reviewer there correctly
pointed out that this widening lets the test pass without ever exercising the specific
barrier-dispatch regression it exists to guard, since the notify-complete path is a different,
pre-existing code path that this test was never meant to validate. #12288 has since reverted to
the original single-reason assertion and instead added a small, purpose-built
@VisibleForTesting CheckpointCoordinator#getLatestCompletedCheckpointId() method so the test can
deterministically wait for checkpoint 1's actual completion before injecting the fault — closing
the race without weakening what the test proves. I checked dev's current state directly and
confirmed that fix hasn't landed there yet, so this PR isn't picking up an already-established
convention; it's independently reintroducing a pattern the community already found insufficient on
a closely related PR.

This PR's own commit message is upfront about knowing of the deterministic alternative and
choosing not to port it "out of scope" — I appreciate the transparency, but I don't think this is
the right tradeoff for a test that guards checkpoint/failover correctness in the engine.

1.2 Compatibility Impact

Fully compatible. No JobStatus enum change, no new field written to any IMap, no
checkpoint/savepoint on-disk format change, no public API/SPI change. Unchanged from all prior
rounds — the new commit is test-only.

1.3 Performance / Side-Effect Analysis

Unchanged from my prior rounds: the redrive task borrows a second thread from the shared bounded
CoordinatorService executor for up to 5 minutes per redriven job — bounded, tunable, and
rejection degrades gracefully. No new unbounded collections, no leak. This round's commit has zero
production-code footprint.

1.4 Error Handling and Logging

Unchanged. My carryover Issue #2 (below) remains open and non-blocking.

Issue 1

  • Location: seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/java/org/apache/seatunnel/engine/e2e/CheckpointCoordinatorFailoverIT.java, testStreamJobFailsAfterCheckpointTriggerDispatchFailure (assertion around the jobResult.getError().contains(...) check, added in commit 872701ec8d8)
  • Problem description: This widens the assertion on a pre-existing (not authored by this PR) regression-guard test to accept either CHECKPOINT_INSIDE_ERROR or CHECKPOINT_NOTIFY_COMPLETE_FAILED. Both are reachable from the same injected fault because CheckpointManager#sendOperationToMemberNode backs both the barrier-dispatch and the post-completion-notify call sites — that part is correct. The problem is that this makes the test pass regardless of which path actually fired, so it can no longer specifically prove that the barrier-dispatch synchronous-catch behavior this test exists to guard is working — it can pass purely because the pre-existing, always-working notify-complete-error path happened to fire instead.
  • Potential risk: A future regression that breaks the barrier-dispatch synchronous-catch path specifically (the thing this test was written to protect) could go undetected, because the test can still pass via the unrelated notify-complete path. This is exactly the coverage gap an independent reviewer already caught on #12288 for the identical widening on the identical test, which was subsequently reverted there in favor of a deterministic fix.
  • Best improvement: Option A (preferred): port #12288's small CheckpointCoordinator#getLatestCompletedCheckpointId() @VisibleForTesting addition and its updated fault-injection timing so the test again asserts only CHECKPOINT_INSIDE_ERROR with the race closed deterministically — a few lines in CheckpointCoordinator.java plus the corresponding test update. Option B: if you'd rather keep this PR's diff free of any src/main change, please at least don't merge this widening as-is; consider leaving this pre-existing test untouched by this PR entirely and letting #12288 (which already owns the correct fix) resolve it, so this PR doesn't reintroduce a known-superseded pattern into dev.
  • Severity: High
  • Raised by another reviewer: No (on this PR) — but this is the same issue an independent reviewer raised on #12288's identical widening of the same test method; I'm treating that prior, validated community finding as directly applicable here rather than re-discovering it from scratch.

Issue 2 (carryover, unchanged, non-blocking)

  • Location: seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java:1281 (inside redriveSavepointAfterMasterFailover's retry loop)
  • Problem description: catch (Exception e) treats the documented TASK_NOT_ALL_READY_WHEN_SAVEPOINT precondition failure and any unexpected defect identically, both silently retried for up to 5 minutes.
  • Potential risk: Slower detection of a genuine defect in production; not a data-safety issue.
  • Best improvement: Narrow the catch to the expected precondition type, or add a counter/metric that distinguishes "still not ready" from "unexpected exception."
  • Severity: Low
  • Raised by another reviewer: No

Issue 3 (carryover, unchanged, non-blocking)

  • Location: CoordinatorService.java (redrive thread-pool usage, REDRIVE_SAVEPOINT_WAIT_MILLIS)
  • Problem description: The redrive task borrows a second thread from the shared bounded executor for up to 5 minutes per redriven job; this cost isn't documented in the core-thread-num/max-thread-num config descriptions.
  • Potential risk: Reduced redrive reliability specifically under tuned, resource-constrained deployments (default unbounded pool is unaffected).
  • Best improvement: Document the extra-thread cost in the relevant config option descriptions, or move the poll loop onto a lightweight dedicated scheduler.
  • Severity: Low
  • Raised by another reviewer: No

2. Code Quality Assessment

2.1 Coding Standards

The new class-javadoc addition explaining the race is clear and well-reasoned. One thing worth a
second look: the continuation-line indentation around the new ||-chained assertion looks slightly
inconsistent with this file's usual Google-Java-Format style. I haven't run spotless:apply myself
to confirm, so treat this as a "please double-check" rather than a confirmed violation.

2.2 Test Coverage and Test Stability

No new tests added this round; one existing (non-PR-authored) test modified — see Issue 1 above,
which is fundamentally a coverage/verification-strength concern rather than a flakiness one.

Mandatory stability rating (flakiness axis only): Stable. From a pure "will this cause
intermittent CI red" perspective, the widened assertion is, if anything, less likely to fail
spuriously going forward, since it now tolerates either outcome of the underlying race. I want to
be precise that this rating is orthogonal to Issue 1: a test can be perfectly deterministic and
still not be checking what it claims to check. Evidence: I pulled the actual CI log for
engine-v2-it (8, ubuntu-latest) on this head and confirmed CheckpointCoordinatorFailoverIT
reports Tests run: 5, Failures: 0, Errors: 0, Skipped: 0 — this test and its four siblings all
pass cleanly.

2.3 Documentation Updates

No docs/en/docs/zh update needed — internal correctness fix, no new Option, no default-value
change.

3. Architectural Soundness

3.1 Elegance of the Solution

The core redrive mechanism (unchanged this round) remains a precise, narrowly-scoped fix. The new
commit, in isolation, is a workaround rather than a fix — it papers over a race instead of removing
it, where a small, already-designed-and-reviewed deterministic alternative exists.

3.2 Maintainability

Unchanged for the core fix. The new commit slightly reduces maintainability of the test suite: a
future reader diffing dev against #12288 (once merged) will find the same test method resolved
two different ways in two different PRs unless this gets reconciled.

3.3 Extensibility

Unchanged from prior rounds.

3.4 Historical-Version Compatibility

Unchanged: no persisted state, protocol, or serialization format touched by this PR at any point
across all six rounds.

4. Issue Summary

# Issue Location Severity
1 (new this round) Widened either-reason assertion on a pre-existing test reintroduces a coverage gap already identified and reverted on the near-identical widening in #12288 CheckpointCoordinatorFailoverIT.java, testStreamJobFailsAfterCheckpointTriggerDispatchFailure High
2 (carryover, non-blocking) Retry loop's broad catch (Exception e) treats the documented precondition failure and an unexpected defect identically CoordinatorService.java:1281 Low
3 (carryover, non-blocking) Redrive borrows a second shared-executor thread for up to 5 minutes; undocumented in thread-pool config descriptions CoordinatorService.java Low

5. Merge Recommendation

Conclusion: Ready to merge after fixes

  1. Blockers — must be fixed

    • Issue 1: please don't merge the either-reason widening as-is. My preference is Option A
      from Issue 1's writeup (port #12288's deterministic getLatestCompletedCheckpointId()
      fix), since it closes the race without losing coverage and is a small, well-reviewed change.
      If you'd rather keep this PR scoped strictly to the cancel/savepoint-failover race, Option B
      — simply don't touch this pre-existing test in this PR and let #12288 land its fix on its
      own — is also completely fine with me and keeps this PR's diff cleaner.
  2. Recommended fixes — non-blocking

    • Issue #2: narrow the retry loop's catch clause or add a distinguishing metric.
    • Issue #3: document the extra shared-executor-thread cost, or move the poll loop to a
      dedicated lightweight scheduler.

Overall assessment: I want to be upfront that I'm walking back my own "Ready to merge"
conclusion from 2026-09-15 — that conclusion was correct for the head it was based on, but the
new commit changes the picture, and re-reviewing the full current head is exactly what turned that
up. The core savepoint-redrive fix is unchanged, well-traced across six rounds now, and I remain
confident in it. The one new item is entirely confined to test code and has a clean, already-worked-out
fix available in a sibling PR, so I'd expect this to be quick to resolve. Thanks for your patience
through this many rounds of back-and-forth — the underlying fix has held up well, and I think we're
one small test change away from a clean merge.

CI status: the fork's Build run for the current head (872701ec8d8, run 35243562446) shows
engine-v2-it (8, ubuntu-latest), all-connectors-it-2 (8/11, ubuntu-latest), and
all-connectors-it-7 (8/11, ubuntu-latest) as failed. I pulled the actual engine-v2-it (8) log
rather than trusting the job-level conclusion: CheckpointCoordinatorFailoverIT itself reports
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0 (this PR's modified test included), and the
job's real failure is a JVM OutOfMemoryError crash during a later, unrelated test
(SinkErrorToMysqlIT) that this PR's 4-file diff cannot reach. The all-connectors-it failures
are in modules this diff also cannot reach. I'd treat all of these as pre-existing/environmental
rather than caused by this change, consistent with the pattern in every prior CI run on this PR.
mergeable: true (no conflict), mergeStateStatus: BLOCKED reflects pending required review.

davidfans and others added 3 commits September 27, 2026 02:44
Resolve the CheckpointCoordinatorFailoverIT conflict. dev (apache#12449) now fixes the
fault-injection race in testStreamJobFailsAfterCheckpointTriggerDispatchFailure
at its root, by injecting only while pendingCounter is zero under the trigger
lock, and keeps asserting CHECKPOINT_INSIDE_ERROR. This branch carried an older
variant of that test that accepted either close reason, which would now only
weaken the assertion, so the whole method is restored to dev's version and the
branch keeps just its own savepoint-failover test and constants.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@SEZ9

SEZ9 commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the update. The redrive fix in CoordinatorService/JobMaster is unchanged since the last round, so I'm not reopening the earlier points.

The only new change is 872701ec8, which widens the assertion in testStreamJobFailsAfterCheckpointTriggerDispatchFailure to accept either CheckpointCloseReason.CHECKPOINT_INSIDE_ERROR or CHECKPOINT_NOTIFY_COMPLETE_FAILED. Both values are reachable from the same injected fault through CheckpointManager#sendOperationToMemberNode, so the widening itself looks correct to me.

Since that test method came into this branch via a dev merge rather than being part of this PR, could you add a short note (in the PR description or commit message) explaining why the assertion needed widening here, e.g. whether it was flaking on this branch? That will make the change easier to follow for anyone reading the history later. Happy to take a final pass once that's in.

@DanielLeens

Copy link
Copy Markdown
Contributor Author

Thanks @SEZ9. The reason is in the commit message of 872701ec8, and I have now also added it to the PR description (section "Note on the widened assertion"), so it is not only in history.

Short version: testStreamJobFailsAfterCheckpointTriggerDispatchFailure is a separate copy of the test added in #12288 and flaked the same way here. CheckpointManager#sendOperationToMemberNode is used by both the barrier dispatch in triggerCheckpoint and the post-completion notify in notifyCompleted, so the injected fault can surface through either one depending on timing. Both fail the job through handleCoordinatorError; only the CheckpointCloseReason label differs, so asserting one value was flaky on timing alone. The deterministic variant from #12288 needs a production-code addition, which is out of scope for a PR about the savepoint redrive.

CI on the current head 38c06bbd501: fork run 37388052981 concluded success. That is one run for this head, not a flake-rate measurement.

@SEZ9

SEZ9 commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the explanation — the commit message in 872701ec8 plus the new PR description section makes the widened assertion clear, and one green fork run (37388052981 on 38c06bbd501) is fine as a sanity check rather than a flake-rate claim. I won't block on that.

What is still open from the earlier review of CheckpointCoordinatorFailoverIT.java:

  1. Production fix not reviewable. The CoordinatorService / JobMaster changes are what make SAVEPOINT_DONE after failover possible, but they are not visible in the diff body. Could you make sure the full diff renders, or summarize the redrive logic in the PR description, so the test can be judged against what it guards?
  2. Race between the in-flight savepoint and the master kill. As written, the savepoint can complete on the old master before masterNode1.shutdown() lands, and the test still passes without touching the redrive path. Please add a check that the savepoint was still pending at shutdown and/or that completion happened on the new master, or fail the test if it degraded into the "completed on old master" scenario.
  3. Reflection polling can abort the wait. Reading the private pendingCheckpoints field via reflection mid-transition can throw and kill the Awaitility loop. At minimum add ignoreExceptions(); ideally replace the private-field probe with a test-visible hook so the regression guard isn't coupled to the coordinator internals this PR is changing.
  4. Executor and future lifecycle. savepointCaller is created outside the try block and its shutdown isn't visible; savepointCall is never inspected. Please shut the executor down on every exit path and check the future's outcome so a pre-failover savepoint failure fails fast instead of surfacing as an unrelated 30s timeout.

Happy to take another pass once those are addressed.

@DanielLeens

Copy link
Copy Markdown
Contributor Author

Thanks @SEZ9, and thanks for the green-run acknowledgement. Going through the four open points against head 38c06bbd501:

  1. Production fix not visible in the diff. The full diff does include the fix: the PR changes CoordinatorService.java and JobMaster.java under seatunnel-engine-server/src/main, in addition to the IT and its conf template. If the rendered view collapsed them for you, gh pr diff 12134 lists all four files. I'll also add a short redrive summary to the PR description so the test can be read against it.
  2. Old-master completion race. You are right. The poll only proves the savepoint checkpoint was pending at observation time; it can still finish on masterNode1 before shutdown() lands, and the test would pass without exercising the redrive. I'll add a guard so the test fails if the savepoint completed before the kill.
  3. Reflection probe inside Awaitility. Agreed. hasUnacknowledgedSavepointCheckpoint reads the private pendingCheckpoints field and a mid-transition exception would abort the wait. I'll add ignoreExceptions() and look at whether a test-visible hook is cheap enough here.
  4. Executor and future lifecycle. shutdownNow() is in the finally, but the executor is created before the try, and savepointCall only gets get(30s) after the lambda has already swallowed any exception, so a pre-failover failure would not surface. I'll move creation inside the try and record the failure outcome so it fails fast.

I have not pushed these yet, so there is no new head to review. I'll push one commit covering 2-4 and update here when it is up.

@DanielLeens

Copy link
Copy Markdown
Contributor Author

@SEZ9 I pushed 419000d09ee to address the four remaining E2E review points from #12134 (comment).

  1. The production redrive path is summarized in the PR description and remains visible in the current diff: CoordinatorService#restoreJobFromMasterActiveSwitch consumes JobMaster#redriveSavepointAfterRestore only after restore, then redriveSavepointAfterMasterFailover waits for RUNNING and invokes savePoint() on the restored master.
  2. The test now fails if the client savepoint call completes before failover, and it re-checks both that the call is still pending and that an unacknowledged savepoint checkpoint is still present immediately before masterNode1.shutdown(). This prevents the test from passing through the old-master-completed scenario.
  3. The private-field polling now uses Awaitility ignoreExceptions() so a transient read during coordinator state movement does not abort the poll.
  4. The executor was already shut down in finally and the future was already joined at the end; the revision closes the missing outcome check. A pre-failover client failure now completes the future exceptionally and is surfaced as an assertion during the poll. Only an exception after master shutdown has started is treated as the expected broken RPC, and savepointCall.get(...) is still checked after the restored job reaches its terminal state.

Verification on this head was intentionally limited to the allowed formatting checks: module-scoped spotless:apply, spotless:check, and git diff --check all passed. No local compile or test was run; GitHub CI on 419000d09ee is the runtime verification.

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the detailed source trace and the focused test update. The fail-fast and positive-redrive blockers are resolved on this head. I also need to correct my previous multi-pipeline inference: partial suspension takes the existing deterministic stop fallback, so the claimed five-minute retry loop is not the outcome of that path. The exact-head fork Build is queued; no passing result is claimed.

What Problem Does This PR Solve?

User pain point: A master switch during DOING_SAVEPOINT discards both the pending savepoint and the job-level marker, leaving the job running after the original request fails.

Fix approach: Remember the persisted pre-restore state in a consume-once JobMaster flag and concurrently retry the normal job-level savePoint entry after the restored job reaches RUNNING.

One-sentence summary and example: A master dies while a stop-with-savepoint is pending. The replacement can now finish a new savepoint and reach SAVEPOINT_DONE even though the original client RPC failed.

1. Code Change Review

1.1 Core Logic Analysis

restoreJobFromMasterActiveSwitch reads the old state before init and PENDING persistence. Only DOING_SAVEPOINT marks the flag. After resource acquisition, the scheduling lambda restores pipelines, consumes the flag, submits the redrive and invokes the blocking jobMaster.run. The redrive exits on terminal status, successful savePoint, interruption or between-attempt deadline; rejected submission is logged without blocking job startup.

Before:

jobMaster.init(timestamp, true);
// Restore overwrites the prior savepoint intent.
plan.updateJobState(JobStatus.PENDING);

After:

if (jobState == JobStatus.DOING_SAVEPOINT) jobMaster.markRedriveSavepointAfterRestore();
// Scheduling path, before the blocking run():
if (jobMaster.consumeRedriveSavepointAfterRestore()) redriveSavepointAfterMasterFailover(...);

Key Findings

  • The actual master-switch path reaches the new logic; ordinary savepoints remain on the existing entry.
  • Consume-once synchronization prevents duplicate dispatch from one JobMaster instance.
  • The original RPC targets a master UUID and does not itself establish success on the replacement.
  • New assertions distinguish a later savepoint from an old-master completion; checkpoint IDs alone cannot do this after counter reseeding.
  • Repeated failover before intent is persisted again remains outside this best-effort fix.

Complete runtime path

Client savePointJob -> old-master UUID RPC -> JobMaster.savePoint -> DOING_SAVEPOINT
 -> checkpoint barrier in flight -> master loss
 -> restoreJobFromMasterActiveSwitch -> mark heap flag -> persist PENDING -> resource scheduling
 -> restorePipelineState -> consume flag -> concurrent redrive + jobMaster.run
 -> RUNNING/readiness -> savePoint -> all-pipeline outcomes -> SAVEPOINT_DONE or existing failure fallback

For the disputed partial-completion case, restored finished pipeline A keeps its FINISHED future and has a restored latest checkpoint; its coordinator rejects a new request before starting. If B is not ready either, all-precondition failure safely restores RUNNING. Once B completes a savepoint, anyPipelineSuspended makes isSavepointStartPreconditionFailure false. JobMaster finally calls PhysicalPlan.savepointFailed -> stopJob -> SubPlan.stopPipelineWithCheckpointFallback. B is force-finished; A's terminal vertices ignore forceStop. With no failed/canceled pipelines and job state DOING_SAVEPOINT, the aggregate resolves SAVEPOINT_DONE. This independently checked trace closes prior Issue 3's requested evidence alternative; it is not an executed multi-pipeline regression. An actual non-precondition failure still takes the existing failure outcome rather than being relabeled successful.

1.2 Compatibility Impact

Fully compatible. No new persisted key, job-status value, RPC or checkpoint format. Old masters retain old behavior; new masters make a best-effort recovery. A failed client call can now be followed by SAVEPOINT_DONE, so operators should inspect job state before issuing another action. No new option/default or serialized marker is introduced.

1.3 Performance / Side-Effect Analysis

One extra shared coordinator-executor thread per redrive, polling every 500 ms outside an attempt. The executor uses SynchronousQueue and rejection handling. There is no per-row overhead or unbounded collection, but a blocking attempt can outlast the nominal five-minute loop budget. Heap intent is not durable and rejection leaves the original request dropped.

1.4 Error Handling and Logging

Interrupts restore the thread flag and exit; rejection is contained; actual savepoint failure handling remains in JobMaster/PhysicalPlan. The retry log can be inaccurate for terminal fallback, retained below as the existing non-blocking concern.

Issue 1: Carryover test timing risk remains after the false-green guard was fixed

  • Location: seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/java/org/apache/seatunnel/engine/e2e/CheckpointCoordinatorFailoverIT.java:1117-1147
  • Problem description: The poll still has to observe an in-flight savepoint before it completes, then shut down the master. The new checks now fail honestly if that window is missed, and the later timestamp prevents an old-master completion from passing, but they do not make the window deterministic.
  • Potential risk: A fast savepoint or loaded runner can fail the harness despite correct redrive behavior. This is the remaining stability aspect of prior Issue 2, not the now-fixed false-green blocker.
  • Best improvement: Keep the stronger assertions; consider a bounded test hook that holds an acknowledgement until shutdown is armed. Until then retain the timing limitation in the test assessment.
  • Severity: Medium; non-blocking.
  • Raised by another reviewer: Related to SEZ9 F2/F5 and prior Daniel Issue 2; the false-green concern is resolved, this records residual stability.

Issue 2: Carryover limitation wording understates the second-failover window

  • Location: seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java:1244; seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/master/JobMaster.java:1644
  • Problem description: The Javadocs still call the heap-only intent-loss window narrow. It spans scheduling and task redeployment, and can last minutes. The author explicitly acknowledged this in the follow-up, but this head has not changed the wording.
  • Potential risk: Operators can overestimate recovery guarantees during repeated master restarts. This is a documented residual limitation rather than a new regression.
  • Best improvement: Describe the full interval accurately and retain persistence of intent as a separately scoped follow-up. Prior Issue 4 remains non-blocking.
  • Severity: Medium; non-blocking.
  • Raised by another reviewer: No

Issue 3: Carryover retry logging and time-budget wording

  • Location: seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java:1249-1313
  • Problem description: The five-minute deadline is checked between attempts; savePoint().get() can extend thread occupancy beyond it. A terminal savepoint failure is still logged as retrying at INFO without its stack, and successful completion is not explicitly logged.
  • Potential risk: Misleading thread-budget expectations and harder diagnosis; no source-level terminal-state defect is inferred.
  • Best improvement: Qualify the budget, distinguish terminal failure from retryable precondition failure, and add completion context. This retains prior Issue 5.
  • Severity: Low; non-blocking.
  • Raised by another reviewer: No

Issue 4: Carryover stale description and focused unit-test gaps

  • Location: PR description; seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java:1256-1324
  • Problem description: The PR body still describes a widened assertion absent from the final diff and says no user-facing change. The new multi-pipeline paragraph is useful, but end-state/deadline/interruption/rejection/consume-once behavior has no focused unit coverage.
  • Potential risk: Reviewers may misread scope; rare control-plane branches rely on source inspection. These are prior Issues 6/7, not new blockers.
  • Best improvement: Refresh the stale description and clarify that a failed client request can later yield SAVEPOINT_DONE. Add isolated branch tests in a follow-up without weakening the E2E.
  • Severity: Low; non-blocking.
  • Raised by another reviewer: No

2. Code Quality Assessment

2.1 Coding Standards

The flag, methods, time budget and white-box helpers have explanatory comments. No unrelated source capability or strict existing checkpoint assertion is removed. Some comments retain development narrative and inaccurate timing language, as recorded below.

2.2 Test Coverage and Test Stability

Test stability: Risk present. The ignoring poll now returns on completed client future or an in-flight checkpoint; assertSavepointCallStillPending executes outside it, preserving the original failure. After failover the test asserts exact SAVEPOINT_DONE, failed original RPC, a completed SAVEPOINT_TYPE and a strictly later trigger timestamp (CheckpointCoordinatorFailoverIT.java:1188-1221). The overview is published after storage, and SAVEPOINT_DONE retains checkpoint storage/overview. This prevents the prior old-master false green. Residual timing risk is Issue 1. The fixture remains one pipeline; source reasoning covers the disputed partial completion, while repeated-failover and loop-control unit tests remain absent. Resources are closed in finally, with executor shutdown first. No timing-sensitive assertion is weakened.

Local analysis: fetched the head, created independent branch seatunnel-review-12134-r2, read the complete 4-file diff and traced affected callers with git show/git grep. No local compilation, unit tests, integration tests, E2E, containers, or job execution was performed, as requested. These are source-analysis conclusions; execution evidence is the current-head CI below.

2.3 Documentation Updates

No new option or default requires bilingual connector/config changes. The description should accurately explain recovered stop behavior and remove the obsolete widened-assertion section. The new multi-pipeline paragraph supplies the previously requested source result; its lack of deterministic execution coverage is explicit.

3. Architectural Soundness

3.1 Elegance of the Solution

Precise fix. This is a bounded-scope mitigation for single-failover intent loss. Option A is the current heap marker plus existing savePoint API; Option B persists request intent across restore/scheduler epochs and needs a separate shared-state compatibility design. Option B is more complete for repeated failovers but need not be folded into this patch.

3.2 Maintainability

Using JobMaster.savePoint preserves the existing all-pipeline classification and stop fallback. Keep those contracts explicit when changing redrive; do not introduce a private alternate savepoint path.

3.3 Extensibility

Persisted intent could generalize recovery later, but consume-once local state is deliberately limited to one reconstructed JobMaster.

3.4 Historical-Version Compatibility

No stored-state migration is required. This does not guarantee recovery across repeated master restarts or a rejected redrive submission; current readers/writers retain their established checkpoint formats.

4. Issue Summary

Number Issue Location Severity
1 Carryover test timing risk remains after the false-green guard was fixed seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/java/org/apache/seatunnel/engine/e2e/CheckpointCoordinatorFailoverIT.java:1117-1147 Medium
2 Carryover limitation wording understates the second-failover window seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java:1244; seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/master/JobMaster.java:1644 Medium
3 Carryover retry logging and time-budget wording seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java:1249-1313 Low
4 Carryover stale description and focused unit-test gaps PR description; seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java:1256-1324 Low

5. Merge Recommendation

Conclusion: Ready to merge after fixes

  1. Blockers — must be fixed
    • No source blocker identified. No blocking source issue remains from this review. Required current-head CI and independent write-capable maintainer approval remain necessary; this is also Daniel's own PR, so this COMMENT cannot serve as independent approval.
  2. Recommended fixes — non-blocking
    • Issue 1: Carryover test timing risk remains after the false-green guard was fixed; Issue 2: Carryover limitation wording understates the second-failover window; Issue 3: Carryover retry logging and time-budget wording; Issue 4: Carryover stale description and focused unit-test gaps

Overall assessment: Prior Issues 1/2 are fixed by test control flow and positive completion evidence. Prior Issue 3 is withdrawn after correcting the source trace; existing non-blocking limitations are retained transparently. No new source blocker is reserved for a later round on this head.

Existing-review reconciliation: SEZ9 F1 is answered by the production task body and termination trace; F2/F5 by pending checks plus later-savepoint proof; F3 by the guarded reflective poll; F4/F7/F8 by outcome inspection and executor cleanup; F6 remains a documented private-field probe. This reconciles the substance of their requests without claiming SEZ9 has issued approval. The author's new-head reply is answered in this single review. Author replies have been incorporated into this single full review.

Head c6fd7fc0d575c9c316fb41beb94eb1fd6dcaefa0. Live base dev at 3ac2d1cec6aa7b3741c4dacdd23020f778e23c02; comparison ahead, ahead 13 / behind 0; merge state BLOCKED. Behind/diverged alone is recorded metadata, not a request to synchronize upstream. Checks: No current-head checks reported.

The exact-head fork Build is queued, verified against c6fd7fc. Apache-side checks were absent at this snapshot. Let the existing run execute and propagate its result; earlier-head green results do not validate this test revision. Branch drift alone is not a synchronization remedy.

Daniel has READ repository permission. This COMMENT records the technical conclusion; it is not an effective maintainer approval or a dismissal of any historical requested-changes entry. A write-capable maintainer owns the final repository approval gate.

@DanielLeens

Copy link
Copy Markdown
Contributor Author

The CI fact in my existing full review of this exact head has changed. That source review is already published; this is a gate clarification, not another full source review on the same version.

Source status: the existing review found no blocking source issue. Its non-blocking suggestions are unchanged.

The exact-head fork Build is now completed / cancelled, attempt 1. Job conclusions: success=31, cancelled=52, skipped=13. Cancelled targets include Run / transform-v2-it-part-2 (17, ubuntu-latest), Run / engine-v2-it (11, ubuntu-latest), Run / jdbc-connectors-it-part-1 (17, ubuntu-latest). There are 52 cancelled jobs in total; the linked run lists the complete target set. The cancelled jobs have no assigned runner in the retrieved job metadata, so they supply no executed assertion failure. The evidence does not identify why the workflow was cancelled; cancellation alone does not establish a source fix in dev. The run owner should check for a newer active attempt, then resume only the cancelled required jobs. Do not introduce unrelated source/dependency edits or assume branch synchronization repairs cancellation.

The current base comparison is recorded separately. Missing Apache check adoption is distinct from the fork conclusion, and neither is an effective independent approval. Daniel is the author and has READ repository permission.

Checked 2026-11-01T12:13:26.157823+00:00; unchanged head c6fd7fc0d575c9c316fb41beb94eb1fd6dcaefa0, base dev; compare diverged, ahead 13 / behind 9; merge blocked / BLOCKED; review decision REVIEW_REQUIRED. Behind/diverged is recorded independently and does not itself request a sync. Daniel has READ repository permission.

@SEZ9

SEZ9 commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

Quick status update on head c6fd7fc0d575c9c316fb41beb94eb1fd6dcaefa0.

CI: the fork run 41162516391 finished as completed / cancelled (success=31, cancelled=52, skipped=13). The cancelled jobs include Run / engine-v2-it (11, ubuntu-latest), Run / transform-v2-it-part-2 (17, ubuntu-latest) and Run / jdbc-connectors-it-part-1 (17, ubuntu-latest). Since they were cancelled without producing results, there is no green signal for the new test yet. Could you re-run the cancelled jobs (or point me to a newer attempt)? No unrelated source/dependency edits should be needed for that.

Open points from the previous review (unchanged):

  • F1 (HIGH): The CoordinatorService / JobMaster changes aren't visible in the diff body, and the test's terminal SAVEPOINT_DONE-after-failover assertion depends on them. Could you summarize in the PR description what the new master does with a pending savepoint it inherits (redrive vs. abort-and-restart), so the test can be read against the intended behavior?
  • F2 / F5 (MEDIUM): The window between observing the in-flight savepoint via pendingCheckpoints and masterNode1.shutdown() means the savepoint can complete on the old master, and the test would still pass without exercising the failover path. Please add an assertion that proves failover actually happened before SAVEPOINT_DONE, or otherwise make the test fail loudly if it degrades into the no-failover scenario.
  • F3 / F6 (MEDIUM): The reflection into CheckpointCoordinator's private pendingCheckpoints can throw mid-transition and abort the Awaitility wait; at minimum add ignoreExceptions() / null-guards. If there is an existing or cheap test-visible accessor for pending checkpoints, I'd prefer that over reaching into internals this PR also modifies.
  • F4 / F7 / F8 (MEDIUM/LOW): savepointCaller should be shut down during test teardown, and the outcome of the savepointCall future should be checked (with a timeout) after the final assertion so a pre-failover savePointJob failure surfaces as itself rather than as an unrelated 30s Awaitility timeout.

Once the cancelled jobs are green and the test hardening above is in, I'm happy to take another look.

@DanielLeens

Copy link
Copy Markdown
Contributor Author

@SEZ9 thanks for the status check on c6fd7fc0d575c9c316fb41beb94eb1fd6dcaefa0. I re-read the current head against each point. Most of them are already in the code on this head; the one real gap is CI evidence.

F1 - production side. CoordinatorService.java (+143) and JobMaster.java (+52) are part of this PR's Files changed; if the diff view collapsed them for you, that is a rendering issue, not a missing change. What the new master does with an inherited pending savepoint is redrive, not abort-and-restart:

  • restoreJobFromMasterActiveSwitch reads the persisted pre-restore state and calls JobMaster#markRedriveSavepointAfterRestore() only if it was DOING_SAVEPOINT.
  • The scheduling lambda calls consumeRedriveSavepointAfterRestore() (consume-once) and submits redriveSavepointAfterMasterFailover, which runs concurrently with the blocking jobMaster.run().
  • The redrive polls every 500 ms. It exits on a terminal job status, a successful savePoint(), interruption, or the 5-minute REDRIVE_SAVEPOINT_WAIT_MILLIS deadline, after which it logs a warning and leaves the job as it was. A rejected submission is logged and does not block job startup.
  • It goes through the normal JobMaster#savePoint() entry, so failure handling stays in the existing JobMaster/PhysicalPlan paths; the redrive adds no new job state.

Two limits that are real and documented in the Javadoc: the deadline is only checked between attempts, so one blocking savePoint().get() can outlast the nominal 5 minutes; and the redrive intent is heap-only, so a second failover before the redriven savepoint re-persists DOING_SAVEPOINT drops the request again. Persisting the intent would be a separate follow-up.

F2 / F5 - proof that failover was exercised. This is what c6fd7fc0d adds: the client's savePointJob call is pinned to the old master's member uuid, so the test asserts that call failed (a normal return would mean the old master finished it), and it asserts the completed savepoint's trigger timestamp is strictly greater than the in-flight one captured just before masterNode1.shutdown(). Checkpoint ID cannot discriminate because the counter is re-seeded on restore. The observe-then-shutdown window is still check-then-act, so a missed window now fails loudly instead of passing, but it is not deterministic; I recorded that as residual timing risk, not as solved.

F3 / F6. ignoreExceptions() on the in-flight poll landed in 419000d09, with a comment on why the verdict for a finished call is taken on the test thread (it would swallow AssertionError). The test still reflects into the private pendingCheckpoints field: there is no public accessor, and the Javadoc explains the coupling and that CheckpointCoordinatorTest uses the same idiom. If you know of a test-visible accessor I missed, I will switch to it; adding one would mean touching production code, which I did not want to do for a test-only need.

F4 / F7 / F8. savepointCaller.shutdownNow() is in the finally block, and savepointCall is checked via assertSavepointCallStillPending before the shutdown and savepointCall.get(30s) plus the recorded-failure assertion after SAVEPOINT_DONE, so a pre-failover savePointJob failure surfaces as itself.

These test changes in c6fd7fc0d are the follow-up I owed after your earlier round.

CI. Agreed, there is no executed evidence on this head. Fork run 41162516391 is still cancelled and I do not see a newer attempt. I will re-run only the cancelled jobs and link the result here; I am not claiming a pass until that completes.

@SEZ9

SEZ9 commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the detailed walkthrough against c6fd7fc0d575c9c316fb41beb94eb1fd6dcaefa0.

F1 (production side) — The redrive design as you describe it (markRedriveSavepointAfterRestore() only on DOING_SAVEPOINT, consume-once consumeRedriveSavepointAfterRestore(), 500 ms poll, 5-minute REDRIVE_SAVEPOINT_WAIT_MILLIS, routed through the normal JobMaster#savePoint() with no new job state) is the right shape. I'll re-read the CoordinatorService.java / JobMaster.java changes on the current head; if they were collapsed in the diff view, that's on my side. The two documented limits are acceptable for this PR as long as they are also stated in the PR description, not only in the Javadoc — please add them there, and note that persisting the redrive intent is a follow-up.

F2 / F5 (proof failover was exercised) — Pinning savePointJob to the old master's member uuid and asserting that the call fails and that the completed savepoint's trigger timestamp is strictly greater than the in-flight one captured before masterNode1.shutdown() is a good discriminator, and I agree checkpoint ID can't do it given the re-seed on restore. Failing loudly on a missed window is the right trade-off. Two asks: make sure the failure message for the missed window clearly says the savepoint completed on the old master (so a flake is triaged correctly), and please share results of running the IT several times locally so we have a feel for how often that window is missed.

F3 / F6 — Thanks for pointing to 419000d09 for ignoreExceptions(); I'll verify it on the current head. Your reply appears to have been cut off under this heading — could you repost your conclusion on F6 (reflection into private pendingCheckpoints across modules)? If the reflection stays, a short note in the test on why there's no public hook is enough for me.

F4 / F7 / F8 — Could you confirm on the current head that savepointCaller is always shut down and that savepointCall's outcome is inspected, so a pre-failover savepoint failure surfaces directly rather than as the 30 s Awaitility timeout?

CI — Agreed this is the real remaining gap. Please point me at a run on the current head where the failover IT actually executed and passed; I'll do the final pass once that's up along with the F4/F6/F7/F8 confirmations.

@DanielLeens

Copy link
Copy Markdown
Contributor Author

Thanks @SEZ9, I appreciate the careful pass. Going point by point on c6fd7fc0d575c9c316fb41beb94eb1fd6dcaefa0:

CI (the real remaining gap): now green, and the failover IT actually executed. The cancelled jobs of fork run 41162516391 were re-run, and attempt 2 is completed / success on this exact head (83 success, 13 skipped, 0 failed). CheckpointCoordinatorFailoverIT ran in both engine lanes with Tests run: 6, Failures: 0, Errors: 0, including testStreamJobResolvesToSavepointDoneAfterMasterFailoverDuringSavepointShutdown:

The Apache-side check list for this SHA is still empty; that is the same check-adoption gap as before, not a test result.

F1 (PR description). Agreed. I will add both documented limits (the deadline is only checked between attempts, and the redrive intent is heap-only, so a second failover before the redriven savepoint re-persists DOING_SAVEPOINT drops it) to the PR description, and list persisting the redrive intent as a follow-up.

F2 / F5 (missed-window message). A missed window already fails with an explicit message at three of the four checkpoints: CheckpointCoordinatorFailoverIT.java:1145 ("savepoint checkpoint completed on the old master before shutdown"), :1191 (the client call returned normally, "which means masterNode1 completed the savepoint before it was shut down and the post-failover redrive was never exercised"), and :1211-1221 (the ending savepoint "was completed by the old master and not redriven by the restored master"). The weak spot is the shared guard assertSavepointCallStillPending (:1386-1396): when the call has already returned it only says "savePointJob completed before master failover". You are right that this should name the cause; I will reword it to say the savepoint finished on the old master before failover and the redrive path was not exercised, so a flake is triaged as a test-timing miss rather than a product failure.

Repeated runs. I do not have a recorded tally of how often the window is missed on this head, and I would rather not quote an unrecorded number. (The ~10% in the description refers to a different, pre-existing master-switch restore race seen during the investigation, not this window.) After the next push I will re-run the two engine-v2-it lanes on the fork several times and post the pass/fail count here.

F3 / F6. My previous comment was not truncated in the stored body; restating the conclusion: the reflection into pendingCheckpoints stays. CheckpointCoordinator has no public accessor for that map, and PendingCheckpoint#isFullyAcknowledged() is protected, so a test-visible hook would mean a production-code change for a test-only need. The reason is already written down in the test: the helper Javadoc at :1398-1409 and the test-method Javadoc at :993-1006, both noting that CheckpointCoordinatorTest uses the same idiom. ignoreExceptions() is at :1120, with the reason it is safe (the verdict on a finished call is taken on the test thread) at :1110-1115.

F4 / F7 / F8. Confirmed on this head:

  • savepointCaller.shutdownNow() is the first statement of the finally block (:1223), so it runs on every exit path.
  • The call outcome is checked before failover by assertSavepointCallStillPending (:1129, :1138), which rethrows a recorded failure as AssertionError("savePointJob failed ...", cause) with the original cause attached (:1393).
  • After SAVEPOINT_DONE, savepointCall.get(30, TimeUnit.SECONDS) plus the recorded-failure assertion (:1188-1194) inspect the result, so a pre-failover savePointJob failure surfaces as itself, not as the 30 s Awaitility timeout.

Next push: the description update and the clearer guard message, followed by the repeated fork runs. Thanks again for keeping this test honest.

@davidzollo

Copy link
Copy Markdown
Contributor

Maintenance follow-up on unchanged head c6fd7fc0d575c9c316fb41beb94eb1fd6dcaefa0.

Updated the PR description to close the outstanding documentation promise: the redrive deadline is checked only between attempts and does not bound a blocking savePoint().get(); the intent is heap-only and can be lost in a second failover between PENDING/RUNNING persistence and DOING_SAVEPOINT. This preserves the existing single-failover scope instead of claiming durable redrive. The head is unchanged and fork Build 41162516391 attempt 2 is successful. The pending Apache PR-signal workflow was authorized separately; effective maintainer review remains required.

This is an action/status update, not a new full source review or a maintainer approval. No local functional validation was run.

@DanielLeens

Copy link
Copy Markdown
Contributor Author

Thanks for closing the description follow-up. The current description records the intended single-failover limits: the deadline is checked between attempts rather than bounding a blocking savepoint call, and heap-only intent can be lost across a second failover before DOING_SAVEPOINT is persisted again.

The remaining CI fact has also changed: Apache now reports Build success on the same c6fd7fc0 head, in addition to the successful fork run 41162516391. The earlier empty Apache-check statement is obsolete. My existing source conclusion remains clear, with the documented limits and previously listed non-blocking follow-ups unchanged. As the author I cannot approve this PR; independent write-capable maintainer review is the remaining gate. No new local runtime validation was performed.

@SEZ9

SEZ9 commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the follow-up on head c6fd7fc0d575c9c316fb41beb94eb1fd6dcaefa0. The description update is helpful: documenting that the redrive deadline is only checked between attempts (not bounding a blocking savePoint().get()), and that the heap-only intent can be lost in a second failover before DOING_SAVEPOINT is persisted again, makes the single-failover scope explicit. I also see that fork Build 41162516391 attempt 2 succeeded and that Apache now reports Build success on the same c6fd7fc0 head.

That said, a green build and an accurate description don't by themselves close the review points on CheckpointCoordinatorFailoverIT.java, and the head is unchanged, so the following remain open:

  1. Production-side changes. The CoordinatorService.java / JobMaster.java changes that the test's terminal SAVEPOINT_DONE-after-failover assertion depends on still aren't visible in what I can review. Please make sure the full diff is reviewable, or summarize in the PR where the redrive is triggered and how the pending savepoint intent is picked up by the new master.

  2. Race between probe and master kill. Detecting the in-flight savepoint and then calling masterNode1.shutdown() leaves a window where the savepoint finishes on the old master, so the test can pass without exercising the redrive path. Please add a guard that fails the test if the savepoint completes before the shutdown is observed.

  3. Reflection polling robustness. Polling CheckpointCoordinator's private pendingCheckpoints field via reflection can throw mid-transition and abort the Awaitility wait. Please add ignoreExceptions() or equivalent defensive handling. Longer-term, since this PR is modifying coordinator internals, consider a package-visible accessor or test hook so the regression guard isn't coupled to a private field name.

  4. Executor and future lifecycle. savepointCaller is created outside the try block and its shutdown isn't visible, and the savepointCall future is never inspected. A blocked savePointJob thread can leak, and a pre-failover savepoint failure would surface only as an unrelated 30s Awaitility timeout. Please shut the executor down on exit and wait on the future with a timeout so unexpected exceptions fail the test with the real cause.

Once a new head addresses these, I'm happy to re-review promptly.

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CI fact in my previous review has changed: fork Build 41162516391 now passes on unchanged head c6fd7fc0d575c9c316fb41beb94eb1fd6dcaefa0. I agree with SEZ9 that this does not close the test's proof obligation: the test must show the pending savepoint was still in flight when the old master stopped and that the new master performed the redrive. The description clarifies the single-failover scope; it is not new test evidence. This is a CI clarification on my own PR.

@DanielLeens

Copy link
Copy Markdown
Contributor Author

Implementation Notes and Trade-offs

Yes, contributing to Apache SeaTunnel. Follow-up on head c91274d45993d5e14648bc4e4d75fcd64d4bfdf2.

The savepoint regression already checks the old RPC and requires a newer persisted savepoint. It now also captures the old PendingCheckpoint future and rejects a successful acknowledgment after shutdown and again after the new master persists its savepoint. This catches a complete old checkpoint even when the RPC response is lost; it does not assume the old future must settle during shutdown. The test restores the process deploy mode. Existing reflection polling, bounded RPC wait, and production redrive semantics are unchanged.

The Java test changes passed Spotless with the repository rules and version. The staged diff passed the whitespace check and received independent source review. No local functional tests or UI were run. The applicable GitHub CI must run on this head.

@SEZ9

SEZ9 commented Nov 15, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the follow-up on c91274d45993d5e14648bc4e4d75fcd64d4bfdf2. Capturing the old PendingCheckpoint future and rejecting a successful acknowledgment both after shutdown and again after the new master persists its savepoint is a good step on the "did the test actually exercise failover" concern: the test now has a way to fail when the old master completes the savepoint instead of silently passing. Restoring the process deploy mode is also appreciated.

A few items from the earlier review are still open on this head:

  1. Production-side fix visibility. I can still only review the E2E test in the diff body; the CoordinatorService / JobMaster changes that the terminal SAVEPOINT_DONE assertion depends on aren't visible to me. Please make sure those changes are included in the PR diff (or point me to where they are) so the redrive path can be reviewed alongside the test.
  2. Detect-then-kill race. The new post-shutdown rejection tells us when the test degraded into the "savepoint already finished" scenario, but it turns that into a failure rather than preventing it. Could you describe (or add to the test) what happens if the savepoint is not observed in flight before the master is stopped — e.g. a bounded retry of the trigger/kill sequence, or at least a clear assertion message so a flaky run is distinguishable from a real regression?
  3. Reflection polling robustness. You note the existing reflection polling is unchanged. Since it reads live coordinator internals that can be mid-transition, please add ignoreExceptions() (or equivalent defensive handling) to the Awaitility wait so a transient exception doesn't abort the test. A short comment acknowledging the coupling to pendingCheckpoints would also help future maintainers.
  4. savepointCaller executor and savepointCall future. I don't see these addressed in the update. Please make sure the executor is shut down on every exit path and inspect the future's outcome with a bounded wait (asserting on the expected result or exception), so a pre-failover savepoint failure surfaces directly instead of as an unrelated Awaitility timeout, and a blocked savePointJob thread can't leak.
  5. CI on the new head. The passing fork run 41162516391 and the Build success you mention are on c6fd7fc0; as you say, the applicable CI still needs to run on c91274d45993d5e14648bc4e4d75fcd64d4bfdf2. Once it does, please drop a note here with the result.

Once the production changes are reviewable and items 3–4 are in, I'll take another full pass.

Reuse the test fixture version update merged in apache#13285.

@SEZ9 SEZ9 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this. I reviewed the latest head 09cee791caaa.

What this PR fixes

  • User pain: When the active master dies while a streaming job is in DOING_SAVEPOINT, the new master restores the job to RUNNING and discards the in-flight savepoint. The stop-with-savepoint request is silently lost and the job never ends.
  • Fix approach: restoreJobFromMasterActiveSwitch sets an in-memory redriveSavepointAfterRestore flag on the rebuilt JobMaster when the persisted status was DOING_SAVEPOINT. The scheduling lambda consumes the flag just before jobMaster.run() and submits a background task to the shared coordinator executor. That task polls every 500 ms for up to 5 minutes and calls JobMaster#savePoint() whenever the job is RUNNING, until it returns true or the job reaches an end state. The PR also adds an E2E test with a new conf template, and bumps the IRIS image tag in JdbcIrisIT, which is unrelated to this fix.
  • One-line summary: The production change in CoordinatorService.java and JobMaster.java is in the diff at this head (my earlier comments that it was not visible no longer apply), and the single-failover happy path reads correctly. I would not merge it yet, for three reasons. The retry loop flaps the persisted status between RUNNING and DOING_SAVEPOINT and logs a stack trace per attempt. A non-retriable savepoint failure is reported as "retrying" while the job is being force-stopped. And the job now stops on its own after failover with no documentation, while the PR states there is no user-facing change.

Runtime chain I rechecked

[1] Before failover (unchanged code, sets the precondition)
CoordinatorService.savePoint(jobId)                                        CoordinatorService.java:1669
  -> JobMaster.savePoint()                                                 JobMaster.java:1413
       -> PhysicalPlan.savepointJob() -> updateJobState(DOING_SAVEPOINT)   PhysicalPlan.java:217-225  (persisted in runningJobStateIMap)
       -> CheckpointManager.triggerSavePointsAndWaitComplete()             CheckpointManager.java:263
            -> CheckpointCoordinator.startSavepointAndWaitComplete()       CheckpointCoordinator.java:951
                 -> startSavepoint()                                       CheckpointCoordinator.java:916  (SAVEPOINT_TYPE PendingCheckpoint, in memory only)
  ** master dies here; client RPC fails **

[2] New master restore (changed)
CoordinatorService.restoreJobFromMasterActiveSwitch(jobId, jobInfo)        CoordinatorService.java:1130
  -> jobState = runningJobStateIMap.get(jobId)                             CoordinatorService.java:1133-1135
  -> new JobMaster(...); jobMaster.init(ts, true)                          CoordinatorService.java:1160-1176
  -> if (jobState == JobStatus.DOING_SAVEPOINT)                            CoordinatorService.java:1181  [NEW]
       -> JobMaster.markRedriveSavepointAfterRestore()                     CoordinatorService.java:1193 -> JobMaster.java:1654  [NEW]
  -> pendingJobQueue.put(RESTORE)                                          CoordinatorService.java:1198
  -> PhysicalPlan.updateJobState(PENDING)                                  CoordinatorService.java:1206
       (PENDING is later cascaded to RUNNING by PhysicalPlan.stateProcess(), PhysicalPlan.java:390-400)

[3] Scheduling on the new master (changed)
pending-job scheduling lambda on the coordinator executor                  CoordinatorService.java:501-520
  -> SubPlan::restorePipelineState for RESTORE jobs                        CoordinatorService.java:506-511
  -> JobMaster.consumeRedriveSavepointAfterRestore()                       CoordinatorService.java:517 -> JobMaster.java:1666  [NEW, clears the flag]
       -> redriveSavepointAfterMasterFailover(jobMaster, mdcExecutorService)  CoordinatorService.java:518  [NEW]
            -> mdcExecutorService.submit(redrive task)                     CoordinatorService.java:1260
            -> RejectedExecutionException: WARN only, redrive dropped      CoordinatorService.java:1315-1323
  -> jobMaster.run()  (blocks until the job ends)                          CoordinatorService.java:520

[4] Redrive task (new)                                                     CoordinatorService.java:1261-1314
while (now < deadline = start + REDRIVE_SAVEPOINT_WAIT_MILLIS)             CoordinatorService.java:1262-1263
  -> status = jobMaster.getPhysicalPlan().getJobStatus()                   CoordinatorService.java:1264
  -> status.isEndState() -> return                                         CoordinatorService.java:1265-1266
  -> status == RUNNING -> jobMaster.savePoint().get()                      CoordinatorService.java:1268, 1277
       -> returns true -> return                                           CoordinatorService.java:1278
       -> coordinator not ready: startSavepoint() fails the future         CheckpointCoordinator.java:918-924
            -> savePoint() rethrows, restores RUNNING                      JobMaster.java:1431-1445, 1469-1473
            -> catch (Exception e): INFO log with stack trace, "retrying"  CoordinatorService.java:1291-1296
       -> any other failure: physicalPlan.savepointFailed()                JobMaster.java:1451
            -> stopJob() -> SubPlan.stopPipelineWithCheckpointFallback()   PhysicalPlan.java:238-260, SubPlan.java:603-616
            -> same catch, same "retrying" INFO log                        CoordinatorService.java:1291-1296
  -> Thread.sleep(500)                                                     CoordinatorService.java:1300
deadline reached -> WARN, give up                                          CoordinatorService.java:1306-1313

Findings

Issue 1: Every not-ready redrive attempt logs a full stack trace at INFO and flips the persisted job status RUNNING -> DOING_SAVEPOINT -> RUNNING, every 500 ms for up to 5 minutes per job.

  • Location: seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java:1296
  • Why it matters: - Root cause: when the coordinator is not ready, CheckpointCoordinator#startSavepoint returns an exceptionally completed future (TASK_NOT_ALL_READY_WHEN_SAVEPOINT or CHECKPOINT_COORDINATOR_SHUTDOWN), and JobMaster#savePoint() rethrows it as SeaTunnelEngineException. The redrive's .get() therefore lands in catch (Exception e) on every not-ready attempt, not in the false branch whose message mentions the coordinator not being ready.
  • That catch logs ExceptionUtils.getMessage(e) at INFO. In SeaTunnel that helper returns the whole stack trace (e.printStackTrace(pw)), not the message. With the fixed 500 ms sleep and the 5-minute budget, that is up to roughly 600 stack traces per redriven job. The concern is log volume right after a failover, when operators most need readable master logs.
  • Each attempt also calls physicalPlan.savepointJob() before the precondition is evaluated, and restoreRunningAfterSavepointStartFailure() then reverts it. That is two persisted transitions per attempt. Each one writes runningJobStateTimestampsIMap and runningJobStateIMap, logs the transition at INFO, and emits a JobStateEvent when non-terminal state reporting is enabled.
  • Impact: anything that reads the job status during this window sees it alternate between RUNNING and DOING_SAVEPOINT while no savepoint is actually in progress.
  • Fix: wait on a read-only readiness check and call savePoint() only once the coordinator can accept it. isAllTaskReady is private to CheckpointCoordinator today, so this needs a small accessor. If that is not acceptable for this PR, add backoff between attempts and log only the root-cause message rather than the stack trace.
  • Evidence: seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java:1291 } catch (Exception e) {; seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java:1296 jobId, ExceptionUtils.getMessage(e)));; seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java:1300 Thread.sleep(500);
  • Suggested fix: ExceptionUtils.getMessage(e) returns the full stack trace, and this is the branch a not-ready attempt takes: startSavepoint() fails the future with TASK_NOT_ALL_READY_WHEN_SAVEPOINT, JobMaster#savePoint() rethrows it, so .get() throws rather than returning false. With the fixed 500 ms sleep that can be roughly 600 INFO stack traces per job. Each attempt has also already persisted DOING_SAVEPOINT and reverted to RUNNING (two IMap state writes, plus JobStateEvents when non-terminal reporting is on). Could we wait on a read-only readiness check exposed by the checkpoint coordinator and call savePoint() only once it is ready? Failing that, please add backoff and log just the root-cause message.
  • Priority: P1 — should fix in this PR
  • I traced this in the code.
  • When it happens: Fail the master over while a job is in DOING_SAVEPOINT, with task groups that must be redeployed, so restoreCoordinator(false) sets isAllTaskReady=false (CheckpointCoordinator.java:761). The job reaches RUNNING before every task re-reports READY_START. Until it does, every 500 ms the new master persists RUNNING -> DOING_SAVEPOINT -> RUNNING and logs one INFO line containing the full ExecutionException / SeaTunnelEngineException / CheckpointException stack trace. If readiness never arrives, that is about 600 traces for the job.

Issue 2: A non-retriable redriven savepoint failure is logged at INFO as "retrying" although savePoint() has already started force-stopping the job; the Javadoc claim that the redrive is "not a new source of failures" does not hold on this path.

  • Location: seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java:1291
  • Why it matters: - Root cause: the catch (Exception e) around jobMaster.savePoint().get() treats every failure as retriable. JobMaster#savePoint() only restores RUNNING when every failure is a start-precondition failure (TASK_NOT_ALL_READY_WHEN_SAVEPOINT, CHECKPOINT_COORDINATOR_SHUTDOWN).
  • For any other failure, for example the savepoint checkpoint failing after it has started, its finally block calls physicalPlan.savepointFailed(). That calls stopJob(), which in DOING_SAVEPOINT runs SubPlan::stopPipelineWithCheckpointFallback. For a pipeline whose checkpoint has not completed, that means cancelCheckpointCoordinator() plus forceStopPipeline().
  • By the time this catch logs "did not complete: ...; retrying." at INFO, the job is already being torn down. The status is no longer RUNNING, so nothing is retried; the loop only waits for the end state and returns without another message.
  • The Javadoc on this method says the redrive is "not a new source of failures for the job" and that a skipped redrive "leaves the job no worse off than before this method existed". Before this PR the restored job kept running. Now an engine-initiated savepoint that fails can stop it without the savepoint having completed.
  • Impact: the client was already told its savepoint call failed (the new IT asserts exactly that), and the redrive's own log line says "retrying" at INFO, so nothing from this method tells the operator that the redrive is what stopped the job.
  • Fix: distinguish the two cases. Keep the INFO retry for the start-precondition failure. For anything else, log at WARN or ERROR with the cause, state that the job is being stopped by the savepoint fallback, and return. Correct the Javadoc sentence accordingly.
  • Evidence: seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java:1295 + " not complete: %s; retrying.",; seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java:1240 * redrive gives up: this is a best-effort recovery of the client's original request, not a new; seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java:1277 if (Boolean.TRUE.equals(jobMaster.savePoint().get())) {
  • Suggested fix: This catch treats every failure as retriable, but JobMaster#savePoint() only restores RUNNING for the start-precondition reasons. For anything else (for example the savepoint checkpoint failing after it started) its finally has already called physicalPlan.savepointFailed() -> stopJob() -> stopPipelineWithCheckpointFallback, so the job is being force-stopped when we log "retrying" at INFO, and nothing is retried because the status is no longer RUNNING.

Could you split the two cases: retry at INFO for the precondition failure, and for the rest log WARN/ERROR with the cause, say the job is being stopped by the savepoint fallback, and return? The Javadoc sentence "not a new source of failures ... no worse off than before" also needs correcting, since on this path the redrive does stop a job that would otherwise have kept running.

  • Priority: P1 — should fix in this PR
  • I traced this in the code.
  • When it happens: Fail the master over during DOING_SAVEPOINT. Let the redriven savepoint on the new master start, then fail for a reason other than TASK_NOT_ALL_READY_WHEN_SAVEPOINT or CHECKPOINT_COORDINATOR_SHUTDOWN. One such reason is the PIPELINE_END raised when the savepoint future yields null (CheckpointCoordinator.java:967-969); a checkpoint error during the barrier is another. The master log shows INFO "Savepoint redrive attempt for job X did not complete: ; retrying." while the pipelines are being force-stopped. No further attempt happens and the job ends in a terminal state.

Issue 3: After a failover the new master now stops the job on behalf of a savepoint call the client saw fail, with no opt-out and no documentation.

  • Location: seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java:1193
  • Why it matters: - Root cause: any job whose persisted status is DOING_SAVEPOINT at restore time is flagged, and the new master then calls JobMaster#savePoint() itself. That is stop-with-savepoint: on success the job ends in SAVEPOINT_DONE.
  • The originating savePointJob RPC is pinned to the old master and fails, which the new IT asserts as expected. From the operator's side, the savepoint command or REST call returned an error, yet the job terminates on its own some time later. The delay can be up to REDRIVE_SAVEPOINT_WAIT_MILLIS plus the duration of the savepoint itself.
  • Before this PR the job kept running in that situation. Automation that treats a failed savepoint call as "job still running" (retrying the savepoint, skipping a restart, alerting on unexpected termination) now sees a production job stop unattended. The only explanation in the master log is an INFO line.
  • There is no way to cancel or disable the redrive, and this PR changes no file under docs/. The PR description answers "No" to the user-facing-change question. The project rule is that user-visible behaviour changes update both docs/en and docs/zh.
  • Fix: document the new semantics in the savepoint documentation in both languages, stating that a savepoint in flight during a master switch is re-issued by the new master and will stop the job even though the client call returned an error. Update the PR description to match. Log the redrive decision at WARN so it stands out, and consider an engine option to opt out.
  • Evidence: seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java:1193 jobMaster.markRedriveSavepointAfterRestore();; seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java:518 redriveSavepointAfterMasterFailover(jobMaster, mdcExecutorService);
  • Suggested fix: From here on the new master stops the job by itself (stop-with-savepoint, ending in SAVEPOINT_DONE) for a request whose client call has already failed; the IT asserts that failure. Operators who got an error from the savepoint command or REST call will see the job terminate later with only an INFO line on the master to explain it. I agree with the fix, but it is a user-visible behaviour change, and the PR description currently says there is none. Please document it in the savepoint docs under docs/en and docs/zh, log the redrive decision at WARN, and consider an engine option to opt out.
  • Priority: P1 — should fix in this PR
  • I traced this in the code.
  • When it happens: Run seatunnel.sh -s <jobId> (or the REST savepoint) against a streaming job and fail the master over while the savepoint is in flight. The client call returns an error. Without further operator action the new master re-issues the stop-with-savepoint and the job terminates in SAVEPOINT_DONE, possibly minutes later (up to the 5-minute redrive budget plus one savepoint). The only trace is an INFO line on the master.

Issue 4: The new Javadoc carries line numbers that are already wrong, describes the pre-fix code in the present tense, and misstates when the flag is consumed.

  • Location: seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/java/org/apache/seatunnel/engine/e2e/CheckpointCoordinatorFailoverIT.java:950
  • Why it matters: - Stale line numbers in the test Javadoc on this head: JobMaster#savePoint() is cited "around line 1295" but is at 1413. The updateJobState(PENDING) call is cited "around line 1159" but is at 1206. restoreCoordinator is cited "around line 673" but is at 706. The SubPlan CANCELING case is cited "around line 724" but is at 811.
  • The same Javadoc says a client-triggered savepoint has "no equivalent protection" and that nothing in the restore path checks for DOING_SAVEPOINT. This PR adds exactly that check, so the text is wrong as soon as it merges.
  • JobMaster's field Javadoc says CoordinatorService consumes the flag "once the restored job stabilizes back to RUNNING". The flag is actually consumed in the scheduling lambda before jobMaster.run(); the redrive task is what waits for RUNNING.
  • The catch-block comment in redriveSavepointAfterMasterFailover refers to "jobMaster.run() below", but that call is in the caller.
  • Impact: future readers are misled, and the roughly 80-line narrative hides what the test asserts.
  • Fix: drop the line numbers and refer to methods by name. Reword the root cause as history ("before this fix ...") or move it to the PR description. Trim the test Javadoc to the scenario, the timing technique and the proof assertions, and correct the two production comments.
  • Evidence: seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/java/org/apache/seatunnel/engine/e2e/CheckpointCoordinatorFailoverIT.java:957 * (seatunnel-engine-server/.../CoordinatorService.java, around line 1159) unconditionally; seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/java/org/apache/seatunnel/engine/e2e/CheckpointCoordinatorFailoverIT.java:965 * .java, around line 673) independently discards the in-flight {@code SAVEPOINT_TYPE}; seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/master/JobMaster.java:199 * #consumeRedriveSavepointAfterRestore()}) once the restored job stabilizes back to {@code
  • Suggested fix: The hard-coded line numbers here are already off on this head: savePoint() is at 1413, the updateJobState(PENDING) call at 1206, restoreCoordinator at 706, and the SubPlan CANCELING case at 811. The text also describes the pre-fix restore path in the present tense ("no equivalent protection"), which stops being true with this PR. Could you drop the line numbers, phrase the root cause as "before this fix", and trim the Javadoc to the scenario, the timing technique and the proof assertions? Separately, the JobMaster field Javadoc says the flag is consumed once the job is back to RUNNING, but it is consumed before jobMaster.run().
  • Priority: P2 — optional
  • I traced this in the code.
  • When it happens: Open the files at PR head 09cee79 and follow the Javadoc pointers: JobMaster.java line 1295 is not savePoint() (it is at 1413), CoordinatorService.java line 1159 is not the updateJobState(PENDING) call (it is at 1206), CheckpointCoordinator.java line 673 is not restoreCoordinator (it is at 706), and SubPlan.java line 724 is not the CANCELING case (it is at 811). A reader following the Javadoc lands on unrelated code.

Issue 5: The new conf's comment about split.read-interval does not match FakeSource behaviour, and the job writes unthrottled output that the test never cleans up.

  • Location: seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/resources/stream_fake_to_localfile_savepoint_failover_template.conf:43
  • Why it matters: - Root cause: FakeSourceReader#pollNext only applies the read interval when !splitInProgress. For a large split it emits one batch, requeues the remainder, sets splitInProgress = true and skips the trailing sleep.
  • With row.num = 100000000, each reader therefore emits batches back to back, and split.read-interval = 300 has no effect until the split is exhausted. The comment that the delay "spreads out when each of the 5 parallel subtasks reaches the savepoint barrier" is not what the code does.
  • Impact: the source is not throttled by this option, so the job keeps writing into /tmp/hive/warehouse/<testCaseName> for the whole test, including the full three-minute wait when the regression it guards against is present.
  • createTestResources only creates that directory, and the test's finally does not delete it. The other *_failover_template.conf files in this directory use row.num between 5 and 500. Please check how much this writes on a CI runner.
  • Fix: correct the comment to say what actually keeps the savepoint in flight. Bound the output with a smaller row.num that still outlives the test, and delete the output directory in finally.
  • Evidence: seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/resources/stream_fake_to_localfile_savepoint_failover_template.conf:43 split.read-interval = 300; seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/resources/stream_fake_to_localfile_savepoint_failover_template.conf:40 # Per-split read delay spreads out when each of the 5 parallel subtasks reaches the savepoint
  • Suggested fix: FakeSourceReader#pollNext only honours the read interval when no split is in progress. With row.num = 100000000 the reader requeues the remainder and keeps emitting back to back, so this 300 ms delay does not spread out the barrier as the comment says. It also means the job writes unthrottled into /tmp/hive/warehouse/<testCaseName>, which the test never deletes. Could you fix the comment, bound the volume, and remove the output directory in the test's finally?
  • Priority: P2 — optional
  • I traced this in the code.
  • When it happens: Run testStreamJobResolvesToSavepointDoneAfterMasterFailoverDuringSavepointShutdown with the new template (row.num = 100000000, split.num = 5, split.read-interval = 300, parallelism 5). Each reader takes a 20M-row split and pollNext emits 4096-row batches consecutively without the 300 ms interval or the 1 s sleep. The LocalFile sink output under /tmp/hive/warehouse/testStreamJobResolvesToSavepointDoneAfterMasterFailoverDuringSavepointShutdown is left on disk after the test.

Issue 6: The redrive flag is consumed before the task is submitted, so a rejection from the shared coordinator pool loses the redrive for good.

  • Location: seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java:1315
  • Why it matters: - Root cause: consumeRedriveSavepointAfterRestore() clears the flag first, and only then is the task submitted to the shared coordinator executor. That pool is a ThreadPoolExecutor with a SynchronousQueue and the AbortPolicy-based RejectionCountingHandler, so it rejects as soon as the configured maximum thread count is in use.
  • The submission happens while restored jobs are being rescheduled on the new master, which is when the pool is likely to be busiest. Each redriven job needs a second pool thread on top of the one blocked in jobMaster.run().
  • On RejectedExecutionException the code only logs a warning. The flag is already false, so nothing retries and the savepoint request is dropped, which is the pre-fix behaviour this PR sets out to remove.
  • Fix: clear the flag only after a successful submission, or re-mark it in the catch and retry. Better still, drive the poll from a small ScheduledExecutorService, as pipelineCleanupScheduler does, so the redrive neither competes with job threads nor parks a pool thread per job.
  • Evidence: seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java:1315 } catch (RejectedExecutionException e) {
  • Suggested fix: By this point consumeRedriveSavepointAfterRestore() has already cleared the flag, so a rejection drops the redrive permanently. The pool is a SynchronousQueue + AbortPolicy executor and this submit runs during the post-failover restore burst, which is when a rejection is most likely. Could we clear the flag only after a successful submit (or re-mark it and retry), or run the poll on a small scheduled executor instead of holding a pool thread per job?
  • Priority: P2 — optional
  • I traced this in the code.
  • When it happens: Configure the coordinator service with a finite max-thread-num = K (the default is Integer.MAX_VALUE, ServerConfigOptions.java:531-534). On master failover, have K-1 pool threads already occupied (each restored or running job holds one thread blocked in jobMaster.run(), line 520) and restore a job whose persisted status is DOING_SAVEPOINT. Its scheduling task takes the K-th thread, line 517 consumes the flag, the submit at 1260 is rejected, and line 1320 logs 'Failed to schedule savepoint redrive for job ...'. The job stays RUNNING and never reaches SAVEPOINT_DONE.

Review conclusion

Conclusion: final approval remains pending on the previous comments

2. Remaining follow-ups

  • Issue 1: Every not-ready redrive attempt logs a full stack trace at INFO and flips the persisted job status RUNNING -> DOING_SAVEPOINT -> RUNNING, every 500 ms for up to 5 minutes per job.
  • Issue 2: A non-retriable redriven savepoint failure is logged at INFO as "retrying" although savePoint() has already started force-stopping the job; the Javadoc claim that the redrive is "not a new source of failures" does not hold on this path.
  • Issue 3: After a failover the new master now stops the job on behalf of a savepoint call the client saw fail, with no opt-out and no documentation.
  • Issue 4: The new Javadoc carries line numbers that are already wrong, describes the pre-fix code in the present tense, and misstates when the flag is consumed.
  • Issue 5: The new conf's comment about split.read-interval does not match FakeSource behaviour, and the job writes unthrottled output that the test never cleans up.
  • Issue 6: The redrive flag is consumed before the task is submitted, so a rejection from the shared coordinator pool loses the redrive for good.

Thanks for the updates so far. Happy to discuss the remaining points.

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @SEZ9 for the follow-up. The production changes are present in this head's complete PR diff in CoordinatorService and JobMaster. The test poll already tolerates transient exceptions, the old RPC future is inspected with a timeout, and the executor is shut down in the finally block. I rechecked those paths, the current fixture update, and the current CI. This is a technical review of a PR I authored.

What problem does this PR solve?

A master switch could lose an in-flight stop-with-savepoint request, leaving a streaming job running after the client received a failure. The reconstructed JobMaster carries a one-shot marker so the new coordinator can re-issue the existing savepoint action when the job is back. For example, a recovered streaming job with one outstanding stop request can produce a later durable savepoint and reach SAVEPOINT_DONE.

1. Code changes

1.1 Core logic

Before, restoring the job wrote PENDING and the coordinator discarded the in-flight checkpoint, leaving no record of why it was stopping. Now CoordinatorService.java:1181-1206 detects DOING_SAVEPOINT before overwriting the state, and JobMaster.java:1653-1673 holds and consumes the marker.

Client stop-with-savepoint -> JobMaster.savePoint (:1413)
 -> PhysicalPlan.DOING_SAVEPOINT -> trigger all pipeline savepoints -> wait for completion
Master switch -> CoordinatorService.restoreJobFromMasterActiveSwitch (:1130)
 -> read prior status -> reconstruct JobMaster -> mark redrive -> persist PENDING
 -> pending scheduler restores pipeline state (:499-519) -> job run -> RUNNING
 -> redrive task (:1256-1315) -> same savePoint entry point when ready
    -> pre-start readiness failure restores RUNNING and can retry
    -> completed savepoint ends the job; other trigger failures follow existing stop semantics

The marker is consumed only for this recovered state, and the steady-state path remains unchanged. The marker is in memory and a second failover before the new intent is stored can lose it. The E2E now rejects successful completion on the old master and checks a later persisted savepoint. This answers the false-pass concern. +1 to @SEZ9 that the poll-then-stop boundary is still a possible test failure and that a prior-head Build cannot validate this commit.

1.2 Compatibility

Fully compatible in checkpoint format, API, config and wire representation. In the targeted failover scenario a previously dropped request can now be retried and complete. There is no saved-state migration.

1.3 Performance and side effects

Each redrive temporarily takes a shared-executor worker and checks the job every 500 ms between waits. The call can wait for pipeline savepoint futures, so the five-minute retry window does not cap worker occupancy. No additional network round trip occurs on the normal path. The redrive reuses existing barrier dispatch, savepoint storage and stop semantics. The one-shot flag guards duplicate scheduling on the same reconstructed master.

1.4 Errors, logging, and findings

Issue 1 (Medium, non-blocking carryover): The regression fixture still races the old master's final acknowledgement. At seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/java/org/apache/seatunnel/engine/e2e/CheckpointCoordinatorFailoverIT.java:1119-1159, the old checkpoint can finish between detection and shutdown. The test now fails explicitly when it sees that, which blocks a false pass. A deterministic gate on one acknowledgement would make the fixture repeatable under scheduler load. @SEZ9 raised the same timing concern, and this is the existing review item.

Issue 2 (Low, non-blocking carryover): Align the executor time-budget wording with the documented behavior. At seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java:1239-1299, the timeout is checked between attempts. The blocking savepoint call may run past it, and the in-memory marker addresses a single failover. The PR description now states both limitations. Give the same precise scope in the implementation comment and distinguish readiness retries from other checkpoint failures in follow-up work if the path is extended.

Failed scheduling emits a warning and leaves the job on the existing restore path. No new source blocker was found within the documented single-failover scope.

2. Code quality

2.1 Conventions

The redrive field, mark/consume methods, retry entry point, and test helpers document their lifecycle contracts. The latest IRIS test fixture change matches the separately landed upstream change #13285.

2.2 Test coverage and stability

Stability rating: risk present (Issue 1). CheckpointCoordinatorFailoverIT.java:1089-1247 uses an observed pending checkpoint, bounded later assertions, an old-master completion guard, and cleanup in finally. It verifies a new savepoint was persisted and does not rely only on terminal status. The stop trigger still races acknowledgement; an explicit test gate would remove that timing dependency. The current engine-v2 integration lanes passed on JDK 11 and 17. No local PR test ran.

2.3 Documentation

The existing PR description now describes one failover and a deadline between attempts. No option, CLI or user-facing documentation format changes are needed for this scoped correctness fix.

3. Architecture

3.1 Change location

A focused single-failover recovery change using the existing savepoint path. Persisted intent would be a separate extension for repeated failovers.

3.2 Maintainability

Keeping trigger and classification in JobMaster avoids a second savepoint protocol. A deterministic fixture hook would reduce dependence on private coordinator fields.

3.3 Extensibility

If repeated failover coverage is required, use a durable intent and a bounded, idempotent request identity across master epochs.

3.4 Upgrade impact

Existing savepoints and checkpoints remain readable. Retrying the client request remains necessary when the redrive cannot be scheduled or a second failover loses its marker.

4. Findings summary

# Finding Location Severity
1 Detect-then-stop timing risk (carryover) seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/java/org/apache/seatunnel/engine/e2e/CheckpointCoordinatorFailoverIT.java:1119-1159 Medium
2 Clarify time-budget wording (carryover) seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java:1239-1299 Low

5. Merge recommendation

Can merge after current-head CI and independent maintainer review are satisfied.

Blocking items: No source blocker in the documented scope. SFTP JDK 17 cannot pull the retired fixture image; dev has the replacement in #13203. Please sync the latest dev and rerun Build. The identical IRIS fixture update is already in dev via #13285, so it need not remain an isolated PR commit after sync. Dependency licenses hit HTTP 429 during installation. The failed Linux JDK 11 unit lane needs a readable job log or rerun before attributing it. A write-capable maintainer's independent review remains required.

Non-blocking suggestions: Issues 1 and 2 are the remaining scoped follow-ups.

The latest test can distinguish redrive from completion on the original master. A deterministic acknowledgement gate is the most direct way to harden that evidence in a follow-up.

CI and repository state: no check reported in the Apache rollup; Build: failure. GitHub reports BLOCKED / REVIEW_REQUIRED.

Verification: Reviewed all changed files and the referenced call sites at 09cee791caaaef39e09646057275604731826b55 against merge base 3ac2d1cec6aa7b3741c4dacdd23020f778e23c02. git diff --check passed. I did not build, run tests, or execute SeaTunnel locally.

@SEZ9

SEZ9 commented Nov 22, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the follow-up on c91274d45993d5e14648bc4e4d75fcd64d4bfdf2. Capturing the old PendingCheckpoint future and rejecting a successful acknowledgment after shutdown makes the regression test stricter, and restoring the deploy mode is a good cleanup.

The follow-up also states that the production redrive semantics are unchanged, and I see nothing in the thread that addresses the earlier points, so they remain open:

  • PR12134-F1 (not-ready retries): The described flow ("pre-start readiness failure restores RUNNING and can retry") still means that every not-ready attempt logs a full stack trace at INFO and flips the persisted status RUNNING -> DOING_SAVEPOINT -> RUNNING, every 500 ms for up to 5 minutes per job. Please check readiness before entering savePoint() so the persisted status is not touched, and log the not-ready case without a stack trace.

  • PR12134-F5 (non-retriable failure): The note says other trigger failures "follow existing stop semantics", which is the path in question. Here savePoint() has already started force-stopping the job, yet the log says "retrying" at INFO. Please log this case at a higher level with an accurate message, and correct the Javadoc claim that the redrive is "not a new source of failures".

  • PR12134-F6 (behaviour change): Agreed that checkpoint format, API, config and wire representation are compatible. The open point is behavioural: after a failover, the new master now stops the job on behalf of a savepoint call the client saw fail. The compatibility section is cut off in what I can see, so please confirm whether an opt-out or user-facing documentation is planned, and add at least the documentation.

  • PR12134-F9 (Javadoc): Please remove the hard-coded line numbers, describe the pre-fix behaviour in the past tense, and correct the statement of when the flag is consumed.

  • PR12134-F10 (test conf): The review mentions a fixture update, but not what changed. Please confirm whether the split.read-interval comment now matches FakeSource behaviour, and whether the unthrottled output is throttled or cleaned up by the test.

  • PR12134-F11 (flag consumption order): The flag is still consumed before the task is submitted, so a rejection from the shared coordinator pool loses the redrive for good. Please consume it only after a successful submit, or restore it on rejection.

If any of these are already handled in this head, please point me to the change and I will re-check.

@DanielLeens DanielLeens left a comment •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, contributing to Apache SeaTunnel. Sorry for my previous blanket source-clear conclusion: I should have reconciled the existing retry, logging and user-documentation findings more carefully. These are carryover review omissions, not newly introduced defects. I have now read the complete production and test diff locally. The regression guard is materially stronger, but the existing production findings below remain open.

What problem does this PR solve?

User pain point: a master switch during stop-with-savepoint discards the in-flight checkpoint and resumes the job without completing the requested stop.

Fix approach: remember restored DOING_SAVEPOINT jobs in the new JobMaster and asynchronously reissue the savepoint after scheduling.

One sentence: recover one interrupted stop-with-savepoint request after a master switch.

Example: a streaming job is saving its final checkpoint when the master leaves. The old RPC fails; the replacement master now starts another savepoint and eventually stops the job as SAVEPOINT_DONE.

1. Code changes

1.1 Core logic

Complete runtime path:

Client savePointJob pinned to old master -> JobMaster.savePoint -> PhysicalPlan.savepointJob -> DOING_SAVEPOINT
  -> CheckpointManager trigger -> PendingCheckpoint / barrier / ACK
Master switch -> restoreJobFromMasterActiveSwitch sees persisted DOING_SAVEPOINT
  -> mark heap-only redrive flag -> queue RESTORE -> persist PENDING
Scheduler consumes flag before executor submission -> asynchronous redrive + JobMaster.run
  -> RUNNING -> savePoint().get -> readiness failure restores RUNNING -> retry500ms
  -> accepted savepoint completes -> SAVEPOINT_DONE
  -> non-precondition failure -> savepointFailed -> stopJob -> stopPipelineWithCheckpointFallback
  -> terminal state ends retry; five-minute deadline checked only between attempts.

Key findings and correctness:

The original lost-intent path is real, and scheduling alongside run (rather than after its terminal return) is necessary. The synchronized one-shot flag limits duplicate scheduling for one JobMaster. Normal jobs without restored DOING_SAVEPOINT do not enter this branch. Single-failover scope is explicit: a second failover before DOING_SAVEPOINT is persisted again can lose the heap-only intent. Rejected executor submission also loses the consumed intent, as the current rejection comment explicitly acknowledges; this remains best-effort, not durable request recovery. The five-minute budget is not a timeout on savePoint().get. The complete production diff is locally visible; lack of a rendered web diff is no longer a source-review blocker. Current code still confirms the existing peer findings on repeated persisted transitions, misleading retry classification, and missing user-facing semantics. No new duplicate numbered finding is added.

Before:

PendingJobInfo pendingJobInfo = new PendingJobInfo(PendingSourceState.RESTORE, jobMaster);
pendingJobQueue.put(pendingJobInfo);
jobMaster.getPhysicalPlan().updateJobState(JobStatus.PENDING);

After:

if (jobState == JobStatus.DOING_SAVEPOINT) {
    jobMaster.markRedriveSavepointAfterRestore();
}
// Later, in the scheduling runnable, before jobMaster.run():
if (jobMaster.consumeRedriveSavepointAfterRestore()) {
    redriveSavepointAfterMasterFailover(jobMaster, mdcExecutorService);
}

1.2 Compatibility

API, options, defaults, checkpoint/wire representation are unchanged. Behavior is intentionally changed: a failed client savepoint RPC can be followed by an autonomous successful job stop. This must be described in both user guides, including single-failover, rejection and deadline limits; do not present it as a durable acknowledged request. The fractional-rate correction changes a test oracle only.

1.3 Performance and side effects

One shared coordinator executor thread is held per redrive, including sleep and an unbounded future get relative to the stated five-minute polling budget. Repeated not-ready attempts add persisted state/timestamp writes and INFO stack traces during failover. There is no new row buffer/network protocol; existing checkpoint IO and stop semantics are reused. Interruption is preserved and submission rejection is logged, but ownership across another master switch remains the documented limitation.

1.4 Errors, logging, and findings

No new independently numbered finding; the existing peer blockers below remain open.

+1 to @SEZ9 review5933781162 Issues1-3, reiterated in comment7087175006 as F1/F5/F6. Current evidence: CoordinatorService.java:1277 calls savePoint on every RUNNING poll; JobMaster.java:1424 persists DOING_SAVEPOINT before start readiness is checked, and :1439-1445 restores RUNNING on precondition failure. PhysicalPlan.java:271-301 persists timestamps/status and logs each transition. ExceptionUtils.java:30-40 returns an entire stack trace, so CoordinatorService.java:1291-1296 produces repeated INFO stacks at the fixed500ms cadence. Please gate on read-only readiness or use bounded backoff and a concise cause. For non-precondition failures JobMaster.java:1451 calls savepointFailed -> PhysicalPlan.java:238-260 stops pipelines; the same catch still says retrying at INFO, contrary to :1240-1242. Separate retriable start failures from terminal fallback, report the actual action, and correct that Javadoc. Finally, no docs/en or docs/zh file explains that the old client RPC can fail while the replacement master subsequently completes stop-with-savepoint; add that operational contract. An opt-out is a design choice, not an independently demonstrated mandatory new setting. Peer F9 remains a documentation cleanup: the IT still cites approximate hard-coded source line numbers. F10 now has the per-split throttle comment and transactional LocalFile test directory; F11 remains explicitly best-effort consumed-before-submit, rather than a proven durable guarantee. The later peer test concerns are largely addressed: ignoreExceptions/null guards, finally shutdown/mode restoration, bounded future inspection and old-checkpoint non-success checks are present. The detect-then-shutdown scheduling window remains a nonblocking stability concern, as discussed below. There is no independent active formal approval to override; these specific peer production findings still need resolution.

2. Code quality

2.1 Conventions

Reviewed all changed files for license, imports, naming, core-method and state-field comments. No additional convention blocker found.

2.2 Test coverage and stability

Stability rating: At risk. At risk (nonblocking scheduling concern). CheckpointCoordinatorFailoverIT.java now uses a uniquely named in-process cluster, bounded conditional waits, a pinned old-master RPC, a captured old PendingCheckpoint future checked after shutdown and after persistence, a newer checkpoint trigger timestamp, explicit SAVEPOINT_DONE and expected client failure. This rejects false success from an old-master completed savepoint. It does not prevent that checkpoint from completing between the reflection probe and shutdown, so a loaded CI worker can still miss the window and fail the explicit assertion. Prefer a controlled barrier/ACK test hook or a bounded fresh trigger sequence; the300ms split delay is not synchronization. No measured flake rate is claimed. Reflection polling is guarded; executor, cluster and deploy-mode cleanup are in finally. The added SeaTunnelClientTest sums fractional JSON rates with asDouble rather than truncating every sample with asLong; its deterministic fractional positive and omitted-component negative assertions cover that oracle correction. The current queued fork run has not yet supplied a completed result; older green/red runs are not validation for this head. No local runtime or repeated IT run was performed.

2.3 Documentation

Core lifecycle methods and flag ownership have extensive comments, but the no-new-failure and five-minute-thread wording are inaccurate on the traced branches. Replace hard-coded IT source line numbers with method references. Add docs/en and docs/zh savepoint recovery semantics; an internal Javadoc or PR description is not a user guide.

3. Architecture

3.1 Change location

Keep recovery intent scheduling in CoordinatorService and savepoint readiness/failure semantics at the checkpoint/JobMaster boundary. A small readiness contract and accurate outcome classification are preferable to treating every exception as a retry.

3.2 Maintainability

Keep the behavior, lifecycle ownership, and failure contract together. Keep recovery intent scheduling in CoordinatorService and savepoint readiness/failure semantics at the checkpoint/JobMaster boundary. A small readiness contract and accurate outcome classification are preferable to treating every exception as a retry.

3.3 Extensibility

Prefer the existing component boundary and tests over unrelated shared abstractions.

3.4 Upgrade impact

API, options, defaults, checkpoint/wire representation are unchanged. Behavior is intentionally changed: a failed client savepoint RPC can be followed by an autonomous successful job stop. This must be described in both user guides, including single-failover, rejection and deadline limits; do not present it as a durable acknowledged request. The fractional-rate correction changes a test oracle only.

4. Findings summary

Completeness check: All changed files and affected entry/failure paths were reviewed; configuration/serialization compatibility, test failure capability and stability, documentation/examples, change ownership, and current CI/conflict/review gates are covered above. No unreviewed source scope is claimed complete.

# Finding Location Severity
Peer F1 Readiness retry repeatedly mutates persisted status / logs stacks CoordinatorService.java:1277-1300 High
Peer F5 Terminal fallback reported as retry / incorrect Javadoc CoordinatorService.java:1240-1242,1291-1296 High
Peer F6 Autonomous stop after failed client RPC needs bilingual user documentation CoordinatorService.java:1193 Medium

5. Merge recommendation

Merge after fixes

Blocking items: @SEZ9 review5933781162 Issues1-3 / latest F1,F5,F6: readiness/status churn, incorrect terminal-failure reporting and missing user documentation. Current-head CI and write-capable maintainer review remain independent requirements.

Non-blocking suggestions: None beyond the validation limits above.

Overall: the lost-intent fix is real, but the peer production blockers remain; no runtime acceptance is claimed. Daniel has READ permission, so this COMMENT cannot dismiss historical requested changes or satisfy a write-capable maintainer approval gate.

CI and repository state: Signal pull request update: SUCCESS; Build: IN_PROGRESS; Build: queued. GitHub reports BLOCKED / REVIEW_REQUIRED.

Verification: Reviewed all changed files and the referenced call sites at cb596b6d3e88a88e45d7898c8038f8ba81b250c8 against merge base efecb179a100d0a621566ba1b0c015357f55c168. git diff --check passed. I did not build, run tests, or execute SeaTunnel locally.

Review time: 2026-11-23T08:06:12.889287-05:00

Local evidence: git fetch obtained head cb596b6d3e88a88e45d7898c8038f8ba81b250c8; git merge-base returned efecb179a100d0a621566ba1b0c015357f55c168; git diff --stat reports 5 files changed, 740 insertions(+), 55 deletions(-). git show and source searches were used for the entry points above. No local build, unit test, E2E, Docker run or service startup was executed.

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for keeping this moving. The pending CI fact in my previous full review has changed: exact-head Build 45010296782 has completed as cancelled and the Apache bridge reports TIMED_OUT. Its current manifest has no failed job, but twelve connector lanes were cancelled (JDBC parts1/2/5, Doris, Oracle, MySQL CDC and Elasticsearch among them). These cancellations are not passing validation or evidence of a new source defect.

The source conclusion is unchanged: +1 to SEZ9's retained F1/F5/F6 on readiness/status churn, terminal-outcome reporting/Javadoc, and bilingual autonomous-stop documentation. Please close those focused requests and complete applicable CI on the updated head. No unrelated CI workaround or blind base sync is requested by this cancellation update.

5. Merge recommendation

Conclusion: Merge after the retained fixes and repository gates

Blocking items: The retained source/test/documentation requests referenced above, plus completed applicable CI.

Non-blocking suggestions: No new source finding is added in this CI follow-up.

Checked unchanged head cb596b6d3e88a88e45d7898c8038f8ba81b250c8 against dev: compare diverged, ahead 17 / behind 13. Branch drift is recorded independently. Daniel has READ permission; this COMMENT cannot dismiss historical change requests or replace write-capable maintainer approval. No local build, test, or runtime execution was performed.

@SEZ9

SEZ9 commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

Quick status update: the CI picture has changed, but the review conclusion has not.

CI: Build 45010296782 on head cb596b6d3e88a88e45d7898c8038f8ba81b250c8 finished as cancelled (timed out). Twelve connector lanes were cancelled and no job is reported as failed, so this is neither a passing run nor a sign of a defect in your change. No CI workaround or base sync is needed because of it. A completed run on the updated head is still required.

Still blocking:

  • F1: Each not-ready redrive attempt logs a full stack trace at INFO and flips the persisted job status RUNNING -> DOING_SAVEPOINT -> RUNNING, every 500 ms for up to 5 minutes per job. Please check readiness without the status churn and without the per-attempt stack trace.
  • F5: A non-retriable redriven savepoint failure is logged at INFO as "retrying" although savePoint() has already started force-stopping the job. Please report that terminal outcome as what it is, and correct the Javadoc claim that the redrive is "not a new source of failures".
  • F6: After a failover the new master now stops the job on behalf of a savepoint call the client saw fail, with no opt-out and no documentation. Please document this autonomous stop in both the English and Chinese docs, and say whether you intend to offer an opt-out.

Also still open (lower severity):

  • F9: The new Javadoc in CheckpointCoordinatorFailoverIT carries line numbers that are already wrong, describes the pre-fix code in the present tense, and misstates when the flag is consumed.
  • F10: In stream_fake_to_localfile_savepoint_failover_template.conf, the comment about split.read-interval does not match FakeSource behaviour. The job also writes unthrottled output that the test never cleans up.
  • F11: The redrive flag is consumed before the task is submitted, so a rejection from the shared coordinator pool loses the redrive for good.

Once F1, F5 and F6 are addressed and CI completes on the new head, this should be ready to merge. For F9–F11, please either fix them in the same update or reply with how you plan to handle each.

@DanielLeens

Copy link
Copy Markdown
Contributor Author

Thanks, @SEZ9. The separation is right: cancellation/time-out is incomplete validation, not proof of a source regression. My previously recorded blockers remain open: readiness redrive must avoid repeated persisted status churn and full stack traces; a terminal savepoint failure must not be logged as retryable; and the autonomous post-failover stop contract needs EN/ZH documentation. Please keep the per-item status for the existing lower-severity flag-submission and fixture notes in the same update. GitHub also reports actual dev conflicts, which the contributor must resolve before new-head checks. No unrelated dependency patch is requested.

Discussion-only follow-up on unchanged head cb596b6d3e88a88e45d7898c8038f8ba81b250c8; no new full source review or local build/test/runtime execution is claimed. Daniel has READ permission; effective write-maintainer approval/dismissal remains separate.

@SEZ9

SEZ9 commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

Thanks for sticking with this. The cancelled run of Build 45010296782 is incomplete validation, not evidence of a source defect, so it does not change the review. The open requests on head cb596b6d3e88a88e45d7898c8038f8ba81b250c8 are the same as before.

Blocking

  • F1 (redrive readiness churn): each not-ready redrive attempt logs a full stack trace at INFO and flips the persisted job status RUNNING -> DOING_SAVEPOINT -> RUNNING, every 500 ms for up to 5 minutes per job. Please make the not-ready path stop touching the persisted status and stop logging a stack trace on every attempt.
  • F5 (terminal failure logged as retry): a non-retriable redriven savepoint failure is logged at INFO as "retrying", although savePoint() has already started force-stopping the job. Please report that outcome as terminal, and correct the Javadoc claim that the redrive is "not a new source of failures", which does not hold on this path.
  • F6 (autonomous stop after failover): the new master now stops the job on behalf of a savepoint call the client saw fail, with no opt-out and no documentation. Please document this contract in both the EN and ZH docs. Could you also say whether you intend to add an opt-out, or explain why one is not needed?

Lower severity (please give a per-item status in the same update)

  • F9: the new Javadoc carries line numbers that are already wrong, describes the pre-fix code in the present tense, and misstates when the flag is consumed.
  • F10: the split.read-interval comment in the new conf does not match FakeSource behaviour, and the job writes unthrottled output that the test never cleans up.
  • F11: the redrive flag is consumed before the task is submitted, so a rejection from the shared coordinator pool loses the redrive for good.

For each item, a short "fixed" or "not changed, because…" note is enough. Once the update is pushed, I'll go through these six points again.

@DanielLeens

Copy link
Copy Markdown
Contributor Author

Thanks, @SEZ9. I agree with keeping the existing items separate. On the unchanged head, F1/F5/F6 still require the readiness path, terminal-failure handling and bilingual failover contract changes you describe; F9/F10/F11 retain their previously recorded documentation/fixture/submission status. No new commit exists to verify a fix, so none is being marked resolved. The current Build is timed out, which is incomplete validation rather than evidence that any of those source requests is fixed. A single path-to-change/test summary with the next commit will let us reconcile them without adding unrelated work.

This is a discussion/gate follow-up on unchanged head cb596b6d3e88a88e45d7898c8038f8ba81b250c8, not a new full source review. Base dev compare: diverged, ahead 17 / behind 69. Branch drift alone is not a request to sync. No local build/test/runtime execution was performed. Daniel has READ permission; any required write-capable maintainer approval or historical-review dismissal remains separate.

@SEZ9

SEZ9 commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

Thanks for sticking with this. No new commit has landed on cb596b6d3e88a88e45d7898c8038f8ba81b250c8, so none of the earlier items can be marked resolved yet. Build 45010296782 was cancelled / timed out, which means validation is incomplete; it says nothing either way about these items.

The three items that still block merge:

  • F1: a not-ready redrive attempt should not log a full stack trace at INFO or flip the persisted job status RUNNING -> DOING_SAVEPOINT -> RUNNING. Today that repeats every 500 ms for up to 5 minutes per job.
  • F5: a non-retriable redriven savepoint failure is logged at INFO as "retrying" even though savePoint() has already started force-stopping the job. Please report it as a terminal outcome, and correct the Javadoc claim that the redrive is "not a new source of failures".
  • F6: after a failover, the new master stops the job on behalf of a savepoint call the client saw fail. Please document this in both EN and ZH, and say how you want to handle the missing opt-out.

The three lower-severity items, which still need a per-item status in the same update:

  • F9: the new Javadoc in CheckpointCoordinatorFailoverIT has stale line numbers, describes the pre-fix code in the present tense, and misstates when the flag is consumed.
  • F10: the split.read-interval comment in stream_fake_to_localfile_savepoint_failover_template.conf does not match FakeSource behaviour, and the job writes unthrottled output that the test never cleans up.
  • F11: the redrive flag is consumed before the task is submitted, so a rejection from the shared coordinator pool loses the redrive for good.

With the next commit, could you add a short summary mapping each of F1/F5/F6/F9/F10/F11 to the change and the test that covers it (or a note on why you are leaving it as is)? That lets us reconcile them in one pass, and nothing beyond these six is being asked for.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants