Skip to content

[Test][E2E] Add regression coverage for task stuck in CANCELING when worker crashes mid-cancel - #12030

Merged
nzw921rx merged 1 commit into
apache:devfrom
davidzollo:zeta-i7-canceling-stuck
Sep 9, 2026
Merged

nzw921rx merged 1 commit into
apache:devfrom
davidzollo:zeta-i7-canceling-stuck

Conversation

@davidzollo

Copy link
Copy Markdown
Contributor

Purpose

Adds multi-node E2E regression coverage for the CANCELING-stuck-forever race
fixed in #10729 ("[Fix][Zeta] prevent cancel stuck and downgrade tmp cleanup
failure", commit 2c81f7f3c31).

Before that fix, PhysicalVertex#noticeTaskExecutionServiceCancel sent a
CancelTaskOperation to the worker owning the task and retried while that
worker remained a cluster member, but once the worker actually left the
cluster before acking the cancel, the retry loop simply exited without ever
resolving the task's state. The vertex — and therefore its pipeline and job
— stayed CANCELING forever, because nothing else in that method drove it
to a terminal state. The fix added a fallback right after the retry loop: if
the loop exits with the ack still missing and the vertex is still
CANCELING, mark it CANCELED locally.

The fix shipped with no dedicated regression test reproducing the original
multi-node timing/race at the engine level.

What was still missing

