Repository navigation
[Test][E2E] Add regression coverage for duplicate pending-job dispatch after failover - #12027
Conversation
DanielLeens
left a comment
There was a problem hiding this comment.
What Problem Does This PR Solve?
- User pain point: the duplicate/lost pending-job dispatch fix in #11653 (monotonic scheduling epoch in
CoordinatorService) only had single-JVM, mock/reflection-based unit coverage (CoordinatorServiceTest). Nothing exercised the invariant through a real multi-node cluster with real client submission, real Hazelcast membership changes, and real resource contention. - Fix approach: adds
SplitClusterPendingJobLifecycleFailoverIT#testPendingJobNotDuplicatedAcrossRepeatedMasterFailover, which flaps master ownership across 4 rounds while aScheduleStrategy.WAITpending job is under active re-evaluation, then asserts the job survives every epoch transition as a single pending entry and is eventually dispatched exactly once (exact output row count, not doubled). - One-sentence summary: a well-designed, test-only PR that closes a real integration-coverage gap for #11653, but its own new test currently fails deterministically in CI, so it cannot be merged as-is.
1. Code Change Review
1.1 Core Logic Analysis
Single new file: seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/java/org/apache/seatunnel/engine/e2e/SplitClusterPendingJobLifecycleFailoverIT.java (+198, new file, no production code touched).
Runtime path the new test is meant to exercise:
client submits contested (batch) job
-> CoordinatorService.pendingJobQueue (ScheduleStrategy.WAIT)
-> "pending-job-schedule-runner" thread loops pendingJobSchedule(epoch) every ~3s
-> preApplyResources(): insufficient slots (holder job saturates all 4) -> stays PENDING
master flap (repeated x4 in the test):
activeMaster.shutdown()
-> Hazelcast membership change
-> standby's masterActiveListener (100ms poll) -> checkNewActiveMaster()
-> initCoordinatorService() (async restoreAllRunningJobFromMasterNodeSwitch on executorService)
-> pendingJobScheduleEpoch++, isActive = true
-> startPendingJobScheduleThread() submits a fresh scheduler runner on executorService
test starts one more replacement master-eligible node so a standby is always ready
after 4 rounds:
holder job cancelled -> ResourceManager frees 4 slots
-> current active master's scheduler runner should notice freed slots on its next ~3s
poll and dispatch the still-pending job -> RUNNING -> FINISHED
Key Findings:
- The test correctly reuses existing harness primitives (
SeaTunnelServerStarter,TestUtils, Awaitility patterns) — no new test infrastructure, low maintenance surface. - Using
ScheduleStrategy.WAIT's fixed 3-second re-check cadence to create a "wide, deterministic window" for landing failovers mid-evaluation (instead of chasing a microsecond race) is a genuinely good test-design choice, and the class-level Javadoc on the new test method explains this reasoning clearly. - Using a bounded batch job with an exact expected row count (rather than the streaming holder template) to detect a duplicate dispatch (double the rows) instead of relying on a status transition alone is the right assertion strategy for this bug class.
- The test itself fails deterministically in the PR author's own CI run — see Issue 1. This is the dominant fact of this review: everything else about the design is sound, but the test as committed does not pass.
- The sibling test in the same file,
testPendingJobScheduledAfterRunningJobCanceled(single master, no flapping), performs the same "cancel holder -> pending job transitions to RUNNING" step and passes in the same CI run. That narrows the failure to something specific to repeated (>1) master transitions underScheduleStrategy.WAIT, not to the cancel/reschedule mechanism in general.
1.2 Compatibility Impact
Fully compatible. Test-only change, zero production code modified, zero config/protocol/serialization surface touched.
1.3 Performance / Side-Effect Analysis
No production runtime impact. CI-cost side effect: this single test method took ~264s wall time in the fork run (spinning up to 3 concurrent Hazelcast instances per round across 4 rounds, i.e. up to 6 master-eligible instances total over the test lifetime) inside the already-heavy engine-v2-it job. Not a blocker, but worth the author's awareness given engine-v2-it is a long-running CI job.
1.4 Error Handling and Logging
Issue 1
- Location:
SplitClusterPendingJobLifecycleFailoverIT.java:387(assertion call) /:449(assertJobStatusWithTimeouthelper); production code referenced for root-cause analysis:CoordinatorService.java:307-335(startPendingJobScheduleThread),CoordinatorService.java:1241-1271(checkNewActiveMaster),CoordinatorService.java:287-298(createCoordinatorExecutor,SynchronousQueue-backed pool). - Problem description:
testPendingJobNotDuplicatedAcrossRepeatedMasterFailoverfails deterministically in the PR author's own fork CI run (commit73a8c0da70fd75d738175e80da5635088718fb4a), on bothengine-v2-it (8, ubuntu-latest)andengine-v2-it (11, ubuntu-latest), at the identical line with the identical error:Evidence: fork Actions run 33460309270 — jobs engine-v2-it (8) and engine-v2-it (11). The apache-side "Build" check is only a pointer to this same fork run. The branch is not behindorg.awaitility.core.ConditionTimeoutException: ... expected: <FINISHED> but was: <PENDING> within 3 minutes. at SplitClusterPendingJobLifecycleFailoverIT.assertJobStatusWithTimeout(SplitClusterPendingJobLifecycleFailoverIT.java:449) at SplitClusterPendingJobLifecycleFailoverIT.testPendingJobNotDuplicatedAcrossRepeatedMasterFailover(SplitClusterPendingJobLifecycleFailoverIT.java:387)dev(compare/dev...73a8c0da70f→ahead_by: 1, behind_by: 0), so this is not a stale-base/unrelated-flake situation — the failure is caused by this PR's own diff. Out of 178 tests in theengine-v2-itreactor run, this is the only failure, and it is the exact same failure on both JDKs, which rules out ordinary CI flakiness.
The preceding assertion at line 384 (job stillPENDINGafter 4 flap rounds, before the holder job is cancelled) does pass — so the epoch/queue-survival invariant from #11653 that this test set out to prove does hold. The failure is specifically in the subsequent step: after cancelling the holder job to free resources, the pending job never transitions pastPENDINGwithin the 180s budget. - Potential risk: Two possibilities, both requiring resolution before merge:
- A genuine, previously-unknown production bug: after repeated (>1) master transitions under
ScheduleStrategy.WAIT, the final active master'spending-job-schedule-runnerthread may not be correctly (re-)armed — e.g.startPendingJobScheduleThread()'sexecutorService.submit(...)(CoordinatorService.java:334) could be rejected by theSynchronousQueue-backed pool (CoordinatorService.java:287-298,AbortPolicy-derivedRejectionCountingHandler) ifrestoreAllRunningJobFromMasterNodeSwitch(also submitted to the same pool,CoordinatorService.java:658-661) is still occupying the pool's threads during rapid successive flaps.checkNewActiveMaster()swallows any such exception (CoordinatorService.java:1261-1270) and silently falls back toisActive = false, relying on the next 100ms poll to retry — if that retry loop never succeeds cleanly across repeated flaps, the node would be a "de-jure" active master with no live scheduler thread, and the pending job would sit forever regardless of freed resources. If real, this is a legitimate gap in #11653's fix scope (which only proved correctness for the dedup/epoch invariant, not for scheduler-thread liveness across >1 rapid transitions). - A test-authoring bug specific to the repeated-flap scenario (e.g. a resource-accounting assumption, cluster-membership timing assumption, or an interaction between the 4 sequentially-created replacement master instances and slot/resource-manager state that only manifests after multiple rounds).
Either way, a regression test that fails 100% of the time in CI provides zero protection value and will block every future CI run for anyone rebasing on top of this branch.
- A genuine, previously-unknown production bug: after repeated (>1) master transitions under
- Best improvement: Root-cause the failure locally (this is exactly the kind of case where actually running the test — not just reading the diff — is required) before merging. If it is a production bug, either fix
CoordinatorService's scheduler-thread re-arming path in this PR (acceptable scope creep for a bug this test itself just found) or split into a companion fix PR and keep this test gated on it. If it is a test-timing bug, fix the test's assumptions and re-verify green on both JDKs. - Severity: High (blocking)
- Raised by another reviewer: No (no other reviews exist on this PR)
2. Code Quality Assessment
2.1 Coding Standards
- The new test method (
testPendingJobNotDuplicatedAcrossRepeatedMasterFailover) and most non-trivial private helpers (assertRunningJobGraphWithTimeout,assertRunningSubPlan,assertRunningVertex,getJobMaster,awaitCoordinatorActive,createBatchTestResources,assertEventuallyCanceled) carry clear Javadoc explaining why, not just what — good adherence to the "explain the why and constraints" standard. - Missing class-level Javadoc:
SplitClusterPendingJobLifecycleFailoverIT(line 61) is an entirely new class with no class-level Javadoc describing its overall responsibility/scope (it now covers three distinct lifecycle scenarios: single-failover restore, cancel-then-reschedule, and repeated-failover dedup). Flagging per review policy — new classes need a class-level Javadoc even when method-level docs are present. Medium severity, non-blocking on its own but should be picked up alongside Issue 1's fix. - No
System.out.println, no forbidden single-line Javadoc, no@DisplayNameusage — clean.
Issue 2
- Location:
SplitClusterPendingJobLifecycleFailoverIT.java:61 - Problem description: New test class has no class-level Javadoc.
- Potential risk: Low — reduces discoverability of the class's overall test scope for future maintainers scanning the E2E suite.
- Best improvement: Add a short class-level Javadoc summarizing that this class covers pending-job lifecycle behavior across master failover (single failover restore, cancel-triggered reschedule, and repeated-failover duplicate-dispatch regression).
- Severity: Medium
- Raised by another reviewer: No
2.2 Test Coverage and Test Stability
Rating: High risk — path:line evidence: SplitClusterPendingJobLifecycleFailoverIT.java:387 / :449, confirmed failing on both engine-v2-it (8, ubuntu-latest) and engine-v2-it (11, ubuntu-latest) in the author's own fork CI run for this exact commit (see Issue 1 for full detail and links). This is not a Thread.sleep-based-wait problem — the test correctly uses Awaitility/untilAsserted polling throughout, with no raw sleeps in assertion paths (the sleep interrupted log lines seen in CI are expected InterruptedException noise from ScheduleStrategy.WAIT's internal 3s poll being interrupted during node shutdown, not a test-authored sleep). The instability is not "flaky under load" — it is 100% reproducible on the exact same commit across two independent JDK runs, which is worse than ordinary flakiness: it means the scenario this test targets does not currently pass at all. Per review policy this is elevated to the formal High-severity blocking Issue 1 above rather than treated as a soft stability note.
2.3 Documentation Updates
N/A — test-only PR, no docs/en or docs/zh changes needed or expected.
3. Architectural Soundness
3.1 Elegance of the Solution
The design of the test (WAIT-strategy cadence as a deterministic race window, exact-row-count assertion instead of status-only) is a precise, well-thought-out way to close the stated coverage gap — this is not a temporary workaround in intent. However, "Precise fix" cannot be claimed for the PR as committed, since the test does not currently pass; classification is deferred until Issue 1 is resolved.
3.2 Maintainability
Good — helper methods are cleanly factored and reused across all three test methods in the file (assertJobStatusWithTimeout, waitAndFindActiveMaster, isCoordinatorActive, assertPendingQueueState/Contains/NotContainsJob), avoiding duplication within the file. createBatchTestResources explicitly notes it mirrors ClusterFaultToleranceIT#createTestResources and is kept local since only this one test needs it — reasonable judgment call, consistent with the existing codebase convention of not centralizing single-use test helpers.
3.3 Extensibility
Self-contained new test class; does not touch shared test base classes or production code, so no extensibility concerns for the rest of the suite.
3.4 Historical-Version Compatibility
N/A — test-only change, no serialization/config/protocol surface affected.
4. Issue Summary
| Number | Issue | Location | Severity |
|---|---|---|---|
| 1 | New regression test fails deterministically in CI (both JDK 8 and 11) at the final FINISHED-transition assertion after repeated master failover | SplitClusterPendingJobLifecycleFailoverIT.java:387,449 |
High |
| 2 | New test class lacks a class-level Javadoc | SplitClusterPendingJobLifecycleFailoverIT.java:61 |
Medium |
5. Merge Recommendation
Conclusion: Not recommended for merge
-
Blockers — must be fixed (sorted by severity)
- Issue 1 (High): root-cause the deterministic CI failure of
testPendingJobNotDuplicatedAcrossRepeatedMasterFailoveron both JDK 8 and JDK 11. This needs an actual local/CI run to diagnose, not just static reading — please pull the fork's failure logs (linked above), reproduce, and determine whether this is exposing a real gap in the scheduler-thread re-arming path across repeated master transitions (in which caseCoordinatorServiceneeds a companion fix) or a bug in the test's own timing/resource assumptions (in which case the test needs correcting). Either way, the test must be green on both JDKs before this can merge — a deterministically-failing regression test blocks CI for everyone and provides no actual regression protection in the meantime.
- Issue 1 (High): root-cause the deterministic CI failure of
-
Recommended fixes — non-blocking
- Issue 2 (Medium): add a class-level Javadoc to
SplitClusterPendingJobLifecycleFailoverITdescribing the three lifecycle scenarios it now covers.
- Issue 2 (Medium): add a class-level Javadoc to
Overall assessment: the test design here is genuinely good — the WAIT-strategy-cadence trick for creating a deterministic (not microsecond-scale) race window, and the exact-row-count assertion for detecting duplicate dispatch, are both the right way to close the stated integration-coverage gap for #11653. But "adds coverage for an already-fixed bug" is not what the evidence in the PR author's own CI run shows today — the new test fails 100% of the time, and it fails specifically on the repeated-failover path while the equivalent single-failover cancel/reschedule path (testPendingJobScheduledAfterRunningJobCanceled, same file) passes. That asymmetry is worth taking seriously: this may well be uncovering a real edge case in CoordinatorService's master-failover handling that #11653 and its unit tests didn't reach. I'd encourage David to treat this as a genuine lead rather than "just fix the test until it's green" — if it turns out to be a live scheduler-liveness bug, that's a more important finding than the E2E coverage PR itself.
No merge blockers unrelated to the above were found: the diff is compatibility-neutral (test-only, no production code), there is no merge conflict (mergeable: MERGEABLE), and the branch is not behind dev.
DanielLeens
left a comment
There was a problem hiding this comment.
What Problem Does This PR Solve?
This is a test-only PR that adds SplitClusterPendingJobLifecycleFailoverIT#testPendingJobNotDuplicatedAcrossRepeatedMasterFailover, a new multi-node E2E regression test intended to prove the duplicate/lost pending-job dispatch fix from #11653 (monotonic pendingJobScheduleEpoch + unconditional pending-queue clearing in clearCoordinatorService) holds through a real client-submission / real-Hazelcast-membership / real-resource-contention path, not just the mocked unit tests in CoordinatorServiceTest. No production code is touched.
1. Code Change Review
1.1 Core Logic Analysis
The new test (lines 290-409 of SplitClusterPendingJobLifecycleFailoverIT.java):
- Starts 2 master-eligible nodes + 1 worker (fixed 4-slot capacity,
ScheduleStrategy.WAIT). - Submits a streaming "holder" job that saturates worker slots, then a small bounded batch "contested" job that goes
PENDING. - Flaps master ownership 4 times: shuts the active master down, waits for the standby to become active, starts a fresh replacement so a standby is always available for the next round.
- Asserts the contested job is still
PENDING(single entry, not lost/duplicated) after all flaps. - Cancels the holder job, then asserts the contested job reaches
FINISHEDwith exactlytestRowNumber * testParallelismoutput rows (ruling out a double-dispatch, which would double the row count).
Key Finding — the new test does not pass in this PR's own CI run, on either JDK. I pulled the real fork Actions run behind the apache-side "Build" pointer check (davidzollo/seatunnel run 33460309270, since the apache-side check is only a redirect to the contributor fork's run) and both engine-v2-it (8, ubuntu-latest) and engine-v2-it (11, ubuntu-latest) fail with the same error, at the same line, at almost the same elapsed time:
org.awaitility.core.ConditionTimeoutException: ... expected: <FINISHED> but was: <PENDING> within 3 minutes.
at SplitClusterPendingJobLifecycleFailoverIT.assertJobStatusWithTimeout(SplitClusterPendingJobLifecycleFailoverIT.java:449)
at SplitClusterPendingJobLifecycleFailoverIT.testPendingJobNotDuplicatedAcrossRepeatedMasterFailover(SplitClusterPendingJobLifecycleFailoverIT.java:387)
(JDK8: Tests run: 3, Errors: 1 ... Time elapsed: 220.235 s; JDK11: Time elapsed: 218.388 s — same failure, same test.)
This is the assertion at line 387, right after cancelling the holder job at line 386:
engineClient.createJobClient().getJobProxy(holderJob.getJobId()).cancelJob();
assertJobStatusWithTimeout(pendingJobAfterFlapping, JobStatus.FINISHED, 180);The prior assertion at line 384 (PENDING after all 4 flaps, 60s timeout) is not in the failure trace, so the part of the test that actually exercises the epoch/queue-clearing invariant from #11653 (job survives repeated failovers without being lost or duplicated while still pending) passes. The failure is entirely in the "now free the resources and let it finish" tail of the test: after cancelling the holder, the contested job never leaves PENDING within the full 180s window on either JDK.
Runtime/call-chain path relevant here:
ClientJobProxy.cancelJob()(seatunnel-engine-client) sendsSeaTunnelCancelJobCodecto the master and.join()s on the ack — it only blocks until the master accepts the cancel request, not until the job'sJobMasterhas fully torn down and released its worker slots.CoordinatorService.pendingJobSchedule(...)re-evaluates the queue head every 3s underScheduleStrategy.WAITand only dispatches oncejobMaster.preApplyResources()reports enough free slots.- The sibling test in the same file,
testPendingJobScheduledAfterRunningJobCanceled(which passes), callsholderJob.cancelJob(); assertEventuallyCanceled(holderJob);— explicitly waiting for the holder to reach a terminalCANCELEDstate (viawaitForJobCompleteV2()) — before asserting the pending job starts running. The new test skips that wait entirely and goes straight fromcancelJob()to a 180s wait forFINISHED.
Given cancelJob()'s own class-level comment two methods down (assertEventuallyCanceled's Javadoc: "cancellation can leave the client-observed status at CANCELING after the cancel request has already completed") explicitly documents that cancel completion lags the RPC ack, the missing assertEventuallyCanceled(holderJob) step is the most concrete, source-grounded gap between this test and its (passing) sibling. Whether the true root cause is exactly this missing wait, or a deeper defect in slot release specifically after repeated master failover (a scenario neither existing test in this file exercises — they each do at most one failover), I can't fully distinguish from static analysis alone; both are plausible and worth root-causing before merge, but either way the test as written does not pass.
1.2 Compatibility Impact
Fully compatible — this PR adds a new test class/method only. No production code, no config schema, no serialization/protocol changes.
1.3 Performance / Side-Effect Analysis
The new test method alone spins up 6 Hazelcast instances over its lifetime (2 initial masters + 4 flap-round replacements + 1 worker) and, even on the failure path, ran for ~220s before timing out. On a passing run it would likely take at least that long (4 rounds x awaitCoordinatorActive/member-count waits, plus the final FINISHED wait). Combined with the file's other two tests, this file's total time in the engine-v2-it job is already ~4.5 minutes on CI. This is consistent with the module's existing E2E cost, not a new category of concern, but worth being aware of given this repo's engine-v2-it partitioning is timeout-budget-sensitive.
1.4 Error Handling and Logging
See Issue 1 below — the only formal issue in this PR is the test's own failure to pass CI.
2. Code Quality Assessment
2.1 Coding Standards
Very good. The new method and every new private helper carry precise Javadoc explaining why (not just what), including a detailed rationale for ScheduleStrategy.WAIT's 3s poll cadence being used as the failover-landing window, and why a bounded batch job with an exact row count (rather than the streaming holder template) is required to detect a double-dispatch. No missing-comment issues on any new method or field. The ImmutablePair-from-testcontainers.shaded import (createBatchTestResources) mirrors the exact same pattern already used in ClusterFaultToleranceIT.createTestResources in this same module (verified — ClusterFaultToleranceIT.java:38 imports the identical shaded class), so it's pre-existing local convention, not a new smell introduced here.
2.2 Test Coverage and Test Stability
Rating: High risk. The new test (SplitClusterPendingJobLifecycleFailoverIT.java:290-409) fails deterministically in this PR's own CI, on both JDK 8 and JDK 11, at the same assertion (SplitClusterPendingJobLifecycleFailoverIT.java:387) with elapsed time in both runs landing right at the 180s timeout boundary (220.2s / 218.4s total). This is not one of this repository's known-flaky signatures (Windows Hazelcast node-start flake, Debezium tombstone NPE, Couchbase container bootstrap) — it is a brand-new test with no prior CI history, failing identically twice in a row. That pattern (same line, same symptom, both JDKs) points to a deterministic defect rather than environmental flakiness.
This becomes Issue 1 below (High, formal).
2.3 Documentation Updates
N/A — test-only change, no user-facing docs affected.
3. Architectural Soundness
3.1 Elegance of the Solution
The design of the test (bounded batch job for an exact row-count assertion, reusing ScheduleStrategy.WAIT's cadence as a wide deterministic landing window for the flaps, explicit masterNodes list with idempotent cleanup) is a precise, well-thought-out approach to closing the real coverage gap described in the PR body — the existing tests in this file only exercise a single clean failover with no duplicate-dispatch assertion. Once Issue 1 is resolved, this is a solid long-term addition, not a workaround.
3.2 Maintainability
Good — consistent with the file's existing structure and helper reuse (getSeaTunnelConfig, configurePendingLifecycleTest, waitAndFindActiveMaster, isCoordinatorActive), no new test infrastructure introduced.
3.3 Extensibility
No concerns; self-contained test method.
3.4 Historical-Version Compatibility
N/A — no serialization, config, or protocol surface touched.
4. Issue Summary
| Number | Issue | Location | Severity |
|---|---|---|---|
| 1 | New test testPendingJobNotDuplicatedAcrossRepeatedMasterFailover fails deterministically in this PR's own CI on both JDK 8 and JDK 11 (stuck at PENDING, never reaches FINISHED, after cancelling the holder job) |
seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/java/org/apache/seatunnel/engine/e2e/SplitClusterPendingJobLifecycleFailoverIT.java:387 |
High |
| 2 | The new test cancels the holder job and immediately starts the 180s FINISHED wait without first confirming the holder actually reached a terminal state, unlike the sibling testPendingJobScheduledAfterRunningJobCanceled in the same file, which calls assertEventuallyCanceled(holderJob) before checking the pending job's next transition |
SplitClusterPendingJobLifecycleFailoverIT.java:386-387 (compare :247-250) |
Medium |
5. Merge Recommendation
Conclusion: Not recommended for merge
- Blockers — must be fixed (sorted by severity)
- Issue 1 (High): the added test must actually pass CI before this PR can be merged. A "regression coverage" PR whose own regression test cannot pass does not deliver the coverage it claims, and merging a permanently-red new IT would either get it disabled/skipped later (losing the coverage) or become a recurring CI-red source for unrelated PRs.
- Recommended fixes — non-blocking (but likely the fix for Issue 1)
- Issue 2 (Medium): add the missing
assertEventuallyCanceled(holderJob)(or equivalent terminal-state wait) after cancelling the holder, mirroring the established pattern intestPendingJobScheduledAfterRunningJobCanceledin this same file, then re-verify in CI that the contested job reliably reachesFINISHEDwell within the 180s budget across repeated runs (not just once) before resubmitting.
- Issue 2 (Medium): add the missing
Overall assessment: the test's design and intent are sound and the coverage gap it targets (repeated failover + duplicate-dispatch detection, which the existing two tests in this file don't cover) is real and valuable. But as submitted, the PR's own CI proves the new test does not pass — twice, identically, on both supported JDKs — so it cannot be merged in its current form. Since the PR description states the new IT was never actually executed before submission ("Full test execution is left to CI... not run in this sandbox"), I'd suggest actually running this specific test method locally/in a loop a few times after applying the fix, rather than relying on CI alone for the resubmission, given how close to the 180s boundary both failing runs landed — if the real cause turns out to be a genuine slot-release lag under repeated failover (not just the missing wait), 180s may still be too tight and either the root cause needs fixing or the timeout needs headroom with justification.
No better alternative architecture is needed here (Option A === "fix and re-verify this test" is the only necessary path); this is not a case that calls for a different testing strategy.
DanielLeens
left a comment
There was a problem hiding this comment.
What Problem Does This PR Solve?
This PR adds a new multi-node E2E regression test, SplitClusterPendingJobLifecycleFailoverIT#testPendingJobNotDuplicatedAcrossRepeatedMasterFailover, that targets the duplicate/lost pending-job dispatch bug previously fixed in #11653 ("[Fix][Zeta] Avoid duplicate pending job scheduling after failover"). That fix introduced a monotonic pendingJobScheduleEpoch so a scheduler thread from a stale master generation can no longer dispatch a pending job that a newer generation has already claimed, and made clearCoordinatorService unconditionally drop interrupted pending jobs from the local queue. That fix already has thorough unit coverage in CoordinatorServiceTest via mocking/reflection, but no test previously exercised the same invariant through the real multi-node path (real client submission, real Hazelcast membership churn, real resource contention across repeated failovers). This PR closes that gap. No production code is touched — this is a test-only change.
1. Code Change Review
1.1 Core Logic Analysis
This is a pure test addition; there is no "before" to diff against. The new test method:
- Starts a 2-master + 1-worker split cluster with fixed 4-slot capacity and
ScheduleStrategy.WAIT. - Submits a long-running "holder" job that saturates all worker slots.
- Submits a small bounded batch "contested" job, which goes
PENDING. - Flaps master ownership 4 times: kills the active master, waits for the standby to take over, starts a fresh replacement master node so a standby is always ready for the next round.
- After all flaps, asserts the contested job is still tracked as a single
PENDINGentry, then cancels the holder job to free capacity. - Asserts the job reaches
FINISHEDwith an exact row count (testRowNumber * testParallelism) — a duplicate dispatch would double this.
// SplitClusterPendingJobLifecycleFailoverIT.java:379-395
ClientJobProxy pendingJobAfterFlapping =
engineClient.createJobClient().getJobProxy(pendingJobId);
assertJobStatusWithTimeout(pendingJobAfterFlapping, JobStatus.PENDING, 60);
engineClient.createJobClient().getJobProxy(holderJob.getJobId()).cancelJob();
assertJobStatusWithTimeout(pendingJobAfterFlapping, JobStatus.FINISHED, 180);
Long finalLineCount =
FileUtils.getFileLineNumberFromDir(contestedJobResources.getLeft());
Assertions.assertEquals(
testRowNumber * testParallelism,
finalLineCount,
"Contested job output must equal exactly one dispatch's worth of rows; a "
+ "duplicate dispatch across the master flaps above would double it");Runtime path traced against real source (seatunnel-engine/seatunnel-engine-server/.../CoordinatorService.java, dev @ 5dbfb374f985):
checkNewActiveMaster()polls master ownership every 100ms (masterActiveListener.scheduleAtFixedRate(this::checkNewActiveMaster, 0, 100, TimeUnit.MILLISECONDS)), bumpspendingJobScheduleEpochand callsstartPendingJobScheduleThread()on activation.pendingJobSchedule(scheduleEpoch)reserves the queue head, callsjobMaster.preApplyResources(), and — underScheduleStrategy.WAIT— sleeps a fixed 3s and retries if resources are insufficient (CoordinatorService.java:455-461). This is exactly what the PR's Javadoc claims and I confirmed it directly in source, not just from the PR description.clearCoordinatorService()unconditionally drops queuedPendingJobInfoentries and interrupts theirJobMasters (CoordinatorService.java:1281-1311), consistent with the #11653 fix.
Key Findings: The test is a faithful, source-verified exercise of the real epoch/lock mechanism through genuine Hazelcast membership changes rather than mocks. However, see Issue 1 — CI evidence shows the test does not reliably reach its own terminal assertion in the real CI environment.
Normal path vs. boundary path: This test exclusively exercises the master-failover recovery/boundary path of the scheduler (repeated epoch transitions under ScheduleStrategy.WAIT), not the primary single-master dispatch path. That is appropriate for a regression test targeting a failover bug, but it means the added coverage is inherently a low-frequency, high-complexity code path — which is also likely why it is the most fragile path to exercise reliably in CI (see Issue 1).
1.2 Compatibility Impact
Fully compatible. No production code, public API, SPI, configuration option, serialization format, or documented behavior is touched. Risk surface is limited to test-suite runtime and CI stability.
1.3 Performance/Side-Effect Analysis
- The test sequentially starts up to 7
HazelcastInstanceImplnodes over its lifetime within one JVM (2 initial masters + 1 worker + 4 replacement masters across the flap loop). All are properly shut down in thefinallyblock (workerNode, and every still-running entry in the accumulatedmasterNodeslist), so there is no resource leak across test runs. - Wall-clock cost is substantial: per the CI logs I pulled (see Issue 1), this single test consumed 220–264 seconds in a module (
connector-seatunnel-e2e-base) that per the same run already ran for over an hour before reaching it. This is a meaningful, not negligible, addition to an already long-running E2E suite — worth being aware of, though not by itself blocking for a regression test of this nature. - No new production-facing memory/CPU/lock-contention/retry/idempotency concerns, since no production code changed.
1.4 Error Handling and Logging
No new production logging or exception handling. Within the test, resource cleanup is correctly wrapped in try/finally; Awaitility is used throughout instead of hard sleeps (see 2.2). See Issue 1 below for the one blocking issue found.
Issue 1 (see full detail in Section 2.2 and Section 4)
2. Code Quality Assessment
2.1 Coding Standards
- Javadoc completeness: excellent. The new test method has a thorough class-level-quality Javadoc explaining the bug being regression-tested, the source line it references, and the reasoning behind both the
ScheduleStrategy.WAITtiming window and the exact-row-count assertion. The two new private helpers,awaitCoordinatorActiveandcreateBatchTestResources, both have Javadoc explaining purpose and return value. No missing-Javadoc issues found — this fully satisfies the "new non-trivial method/field needs Javadoc" bar. createBatchTestResourcesis a near-verbatim structural mirror ofClusterFaultToleranceIT#createTestResources(I diffed both — sametargetDir/targetConfigFilePathconstruction, sameFileUtils.createNewDir+TestUtils.createTestConfigFileFromTemplatecalls). The PR's own Javadoc says as much. This is good — it reuses an established, working pattern rather than inventing a new one.- The import
org.testcontainers.shaded.org.apache.commons.lang3.tuple.ImmutablePairlooks unusual at first glance (borrowing a shaded relocation from a test dependency for basic tuple functionality), but I confirmedClusterFaultToleranceIT.java:38already uses the identical import — this PR is following existing module convention, not introducing a new one, so I'm not raising it as a new issue. - No
System.out.println, no wildcard imports, formatting looks Spotless-clean from the diff.
2.2 Test Coverage and Test Stability
This PR is 100% test code, so this is the most important section.
Does the test exercise the critical path? Yes — as traced in 1.1, it genuinely drives the real epoch-bump/scheduler-restart mechanism through 4 real master failovers, which is a strictly stronger exercise than the existing single-failover testPendingJobLifecycleInMasterFailover test in the same file.
Mandatory stability rating: High risk.
This is not a theoretical concern — I pulled the actual CI run for this PR's head commit (73a8c0da70fd75d738175e80da5635088718fb4a) from the contributor's fork, since the apache-side "Build" check is just a pointer to it:
https://github.com/davidzollo/seatunnel/actions/runs/33460309270, jobengine-v2-it (11, ubuntu-latest):SplitClusterPendingJobLifecycleFailoverIT.testPendingJobNotDuplicatedAcrossRepeatedMasterFailover:387->assertJobStatusWithTimeout:449 » ConditionTimeout- The same run, job
engine-v2-it (8, ubuntu-latest): the identical test, identical failure:org.awaitility.core.ConditionTimeoutException: ... expected: <FINISHED> but was: <PENDING> within 3 minutes, elapsed 220.235s.
Both are the exact new test this PR adds, both fail at the exact same assertion (SplitClusterPendingJobLifecycleFailoverIT.java:387, i.e. assertJobStatusWithTimeout(pendingJobAfterFlapping, JobStatus.FINISHED, 180)), in two independently-scheduled shards of the same workflow run. This is not an unrelated pre-existing flake being picked up incidentally — it is this PR's own new test failing to reach its own terminal assertion. Notably, because the job never reaches FINISHED, the row-count assertion that is the entire point of this regression test (detecting a duplicate dispatch) is never actually exercised in these runs — the test fails before it can prove what it exists to prove.
I traced the surrounding production code (CoordinatorService.pendingJobSchedule/checkNewActiveMaster) and found nothing structurally wrong with the epoch mechanism itself (see 1.1) — preApplyResources() polls every 3s under WAIT strategy, and 180s should normally be far more than enough for a 4-slot cluster to notice the holder job's slots freed up and dispatch a 1-parallelism batch job. A plausible, evidence-grounded (not confirmed) explanation is environmental: by the time this test runs, the same CI job has already been executing the connector-seatunnel-e2e-base IT suite for over an hour (per the shard-8 log, ClusterFaultToleranceIT alone took 338s immediately before this test's position in the run), and this new test itself starts up to 7 real Hazelcast JVM-embedded nodes across 4 sequential real failovers in a single test method — that is a heavy load to place on an already CPU/IO-constrained shared GitHub Actions runner, and could plausibly starve the 100ms checkNewActiveMaster poll or the 3s pendingJobSchedule retry loop enough to blow a 180s budget. I want to be explicit that this is a hypothesis for the author to verify, not a confirmed root cause — but the failure itself (two independent reproductions, same assertion, same PR head) is a directly observed fact, not a guess.
Per the task's fixed rubric, a "High risk" rating is a formal High-severity blocking issue (Issue 1 in Section 4) regardless of root cause, precisely because the failure is reproducible against this PR's own diff and blocks the CI gate this PR needs to pass to be merge-ready.
Anti-pattern check (since this is E2E test code): No hard Thread.sleep used for synchronization inside the test (all waits go through Awaitility.await()...untilAsserted, consistent with the rest of the file). No shared static state. No floating-point-without-delta issues. No order dependency between test methods. The one real risk category present is "weak readiness signal / timing race under load" — specifically the 180s post-cancellation window not accounting for cumulative CI load after 4 real failovers, which is exactly what's manifesting in the CI evidence above.
2.3 Documentation Updates
No user-visible behavior changed (test-only PR), so no docs/en/docs/zh updates are required, and none were made. Correct.
3. Architectural Soundness
3.1 Elegance
This is a precise, well-targeted regression test for a specific, previously-fixed bug, not a workaround. It correctly builds on existing test infrastructure (getSeaTunnelConfig, configurePendingLifecycleTest, submitJob, assertJobStatusWithTimeout, waitAndFindActiveMaster/isCoordinatorActive) without introducing new test scaffolding, and its javadoc is unusually thorough about why each design choice (the WAIT-strategy 3s window, the exact-row-count assertion) exists. The one gap is that its current timing assumptions do not hold up against the real CI environment (Issue 1).
3.2 Maintainability
Good. The two new helpers are small, single-purpose, and documented. The test method itself is long (~120 lines) but that's proportionate to the scenario it drives (multi-round real cluster failover), and it mirrors the structure of the existing tests in the same file rather than diverging stylistically.
3.3 Extensibility
The flapRounds constant and createBatchTestResources helper make it straightforward to adjust the number of failover rounds or reuse the batch-job pattern in future regression tests in this file without further refactoring.
3.4 Historical-Version Compatibility
No impact — test-only change, no serialization/protocol/config/checkpoint surface touched. Nothing here affects upgrade paths or old-version compatibility.
4. Issue Summary
| # | Issue | Location | Severity |
|---|---|---|---|
| 1 | New E2E test fails to reach its own terminal assertion in real CI — ConditionTimeoutException at the FINISHED wait, reproduced independently in 2 shards of the same run (davidzollo/seatunnel run 33460309270, jobs engine-v2-it (8) and engine-v2-it (11)) |
SplitClusterPendingJobLifecycleFailoverIT.java:387 (assertJobStatusWithTimeout(pendingJobAfterFlapping, JobStatus.FINISHED, 180)) |
High |
No other blocking issues found. Remaining (non-blocking) observations: the new test adds ~220–260s to an already long connector-seatunnel-e2e-base IT run (Section 1.3) — worth being aware of for overall CI budget, but not by itself a reason to block a regression test for a real previously-fixed bug; and the lack of temp-directory cleanup for /tmp/hive/warehouse/<testCaseName> after the test finishes exactly mirrors the pre-existing ClusterFaultToleranceIT#createTestResources pattern, so it is not a new issue introduced by this PR.
5. Merge Recommendation
Conclusion: Ready to merge after fixes
Blockers
- Issue 1: the new test must reliably reach
FINISHEDin the real CI environment before this PR can merge. Right now it fails deterministically against this PR's own head commit in the fork's CI, in two independent shards, which means as-is it would land as a new source of red/flaky CI for every future PR that happens to run this module — the opposite of what a regression test should do.
Recommended fixes (either direction is reasonable; I don't have enough evidence to pick one over the other with certainty)
- Option A: Investigate why the final dispatch doesn't happen within 180s post-cancellation on CI hardware specifically (e.g., add a diagnostic log dump of
CoordinatorService#getPendingJobQueue/isCoordinatorActivestate on timeout, or reproduce locally under artificial CPU throttling) and fix the underlying cause if it turns out to be a genuine dispatch bug rather than pure timing. - Option B: If investigation shows this is purely a CI-load timing budget problem (not a functional bug), increase the final
assertJobStatusWithTimeout(..., JobStatus.FINISHED, 180)window (and/or trimflapRoundsor the per-round 30s membership-wait budget) to a value empirically proven stable across several real CI runs before merging, and say so explicitly in the PR description with the evidence.
Overall assessment: This is a well-designed, well-documented regression test that correctly closes a real coverage gap (proving the #11653 epoch fix holds under real multi-node, multi-round failover rather than just in mocked unit tests) and follows this file's and this module's existing conventions closely — genuinely good work, and I want to be clear the design intent here is sound. The one blocker is concrete and CI-proven rather than a matter of opinion: as currently tuned, this test does not pass in the project's own CI infrastructure. Once it passes reliably (whichever of the two options above turns out to be the right fix), I'd expect this to be an easy approve.
No alternative architectural approach is needed — the test's structure and use of existing harness capabilities is appropriate; only the timing/robustness of its final assertion needs to be resolved.
DanielLeens
left a comment
There was a problem hiding this comment.
Sorry for the noise on my side first — this PR ended up with three near-identical CHANGES_REQUESTED reviews from me within about five minutes on 2026-09-01 (an artifact of a batch-processing hiccup on my end, not intentional spam). Please treat this comment as the current, authoritative one; I've re-reviewed the latest head from scratch rather than just diffing against my own earlier reviews.
What Problem Does This PR Solve?
- User pain point: the duplicate/lost pending-job dispatch fix in #11653 (monotonic
pendingJobScheduleEpochinCoordinatorService) only had single-JVM, mock/reflection-based unit coverage (CoordinatorServiceTest). Nothing exercised the invariant through a real multi-node cluster with real client submission, real Hazelcast membership changes, and real resource contention. - Fix approach: adds
SplitClusterPendingJobLifecycleFailoverIT#testPendingJobNotDuplicatedAcrossRepeatedMasterFailover, which flaps master ownership across 4 rounds while aScheduleStrategy.WAITpending job is under active re-evaluation, then asserts the job survives every epoch transition as a single pending entry and is eventually dispatched exactly once (exact output row count, not doubled). - One-sentence summary: the test design is genuinely good and closes a real coverage gap, but as of this review the exact head commit has not yet produced passing CI evidence on either JDK, and the most recent completed run (one commit behind the current head) still failed with the identical symptom — so this still cannot be merged today.
1. Code Change Review
1.1 Core Logic Analysis
Since my last review (commit 73a8c0da70f), two more commits landed:
e8fc49e1662(davidzollo): addsassertEventuallyCanceled(holderJobAfterFlapping)afterholderJobAfterFlapping.cancelJob(), mirroring the existing pattern in the sibling testtestPendingJobScheduledAfterRunningJobCanceled(line 247-248) — this was exactly my Issue 2 recommendation from the prior round.efd640318c8(pushed via maintainer-edit): adds one more master handoff right before the final assertion:
// SplitClusterPendingJobLifecycleFailoverIT.java:391-397 (current head)
// The active master restored both jobs while all worker slots were occupied. Hand off
// once more after releasing the holder's slots so the new coordinator rebuilds the
// pending entry from distributed state and schedules it with the newly available
// resources. This also verifies that the final recovery cannot revive a stale copy.
currentActive.shutdown();
awaitCoordinatorActive(currentStandby, 30);
assertJobStatusWithTimeout(pendingJobAfterFlapping, JobStatus.FINISHED, 180);Confirming the restore mechanism against real source: CoordinatorService.clearCoordinatorService() (CoordinatorService.java:1281-1311) unconditionally drops the local pendingJobQueue and interrupts every JobMaster in it, with the comment "every entry in pendingJobQueue corresponds to a JobInfo already persisted in runningJobInfoIMap... Restore on the next activation will rebuild PendingJobInfo entries from runningJobInfoIMap via restoreAllRunningJobFromMasterNodeSwitch, producing a single fresh JobMaster per job id." restoreJobFromMasterActiveSwitch (CoordinatorService.java:1106-1161) confirms this: any non-terminal job (RUNNING or PENDING) gets a brand-new JobMaster and is re-enqueued into pendingJobQueue with PendingSourceState.RESTORE (line 1157-1160), then re-enters the normal pendingJobSchedule evaluation loop. So the code comment in the new hunk is accurate, not just plausible-sounding.
Important new evidence I dug up that neither commit message mentions: the fork's fully-completed CI run for commit e8fc49e1662 (i.e., fix-commit-2 alone, before the extra failover was added) still failed identically:
https://github.com/davidzollo/seatunnel/actions/runs/33517249100
engine-v2-it (8, ubuntu-latest): failure
engine-v2-it (11, ubuntu-latest): failure
SplitClusterPendingJobLifecycleFailoverIT.testPendingJobNotDuplicatedAcrossRepeatedMasterFailover:390->assertJobStatusWithTimeout:452 » ConditionTimeout
org.awaitility.core.ConditionTimeoutException: ... expected: <FINISHED> but was: <PENDING> within 3 minutes.
This is the same symptom, same both-JDK reproduction, as the original failure I reported against 73a8c0da70f — just shifted a few lines because of the new assertEventuallyCanceled call. This directly refutes the "missing wait for holder cancellation" theory as the actual root cause — it was a legitimate correctness improvement (the sibling test does it, so it should be there regardless), but it did not by itself fix the hang. That means the real fix candidate is the third commit (the extra failover), not the second one — and that commit has not yet been CI-validated at all: I checked davidzollo/seatunnel run 33528373089 (head efd64031c845) and as of this review, engine-v2-it (8) and engine-v2-it (11) are still queued, not yet started.
Key Findings:
- The
assertEventuallyCanceledaddition (commit 2) is correct and worth keeping regardless of whether it turns out to be sufficient — it closes a real, documented gap versus the sibling test. - Commit 2 alone does not fix the underlying hang (proven by the completed CI run above), which means the root cause of the original failure is still not diagnosed anywhere in this PR's commits or description.
- Commit 3's extra failover is architecturally sound as an assertion of the restore invariant (see 1.1 above), but it changes which master ends up performing the decisive dispatch: instead of the master that survived all 4 repeated flap rounds (
currentActive, the scenario this regression test exists to protect), the job is now finally dispatched bycurrentStandby— a node that has never been active before this point. See Issue 3 below for why this matters. - No CI evidence yet exists for the current head. My previous three reviews were against
73a8c0da70f; they cannot be treated as still applying toefd64031c845one way or the other on the pass/fail question.
1.2 Compatibility Impact
Fully compatible. Test-only change across all three commits; no production code, config, protocol, or serialization surface touched.
1.3 Performance / Side-Effect Analysis
No production impact. Resource cleanup in the finally block correctly guards each masterNodes entry with isRunning() before calling shutdown() (line 413-417), so the extra fifth failover doesn't introduce a double-shutdown or leaked-instance risk. CI cost increases slightly (one more ~30s awaitCoordinatorActive wait plus another node startup/shutdown cycle) on top of an already ~220-260s test method inside a long engine-v2-it job — not a blocker, but worth the author's awareness.
1.4 Error Handling and Logging
Issue 1
- Location: current head
efd64031c845— no completed CI evidence; last completed evidence ise8fc49e1662(one commit behind head), which failed:SplitClusterPendingJobLifecycleFailoverIT.java:390/assertJobStatusWithTimeout:452,davidzollo/seatunnelrun33517249100, bothengine-v2-it (8)andengine-v2-it (11). - Problem description: The change this PR is really staking its "ready to merge" claim on — the extra failover in commit 3 — has not been exercised by CI at all yet (
davidzollo/seatunnelrun33528373089,engine-v2-it (8)and(11)bothqueuedas of this review). The only CI evidence that exists for a version of this test with the holder-cancellation fix shows it still failing identically. - Potential risk: Merging without actual green CI evidence for the exact head commit would repeat the exact situation my first review flagged — a "regression coverage" PR whose own regression test doesn't reliably pass, which either becomes a recurring red/flaky signal for unrelated PRs or gets disabled later (silently losing the coverage).
- Best improvement: Wait for
davidzollo/seatunnelrun33528373089(or its successor) to complete for headefd64031c845, and confirm bothengine-v2-it (8, ubuntu-latest)andengine-v2-it (11, ubuntu-latest)are green. If either still fails, please paste the new failure link here — given commit 2 alone didn't fix it, I'd want to see whether commit 3 actually addresses the underlying cause or just relocates the race (see Issue 3). - Severity: High
- Raised by another reviewer: No
2. Code Quality Assessment
2.1 Coding Standards
Issue 2 (carryover from my first review round)
- Location:
SplitClusterPendingJobLifecycleFailoverIT.java:61 - Problem description: This is a genuine carryover, not a new issue — I flagged in my first review that the new test class has no class-level Javadoc, and neither of the two fix commits touched this.
public class SplitClusterPendingJobLifecycleFailoverIT {still has no class-level Javadoc describing that the class now covers three lifecycle scenarios (single-failover restore, cancel-triggered reschedule, repeated-failover duplicate-dispatch regression). - Potential risk: Low — reduces discoverability for future maintainers scanning the E2E suite.
- Best improvement: Add a short class-level Javadoc summarizing the three scenarios this class covers.
- Severity: Medium
- Raised by another reviewer: No
Issue 3
- Location:
SplitClusterPendingJobLifecycleFailoverIT.java:391-397 - Problem description: The new failover-before-dispatch step means the job that finally reaches
FINISHEDis dispatched bycurrentStandby— a master instance that has never been active before this point in the test — rather than bycurrentActive, the master that survived all 4 repeated flap rounds underScheduleStrategy.WAIT. Given the concrete evidence in Issue 1 that fix-commit-2 alone (holder-cancellation wait, no extra failover) still hung with the battle-scarredcurrentActivenever reachingFINISHED, it's a real possibility that this change works around, rather than explains, whatever prevented that specific master from noticing the freed resources and dispatching. The scenario "can the master that has been through N repeated failovers still correctly schedule a long-pending job once resources free up" is precisely what this regression test exists to prove per its own class Javadoc (lines 268-289); routing the decisive step through a fresh node instead doesn't disprove the original concern, it just stops asking the question. - Potential risk: If there is a genuine, still-latent defect in
CoordinatorServicewhere a master that has survived several rapid epoch transitions can end up with itspending-job-schedule-runnerthread not properly re-armed (this is architecturally possible — see below — though not confirmed as the actual cause here), this test would now pass without ever detecting it, undermining the coverage goal stated in the PR description. - Best improvement: At minimum, add a code comment explaining why the extra failover step was necessary (i.e., that the holder-cancellation fix alone was proven insufficient by CI, and this was the fix that (is expected to) work) so future maintainers understand this isn't decorative. Ideally, before merging, get one clean CI run's diagnostic output (e.g. temporarily log
CoordinatorService.isCoordinatorActive()/getPendingJobQueue()state on the pre-failovercurrentActiveright before the timeout) to confirm whethercurrentActivereally was stuck (in which case this is a live production bug worth its own follow-up issue) or whether it was purely a CI-load timing artifact (in which case the extra failover is a reasonable, if opaque, workaround). For context on the architectural possibility:checkNewActiveMaster()(CoordinatorService.java:1241-1271) callsinitCoordinatorService()— which firesrestoreAllRunningJobFromMasterNodeSwitchasynchronously ontoexecutorService(CoordinatorService.java:658-661) — and then immediately callsstartPendingJobScheduleThread(), which doesexecutorService.submit(...)(line 334) against the same pool. That pool isSynchronousQueue-backed withAbortPolicy-derived rejection (createCoordinatorExecutor, line 287-297); a rejection there is caught bycheckNewActiveMaster's outercatch (Exception e)and silently falls back toisActive = false, relying on the next 100ms poll to retry. With this test's defaultcore-thread-num=10/max-thread-num=Integer.MAX_VALUE(ServerConfigOptions.java:456-466), outright rejection is unlikely with only 1-2 concurrent jobs — so I don't think this exact mechanism is the live cause here, but it's a real self-healing race in the shared executor worth knowing about, and it's the kind of thing that would only reveal itself under exactly the "repeated real failover" conditions this test creates. - Severity: Medium
- Raised by another reviewer: No
No System.out.println, no forbidden single-line Javadoc, no @DisplayName usage — clean otherwise.
2.2 Test Coverage and Test Stability
Rating: High risk — evidence: SplitClusterPendingJobLifecycleFailoverIT.java:387-397, davidzollo/seatunnel run 33517249100 (completed, failed on both JDKs against a version of this test that already included the holder-cancellation fix) and run 33528373089 (current head, engine-v2-it still queued, no result yet). This is not a Thread.sleep-based synchronization problem — all waits go through Awaitility.await()...untilAsserted() or waitForJobCompleteV2(). The instability is worse than ordinary flakiness: it has been 100% reproducible on two independent commits so far, across both JDKs, and the fix that has actually been CI-validated (commit 2) was proven insufficient. Per the task's stability rubric this must be a formal High-severity blocker (Issue 1) until the current head shows two clean passes on both JDKs.
Secondary, lower-confidence anti-pattern note: assertJobStatusWithTimeout (line 455-463) and its Awaitility siblings in this file never call .ignoreExceptions(). ClientJobProxy.getJobStatus() routes through SeaTunnelHazelcastClient.requestOnMasterAndDecodeResponse → ClientInvocation.invoke().get(), and any transient invocation failure (e.g. a TargetDisconnectedException-style error while the client's own view of getMasterMember() is still converging right after currentActive.shutdown()) would propagate as an unchecked exception out of the lambda, which Awaitility's default behavior does not retry (only AssertionError is retried; other exceptions abort the wait immediately) — a documented anti-pattern this same review process has flagged elsewhere in this codebase before. I can't confirm this is the actual cause of the observed hang (the hang is a timeout, not an exception, per the CI logs), and the equivalent post-failover poll already works elsewhere in this same file's other passing tests, so I'm not making this a formal blocking issue — but the newly added failover in commit 3 places a master shutdown immediately before this exact call pattern, which increases exposure. Worth a defensive .ignoreExceptions() at some point, non-blocking.
2.3 Documentation Updates
N/A — test-only PR, no docs/en or docs/zh changes needed.
3. Architectural Soundness
3.1 Elegance of the Solution
The core test design (WAIT-strategy cadence as a deterministic race window, exact-row-count assertion) remains a precise, well-thought-out way to close the stated coverage gap. Whether the two fix commits amount to a "precise fix" or a "workaround that narrows what's actually being tested" is exactly the open question in Issue 3 — I'd classify this as "temporary workaround, pending confirmation" until either CI evidence or a clarifying comment resolves it.
3.2 Maintainability
Good overall — helper methods remain cleanly factored and reused. The undocumented "why" behind the extra failover (Issue 3) is the one maintainability gap introduced by the newest commit.
3.3 Extensibility
No concerns; self-contained new test class.
3.4 Historical-Version Compatibility
N/A — test-only change, no serialization/config/protocol surface touched.
4. Issue Summary
| Number | Issue | Location | Severity |
|---|---|---|---|
| 1 | Current head has no completed CI evidence yet; the most recent completed run (one commit behind, holder-cancellation fix only) still failed identically on both JDK 8 and JDK 11 | SplitClusterPendingJobLifecycleFailoverIT.java:390-397 / CI runs 33517249100, 33528373089 |
High |
| 2 | New test class still lacks a class-level Javadoc (carryover from my first review, not yet addressed) | SplitClusterPendingJobLifecycleFailoverIT.java:61 |
Medium |
| 3 | The newly added final failover routes the decisive dispatch through a never-before-active master instead of the one that survived all 4 repeated flap rounds, which may sidestep rather than resolve whatever caused the earlier hang; needs an explanatory comment and ideally a root-cause confirmation | SplitClusterPendingJobLifecycleFailoverIT.java:391-397 |
Medium |
5. Merge Recommendation
Conclusion: Not recommended for merge
-
Blockers — must be fixed
- Issue 1 (High): the current head commit must actually pass CI (
engine-v2-itgreen on both JDK 8 and JDK 11) before this can merge. As of this review that run is still queued, and the last completed run one commit behind still failed with the identical symptom. Please ping this thread oncedavidzollo/seatunnelrun33528373089(or its successor) completes so I can take another look right away.
- Issue 1 (High): the current head commit must actually pass CI (
-
Recommended fixes — non-blocking
- Issue 2 (Medium): add the missing class-level Javadoc — small, easy to fold into the same push.
- Issue 3 (Medium): please add a short comment explaining why the extra failover step was needed. Given commit 2 alone didn't fix the hang, I don't think this can currently be dismissed as "just a Javadoc nit" — understanding whether
currentActivewas genuinely stuck or whether this is CI-load timing would materially change how much confidence the community should have in this test once it's green. I'm not blocking merge on root-causing this fully, since that could be a real time sink, but at minimum the "why" should be recorded so the next person touching this file (or debugging a future flake here) isn't starting from zero.
Overall assessment: The test's design intent is still sound and the coverage gap is real and worth closing. The holder-cancellation fix (commit 2) was a correct improvement to make regardless, but the CI evidence shows it wasn't sufficient by itself — which means the actual fix candidate (commit 3's extra failover) is currently unverified by CI and its rationale isn't documented anywhere in the PR. I'd like to see this go green on the current head before approving, and I'd appreciate a one-line comment recording why the extra failover was the right call, so this doesn't read as an unexplained CI-chasing patch to the next person who reads this file. Happy to re-review the moment the current run finishes — if it's green on both JDKs and Issue 2/3 are picked up, I'd expect this to move to approval quickly.
No better alternative architecture is needed here — once verified, this is the right approach; only the missing verification and missing rationale need to be closed out.
DanielLeens
left a comment
There was a problem hiding this comment.
What Problem Does This PR Solve?
Thanks for the update, @davidzollo — I re-reviewed the current head (db8889317) end to end, not just a diff against my last-reviewed commit.
- User pain point: the duplicate/lost pending-job dispatch fix in #11653 (monotonic
pendingJobScheduleEpochinCoordinatorService) only had single-JVM, mock/reflection-based unit coverage. Nothing exercised the invariant through a real multi-node cluster with real client submission, real Hazelcast membership changes, and real resource contention. - Fix approach: adds
SplitClusterPendingJobLifecycleFailoverIT#testPendingJobNotDuplicatedAcrossRepeatedMasterFailover, which flaps master ownership across 4 rounds while aScheduleStrategy.WAITpending job is under active re-evaluation, then asserts the job survives every epoch transition as a single pending entry and is eventually dispatched exactly once. - This round's one-sentence summary: nothing has changed in the test itself since my last review — the only commits since then are two
Merge branch 'dev' into ...merges that bring in unrelateddevhistory (including PR #12034, which independently added a different test,testTerminalJobCleanupSkipsWorkerWaitAfterMasterSwitch, to this same file — that one nets out to zero against currentdevand is not this PR's content). And the current head's CI has now actually completed: bothengine-v2-it (8)andengine-v2-it (11)fail with the exact same symptom I reported last round against a different commit — so Issue 1 is not just unresolved, it is now confirmed to reproduce on the current, final head too.
1. Code Change Review
1.1 Core Logic Analysis
I confirmed the actual net diff with git diff apache/dev...db8889317 --stat (the three-way diff, not a two-dot diff against my last-reviewed commit — the latter is misleading here because the branch merged in ~90 unrelated dev commits). It shows exactly one file, SplitClusterPendingJobLifecycleFailoverIT.java, and I diffed that file directly against my last-reviewed commit (efd64031c845) with a path-scoped git diff — it is byte-identical. So every finding from my last review still applies verbatim to the current head; nothing here is stale.
Issue 1 is now CI-confirmed on the current head, not just "no evidence yet" as I reported last round. I dereferenced the apache-side Build check (a pointer only) to the real run in davidzollo/seatunnel, run 33888105908, head db8889317 (the current head). Both engine-v2-it (8, ubuntu-latest) and engine-v2-it (11, ubuntu-latest) fail:
[ERROR] SplitClusterPendingJobLifecycleFailoverIT.testPendingJobNotDuplicatedAcrossRepeatedMasterFailover:399->assertJobStatusWithTimeout:689 » ConditionTimeout
Caused by: org.opentest4j.AssertionFailedError: expected: <FINISHED> but was: <PENDING>
This is the exact same failure mode, at the exact same final assertion (assertJobStatusWithTimeout(pendingJobAfterFlapping, JobStatus.FINISHED, 180), now at line 399 instead of 390 purely because of upstream line shifts from the dev merge — the test's own logic is unchanged), that I reported last round against e8fc49e1662 (one commit behind that review). That means we now have three independent CI runs — 73a8c0da70f, e8fc49e1662, and now this PR's actual current head db8889317 — all reproducing the identical hang. The "extra failover" workaround in commit 3 (efd64031c845, reviewed last round) has not changed the outcome at all; my Issue 3 concern from last round — that routing the decisive dispatch through a never-before-active master might sidestep rather than fix whatever is actually wrong — looks more likely to be correct given this is now a third reproduction with the same symptom.
Key Findings
- No code has changed in this file since my last review; nothing to re-verify on the "did the author's diff introduce a new problem" axis.
- The CI evidence gap I flagged last round ("current head unverified") is now closed, and it closed in the direction I was worried about: the current head fails identically.
- I did not additionally dig into root cause beyond what I already traced last round (
CoordinatorService.clearCoordinatorService()/restoreJobFromMasterActiveSwitch()semantics) — that analysis is unchanged and still holds; the new information this round is purely "does the current, final head pass CI," and the answer is no.
1.2 Compatibility Impact
Fully compatible. Test-only change; no production code, config, protocol, or serialization surface touched.
1.3 Performance / Side-Effect Analysis
No production impact. Unchanged from last review.
1.4 Error Handling and Logging
Issue 1 (carryover, now CI-confirmed on the current head — escalated from "no evidence yet" to "confirmed failing")
- Location:
SplitClusterPendingJobLifecycleFailoverIT.java:399(current head) / CI runsdavidzollo/seatunnel#33888105908(engine-v2-it (8)and(11), both failed on the exact current head commitdb8889317). - Problem description: The regression test this PR adds does not pass. Three independent CI runs across two different commits, spanning both fix attempts (holder-cancellation wait, and the extra-failover workaround), all fail identically with
expected: <FINISHED> but was: <PENDING>on the final assertion. - Potential risk: Merging a "regression coverage" PR whose own regression test does not reliably pass would either (a) become a recurring red/flaky signal blocking unrelated PRs' CI, or (b) get silently disabled later, losing the coverage this PR exists to add.
- Best improvement: The underlying hang needs to actually be root-caused before this can merge — three identical reproductions on the real head is strong enough evidence to treat this as a real, still-unfixed condition rather than CI noise. I'd suggest instrumenting the specific state this test cares about (
CoordinatorService.pendingJobScheduleEpoch,pendingJobQueuecontents, and whether apending-job-schedule-runnerthread is even alive) oncurrentActive/currentStandbyright before the final 180s timeout expires, rather than attempting another blind workaround. - Severity: High
- Raised by another reviewer: No
2. Code Quality Assessment
2.1 Coding Standards
Issue 2 (carryover from my first review round, still not addressed)
- Location:
SplitClusterPendingJobLifecycleFailoverIT.java:61(current head — confirmed by reading the class declaration directly; still no class-level Javadoc). - Problem description:
public class SplitClusterPendingJobLifecycleFailoverIT {still has no class-level Javadoc describing the (now three, including #12034's independently-landed test) lifecycle scenarios this class covers. - Potential risk: Low — reduces discoverability for future maintainers.
- Best improvement: Add a short class-level Javadoc.
- Severity: Medium
- Raised by another reviewer: No
Issue 3 (carryover, unchanged — still not addressed since the file hasn't changed)
- Location:
SplitClusterPendingJobLifecycleFailoverIT.java:391-397(line numbers shifted slightly to 396-402 in some contexts due to upstream merges, content unchanged). - Problem description: unchanged from last round — the extra failover step before the final assertion routes the decisive dispatch through
currentStandby, a master that has never been active before that point, rather than throughcurrentActive, the master that survived all 4 repeated flap rounds. Given Issue 1's now-tripled evidence that this doesn't actually fix the hang, this remains an open, undocumented design question rather than a settled workaround. - Potential risk: Same as before — if there's a genuine latent defect specific to a master that has been through repeated rapid epoch transitions, this design increasingly looks unlikely to ever catch it, since the CI evidence shows the hang recurring regardless.
- Best improvement: Unchanged from last round — either explain (with a comment, once root-caused) why the extra failover is expected to help, or restructure per Issue 1's suggestion above to actually diagnose what's stuck.
- Severity: Medium
- Raised by another reviewer: No
No System.out.println, no forbidden single-line Javadoc, no @DisplayName usage.
2.2 Test Coverage and Test Stability
Rating: High risk — unchanged and now further substantiated. Evidence: SplitClusterPendingJobLifecycleFailoverIT.java:399, CI runs 33517249100 (previous commit, failed both JDKs), 33888105908 (current head db8889317, failed both JDKs — engine-v2-it (8) job 101076074832, engine-v2-it (11) job 101076074953). This is not a Thread.sleep-based synchronization problem — all waits go through Awaitility.await()...untilAsserted(). The instability is worse than ordinary flakiness: it is now 100% reproducible across three independent CI runs spanning two different fix attempts, on both JDK 8 and JDK 11 every time. Per the task's stability rubric this remains a formal High-severity blocker (Issue 1) until the current head shows a clean pass on both JDKs — which, as of this review, it does not.
2.3 Documentation Updates
N/A — test-only PR.
3. Architectural Soundness
3.1 Elegance of the Solution
Unchanged assessment: the core test design (WAIT-strategy cadence as a deterministic race window, exact-row-count assertion) is a precise, well-thought-out way to close the stated coverage gap. Whether the fix commits actually make the test pass remains the open question — and the current evidence says they don't.
3.2 Maintainability
Unchanged — helper methods remain cleanly factored. The undocumented "why" behind the extra failover (Issue 3) is still the one gap, now compounded by CI evidence that it isn't sufficient.
3.3 Extensibility
No concerns.
3.4 Historical-Version Compatibility
N/A — test-only.
4. Issue Summary
| Number | Issue | Location | Severity |
|---|---|---|---|
| 1 | Current head's own regression test fails identically to the two commits before it — three consecutive CI reproductions of expected: <FINISHED> but was: <PENDING> on both JDK 8 and JDK 11 |
SplitClusterPendingJobLifecycleFailoverIT.java:399; CI runs 33517249100, 33888105908 |
High |
| 2 | New test class still lacks a class-level Javadoc (carryover, unaddressed across two rounds) | SplitClusterPendingJobLifecycleFailoverIT.java:61 |
Medium |
| 3 | The extra failover routes the decisive dispatch through a never-before-active master; now further evidenced not to actually resolve the hang | SplitClusterPendingJobLifecycleFailoverIT.java:391-397 |
Medium |
5. Merge Recommendation
Conclusion: Not recommended for merge
-
Blockers — must be fixed
- Issue 1 (High): the regression test this PR adds must actually pass CI on the head that gets merged. As of this review, the current head fails identically to the two commits before it across three independent CI runs on both JDKs. This needs a genuine root-cause fix, not another CI cycle hoping for a different outcome — the identical failure across three attempts strongly suggests this isn't timing jitter.
-
Recommended fixes — non-blocking
- Issue 2 (Medium): add the missing class-level Javadoc.
- Issue 3 (Medium): once Issue 1 is root-caused, document why whatever the actual fix turns out to be addresses the hang.
Overall assessment: The test's design intent remains sound and the coverage gap is real. But this is now the third commit in a row to fail with the exact same symptom on real CI, which shifts my read from "probably a timing race that needs one more iteration" toward "there is a genuine, still-undiagnosed defect (either in the fix this test targets, or in the test's own assumptions about how failover interacts with ScheduleStrategy.WAIT) that needs actual investigation, not another workaround commit." I'd like to see the next round come with either a fix that's shown two clean CI passes, or a clear diagnostic writeup of what state the cluster is actually in when the 180s timeout expires. Happy to re-review as soon as either lands.
CI analysis for the current head (
|
CI update for head
|
DanielLeens
left a comment
There was a problem hiding this comment.
What Problem Does This PR Solve?
Thanks for the update, @davidzollo — I re-reviewed the current head (e9923e5337c) end to end, not just a diff against my last-reviewed commit.
- User pain point: the duplicate/lost pending-job dispatch fix in #11653 (monotonic
pendingJobScheduleEpochinCoordinatorService) only had single-JVM, mock/reflection-based unit coverage. Nothing exercised the invariant through a real multi-node cluster with real client submission, real Hazelcast membership changes, and real resource contention. - Fix approach: adds
SplitClusterPendingJobLifecycleFailoverIT#testPendingJobNotDuplicatedAcrossRepeatedMasterFailover, which flaps master ownership across 4 rounds while aScheduleStrategy.WAITpending job is under active re-evaluation, then asserts the job survives every epoch transition as a single pending entry and is eventually dispatched exactly once. - This round's one-sentence summary: the one new commit since my last review (
e9923e53, "Decouple pending-job duplicate dispatch test from slot reclaim") is a real, well-targeted redesign — it stops cancelling the holder job (the action that three straight CI runs traced back to a genuine, separate worker-slot leak) and instead frees capacity by growing the cluster with an extra worker, which correctly routes around that unrelated defect instead of trying to out-wait it again.
1. Code Change Review
1.1 Core Logic Analysis
I confirmed the net diff with git diff apache/dev...e9923e5337c --stat: one file, SplitClusterPendingJobLifecycleFailoverIT.java (+221). I then path-scoped git diff db888931..e9923e53 -- '*SplitClusterPendingJobLifecycleFailoverIT.java' against my last-reviewed head — the only change is exactly the commit described above.
Before (the head I last reviewed, db8889317):
ClientJobProxy holderJobAfterFlapping =
engineClient.createJobClient().getJobProxy(holderJob.getJobId());
holderJobAfterFlapping.cancelJob();
assertEventuallyCanceled(holderJobAfterFlapping);
currentActive.shutdown();
awaitCoordinatorActive(currentStandby, 30);
assertJobStatusWithTimeout(pendingJobAfterFlapping, JobStatus.FINISHED, 180);After (current head, e9923e5337c):
currentActive.shutdown();
awaitCoordinatorActive(currentStandby, 30);
assertJobStatusWithTimeout(pendingJobAfterFlapping, JobStatus.PENDING, 60);
SeaTunnelConfig extraWorkerConfig = getSeaTunnelConfig(testClusterName);
configurePendingLifecycleTest(extraWorkerConfig);
extraWorkerNode = SeaTunnelServerStarter.createWorkerHazelcastInstance(extraWorkerConfig);
HazelcastInstanceImpl finalCoordinator = currentStandby;
Awaitility.await()
.atMost(60, TimeUnit.SECONDS)
.untilAsserted(
() -> Assertions.assertEquals(3, finalCoordinator.getCluster().getMembers().size()));
assertJobStatusWithTimeout(pendingJobAfterFlapping, JobStatus.FINISHED, 180);Why this matters — the root cause you diagnosed in your CI-analysis comments is real, and this design correctly avoids it. I read through both of your CI-analysis comments in detail (on db88893 and bcf9ad1). Your trace is convincing: cancelJob() on the holder flips the coordinator's job status to CANCELED, but its worker-side tasks were still alive 3 minutes later and its 4 static slots (dynamicSlot=false) were never released, so the contested job's ResourceRequestHandler kept getting applied: 0 for the full window. That is a real engine robustness gap — and, worth noting for your own tracking, it looks like the same class of defect already tracked in #11437 ("Fixed-slot streaming job remains PENDING and leaks slots after active Master failover") and the older #9589 ("the slots will leak when the active master switches"). You may want to link this CI evidence to one of those rather than opening a third one.
Retiring the cancel-and-wait step entirely (rather than trying to fix the race around it) is the right call for a [Test][E2E] PR: it keeps this PR scoped to proving the duplicate-dispatch invariant, and leaves the separate slot-leak defect to be fixed (and tested) on its own terms in seatunnel-engine-server.
This also resolves my carryover Issue 3 from the last two rounds (the concern that routing the decisive dispatch through currentStandby — a master that has never been active before — was an undocumented design choice). The new comment at lines 396-402 now explains it clearly: growing the cluster forces "a coordinator that never saw the original submission" to rebuild the pending entry purely from distributed state, which is actually a stronger test of the epoch invariant than promoting an already-active master. That rationale is sound and now on the record — no further action needed here.
Key Findings
- The redesign correctly targets the actual root cause your own CI investigation uncovered (worker-slot leak on cancel + failover), not the epoch-scheduling logic this test exists to guard — so it doesn't risk masking a real defect in either direction.
- My prior Issue 3 (undocumented "never-active master" handoff) is resolved by the new comment; I'm closing it out of this round's issue list.
- What is not yet resolved: the current head's own CI run has not completed.
apache/seatunnel'sBuildcheck fore9923e53isQUEUEDas of this review, and the corresponding fork run (davidzollo/seatunnelrun33961795042, same head) is also stillqueued. Three prior heads on this exact test (73a8c0da70f,e8fc49e1662/db8889317,bcf9ad180) all failed identically. A sound design on paper is not the same as demonstrated evidence that the hang is actually gone — that's the one remaining gap before I can approve.
1.2 Compatibility Impact
Fully compatible. Test-only change; no production code, config, protocol, or serialization surface touched.
1.3 Performance / Side-Effect Analysis
No production impact. The test itself is heavier than before in one respect worth flagging for CI runtime, not correctness: it now starts an additional Hazelcast worker instance (extraWorkerNode) that did not exist in the previous version, on top of the up-to-6 master/worker instances already spun up across the 4 flap rounds. That's a reasonable trade for correctness (real slot growth vs. a racy cancel), but it does add real wall-clock and resource cost to an already-heavy multi-node IT.
1.4 Error Handling and Logging
Resource cleanup is correct: extraWorkerNode is null-guarded and shut down in the finally block alongside the other nodes.
Issue 1: Current head's fix has not yet been confirmed by a completed CI run
- Location:
SplitClusterPendingJobLifecycleFailoverIT.java(whole test, current heade9923e5337c); CI reference:apache/seatunnelPR checkBuild(queued, dereferences todavidzollo/seatunnelrun33961795042, same head, statusqueuedas of this review). - Problem description: the design change is well-reasoned and directly addresses the root cause traced through three prior failing CI runs, but as of this review there is no completed run — passing or failing — for the exact head being reviewed. Given this test has now failed identically on three consecutive prior commits (two different fix attempts), a plausible-looking design is not sufficient evidence that the hang is actually gone.
- Potential risk: merging a "regression coverage" PR whose own regression test has never been shown to pass on its final head risks landing a red or newly-flaky signal on
dev, or (if later disabled) silently losing the coverage this PR exists to add. - Best improvement: wait for the currently queued run to complete and confirm
testPendingJobNotDuplicatedAcrossRepeatedMasterFailoverpasses on bothengine-v2-it (8)andengine-v2-it (11). Given the history here, I'd also feel more confident seeing it repeated once (e.g., a rerun) rather than treating a single green run as conclusive, though that's a suggestion rather than a hard requirement. - Severity: High
- Raised by another reviewer: No
Issue 2 (carryover from my first review round, still not addressed)
- Location:
SplitClusterPendingJobLifecycleFailoverIT.java:63(current head). - Problem description:
public class SplitClusterPendingJobLifecycleFailoverIT {still has no class-level Javadoc describing the lifecycle scenarios this class covers (now four@Testmethods, including the independently-landedtestTerminalJobCleanupSkipsWorkerWaitAfterMasterSwitchfrom #12034). - Potential risk: Low — reduces discoverability for future maintainers.
- Best improvement: Add a short class-level Javadoc.
- Severity: Medium
- Raised by another reviewer: No
Issue 3 (new in this commit): stale method-name reference in a new comment
- Location:
SplitClusterPendingJobLifecycleFailoverIT.java:402— "...and matches how testPendingJobLifecycleAcrossMasterFailover releases a pending job." - Problem description: there is no method named
testPendingJobLifecycleAcrossMasterFailoveranywhere in the codebase. The method this comment almost certainly means to reference istestPendingJobLifecycleInMasterFailover(same file, line 67), which does grow the cluster with a second worker node to free capacity for a pending job after a single failover — the same pattern this comment is describing. - Potential risk: Low — cosmetic, but a future maintainer trying to look up the referenced precedent for this pattern will not find it.
- Best improvement: Fix the method name in the comment to
testPendingJobLifecycleInMasterFailover. - Severity: Low
- Raised by another reviewer: No
No System.out.println, no @DisplayName usage.
2.2 Test Coverage and Test Stability
Rating: Risk present. Evidence: SplitClusterPendingJobLifecycleFailoverIT.java (current head e9923e5337c). All waits go through Awaitility.await()...untilAsserted() — no Thread.sleep-based synchronization, which is good practice. I'm not repeating the "High risk" rating from my last two rounds, because the specific mechanism that produced three identical CI failures (cancel-holder-then-immediately-shut-down-master, racing an unrelated slot-release defect) has been removed from the test entirely, not patched around. That said, I'm holding at "Risk present" rather than "Stable" for two reasons: (1) Issue 1 above — no completed CI run yet exists for this exact head to empirically confirm the redesign works; and (2) this remains a long, multi-round, multi-node failover test (up to 7 Hazelcast instances across the run) where a slow CI runner could still introduce new timing sensitivity that a single passing run wouldn't fully rule out. Recommend one confirmed clean run (ideally two) on both JDK 8 and 11 before treating this as settled.
2.3 Documentation Updates
N/A — test-only PR.
3. Architectural Soundness
3.1 Elegance of the Solution
Between a precise fix and a temporary workaround, this now reads as the precise fix: the test no longer depends on a code path (cancel-then-immediate-failover) that turned out to hide an unrelated defect, and the "why" behind the final never-active-master handoff is now documented rather than left as an unexplained workaround.
3.2 Maintainability
Good — helper methods remain cleanly factored, and the new Javadoc (lines 20-41, 396-402) clearly explains intent. Only gaps are Issue 2 (missing class Javadoc) and Issue 3 (stale reference).
3.3 Extensibility
No concerns.
3.4 Historical-Version Compatibility
N/A — test-only.
4. Issue Summary
| Number | Issue | Location | Severity |
|---|---|---|---|
| 1 | Redesigned test's fix has not yet been confirmed by a completed CI run on the current head | SplitClusterPendingJobLifecycleFailoverIT.java (current head); fork run 33961795042 (queued) |
High |
| 2 | New test class still lacks a class-level Javadoc (carryover, unaddressed across three rounds) | SplitClusterPendingJobLifecycleFailoverIT.java:63 |
Medium |
| 3 | New comment references a nonexistent method name (testPendingJobLifecycleAcrossMasterFailover); likely meant testPendingJobLifecycleInMasterFailover |
SplitClusterPendingJobLifecycleFailoverIT.java:402 |
Low |
5. Merge Recommendation
Conclusion: Not recommended for merge
-
Blockers — must be fixed
- Issue 1 (High): the redesign looks correct and well-reasoned, and I want to be clear that this is a much stronger position than the last two rounds — but the exact head being reviewed has not yet produced a completed CI result. Given the history of three straight identical failures on this test, I'd like to see it actually pass (ideally more than once) before removing this blocker.
-
Recommended fixes — non-blocking
- Issue 2 (Medium): add the missing class-level Javadoc.
- Issue 3 (Low): fix the stale method-name reference in the new comment.
Overall assessment: This is real progress, not another guess — you correctly separated "the epoch invariant this test guards" from "the slot-leak defect three CI runs happened to trip over," fixed the test to stop exercising the latter, and left a clear paper trail (including for a likely-related existing issue, #11437) for the latter to be tracked and fixed on its own. Once the currently-queued CI run comes back green on both JDKs, I don't expect to have further concerns beyond the two non-blocking cleanups above. Happy to take another look as soon as that lands — feel free to ping me directly once you have a clean run, since at that point this should just need a final confirmation rather than another full pass.
|
@DanielLeens Thanks for the thorough re-review. Both points from your last round are now closed out. Issue 1 (High, blocking) — resolved by evidence, not by argumentThe run you saw as
That is the first green result on this test after three consecutive identical failures ( Agreed on your tracking note as well: this CI evidence lines up with the existing #11437 / #9589 slot-leak reports rather than warranting a third issue, so I'll attach it there instead of opening a new one. Issues 2 and 3 — fixed in
|
DanielLeens
left a comment
There was a problem hiding this comment.
What Problem Does This PR Solve?
Thanks for the persistence through the CI diagnosis on this one, @davidzollo — I re-reviewed the current head (222b8bbabe1) end to end against dev, not just the delta from my last review.
- User pain point: the duplicate/lost pending-job dispatch fix in #11653 (monotonic
pendingJobScheduleEpochinCoordinatorService) only had single-JVM, mock/reflection-based unit coverage. Nothing exercised the invariant through a real multi-node cluster with real client submission, real Hazelcast membership changes, and real resource contention. - Fix approach: adds
SplitClusterPendingJobLifecycleFailoverIT#testPendingJobNotDuplicatedAcrossRepeatedMasterFailover, which flaps master ownership across 4 rounds while aScheduleStrategy.WAITpending job is under active re-evaluation, then hands off one final time and grows the cluster to free capacity, asserting the job survives every epoch transition as a single pending entry and is dispatched exactly once. - This round's one-sentence summary: the one new commit since my last review (
222b8bba, "Add class Javadoc and fix stale method reference") is comment-only and closes out both remaining items from my last round cleanly; combined with a completed greenBuildrun on this exact head, all three of my outstanding issues are now resolved and I have no further blockers.
1. Code Change Review
1.1 Core Logic Analysis
I confirmed the net diff with git diff dev...222b8bbabe --stat: one file, SplitClusterPendingJobLifecycleFailoverIT.java (+243/-0) relative to dev. I then path-scoped git diff e9923e53..222b8bba -- '*SplitClusterPendingJobLifecycleFailoverIT.java' against the head I last reviewed — the diff is exactly what the commit message says: a new class-level Javadoc block and one corrected method name in an existing comment. No test logic, assertion, or helper method changed.
Issue 1 from my last review (High, blocking) — resolved by a genuinely completed CI run on this exact head. My last review's sole blocker was that the redesigned test (which stopped cancelling the holder job and instead grows the cluster to free capacity, correctly routing around the separate worker-slot-leak defect that three prior heads' CI runs had traced back to) had a sound design but no completed CI result yet. I re-checked apache/seatunnel's Build check directly rather than trusting the PR comment: it is SUCCESS, head_sha: 222b8bbabe122637e2e8478c11688e8ac7eaa18c (the current head, not a stale one), completed 2026-09-05T16:13:02Z — https://github.com/apache/seatunnel/runs/101309647959. Since 222b8bba is comment-only relative to e9923e53 (confirmed above), this run is also, as the author correctly points out, an independent repeat of the exact same test logic that passed on e9923e53 — i.e. the "see it pass twice" I asked for in my last review is satisfied by these two independent green runs on byte-identical test logic, not just one.
Issue 2 from my last review (Medium, carryover across three rounds) — fixed. The class now has a proper Javadoc block (SplitClusterPendingJobLifecycleFailoverIT.java:63-84) describing the shared setup (real split cluster, master ownership changes while worker slots are occupied) and listing all four @Test scenarios in the class, including testTerminalJobCleanupSkipsWorkerWaitAfterMasterSwitch, which landed independently via #12034 and was already present in this file before this round.
Issue 3 from my last review (Low) — fixed correctly. The comment at line 424 previously referenced a nonexistent method, testPendingJobLifecycleAcrossMasterFailover. I grepped the full current head for that string and confirmed it no longer exists anywhere; the comment now correctly reads testPendingJobLifecycleInMasterFailover (SplitClusterPendingJobLifecycleFailoverIT.java:424), and I independently confirmed that method (lines 89 onward) does start a second worker instance after a master failover to free capacity for a pending job — the same pattern this comment is describing, so the corrected reference is not just spelled right but actually accurate.
Key Findings
- All three of my outstanding issues across six review rounds on this PR are now closed, each verified against the real source/CI rather than taken on the author's word.
- The underlying production invariant this test guards is real: I independently confirmed
pendingJobScheduleEpoch(CoordinatorService.java:198), its increment sites incheckNewActiveMaster/clearCoordinatorService(lines 1250, 1286), and the epoch-mismatch abort check inpendingJobSchedule(line 344) are present in currentdevexactly as #11653 and this test's Javadoc describe. - The net diff against
devremains test-only: zero production code changes at this head (the interim73aaf491a7"Retry master-switch job restore on transient failure" production fix that appeared briefly earlier in this branch's history is fully gone by thebcf9ad1804merge commit — I verifiedgit diff dev pr-12027 -- .../CoordinatorService.javais empty at the current head, confirming that hypothesis fix was cleanly abandoned once the author's own CI investigation showed the real cause was the unrelated slot-leak defect, not a transient-failure retry gap).
1.2 Compatibility Impact
Fully compatible. Test-only change at the current head; no production code, config, protocol, or serialization surface touched.
1.3 Performance / Side-Effect Analysis
No change from my last review: the redesigned test starts an additional Hazelcast worker instance (extraWorkerNode) on top of the up-to-6 master/worker instances already spun up across the 4 flap rounds, which is a reasonable trade for correctness (real slot growth vs. a racy cancel) but does add real wall-clock/resource cost to an already-heavy multi-node IT. All instances (workerNode, extraWorkerNode, every entry in masterNodes) are null/running-state guarded and shut down in the finally block (lines 447-462).
1.4 Error Handling and Logging
No new issues in this round's comment-only commit. All three issues from my last review are resolved (see 1.1 above); none remain open.
No System.out.println, no @DisplayName usage.
2.2 Test Coverage and Test Stability
Rating: Stable (upgraded from "Risk present" in my last review). The mechanism that produced three identical CI failures across earlier heads — cancelling the holder job then immediately shutting down its master, racing an unrelated worker-slot-release defect (tracked separately at #11437/#9589) — has been removed from the test entirely, not patched around, and that redesign has now passed on two independent runs of byte-identical test logic (e9923e5337c and 222b8bbabe1). All waits go through Awaitility.await()...untilAsserted(); no Thread.sleep-based synchronization gates any assertion. The remaining residual risk is inherent to any long multi-node failover IT (up to 7 Hazelcast instances across the full run) rather than anything specific to this design, and two green runs on the exact logic under test is enough evidence to no longer treat that as an open question.
2.3 Documentation Updates
N/A — test-only PR. The new class-level Javadoc (Issue 2 above) is itself the documentation improvement this round adds.
3. Architectural Soundness
3.1 Elegance of the Solution
Precise fix. Retiring the cancel-and-wait step in favor of growing the cluster correctly separates "the epoch invariant this test exists to guard" from "the slot-leak defect three CI runs happened to trip over," and the rationale for routing the decisive dispatch through a coordinator that never saw the original submission is now documented rather than left as an unexplained design choice.
3.2 Maintainability
Good, and improved this round: the new class Javadoc closes the one real maintainability gap I'd carried across three review rounds. The one remaining known gap — the four active-master helper methods duplicated with #12029's test class — was explicitly and reasonably deferred by the author on #12029 to avoid a cross-PR merge conflict while both PRs are in flight in the same batch; I agree that's the right call and am not re-raising it here as a new issue on this PR.
3.3 Extensibility
No concerns.
3.4 Historical-Version Compatibility
N/A — test-only, no state/config/protocol surface touched at the current head.
4. Issue Summary
No open issues. All three issues carried from my earlier review rounds (CI confirmation pending / missing class Javadoc / stale method-name reference) are resolved as of this head.
5. Merge Recommendation
Conclusion: Ready to merge
- Blockers — none. The one remaining blocker from my last round (unconfirmed CI on the exact head) is resolved:
BuildisSUCCESSon222b8bbabe122637e2e8478c11688e8ac7eaa18c, completed 2026-09-05T16:13:02Z, and that result is a genuine repeat of the same test logic that also passed on the immediately prior head. - Recommended fixes — none outstanding.
Overall assessment: this PR took real, well-documented iteration to get right — the author correctly used CI evidence across several rounds to distinguish "the epoch-scheduling invariant this test exists to guard" from "an unrelated worker-slot-leak defect the original test design happened to trip over," fixed the test to stop exercising the latter, and left a clear paper trail (including pointers to the pre-existing #11437/#9589 reports for the unrelated defect) rather than either masking the CI failures or quietly changing production code to paper over them. All of my concerns across six rounds — the CI-confirmation blocker, the missing class Javadoc, and the stale method reference — are now closed, each independently re-verified against source and CI rather than taken on trust. Approving.
|
Thanks for the +1, @nzw921rx — appreciate the second pair of eyes, and glad we're aligned after the back-and-forth on the CI evidence across the earlier rounds. One more thing before this can actually merge, unrelated to review content: GitHub is currently reporting merge conflicts between this branch and the latest |
…h after failover Adds an E2E test that repeatedly flaps master ownership across a rotating set of master-eligible nodes while a pending job sits under active ScheduleStrategy.WAIT re-evaluation, then verifies the job survives every epoch transition as a single pending entry and is dispatched exactly once (exact output row count, not doubled). This exercises the multi-node integration path (real client submission, real Hazelcast membership changes, real resource contention) for the fix in apache#11653, which currently only has single-JVM mock/reflection-based unit coverage of the underlying epoch/lock mechanism in isolation.
restoreAllRunningJobFromMasterNodeSwitch previously ran once, fire-and-forget, via CompletableFuture.runAsync with no exception handler. Any exception it threw -- e.g. a transient IMap read failure while an overlapping membership change from a rapid master failover is still settling -- silently and permanently failed that future. No job-status read path (only waitForJobComplete does) joins on it, so a job still needing restore stayed at its pre-switch status forever, with nothing retried and nothing logged. Add restoreAllRunningJobFromMasterNodeSwitchWithRetry, which retries on failure until this activation is superseded, matching the retry standard startPendingJobScheduleThread already applies to itself. Make restoreAllRunningJobFromMasterNodeSwitch's job-selection filter also exclude jobs already in pendingJobQueue (not only runningJobMasterMap) so a retry after a partially-completed attempt cannot construct a second JobMaster for the same job id via PeekBlockingQueue's non-deduplicated underlying queue. Adds testRestoreAllRunningJobFromMasterNodeSwitchRetriesOnTransientFailure to CoordinatorServiceTest, injecting a one-time transient IMap failure and asserting the restore retries instead of abandoning the job. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…claim The CI run for this branch showed testPendingJobNotDuplicatedAcrossRepeatedMasterFailover timing out at its final step: after the holder job was cancelled and its master was immediately shut down, the contested job stayed PENDING for the full 3 minute window while the resource manager reported 0 free slots, and the holder's task groups were still running on the worker at teardown. That is a resource-lifecycle concern (a terminal job's worker slots are only released by its own JobMaster, and no coordinator reclaims them if that master dies first), not the duplicate-dispatch invariant this test exists to cover. Coupling the two made the test assert on an unrelated mechanism. Restructure the final phase so capacity is freed by adding a worker instead, mirroring how testPendingJobLifecycleAcrossMasterFailover releases a pending job. The final master hand-off now happens while the job is still pending, with an explicit assertion that the new coordinator rebuilds exactly one pending entry, and the exact row-count assertion that detects a duplicate dispatch is unchanged. No assertion is relaxed and no timeout is enlarged. Also revert the CoordinatorService restore-retry change and its unit test from this branch. The CI logs show no restore failure, so that production change was not supported by evidence and does not belong in a regression-test-only PR. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
222b8bb to
116b9cf
Compare
DanielLeens
left a comment
There was a problem hiding this comment.
What Problem Does This PR Solve?
Thanks for the persistence on this one, @davidzollo, and thanks @nzw921rx for the extra pair of eyes along the way. I want to start with an honest note on process: I approved commit 222b8bbabe1 on 2026-09-05 and then flagged a dev merge conflict on 2026-09-07. Since then the branch was rebased onto current dev and the head has moved twice more, so per the review protocol I re-reviewed the current head (116b9cf6c7) end to end from scratch, not just the delta since my approval.
- User pain point: the duplicate/lost pending-job dispatch fix in #11653 (monotonic
pendingJobScheduleEpochinCoordinatorService) only had single-JVM, mock/reflection-based unit coverage (CoordinatorServiceTest). Nothing exercised the invariant through a real multi-node cluster with real client submission, real Hazelcast membership changes, and real resource contention. - Fix approach: adds
SplitClusterPendingJobLifecycleFailoverIT#testPendingJobNotDuplicatedAcrossRepeatedMasterFailover, which flaps master ownership across 4 rounds while aScheduleStrategy.WAITpending job is under active re-evaluation, then hands off one final time and grows the cluster (rather than cancelling the job holding the slots) to free capacity, asserting the job survives every epoch transition as a single pending entry and is dispatched exactly once (exact output row count, not doubled). - One-sentence summary of this round: the net PR content is unchanged in substance from what I approved on
222b8bbabe1— the intervening commits added a speculativeCoordinatorServiceproduction fix and then correctly reverted it for lack of evidence, and the branch was rebased onto a newerdevto resolve the conflict I flagged; the regression test itself is still the same sound, already-proven design.
1. Code Change Review
1.1 Core Logic Analysis
Current head 116b9cf6c76676b4fedf2691cbfb434b97612f9d is 3 ahead / 0 behind dev (gh api repos/apache/seatunnel/compare/dev...116b9cf6c7), and gh pr view --json files shows exactly one file changed relative to current dev: seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/java/org/apache/seatunnel/engine/e2e/SplitClusterPendingJobLifecycleFailoverIT.java. No production code is touched in the final diff.
I looked at the raw commit history behind that net-zero-elsewhere result, since it is unusual: commit e7111c980f ("Retry master-switch job restore on transient failure") added a real fix to CoordinatorService.restoreAllRunningJobFromMasterNodeSwitch plus a new CoordinatorServiceTest case; commit 116b9cf6c7 ("Decouple pending-job duplicate dispatch test from slot reclaim") then explicitly reverts that production change with the stated reason "CI logs show no restore failure, so that production change was not supported by evidence and does not belong in a regression-test-only PR." That is exactly the right call for a [Test][E2E]-scoped PR, and I verified with git diff 222b8bbabe 116b9cf6c7 -- <the test file> that the actual regression test body I already reviewed and approved is unchanged — same flap loop, same final "hand off once more while still PENDING, then grow the cluster with an extra worker instead of cancelling the holder" tail that Issue 1 from my 2026-09-05 round already confirmed avoids the real (and separate) worker-slot-leak defect (tracked-worthy against #11437 / #9589, not this PR's concern).
Runtime path (verified against current dev source, not just re-asserted from memory):
client submits contested batch job (parallelism 1)
-> CoordinatorService.pendingJobQueue, ScheduleStrategy.WAIT
-> pending-job-schedule-runner thread re-evaluates every ~3s, held PENDING by the
holder job saturating all 4 static slots (dynamicSlot=false)
4x master flap (test loop) + 1 final hand-off, all while holder still holds every slot:
activeMaster.shutdown() -> Hazelcast membership change -> standby's 100ms
masterActiveListener poll -> checkNewActiveMaster() -> pendingJobScheduleEpoch++
-> clearCoordinatorService() drops the local queue -> restoreAllRunningJobFromMasterNodeSwitch
rebuilds a single fresh PendingJobInfo per job id from runningJobInfoIMap
-> assertJobStatusWithTimeout(..., PENDING, ...) after every hand-off proves no
stale generation revived a duplicate copy
capacity freed by growing the cluster (extraWorkerNode), not by cancelling the holder:
-> next ~3s scheduler tick on the surviving coordinator sees free slots -> dispatches
the (still-single) pending entry -> RUNNING -> FINISHED
-> exact row count assertion (testRowNumber * testParallelism) rules out a double dispatch
The reason for the "grow the cluster" tail instead of "cancel the holder" is well-documented in the test's own comments (lines around the final phase) and matches my prior review's finding: cancelling the holder and immediately shutting its master down leaves its worker-side tasks running and its 4 static slots permanently unreleased (a genuine engine bug, out of scope here), which is exactly what made three earlier heads (73a8c0da70, e8fc49e1662/efd64031c8, db8889317) time out deterministically on both JDK 8 and JDK 11. The current design routes around that unrelated defect instead of trying to out-wait it, which is the correct scope decision for a test-only PR.
Normal path vs. boundary path: this is exclusively a master-failover recovery-path test (by design — that is the invariant under test), it does not exercise the steady-state single-master dispatch path, and it correctly says so in its own Javadoc.
1.2 Compatibility Impact
Fully compatible. Test-only change relative to current dev; zero production code, config option, protocol, serialization, or public API surface touched in the final diff. The one production-code excursion (e7111c980f) that would have needed real compatibility scrutiny (an added retry loop and a broadened job-selection filter in restoreAllRunningJobFromMasterNodeSwitch) was self-reverted by the author in the very next commit before I did this review, so there is nothing outstanding to evaluate on that front — but full credit to the author for reverting an unproven fix rather than letting it ride into an unrelated PR.
1.3 Performance / Side-Effect Analysis
No production runtime impact (test-only). CI cost: this one test method starts 6 master-eligible Hazelcast instances and 2 workers across its lifetime (2 initial masters + 4 flap replacements) plus one extra worker, with 5 total master shutdowns and bounded Awaitility waits (worst case a few minutes). That is comparable to the existing testMasterElectionLoopRecoversFromRapidFailoverChurn in the same file and is an accepted cost for this class of failover regression test.
1.4 Error Handling and Logging
No new exception-swallowing or log-level issues. The test relies on Awaitility's ConditionTimeoutException and JUnit's AssertionFailedError to surface failures with full context (expected/actual status, job id via the enclosing method name), consistent with the rest of the file. The finally block correctly guards every shutdown() call with an isRunning() (or list-membership) check so a partially-initialized cluster from an earlier failure does not throw a masking exception during teardown.
2. Code Quality Assessment
2.1 Coding Standards
Matches the file's existing conventions (helper method placement, Awaitility usage, try/finally resource cleanup pattern, ASF header already present at file top since this is not a new file). No wildcard imports. No System.out.println.
2.2 Test Coverage and Test Stability
Stability rating: Stable.
Evidence:
- No
Thread.sleepin place ofAwaitilityanywhere in the new code; every wait isAwaitility.await()...untilAsserted(...). - The terminal assertion is an exact row-count equality (
testRowNumber * testParallelism), not a weak existence/range check, so a duplicate dispatch is unambiguously detected rather than merely "probably" detected. - No shared static mutable state between test methods (each method builds its own isolated Hazelcast cluster keyed by a unique
testClusterName), so this test is not order-dependent with respect to its siblings. - No floating-point comparisons.
- The exact same test logic (byte-identical per my 2026-09-05 approval-round diff) has two independent, fully completed green
Buildruns in CI history (one9923e5337and222b8bbabe), after three earlier heads reproduced the same timeout deterministically on both JDK 8 and JDK 11 — i.e., this is evidence of a real fix to test stability, not merely an untested hope. - Re-derived live, right before writing this review: the apache-side
Buildcheck and the real fork run behind it (davidzollo/seatunnelrun34178685894) are both stillin_progressfor the current head116b9cf6c7. I am not treating any cached/prior conclusion as valid for this exact commit — see Issue 1 below.
2.3 Documentation Updates
No docs/en / docs/zh update needed; this is an internal test-only change with no user-facing config, API, or behavior change. See Issue 2 for one small class-Javadoc completeness gap surfaced by this round's full re-review.
3. Architectural Soundness
3.1 Elegance of the Solution
Good. Reusing the existing ScheduleStrategy.WAIT 3-second re-check cadence to get a wide, deterministic window instead of chasing a microsecond-scale race, and reusing the "grow the cluster" resource-release pattern already established by the sibling testPendingJobLifecycleInMasterFailover, are both idiomatic uses of existing test harness primitives. No new test infrastructure was introduced.
3.2 Maintainability
Good. The class-level and method-level Javadoc thoroughly explain the "why" (design rationale, prior CI failure history, and the scope boundary against the separate slot-leak defect), which will save the next person real investigation time if this test ever needs to change again.
3.3 Extensibility
Neutral/positive — createBatchTestResources and awaitCoordinatorActive are reasonable, narrowly-scoped private helpers that other tests in this file could reuse if a similar bounded-batch-job or hand-off pattern is needed later.
3.4 Historical-Version Compatibility
No impact. Test-only change; nothing here touches checkpoint/savepoint format, serialization, persisted state, or any upgrade path.
4. Issue Summary
Issue 1 (raised by another reviewer: No)
- Location: current head
116b9cf6c76676b4fedf2691cbfb434b97612f9d, apache-sideBuildcheck / fork runhttps://github.com/davidzollo/seatunnel/actions/runs/34178685894. - Problem description: the real CI run for this exact head has not completed yet (
in_progressat the time of this review) — I am deliberately not carrying forward the "green" conclusion from the earlier, byte-identical test logic one9923e5337/222b8bbabe, since the file itself has since picked up new sibling content fromdev(see Issue 2) that now shares the same test class and CI job. - Potential risk: low — the exact assertions under review here are unchanged from two already-green runs, but a merge should not be finalized on inference alone.
- Best improvement: wait for this run to reach
COMPLETED/SUCCESSon the current head before merging; no code change expected to be needed. - Severity: High (blocking merge, not blocking the design), Raised by another reviewer: No.
Issue 2 (raised by another reviewer: No)
- Location:
SplitClusterPendingJobLifecycleFailoverIT.java:67-88(class-level Javadoc added by this PR). - Problem description: the "Scenarios covered" bullet list added by this PR names 4 test methods, but the class (after picking up unrelated sibling tests from
devduring the rebase that resolved the merge-conflict I flagged on 2026-09-07) now actually contains 6@Testmethods — it is missingtestPermanentlyStuckWaitJobBlocksSchedulableJobBehindItandtestMasterElectionLoopRecoversFromRapidFailoverChurn. Both of those pre-date this PR ondevand are not this PR's own content, so this is purely a side effect of the rebase timing, not something that could have been caught in my earlier approval (they were not present in the file at222b8bbabe1, my approved head). - Potential risk: low — cosmetic only, a future reader could be misled into thinking the class only has 4 scenarios.
- Best improvement: Option A (preferred) — add the two missing bullets so the list stays exhaustive; Option B — reword the intro sentence to "including (non-exhaustive)" if keeping the list in sync with
devchurn is undesirable long-term. - Severity: Low, Raised by another reviewer: No.
5. Merge Recommendation
This PR's actual content (the regression test itself) has not changed in substance since I approved it on 2026-09-05, and the only production-code detour in between was correctly self-reverted before I did this review. The single remaining gate is a CI run for this exact head that had not yet completed at review time, plus one cosmetic Javadoc completeness nit surfaced by the rebase. There are no design, correctness, compatibility, or test-stability blockers.
Conclusion: Ready to merge after fixes
Blockers:
- Let the in-progress
Buildrun on head116b9cf6c76676b4fedf2691cbfb434b97612f9dreach a completed, green result (no code change anticipated — this is the same test logic that has already passed twice independently).
Recommended fixes (non-blocking):
- Update the class-level Javadoc "Scenarios covered" list (
SplitClusterPendingJobLifecycleFailoverIT.java:67-88) to also mentiontestPermanentlyStuckWaitJobBlocksSchedulableJobBehindItandtestMasterElectionLoopRecoversFromRapidFailoverChurn, or note that the list is illustrative rather than exhaustive.
DanielLeens
left a comment
There was a problem hiding this comment.
CI follow-up on head 116b9cf6c76676b4fedf2691cbfb434b97612f9d: in my 2026-09-08 review, the sole blocking item (Issue 1, High severity) was that the apache-side Build check for this exact head was still in_progress at review time, and I deliberately did not carry forward the "green" conclusion from the earlier byte-identical test logic on prior heads since the file had since picked up new sibling content during the rebase. Issue 2 (a class-Javadoc completeness nit) was explicitly non-blocking.
The Build check for this head has since completed and is green. CI was the only remaining blocker and it is now passing, so I'm updating this to approve.
Purpose
Adds multi-node E2E regression coverage for the duplicate/lost pending-job
dispatch race fixed in #11653 ("[Fix][Zeta] Avoid duplicate pending job
scheduling after failover").
That fix introduced a monotonic scheduling epoch so a scheduler thread from
a stale master generation cannot dispatch a pending job that a newer
generation has already claimed, and made
clearCoordinatorServiceunconditionally drop interrupted pending jobs from the local queue so a
later flap-back cannot re-dispatch a poisoned
JobMaster. It already shipswith four thorough unit tests in
CoordinatorServiceTestthat prove theepoch/lock mechanism correct in isolation via mocked
CoordinatorServiceand reflection.
What was still missing: proof that the same invariant holds through the
real multi-node integration path — real client job submission, real
Hazelcast membership changes, and real resource contention — rather than a
single JVM driving the internal method calls directly.
What this test does
SplitClusterPendingJobLifecycleFailoverIT#testPendingJobNotDuplicatedAcrossRepeatedMasterFailover:4-slot capacity,
ScheduleStrategy.WAIT).PENDINGsince no slots remain. Because the strategy is
WAIT, the schedulerthread repeatedly re-evaluates this job on a fixed 3-second cadence —
this gives the test a wide, deterministic window to land repeated
failovers while the job is under active scheduler evaluation, instead
of chasing a microsecond-scale race.
waits for the standby to take over, then starts a fresh replacement
master-eligible node so there is always a standby ready for the next
round.
single
PENDINGentry (not lost, not duplicated), then cancels theholder job to free capacity and lets it actually run.
FINISHEDwith exactly the expected rowcount. The contested job is a bounded batch job specifically so this
count is exact rather than a lower bound: if it were ever dispatched
twice as two independent
JobMasterinstances, the sink would end upwith double the expected rows instead of matching precisely.
Why this belongs at the E2E layer, not just as another unit test
The existing
SplitClusterPendingJobLifecycleFailoverITalready proves apending job survives a single clean master failover, but never times the
kill to land while the job is actively mid-evaluation, and has no
assertion against duplicate dispatch (only status-transition checks). The
new test closes both gaps using entirely existing harness capabilities —
no new test infrastructure was needed.
Test plan
./mvnw spotless:applyrun on the affected module../mvnw install -DskipTestsrun on the affected module and itsdependency chain to confirm the new test compiles cleanly (this repo's
shaded modules need
install, not barecompile/test-compile, toresolve relocated classes) — build succeeded.
(Testcontainers/Hazelcast-backed, not run in this sandbox).