Repository navigation
[Test][E2E] Add scale coverage for CoordinatorService executor growth during mass failover - #12104
Conversation
… during mass failover Tier-3 scale/stress E2E for scenario L4 of the Zeta engine-core extreme-case E2E initiative. CoordinatorService#createCoordinatorExecutor() builds one node-wide ThreadPoolExecutor (core-thread-num=10, max-thread-num=MAX_VALUE, SynchronousQueue) shared across every job's state-transition callbacks, checkpoint I/O, and the pending-job scheduler. restoreAllRunningJobFromMasterNodeSwitch() fans every job needing restore out onto this same executor in one unthrottled pass during a master failover. CoordinatorExecutorMassFailoverStormIT boots a split-role 3-node embedded cluster, submits 30 concurrent long-running streaming jobs, kills the active master to trigger a genuine mass-simultaneous-restore condition, and samples the promoted standby's executor via the existing public telemetry API getThreadPoolStatusMetrics() immediately after takeover. It asserts what is actually observed (pool grows past core size, zero rejections) rather than proposing a fix; test-only change, no src/main modifications.
DanielLeens
left a comment
There was a problem hiding this comment.
What Problem Does This PR Solve?
The Zeta master's CoordinatorService shares one node-wide ThreadPoolExecutor across every job's state-transition callbacks, checkpoint I/O, and the pending-job scheduler. There was zero test coverage of what that executor actually does when a master failover forces a burst of simultaneous job restores onto it. This PR adds CoordinatorExecutorMassFailoverStormIT: 30 concurrent long-running streaming jobs on a 2-master/1-worker embedded cluster, kill the active master, then sample the promoted standby's executor metrics for 20 seconds and assert on what's actually observed (pool grows past core size, nothing gets rejected, growth stays under a generous CI safety ceiling). Test-only, no src/main changes.
1. Code Change Review
1.1 Core Logic Analysis
I fetched the actual PR-head source (CoordinatorService.java at commit 7b334fa8d09b7) and checked every specific claim in the description against it — all of it held up:
createCoordinatorExecutor()(CoordinatorService.java:287-296):new ThreadPoolExecutor(coreThreadNum, maxThreadNum, 60L, SECONDS, new SynchronousQueue<>(), ..., RejectionCountingHandler())— matches exactly, zero-capacity queue confirmed.- Defaults:
core-thread-num=10,max-thread-num=Integer.MAX_VALUE(ServerConfigOptions.java:456-465), wired throughCoordinatorServiceConfig— matches exactly. checkNewActiveMaster()(CoordinatorService.java:1241-1269, synchronized): executor is only recreated ifisShutdown()/isTerminated(); otherwiseinitCoordinatorService()runs against the pre-existing instance andisActive=trueis set only after — matches exactly, confirming the executor this test samples viaisCoordinatorActive()really is the one that receives the restore burst.initCoordinatorService()(CoordinatorService.java:611-662) ends with exactlyCompletableFuture.runAsync(this::restoreAllRunningJobFromMasterNodeSwitch, executorService)— matches.restoreAllRunningJobFromMasterNodeSwitch()(CoordinatorService.java:989-1093): retryable IMap read, a terminal-state pre-filter, a worker-registration wait gate, then the N-way fan-out (needRestoreFromMasterNodeSwitchJobs.stream().map(entry -> CompletableFuture.runAsync(..., executorService)), wrapped inMDCTracer.tracing(...)but still landing on the sameexecutorService), then a blockingCompletableFuture.allOf(...).get(). All matches the PR's simplified pseudocode.Constant.OPERATION_RETRY_TIME=30,OPERATION_RETRY_SLEEP=2000— matches exactly.getThreadPoolStatusMetrics()(CoordinatorService.java:2253-2269) reads the liveThreadPoolExecutorgetters plus the custom rejection counter — already-public, already used for telemetry export, and this test adds zerosrc/maincode, purely calling an existing API. ConfirmedJobThreadPoolStatusExports.javaandTelemetryCollectorCoordinatorGuardTestboth exist ondev, consistent with the "already used elsewhere" claim.- The "dynamic-slot" scheduling claim also checks out: this module's default
seatunnel.yamltest resource genuinely setsslot-service.dynamic-slot: true, so the worker won't gate 30 lightweight streaming jobs behind a fixed slot count.
So the technical premise is accurate and the test targets a real, previously-uncovered gap. However, on the PR's own CI run, the new test fails — not on its core assertions, but in its own teardown:
[ERROR] CoordinatorExecutorMassFailoverStormIT.testCoordinatorExecutorGrowsPastCoreDuringMassFailoverRestore:275->cancelAllAndAwaitTerminal:359 » ConditionTimeout
[ERROR] Tests run: 183, Failures: 0, Errors: 1, Skipped: 6
(from engine-v2-it (8, ubuntu-latest) on this PR's own head commit 7b334fa8d09b: https://github.com/davidzollo/seatunnel/actions/runs/33962363106 — the only failure in that job.)
Line 275 in the submitted file is inside the main test method, past the three core assertions (peak pool size > core size, zero rejections, peak under the 500 safety ceiling) and past the "wait for restore to finish" call — it's the final cancelAllAndAwaitTerminal(engineClient, jobIds) cleanup call that timed out (Errors: 1, not Failures, and the reported line is the cleanup helper, not an assertion inside the main body). Read together, this is good news and bad news: the test's actual hypothesis about the shared executor appears to have been confirmed (no assertion failure reported), but the test's own cleanup step — cancelling 30 jobs — didn't reliably finish within its 120-second budget. That's not surprising given the test design: the cancel calls for those same 30 jobs likely route through state-transition machinery competing for the exact same executorService the test just finished deliberately saturating with a mass-restore burst, on a shared/loaded CI runner. This is a self-inflicted reliability risk, not a flaky unrelated failure, and it still leaves the PR CI-red.
1.2 Compatibility Impact
Fully compatible. No src/main/**, config, API, or serialization change. Purely a new E2E test class reusing an existing conf resource (pending_jobs_streaming_lifecycle.conf, confirmed unmodified and matching the FakeSource(parallelism=2)/InMemory(writer_sleep=true) description) and an existing split-role cluster pattern already established by the merged SplitClusterPendingJobLifecycleFailoverIT.
1.3 Performance / Side-Effect Analysis
Test-only, no production code path touched, so no impact on any real deployment's throughput/memory/GC/lock behavior. Within the test's own footprint, this is a genuinely heavier IT than most in this suite: 3 embedded Hazelcast instances, 30 concurrent streaming jobs, a deliberate mass-restore storm, then a 20-second tight-loop metrics poll plus up to several minutes of Awaitility waits across submission/failover/cleanup. That's a reasonable cost for what it's testing, but it does raise the bar for how quickly this specific IT can complete on a busy/shared CI runner, which is directly relevant to the teardown timeout observed above.
1.4 Error Handling and Logging
Issue 1: The new test's own cleanup (cancelAllAndAwaitTerminal, 120s budget) times out on the PR's own CI run, even though the test's core hypothesis appears to have been confirmed. Location: CoordinatorExecutorMassFailoverStormIT.java:355-382 (cancelAllAndAwaitTerminal), triggered from the main test body at line ~275-281. Problem: cancelling 30 jobs competes for the same shared executorService the test just intentionally drove into a mass-restore burst; 120 seconds isn't proven sufficient once that pool is already under stress on a loaded runner. Risk: this permanently reds the engine-v2-it bucket for everyone until fixed, and (more importantly) is exactly the kind of self-inflicted CI instability this project has been burned by before in this test family. Best improvement: either raise the cleanup timeout substantially (this test is already one of the heavier ones in the suite, so a longer bound isn't unreasonable), retry the cancel calls themselves, or reduce reliance on the same contended executor during teardown (e.g. poll job status with its own generous per-job timeout rather than one shared 120s window for all 30). Severity: High. Raised by another reviewer: No.
The exception handling inside the sampling loop (try { status = ...getThreadPoolStatusMetrics(); } catch (Exception e) { Thread.sleep(20); continue; }, lines ~216-226) is a reasonable defensive skip with an explanatory comment, though it would silently swallow a persistent failure for the full 20-second window without ever logging it — a log.debug/log.warn on the caught exception would make a future investigation easier if this ever legitimately throws.
The finally block correctly shuts down engineClient/workerNode/masterNode1/masterNode2 unconditionally, so the observed teardown timeout does not leak Hazelcast instances across test runs — that's good defensive design.
2. Code Quality Assessment
2.1 Coding Standards
The class-level Javadoc is excellent — thorough, source-verified, and precisely quotes the relevant production code paths. Per-method coverage is thinner: getSeaTunnelConfig, submitJob, cancelAllAndAwaitTerminal, getCoordinatorService, waitAndFindActiveMaster, findActiveMaster, and isCoordinatorActive have no Javadoc (only awaitAllJobsInStatus does). Most are short and reasonably self-explanatory from their names, but per this project's standard for new non-trivial test methods, a one-line Javadoc on at least cancelAllAndAwaitTerminal (given Issue 1 above) and submitJob would help. Severity: Medium. Raised by another reviewer: No.
2.2 Test Coverage and Test Stability
Rating: High risk (path:line evidence: CoordinatorExecutorMassFailoverStormIT.java:359, cancelAllAndAwaitTerminal, ConditionTimeout on the PR's own CI run). Per the review guidelines this is promoted into the blocker list (Issue 1). The rest of the test's design is solid: Awaitility throughout (no hard sleeps outside the intentional 20ms sampling cadence, which is the actual measurement window, not a wait), a defensive catch around the metrics call, and a clear separation between "trigger the event" and "sample the result." The core assertions themselves (peak > core, zero rejections given unbounded max, safety ceiling) are reasonable and specific rather than vague.
2.3 Documentation Updates
None needed — test-only, no user-facing behavior/config/API change. The class Javadoc references tasks/docs/design/zeta-engine-core-extreme-case-e2e-gap-analysis.md, which per this repo's convention is a local/internal tracking doc and correctly is not part of the diff.
3. Architectural Soundness
3.1 Elegance of the Solution
This is a well-targeted scale/stress addition to a real gap (no coverage existed for the shared coordinator executor under mass failover). The assertions are honestly framed as "document today's behavior" rather than a fix, which is the right posture for a test-only PR probing at a pre-existing, admittedly-unbounded design (max-thread-num=Integer.MAX_VALUE by default). Given the teardown timeout, though, this currently reads as a Temporary workaround in practice (the test can't reliably finish clean) rather than a fully Long-term-solution-ready addition.
3.2 Maintainability
Single well-organized file, no duplication concerns (unlike its companion PR #12105, which has two large near-duplicate classes). Reasonable structure with small private helpers.
3.3 Extensibility
CONCURRENT_JOB_COUNT and POOL_SIZE_CI_SAFETY_CEILING are both named constants with explanatory Javadoc, making it easy to retune scale later without hunting through the test body.
3.4 Historical-Version Compatibility
N/A — test-only, no state/serialization/config format touched.
4. Issue Summary
| # | Issue | Location | Severity |
|---|---|---|---|
| 1 | New test's own cleanup (cancelAllAndAwaitTerminal) times out on the PR's own CI run after the core assertions apparently passed |
CoordinatorExecutorMassFailoverStormIT.java:355-382, invoked around line 275-281 |
High |
| 2 | Several new private helper methods lack Javadoc | CoordinatorExecutorMassFailoverStormIT.java |
Medium |
5. Merge Recommendation
Conclusion: Not recommended for merge
- Blockers — must be fixed:
- Issue 1: harden the teardown so 30 job cancellations reliably complete even while the shared coordinator executor is still working through the restore burst the test itself created — longer timeout, retried cancels, and/or per-job rather than shared polling budgets.
- Recommended fixes — non-blocking:
- Issue 2: add short Javadoc to
submitJob,cancelAllAndAwaitTerminal, and the master-detection helpers.
- Issue 2: add short Javadoc to
Overall assessment: the source verification here is excellent — essentially every specific line-level claim in the PR description checks out against the real CoordinatorService/ServerConfigOptions/Constant code, and the scenario is a real, previously-untested gap in a genuinely unbounded-by-design executor. The core hypothesis (mass failover pushes the shared pool well past its core size, with no rejection given the unbounded max) looks like it held up on CI. The one thing standing between this and a clean merge is that the test doesn't currently finish cleanly — the teardown itself needs to be made robust against the exact load condition the test deliberately creates.
…ncel teardown CoordinatorExecutorMassFailoverStormIT's cancelAllAndAwaitTerminal polled getJobStatus() in a 120s Awaitility loop after cancelling all 30 jobs. On GitHub Actions CI (fork davidzollo/seatunnel, run 33962363106) one job out of 30 was still reporting UNKNOWABLE when the window expired. UNKNOWABLE is a computed, non-self-healing snapshot: CoordinatorService# getJobStatus() returns it whenever a job id is absent from the pending queue, the running-job map and the finished-job history all at once, at the instant of the call. Nothing re-populates any of those structures just because more time passes, so a raw poll can legitimately observe that momentary gap while 30 concurrent cancellations are still settling their bookkeeping, even though the job itself already has a real terminal result. SplitClusterPendingJobLifecycleFailoverIT already hit and solved this same "cancel right after a master failover" race: its assertEventuallyCanceled() awaits the job's own completion result via waitForJobCompleteV2()/doWaitForJobComplete() instead of sampling getJobStatus(). That future resolves directly off the JobMaster's own event-driven completion signal (CoordinatorService#waitForJobComplete hands back JobMaster#jobMasterCompleteFuture whenever the JobMaster is still found in either the pending queue or the running-job map), so it cannot observe the tri-structure snapshot gap that getJobStatus() can. This switches cancelAllAndAwaitTerminal to the same pattern: cancel and kick off doWaitForJobComplete() back-to-back per job while it is still known to be tracked, then await each job's own future with a 150s per-job ceiling (a real hang still fails cleanly with a clear message instead of the whole suite polling in place). Verified locally (two consecutive full runs, 174.968s and 180.318s): both runs' logs show real ~120s Hazelcast operation-heartbeat-timeouts (NotifyTaskStatusOperation, GetTaskGroupMetricsOperation) during the mass-cancel phase, confirming this is a genuinely heavy scenario the fix resolves through rather than a margin bump that would hide it.
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for the quick turnaround, @davidzollo — this round found the blocker from my previous review has actually been fixed, and fixed correctly rather than papered over, so this is a genuinely good update to re-review.
What Problem Does This PR Solve?
CoordinatorService shares one node-wide ThreadPoolExecutor across every job's state-transition callbacks, checkpoint I/O, and the pending-job scheduler, and there was previously zero coverage of what that executor does under a mass-failover restore burst. CoordinatorExecutorMassFailoverStormIT fills that gap: 30 concurrent streaming jobs on a 2-master/1-worker embedded cluster, kill the active master, sample the promoted standby's executor metrics for 20s, and assert on the pool's real behavior (grows past core, never rejects given the unbounded max, stays under a CI safety ceiling). Test-only, no src/main changes.
1. What Changed Since My Last Review (commit 7b334fa8→6b83cf4f)
This is a real, targeted fix, not a dev sync — git diff dev...7b334fa8 (419 lines) vs git diff dev...6b83cf4f (449 lines) confirms new content landed, and the pairwise diff touches only CoordinatorExecutorMassFailoverStormIT.java (+50/-20, one file).
It rewrites cancelAllAndAwaitTerminal end to end:
- Before: cancel all 30 jobs, then
Awaitility.await().atMost(120, SECONDS).untilAsserted(...)re-pollinggetJobProxy(jobId).getJobStatus()for all 30 jobs on every retry, inside one shared 120s budget. - After: cancel each job, immediately capture its own
ClientJobProxy#doWaitForJobComplete()future (PassiveCompletableFuture<JobResult>) in the same loop, then in a second pass block on each job's own future individually with.get(150, TimeUnit.SECONDS), asserting the terminal status from the resolvedJobResultrather than from a fresh status snapshot.
This exactly matches what I flagged as Issue 1 last round (blocking) and is a root-cause fix, not a margin bump: the previous failure mode was getJobStatus() observing the UNKNOWABLE sentinel — a computed, non-self-healing snapshot CoordinatorService returns whenever a job id is momentarily absent from all three of the pending queue / running-job map / finished-job history at once (verified this is exactly what waitForJobComplete() avoids, see trace below). The new code instead awaits the job's own event-driven JobMaster#jobMasterCompleteFuture, the same primitive SplitClusterPendingJobLifecycleFailoverIT#assertEventuallyCanceled already relies on for the identical race. The author's own commit message documents this precisely and states two local runs (174.968s, 180.318s) reproduced the real ~120s Hazelcast heartbeat timeouts during mass-cancel and confirmed the fix resolves through them rather than hiding them — I independently verified this claim is not just asserted but true (see CI section below).
I also independently re-traced the full call chain against the current head and it is unchanged from what I verified last round — still accurate line-for-line:
Test kills activeMaster
-> standbyMaster promoted, isCoordinatorActive() true
(CoordinatorService.checkNewActiveMaster, CoordinatorService.java:1241, synchronized)
-> initCoordinatorService() (CoordinatorService.java:611)
ends with CompletableFuture.runAsync(this::restoreAllRunningJobFromMasterNodeSwitch, executorService)
-> restoreAllRunningJobFromMasterNodeSwitch() (CoordinatorService.java:989)
fans all not-yet-restored jobs out onto the SAME executorService
(createCoordinatorExecutor, CoordinatorService.java:287: core=10, max=MAX_VALUE, SynchronousQueue)
-> test samples getThreadPoolStatusMetrics() (CoordinatorService.java:2253) in a tight 20ms loop
Teardown (the part that changed):
proxy.cancelJob() -> CancelJobOperation -> CoordinatorService.cancelJob(jobId) (:1563)
runningJobMaster.cancelJob() submitted onto the SAME executorService
proxy.doWaitForJobComplete() -> WaitForJobCompleteOperation -> CoordinatorService.waitForJobComplete(jobId) (:1535)
returns runningJobMaster.getJobMasterCompleteFuture() directly (event-driven, not a snapshot read)
test blocks per-job on that future with a 150s ceiling instead of polling getJobStatus() with one shared 120s window
I additionally checked ClientJobProxy.java:126-137 and CoordinatorService.java:1535-1584 directly (not just trusting the PR's own claims) — cancelJob() still routes through the same contended executorService as before (this part is unchanged and not a regression), but completion detection is now push-based off the job's own future rather than poll-based against shared bookkeeping structures, which is the actual fix for the flake.
2. Compatibility
Fully compatible. No src/main/**, config, API, or serialization changes — confirmed the delta touches exactly one test file.
3. Side-Effect / Stability Analysis
No change to production code paths. The test's own footprint is unchanged (3 embedded Hazelcast instances, 30 concurrent jobs); the new teardown design is, if anything, lighter on RPC volume than the old poll loop, since it issues exactly one doWaitForJobComplete() request per job instead of repeatedly re-fetching getJobStatus() for all 30 jobs on every Awaitility retry.
One residual, non-blocking design note: the second loop's entry.getValue().get(150, TimeUnit.SECONDS) calls are sequential per job. Since all 30 cancel requests are already in flight by the time this loop starts, this is not additive in the common case (as CI confirms — see below), but in a theoretical worst case where futures resolve one-at-a-time in adversarial order close to their individual ceilings, total wait time is unbounded up to 30 × 150s. A CompletableFuture.allOf(...)-style parallel wait (or one shared max-elapsed clock across the loop) would remove that theoretical tail risk while keeping the per-job failure message. Severity: Low — not observed in practice and not something I'd block on.
4. Error Handling & Logging
Unchanged from last round and still fine: cancelJob() failures are caught and logged (log.warn, line ~382-384); the sampling loop's defensive catch-and-skip is still present with an explanatory comment; the finally block still unconditionally shuts down engineClient/workerNode/both masters, so no Hazelcast instance leak risk regardless of how the new teardown behaves.
5. CI Verification (independently re-pulled, not just read from cache)
I dereferenced the apache-side "Build" pointer check to the actual fork run for head 6b83cf4f: davidzollo/seatunnel run 33985217230, conclusion success, all 65 jobs green, including both engine-v2-it (8, ubuntu-latest) and engine-v2-it (11, ubuntu-latest) — job 8 is the exact bucket that errored on the previous head. I pulled that job's own log directly:
[main] - CoordinatorExecutorMassFailoverStormIT observed: concurrentJobs=30, corePoolSize=10, peakPoolSize=37, peakActiveCount=32, peakRejectionCount=0
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 155.26 s - in org.apache.seatunnel.engine.e2e.CoordinatorExecutorMassFailoverStormIT
Core hypothesis reconfirmed on this run too (peak 37 > core 10, zero rejections), and the previously-failing teardown now completes cleanly within its new budget — the elapsed time between the sampling log line and test completion is consistent with the real ~120s mass-cancel settling time the author's commit message describes, comfortably inside the new 150s per-job ceiling. This is CI-observed evidence the fix works under real load, not just a plausible theory.
6. Test Coverage and Stability Rating
Rating: Stable (upgraded from High risk last round). Evidence: CoordinatorExecutorMassFailoverStormIT.java:376-406 (cancelAllAndAwaitTerminal), CI run davidzollo/seatunnel#33985217230 job 101358611431, clean pass. The rest of the test's design remains solid (Awaitility throughout for setup/failover-detection, a clear trigger/sample separation, specific rather than vague assertions). I'd still flag the sequential-per-job-wait point in Section 3 as worth a follow-up polish, but it does not currently manifest as instability.
7. Other Reviewer Comments
None — no comments or reviews from anyone other than Daniel exist on this PR at either commit. Nothing to fold in.
8. Issue Summary
| # | Issue | Location | Severity | Raised by another reviewer |
|---|---|---|---|---|
| 1 | (Resolved this round) Teardown timeout in cancelAllAndAwaitTerminal |
CoordinatorExecutorMassFailoverStormIT.java:376-406 |
— (was High, now fixed and CI-verified) | No |
| 2 | Several helper methods (submitJob, getSeaTunnelConfig, getCoordinatorService, waitAndFindActiveMaster, findActiveMaster, isCoordinatorActive) still lack Javadoc; cancelAllAndAwaitTerminal itself now has excellent Javadoc |
CoordinatorExecutorMassFailoverStormIT.java |
Medium (non-blocking) | No |
| 3 | Sequential per-job .get(150s) in cancelAllAndAwaitTerminal's second loop has an unbounded theoretical worst-case wait (30 × 150s) if futures resolve one-at-a-time in adversarial order; not observed in practice |
CoordinatorExecutorMassFailoverStormIT.java:388-405 |
Low (non-blocking) | No |
9. Merge Recommendation
Conclusion: Approved
The blocker from my previous review is resolved with a genuine root-cause fix (event-driven completion instead of a racy status-snapshot poll), and I independently verified on the fork's actual CI run — not just the PR description — that the previously-failing job now passes cleanly, including the core assertions this test exists to make. Source verification of the runtime trace (CoordinatorService.java:287, 611, 989, 1241, 1535, 1563, 2253, ClientJobProxy.java:126-146) holds up against the current head. No src/main changes, fully backward compatible, no other blockers found.
- Blockers: none.
- Recommended fixes (non-blocking, safe to land as-is or as quick follow-ups):
- Issue 2: add short Javadoc to the remaining undocumented helper methods.
- Issue 3: consider bounding total teardown wait time (e.g.
CompletableFuture.allOf) rather than a strictly sequential per-job ceiling, purely to remove a theoretical unbounded tail — not something I've seen manifest.
Nice fix, and thanks for including such a clear commit message explaining exactly why the event-driven future avoids the race the old poll hit.
Purpose of this pull request
Tier-3 (scale/stress) E2E for the Zeta engine master's shared
CoordinatorServiceexecutor — scenario L4 from the ongoing Zeta engine-core extreme-case E2E initiative (Tier 1 shipped 11 PRs: #12027-#12035, #12095, #12098). This scenario had zero existing coverage. Test-only change; nosrc/mainorpom.xmlchanges.CoordinatorService#createCoordinatorExecutor()builds a single, node-wideThreadPoolExecutorshared across every job's state-transition callbacks, checkpoint I/O, and the pending-job scheduler on that node — one pool, no per-job or per-pipeline bound.CoordinatorService#restoreAllRunningJobFromMasterNodeSwitch()is itself dispatched onto this same executor when a node becomes the new active master, and fans every job still needing restore out onto it in one unthrottled pass. With N jobs alive on the old master at failover time, this submits N restore tasks to the shared pool in one tight loop, and because the backing queue is synchronous with an unbounded max pool size, this is a genuine unbounded-thread-creation risk under a mass-failover event. This test builds a small-but-real version of that event and asserts what the source actually does about it, without proposing or requiring a fix.Source verification (traced against this branch's HEAD):
CoordinatorService.java:287-298(createCoordinatorExecutor()):new ThreadPoolExecutor(coreThreadNum, maxThreadNum, 60L, TimeUnit.SECONDS, new SynchronousQueue<>(), ..., new ThreadPoolStatus.RejectionCountingHandler())— zero queue capacity, so any task beyond an already-idle pool thread spawns a brand-new thread immediately.ServerConfigOptions.java:456-466:core-thread-numdefaults to10,max-thread-numdefaults toInteger.MAX_VALUE, wired throughCoordinatorServiceConfig.java:29-33.CoordinatorService.java:1241-1271(checkNewActiveMaster(), synchronized): the executor is only recreated if alreadyisShutdown()/isTerminated()(line 1246-1248); otherwise the same pre-existing, idleexecutorServiceinstance is reused across the promotion.initCoordinatorService()runs first (line 1249), thenisActive = trueis set (line 1251) — so the instance this test samples viaisCoordinatorActive()is exactly the one that receives the restore burst, not a freshly swapped-in one.CoordinatorService.java:611-662(initCoordinatorService()), line 658-661: submits exactly oneCompletableFuture.runAsync(this::restoreAllRunningJobFromMasterNodeSwitch, executorService)— the top-level restore task that, once running, does the actual fan-out.CoordinatorService.java:989-1093(restoreAllRunningJobFromMasterNodeSwitch()): retry-wrapped IMap read (992-1005), a terminal-state ("zombie") pre-filter loop (1016-1042) that does not apply to genuinely running jobs, a worker-registration wait gate (1047-1055, a no-op here since the worker is already registered before failover), the N-way fan-out itself (1056-1083:needRestoreFromMasterNodeSwitchJobs.stream().map(entry -> CompletableFuture.runAsync(..., executorService))), and a blocking join on all N futures (1085-1092).Constant.java:40,42:OPERATION_RETRY_TIME = 30,OPERATION_RETRY_SLEEP = 2000(ms) — the retry budget backingRetryUtils.retryWithException, used both by the IMap read above and by 20+ other state-transition call sites this same executor also carries.CoordinatorService.java:2253-2270(getThreadPoolStatusMetrics()): readsThreadPoolExecutor's own getters directly (getActiveCount,getCorePoolSize,getMaximumPoolSize,getPoolSize,getCompletedTaskCount,getTaskCount,getQueue().size()) plus the rejection counter — O(1), safe to sample in a tight loop. Already public and already used in production for telemetry export (SeaTunnelServer.java:421-422->JobThreadPoolStatusExports.java:44) and covered byTelemetryCollectorCoordinatorGuardTest; this PR adds nosrc/maincode, it only calls an existing public API from a new test.What
CoordinatorExecutorMassFailoverStormITdoes (new file,seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base):SplitClusterPendingJobLifecycleFailoverIT([Test][E2E] Guard terminal-zombie-job restore gate after master switch #12034).pending_jobs_streaming_lifecycle.confresource — aFakeSourceat parallelism 2 against anInMemorysink with a synthetic writer sleep, so each job is CPU-light and never completes on its own) and waits until all 30 report RUNNING, so all 30 are genuinely replicated intorunningJobInfoIMapbefore the failover below.CoordinatorServicereports active, samples its executor viagetThreadPoolStatusMetrics()in a 20ms-interval loop for 20 seconds, tracking peak pool size, peak active count, and peak rejection count.core-thread-num(10), no task is ever rejected (consistent withmax-thread-numdefaulting to unbounded), and a generous CI-safety ceiling (500 threads) is never crossed — a backstop against a future pathological regression, not a claim that today's design bounds growth in general.Scale rationale: 30 concurrent streaming jobs on a single JVM-embedded, 3-node Hazelcast cluster (no Docker, no separate processes) — "dozens," per this initiative's brief for scale/stress scenarios: large enough to reliably push the shared pool well past its default core size of 10, small enough to stay safe on a shared CI runner. The default test config (
seatunnel.yamlin this module) setsslot-service.dynamic-slot: true(resource-accounting rather than a hard slot count), so 30 lightweight streaming jobs schedule without artificially blocking in PENDING — cross-referenced againstDefaultSlotService#selectBestMatchSlot.Does this PR introduce any user-facing change?
No. Test-only addition; no production code, configuration, or documentation changes.
How was this patch tested?
This adds a new E2E test (
CoordinatorExecutorMassFailoverStormIT); no existing test behavior is changed.Locally, per this fork's convention for the Apache SeaTunnel repo, only formatting and compile verification were run (not the IT itself):
./mvnw spotless:apply -pl seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base -am -nsu->BUILD SUCCESS; spotless only reflowed a few Javadoc lines to the column limit, no semantic changes../mvnw install -pl 'seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base,!seatunnel-engine/seatunnel-engine-ui' -am -nsu -Dmaven.gitcommitid.skip=true -DskipTests -Dspotless.check.skip=true->BUILD SUCCESS; confirms the new IT compiles. Verified the compiled.classfile actually exists undertarget/test-classes(not justBUILD SUCCESS---Dmaven.test.skip=truewould fake that by skipping test compilation entirely, so this build intentionally omits that flag).Actual execution of this IT (the concrete peak pool size/active count/rejection count observed under load) is left to this PR's GitHub CI run, which is the authoritative test-execution signal for this repo's contribution workflow.
Check list
incompatible-changes.mdto describe the incompatibility caused by this PR. -- N/A, no incompatible change.