CoordinatorService#failedTaskOnMemberRemoved also matches CANCELING
tasks when a member is lost (this branch predates the fix — confirmed via
git show against the fix commit's parent), which raises the question of
whether that path already covered the bug. It does not, reliably: it has to
go through the same synchronized updateTaskState as
PhysicalVertex#cancel/#updateTaskState/#stateProcess, all of which are
synchronized on the vertex itself, and the whole call chain from cancel()
down into noticeTaskExecutionServiceCancel runs on that lock without
releasing it. A competing failedTaskOnMemberRemoved call can therefore
only run after the cancelling thread has already returned — by which
point the fixed code has already resolved the vertex to CANCELED, and the
end-state consistency check inside updateTaskState rejects any later
attempt to move a terminal-state task to FAILED. So the fixed method's own
fallback is the sole, deterministic mechanism that unsticks this specific
race, which is why the new test asserts CANCELED (not FAILED) as the
outcome.

I also checked the existing fault-tolerance suite
(ClusterFaultToleranceIT, SplitClusterFaultToleranceIT,
ClusterFailureNoRestoreIT) for anything that already combines a cancel
request with a worker crash. It does not: existing tests either cancel a
job on a fully healthy cluster, or kill a worker on a job that is simply
RUNNING with no cancel in flight and cancel only after restore completes.
None land a worker crash inside the narrow window between "cancel issued,
CANCELING set" and "cancel ack received".

What this test does

SplitClusterFaultToleranceIT#testStreamJobCancelResolvesWhenWorkerCrashesBeforeCancelAck:

  1. Starts a minimal split-role cluster: 1 dedicated master + 1 dedicated
    worker.
  2. Submits the same long-running streaming holder job used elsewhere in
    this suite (pending_jobs_streaming_lifecycle.conf) and waits for the
    top-level job status and every individual task vertex to report
    RUNNING, so the cancel below isn't confounded by an in-flight
    DEPLOYING transition.
  3. Issues cancelJob() on its own thread. This is required because
    CoordinatorService#cancelJob runs JobMaster#cancelJob synchronously
    on its own executor, and the client's cancelJob() call blocks
    (PassiveCompletableFuture#join) until that whole per-vertex cancel
    resolves — so the test thread needs to stay free to react while the
    cancel is in flight on the server.
  4. Tight-polls (busy-spin, not Awaitility's ~100ms default interval) every
    task vertex's PhysicalVertex#getExecutionState() via the same in-JVM
    white-box access as SplitClusterPendingJobLifecycleFailoverIT#getJobMaster,
    and the instant any vertex is first observed CANCELING, immediately
    shuts the worker down.
  5. Asserts the job converges to CANCELED within a bounded time (using an
    already-in-flight waitForJobCompleteV2() future so the assertion
    itself cannot hang forever if the regression reappears), and that the
    original cancelJob() call also returns without hanging.

Why this trigger-construction is reliable

The race window this bug depends on — between a vertex's state flipping to
CANCELING and the CancelTaskOperation ack coming back from the worker —
can be sub-millisecond on a healthy local cluster, so blind timing (sleep
then kill) would be unreliable. Instead the test uses direct white-box
polling of internal engine state (same technique already proven in this
series, e.g. #12027), reacting the instant the state transition is
observed rather than guessing a delay. Because SubPlan#cancelPipeline
cancels vertices sequentially on a single thread and each vertex's cancel
call blocks synchronously on noticeTaskExecutionServiceCancel, the
CANCELING state is guaranteed to be visible for at least the duration of
a real cross-process Hazelcast operation invocation (these test nodes
communicate over real loopback sockets, not an in-memory bypass) — long
enough for a tight busy-poll loop to reliably observe it before the ack
round-trip completes.

Test plan

  • New test only; no production code changed.
  • ./mvnw spotless:apply run on the affected module — no additional
    formatting changes beyond what was already applied to the new code.
  • ./mvnw install -DskipTests run on the affected module and its
    dependency chain (this repo's shaded modules need install, not bare
    compile/test-compile, to resolve relocated classes) — confirmed
    BUILD SUCCESS, and confirmed the new test class actually compiled
    (target/test-classes contains the compiled .class file for the new
    method) rather than relying on a build that skips test compilation
    entirely.
  • Full test execution (real Hazelcast cluster startup, worker crash
    injection) is left to CI per this repository's E2E conventions; not run
    in this sandbox.

@github-actions github-actions Bot added the e2e label Sep 1, 2026

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor

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: the fix in #10729 ("[Fix][Zeta] prevent cancel stuck and downgrade tmp cleanup failure") closed a real bug where a task vertex could stay CANCELING forever if its worker crashed after the cancel RPC was sent but before the ack arrived, yet that fix shipped with no dedicated regression test reproducing the original multi-node timing/race at the engine level.
  • Fix approach: adds SplitClusterFaultToleranceIT#testStreamJobCancelResolvesWhenWorkerCrashesBeforeCancelAck, a 1-master/1-worker cluster test that white-box busy-polls PhysicalVertex#getExecutionState() right after issuing cancelJob(), kills the worker the instant any vertex is first observed CANCELING, and asserts the job still converges to CANCELED (not stuck) within a bounded time, and that the original cancelJob() call also returns.
  • One-sentence summary: a genuinely well-researched, test-only regression PR whose every non-trivial claim about the engine's locking/state-machine behavior I independently verified against current dev source, and which does not appear to introduce any flakiness of its own; I found no blocking issues.

1. Code Change Review

1.1 Core Logic Analysis

Single file changed: seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/java/org/apache/seatunnel/engine/e2e/SplitClusterFaultToleranceIT.java (+243, new test method + 7 new private helpers, no production code touched, no existing test modified).

I traced the full runtime path the test is meant to exercise, verifying every step against current dev source rather than trusting the PR description:

test thread: clientJobProxy.cancelJob()  (blocking: PassiveCompletableFuture#join(),
              ClientJobProxy.java:141-145)
  -> server: CoordinatorService#cancelJob(jobId)  (CoordinatorService.java:1563-1584)
       runs runningJobMaster.cancelJob() on executorService, future completes only
       when that call returns
  -> JobMaster#cancelJob -> SubPlan#cancelPipeline -> updatePipelineState(CANCELING)
       -> SubPlan#stateProcess() case CANCELING (SubPlan.java:724-735):
            coordinatorVertexList.forEach(task -> task.cancel());   // sequential!
            physicalVertexList.forEach(task -> task.cancel());      // sequential!
  -> PhysicalVertex#cancel() [synchronized] -> updateTaskState(CANCELING) [synchronized,
       reentrant] :
            this.currExecutionState = CANCELING;   // volatile write, PhysicalVertex.java:396
            stateProcess();                          // reentrant, same lock
  -> PhysicalVertex#stateProcess() case CANCELING -> noticeTaskExecutionServiceCancel()
       (still holding the vertex's own monitor the whole time):
            while (!taskFuture.isDone() && member still in cluster) {
                invoke CancelTaskOperation on worker, .get()  // real cross-process RPC
            }
            if (!taskFuture.isDone() && still CANCELING) {
                updateTaskState(CANCELED);   // <- the #10729 fallback this test targets
            }

meanwhile, test thread busy-polls (Thread.yield(), no sleep):
  getExecutionState() -> reads currExecutionState directly (volatile field read,
  PhysicalVertex.java:482-483) -> NOT the distributed IMap, so this is a pure in-JVM
  read with no network latency
  the instant CANCELING is observed -> workerNode.shutdown()

Key Findings:

  1. The currExecutionState volatile write happens strictly before the RPC is even sent, not just "before the ack arrives" as the PR description phrases it (PhysicalVertex.java:396 executes before stateProcess() triggers noticeTaskExecutionServiceCancel()'s invoke() call). That makes the test's timing guarantee actually stronger than the PR body claims: the busy-poll thread can, in principle, observe CANCELING and call shutdown() even before the CancelTaskOperation is dispatched, not merely before its ack returns. This is a good thing for reliability, just worth noting the PR's own reasoning slightly undersells its own robustness.
  2. SubPlan#stateProcess()'s CANCELING branch cancels vertices sequentially on a single thread, and PhysicalVertex#cancel() is synchronized and blocks until noticeTaskExecutionServiceCancel() fully resolves (ack or fallback) before returning — I confirmed this directly (SubPlan.java:724-735, PhysicalVertex.java:409-465). This is exactly the property the test's Javadoc claims and depends on.
  3. The mutual-exclusion argument for why CoordinatorService#failedTaskOnMemberRemoved cannot be the mechanism that resolves this race also checks out: makeTasksFailed (CoordinatorService.java:2116-2138) does match CANCELING vertices on member loss and calls updateStateByExecutionService(FAILED), but that funnels into the same synchronized updateTaskState() (PhysicalVertex.java:351) as the cancel-thread, so it can only acquire the lock after the cancelling thread already resolved the vertex to CANCELED — and updateTaskState's end-state consistency check (PhysicalVertex.java:376-380) then silently rejects the late FAILED transition. This is a subtle, correct piece of concurrency archaeology; I verified it end-to-end rather than taking the PR body's word for it.
  4. ClientJobProxy#cancelJob() really does block synchronously (cancelFuture.join(), ClientJobProxy.java:145) while CoordinatorService#cancelJob runs the whole per-vertex cancel on its own executor (CoordinatorService.java:1576-1582) — this is why the test correctly issues cancelJob() on its own thread (CompletableFuture.runAsync) rather than calling it inline, which would have deadlocked the test's own polling logic. Good catch by the author, not a cargo-culted pattern.
  5. The white-box getJobMaster(HazelcastInstanceImpl, long) technique (line 536-539) is not novel to this PR — it is line-for-line the same pattern already used in the sibling SplitClusterPendingJobLifecycleFailoverIT#getJobMaster (verified: identical body). The pending_jobs_streaming_lifecycle.conf fixture reused here is likewise a pre-existing file already consumed by that same sibling test, not a new/unvalidated fixture invented for this PR.

Runtime path summary for a reviewer who has not read the engine internals: the test relies on the fact that (a) CANCELING becomes visible to any thread the instant it is set, strictly before the cancel RPC is even sent, and (b) that RPC is a real cross-process/loopback socket call that cannot complete in zero time — so a tight busy-spin thread reacting to (a) is essentially guaranteed to land its workerNode.shutdown() no later than while the RPC to that same worker is in flight, exactly the window PR #10729 patched.

1.2 Compatibility Impact

Fully compatible. Test-only change, zero production code touched, adds a new @Test method plus private helpers to an existing E2E class; nothing else in the file is modified (confirmed via git diff dev...HEAD --stat: 243 insertions, 0 deletions, one file).

1.3 Performance / Side-Effect Analysis

  • awaitAnyVertexCanceling busy-spins with Thread.yield() for up to 10 seconds (line 503-522) instead of a polling/backoff wait. This is a deliberate, justified choice (the race window can be sub-millisecond, well under Awaitility's ~100ms default poll interval) and is bounded, so it cannot hang a CI run — it will just burn one core for up to 10s in the worst case (a hung/regressed build), and typically resolves in far less than that. Not a concern for a bounded E2E test.
  • No new production resources are held; the test cluster (1 master + 1 worker Hazelcast instance) and the SeaTunnelClient are all shut down/closed in the finally block, consistent with every other test in this class.

1.4 Error Handling and Logging

No formal issues found that block merge. Two non-blocking observations below (see Issue Summary and Section 5).

2. Code Quality Assessment

2.1 Coding Standards

New test method and every substantive private helper (assertAllVerticesRunning, awaitAnyVertexCanceling, getJobMaster, assertEventuallyCanceled) carry explanatory Javadoc that documents the "why" (race timing, synchronization guarantees, what regression is being guarded against), not just the "what" — this exceeds the project's usual bar for test helper documentation. assertRunningSubPlan, assertRunningVertex, isAnyVertexCanceling are trivial one-line delegates referenced directly from their documented caller and don't need their own Javadoc. No Thread.sleep-based waits, no @DisplayName usage, no stray System.out.println. Formatting matches the surrounding file's Google-Java-Format style.

2.2 Test Coverage and Test Stability

Rating: Stable, with one non-blocking coverage-fidelity caveat.

  • No Thread.sleep anywhere in the new code; all waits are either Awaitility (assertAllVerticesRunning, assertEventuallyCanceled) or the justified busy-spin discussed above.
  • Readiness signal before triggering the race is solid: assertAllVerticesRunning waits for the top-level job status and every coordinator/task vertex to individually report RUNNING (not just the job-level status), so the cancel can't be confused with an in-flight DEPLOYING -> RUNNING transition (PhysicalVertex.java's own stateProcess() DEPLOYING branch would otherwise make this ambiguous).
  • No shared static state, no unreleased resources (cluster/client all closed in finally), no ordering dependency on other tests in the class (own dedicated testClusterName).
  • Non-blocking caveat (see Issue 1 below): the test has no positive assertion that the specific fallback branch in noticeTaskExecutionServiceCancel (the one #10729 actually added) fired, as opposed to the vertex having already resolved via a normal successful ack just before workerNode.shutdown() took effect. Given Finding 1 above (the CANCELING write is visible even before the RPC is dispatched), this is very unlikely to happen in practice, and even if it did on some run, the test would not become flaky/red — it just wouldn't have exercised the exact line it's meant to guard in that particular run. Not a stability risk, just a coverage-fidelity nuance worth being aware of.

2.3 Documentation Updates

Not applicable — test-only change, no docs/en / docs/zh content is affected by this PR's scope.

3. Architectural Soundness

3.1 Elegance of the Solution

Precise fix (in this case, precise regression test). The trigger-construction technique (react to a volatile-field-visible state transition instead of guessing a sleep duration) is the correct way to deterministically hit a sub-millisecond race window, and is consistent with the same technique already used in the sibling SplitClusterPendingJobLifecycleFailoverIT/PR #12027, giving this a track record within the same test family rather than being a one-off invention.

3.2 Maintainability

High — the extensive Javadoc on the test method (lines 335-368) essentially inlines the concurrency analysis a future maintainer would otherwise have to redo from scratch to understand why the test is shaped this way, and explicitly documents why it asserts CANCELED and not FAILED.

3.3 Extensibility

The helpers (assertAllVerticesRunning, getJobMaster, awaitAnyVertexCanceling) are reasonably generic and could be reused by future engine-lifecycle E2E tests in this class without modification.

3.4 Historical-Version Compatibility

Not applicable in the usual sense (no serialization/state/checkpoint format touched), but I did specifically check that the referenced fix PR #10729 is merged to dev (confirmed: merged 2026-04-20) and that the fallback code path it added is present, unmodified in shape, in current dev (PhysicalVertex.java:458-464) — so the test targets real, currently-shipped behavior, not a hypothetical or already-superseded code path.

4. Issue Summary

Number Issue Location Severity
1 No positive assertion that the specific worker-crash fallback branch (vs. a normal fast successful ack) actually resolved the vertex; extremely unlikely to matter in practice given the volatile-write-before-RPC-dispatch ordering, but not provable by the test itself SplitClusterFaultToleranceIT.java:415-465 (production code, referenced by the test's design) Low
2 awaitAnyVertexCanceling busy-spins on Thread.yield() for up to 10s in the worst case instead of a bounded-CPU wait strategy SplitClusterFaultToleranceIT.java:503-522 Low

5. Merge Recommendation

Conclusion: Ready to merge

  1. Blockers — none.
  2. Recommended fixes — non-blocking:
    • (Issue 1) If the author wants airtight proof the fallback branch specifically fired (not required for merge), a lightweight option would be a custom log4j2 appender or counter hook asserting the "cancel did not receive a terminal callback... mark task as CANCELED locally" log line (PhysicalVertex.java:459-461) was emitted during the test run — Option B below.
    • (Issue 2) Could be left as-is; a bounded busy-spin in a test is a reasonable, well-precedented trade-off for a sub-millisecond race window and I would not hold up merge over it.

Overall assessment: this is one of the more carefully-researched E2E regression PRs I've reviewed in this batch — nearly every non-obvious claim about locking, volatile visibility, and call-chain ordering in the PR description is independently verifiable in current dev source, and I confirmed all of them by reading the actual PhysicalVertex, SubPlan, CoordinatorService, and ClientJobProxy code rather than trusting the write-up. CI ("Build") is still queued/pending as of this review (no result yet on either the apache-side pointer check or the fork's own Actions run) and there are no other reviews yet on this PR — please make sure CI comes back green before merging, but I see no code-side blocker.

Option A (accept as-is, recommended): merge once CI is green; the two Low-severity notes above are informational only.
Option B (only if the team wants stronger proof-of-coverage for this specific regression class going forward): add a log-assertion or a counter/hook in a follow-up PR to make the fallback-branch execution independently verifiable, applied consistently across this whole family of white-box race tests (#12027 and friends) rather than one-off in this PR.

@DanielLeens

Copy link
Copy Markdown
Contributor

CI status update on the same head reviewed above: at review time Build was still queued/pending with no result yet. I just re-checked, and on this unchanged head it has since completed with success (along with Notify test workflow and labeler).

No change to the technical conclusion — this remains a test-only change with no code-side blocker from my side. With CI now green, the review above stands as Ready to merge.

Adds a multi-node E2E test that reproduces the exact race fixed by PR
failure", commit 2c81f7f): a task vertex could stay CANCELING
forever if the worker executing it crashed after the cancel RPC was
sent but before its ack arrived, since the pre-fix retry loop in
PhysicalVertex#noticeTaskExecutionServiceCancel exited silently once
the worker left the cluster, with nothing else driving the vertex to
a terminal state.

The test white-box polls PhysicalVertex#getExecutionState() in a
tight loop right after issuing cancelJob(), shuts the worker down the
instant a vertex is first observed CANCELING, and asserts the job
converges to CANCELED within a bounded time instead of hanging.
@davidzollo
davidzollo force-pushed the zeta-i7-canceling-stuck branch from f2c6c4c to 7cf39f6 Compare September 8, 2026 02:43

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for pushing more coverage onto this PR, @davidzollo! I approved the original single-test version of this branch back on Sept 1, but the head has since moved from f2c6c4c to 7cf39f6 and this new commit adds a second, much larger regression test (testDeployNotDuplicatedWhenMasterKilledDuringDeploy, +~340 lines) alongside the original CANCELING test, without changing the commit message to mention it. Since real test logic changed, I re-traced the whole file top-to-bottom against current dev rather than reviewing only the delta, and I'm combining that into this single review.

What Problem Does This PR Solve?

This PR now adds two independent white-box E2E regression tests to SplitClusterFaultToleranceIT, each pinned to a specific, previously-unguarded Zeta engine race that was already fixed in dev but had no dedicated test:

  • testStreamJobCancelResolvesWhenWorkerCrashesBeforeCancelAck (the test reviewed on Sept 1): guards the fix in #10729 for a task vertex staying CANCELING forever if its worker crashes after the cancel RPC is sent but before the ack returns.
  • testDeployNotDuplicatedWhenMasterKilledDuringDeploy (new in this commit): guards the fix in #10567 ("Make deployTask idempotent during master failover recovery") for TaskExecutionService#deployTask throwing RuntimeException("... already exists") when a new active master, restoring from failover, redeploys a vertex whose worker-side task is still genuinely alive.

One-sentence summary: both tests are well-researched, source-verified regression tests with no production code touched; I found no code-blocking issues, only one proportionality/CI-cost question on the new test's parallelism.

1. Code Change Review

1.1 Core Logic Analysis

Single file changed: seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/java/org/apache/seatunnel/engine/e2e/SplitClusterFaultToleranceIT.java (test-only, no src/main changes).

Test 1 — testStreamJobCancelResolvesWhenWorkerCrashesBeforeCancelAck (unchanged since my Sept 1 review). Runtime path, re-verified again against current dev:

ClientJobProxy.cancelJob() (blocking join)
 -> CoordinatorService#cancelJob -> JobMaster#cancelJob -> SubPlan#updatePipelineState(CANCELING)
 -> SubPlan#stateProcess() case CANCELING: coordinatorVertexList/physicalVertexList .forEach(task -> task.cancel())  [sequential]
 -> PhysicalVertex#cancel() [synchronized] -> updateTaskState(CANCELING) -> stateProcess() [reentrant, same lock]
 -> case CANCELING -> noticeTaskExecutionServiceCancel(): while (!taskFuture.isDone() && member still in cluster) invoke CancelTaskOperation, .get()

This still matches the described fix and the pre-fix silent-exit bug exactly as it did in the version I approved on Sept 1.

Test 2 — testDeployNotDuplicatedWhenMasterKilledDuringDeploy (new, SplitClusterFaultToleranceIT.java:1011-1499 plus helpers at :1517-1660). I independently verified every non-trivial claim in its javadoc against current dev source rather than trusting the PR description:

  • TaskExecutionService#deployTask (seatunnel-engine/seatunnel-engine-server/.../TaskExecutionService.java:445 onward) does contain the exact idempotency guard the test targets: synchronized (this) { if (executionContexts.containsKey(taskGroup.getTaskGroupLocation())) { ...log a warning, release classloaders, return success... } } — confirming #10567 landed on dev and confirming what the pre-fix crash site looked like.
  • PhysicalVertex#initStateFuture() (PhysicalVertex.java:182-203): for a persisted RUNNING state it calls checkTaskGroupIsExecuting and only downgrades to FAILING on failure (never touches a confirmed-alive RUNNING); for persisted DEPLOYING it does the identical check-and-downgrade-only-on-failure — it never upgrades DEPLOYING to RUNNING. This exactly matches the javadoc's claim that a confirmed-alive DEPLOYING vertex stays DEPLOYING after restore.
  • PhysicalVertex#stateProcess() (PhysicalVertex.java:581-596): case RUNNING: break; (true no-op) vs case DEPLOYING: unconditionally calling deploy(...) again — this is the literal redeploy-on-restore branch the test is designed to hit.
  • SubPlan#stateProcess() case DEPLOYING (SubPlan.java:702-718): physicalVertexList.forEach(task -> { if (CREATED) { task.startPhysicalVertex(); task.makeTaskGroupDeploy(); } }) — a genuinely sequential forEach, and PhysicalVertex#makeTaskGroupDeploy() (PhysicalVertex.java:303) calls updateTaskState(DEPLOYING), which (per the synchronized/reentrant stateProcess() chain) runs the deploy RPC synchronously before returning — confirming the javadoc's claim that raising parallelism multiplies independent per-vertex windows rather than widening any single window.
  • SubPlan#getPipelineRestoreNum() / pipelineRestoreNum (SubPlan.java:102,492,635) is incremented once per prepareRestorePipeline() call — the assertion subPlan.getPipelineRestoreNum() <= 1 in assertRecoveredWithBoundedPipelineRestore (:1560) is therefore a correct proxy for "no extra full-pipeline restart was forced by a failed redeploy."
  • getJobMaster (:540-544), createTestResources (:200-202), and FaultToleranceFakeSourceAssertions.assertOutputRecoveredAndStable are pre-existing helpers in this same file, reused with matching signatures — no new production-adjacent test infrastructure was introduced, only new private helpers scoped to this one test (killActiveMasterWhileAnyVertexDeploying, isAnyVertexDeploying, assertRecoveredWithBoundedPipelineRestore, assertAllVertexRunning/assertVertexRunning, waitAndFindActiveMaster/findActiveMaster, awaitCoordinatorActive/isCoordinatorActive), none of which collide with any pre-existing method name in the class.
  • I confirmed #10567 is a real, merged PR (gh pr view 10567: "[Fix][Zeta] Make deployTask idempotent during master failover recovery", merged 2026-03-15) with a title matching the javadoc's description precisely.

Both tests only reach the modified/guarded logic via a genuine failure-injection path (worker/master kill), not the normal happy path — that is expected and appropriate for a regression test, and is clearly disclosed in both javadocs rather than presented as a "normal path" fix.

1.2 Compatibility Impact

Fully compatible. No production code, no Option/config surface, no protocol/serialization format, and no public API touched. Purely additive test coverage in a src/test/java E2E file.

1.3 Performance / Side-Effect Analysis

No production runtime impact (test-only). Two side-effect observations on the new test specifically:

  • testDeployNotDuplicatedWhenMasterKilledDuringDeploy uses testParallelism = 40 (:1017), noticeably higher than every other test in this same file, which uses 2 or 6 (:90, :236, :578, :701, :841, :1135, :1284). The javadoc explains the rationale (more vertices = more independent per-vertex DEPLOYING windows for the watcher to land in, since a single vertex's own window does not widen), which is a legitimate trade-off, but 40 FakeSource+LocalFile task groups plus a 2-master/1-worker Hazelcast cluster in one JVM is meaningfully heavier than its siblings and worth keeping an eye on for flakiness/timeouts on constrained CI runners, especially since this IT module already runs several other multi-node cluster tests. Not a blocker, just a proportionality note — the class's default JUnit timeout budget is shared with sibling tests that use far lower parallelism, so this test alone shifts the module's resource profile.
  • The watcher (killActiveMasterWhileAnyVertexDeploying, :1517-1539) tight-polls with a 1ms sleep for up to 30s on a dedicated single-thread executor; the polled read (jobMaster.getPhysicalPlan() + getExecutionState()) is a cheap in-JVM field access, so this is a bounded, test-only CPU cost and not a concern.

1.4 Error Handling and Logging

No swallowed exceptions of concern. killActiveMasterWhileAnyVertexDeploying declares throws InterruptedException, propagating it to the Future returned by masterKillExecutor.submit(...), which is correctly surfaced via deployingObserved.get(60, TimeUnit.SECONDS). The assertTrue(..., "Never observed any task vertex in DEPLOYING state ...") diagnostic message (:1057-1061) is a good practice: a missed race window fails with an actionable message instead of a bare timeout. masterKillExecutor.shutdownNow() runs unconditionally in the finally block (:1093), so no executor/thread leak even if an earlier assertion throws. No sensitive data is logged.

2. Code Quality Assessment

2.1 Coding Standards

Consistent with the file's existing style: same helper-method placement pattern (private static helpers near the bottom), same Awaitility-based polling idiom used elsewhere in the class, ASF header already present in the file (no new file created). No wildcard imports; the three new imports (SeaTunnelEngineException, ExecutorService, Executors, Future) are all used.

2.2 Test Coverage and Test Stability

Stability rating: Stable, with one moderate flakiness-risk factor to watch.

  • No Thread.sleep-as-synchronization anti-pattern: every wait either uses Awaitility.await()...untilAsserted(...) (:1039-1044, :1064-1075, :1560-1595, :1609-1622, :1636-1648) or a deliberately-tight, self-terminating poll loop with a clear deadline (:1517-1539).
  • No shared static mutable state between tests; each test builds its own cluster with a per-test-case cluster name, avoiding cross-test interference.
  • No floating-point comparisons.
  • Assertions are deterministic outcomes (state equality, bounded restore count, row count), not weak existence checks.
  • Risk factor: as noted in 1.3, testParallelism = 40 combined with a 3-node in-process Hazelcast cluster is the heaviest test in this file by a wide margin; on a loaded/constrained CI runner this is the more plausible source of any future flakiness (timeout on deployingObserved.get(60s) or on the 180s FINISHED wait) than a logic bug in the test itself, given the runtime path was independently verified above.
  • Both new-in-this-PR tests are additive; no existing test was modified or weakened.

2.3 Documentation Updates

None needed — this is an internal E2E regression test with no user-facing behavior, config, or API change.

3. Architectural Soundness

3.1 Elegance of the Solution

Both tests build a deterministic trigger for a race window instead of gambling on sleep-based timing, and both explicitly design their assertions to hold on every legitimate outcome of the race (e.g., assertRecoveredWithBoundedPipelineRestore accepts either "worker already succeeded, no restore needed" or "exactly one clean restore", while treating anything beyond that as the regression). That is the same rigor as the test approved on Sept 1 and it's a strong pattern for white-box concurrency regression tests.

3.2 Maintainability

Both tests carry javadoc that documents the exact pre-fix bug, the referencing PR, the narrow trigger window, and why the assertions are written the way they are — a future maintainer changing PhysicalVertex/SubPlan state-machine internals has enough context here to understand what would break this test and why, without having to reverse-engineer the race from the assertions alone.

3.3 Extensibility

The new helpers (waitAndFindActiveMaster/findActiveMaster/awaitCoordinatorActive/isCoordinatorActive) generalize the existing single-purpose master-failover pattern already used elsewhere in this file (e.g. testStreamJobRestoreInMasterDown) into small reusable pieces scoped to this test; they don't touch or duplicate any existing helper.

3.4 Historical-Version Compatibility

No effect — test-only change, no serialization/checkpoint/state format touched, no config default changed. Both regression tests target behavior that is already the shipped, current behavior on dev (fixes #10729 and #10567 are both already merged); this PR only adds coverage that behavior doesn't regress.

4. Issue Summary

No blocking issues found. One non-blocking observation, not previously raised by any other reviewer (there have been none besides my earlier approval):

Issue 1 — Location: SplitClusterFaultToleranceIT.java:1017 (int testParallelism = 40;). Problem description: this new test's parallelism is 6-20x every sibling test in the same file. Potential risk: higher CPU/memory pressure and a larger surface for CI-runner-induced flakiness (not a logic risk) versus the rest of this IT class. Best improvement: consider whether a smaller parallelism (e.g. 15-20) still reliably reproduces the DEPLOYING window often enough in practice, to bring this test's resource footprint closer in line with its siblings — Option A: keep 40 if empirical CI runs show it's needed for reliability; Option B: lower it if a smaller value is equally reliable. Severity: Low. Raised by another reviewer: No.

5. Merge Recommendation

Both regression tests are technically sound, source-verified against current dev, additive-only, and consistent with this file's existing conventions. Live CI check (Build) is currently still pending on head 7cf39f6 at review time — per this review's own standard, that is not yet a completed/green result, so please confirm CI is green on this exact head before merging. mergeStateStatus currently shows BLOCKED, which in this repository's branch protection reflects "awaiting a maintainer review decision," not a merge conflict — compare/dev...head shows the branch is fully up to date with dev (ahead_by: 1, behind_by: 0).

Conclusion: Ready to merge after fixes

  1. None (no code-blocking issues).

Recommended fixes (non-blocking, optional):

  • Consider whether testParallelism = 40 in testDeployNotDuplicatedWhenMasterKilledDuringDeploy can be reduced without losing reliability, to bring its CI resource footprint closer to its sibling tests (Issue 1).
  • Confirm the Build CI check completes green on the current head (7cf39f6) before merging, since it was still queued/pending at review time.

Nice work tightening this coverage further, and thanks for the very thorough javadocs on both tests — they make the "why" of each assertion easy to follow for whoever touches this state machine next.

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In my last review (this same head, 7cf39f6) I concluded "Ready to merge after fixes" with no code-blocking issues — the only items were an optional, non-blocking parallelism note (Issue 1) and confirming that the Build CI check, which was still queued/pending at review time, completed green.

I just re-checked: Build and all other checks on this head now report success, and the branch remains up to date with dev (no merge conflicts). Since CI was the only remaining item and it's now passing, I'm updating this to approve.

Thanks again for the very thorough regression coverage on both tests — happy to see this land.

@nzw921rx nzw921rx left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1 good job

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.

3 participants