Repository navigation
[Improve][Zeta] Bound worker metrics collection - #11602
tomatotomata wants to merge 20 commits into
Conversation
|
I traced the terminal cleanup path you outlined and agree that the final-history call should not silently reuse the best-effort realtime result. I'm thinking of separating final collection from The current branch is still two commits behind |
|
I pushed
Let me know if you would rather have the strict collector return an explicit completeness result instead of failing the cleanup retry path. |
SEZ9
left a comment
There was a problem hiding this comment.
Thanks for working on this. I reviewed the latest head e4bdab3850cb.
What this PR fixes
- User pain:
getRunningJobMetrics()blocked indefinitely on each worker'sGetMetricsOperationfuture and iterated workers serially, so one slow/hung worker stalled the whole running-job metrics API (#11587). - Fix approach: The default path now delegates to the existing prefix-aware
getRunningJobMetrics(jobIds, timeoutMs, prefixes)overload with a hardcoded 3s budget and the concurrentgetRunningJobRawMetricsfetcher, whileJobMaster.getCurrJobMetricsgains a 3s per-worker timeout with afailOnIncompleteResultsplit: best-effort skip-and-log for live queries, fail-and-retry (via the widenedSubPlan.subPlanDoneretry predicate) for terminalsavePipelineMetricsToHistorysnapshots. - One-line summary: The bounding logic itself is sound and the terminal-vs-live distinction is well thought out, but the 3s timeout is duplicated and unconfigurable, the
SeaTunnelEngineExceptionretry predicate in SubPlan is much broader than the metrics case it targets, the best-effort loop keeps calling remaining workers after an interrupt, and the default-path semantic change from fail-fast to partial results is undocumented.
Runtime chain I rechecked
Live metrics path (bounded, best-effort):
CoordinatorService.getRunningJobMetrics() CoordinatorService.java:1493
-> CoordinatorService.getRunningJobMetrics(runningJobIds, DEFAULT_METRICS_FETCH_TIMEOUT_MS=3000, null) CoordinatorService.java:1494-1495
-> CoordinatorService.getRunningJobRawMetrics(runningJobIds, timeoutMs, prefixes) CoordinatorService.java:1520-1522 (pre-existing concurrent fetcher, now reused)
-> toJobMetricsMap(...) + jobHistoryService.getJobMetrics(jobId).merge(...) CoordinatorService.java:1524-1530 (response shape preserved)
Per-worker JobMaster path:
JobMaster.getCurrJobMetrics(pipelineLocations) JobMaster.java:1039
-> getTaskGroupLocationSlotProfileMap(pipelineLocations) JobMaster.java:1043 (extracted from old inline map build)
-> getCurrJobMetrics(map, failOnIncompleteResult=false) JobMaster.java:1065
-> fetchTaskGroupMetrics(address, taskGroupLocations) JobMaster.java:1163
-> NodeEngineUtil.sendOperationToMemberNode(nodeEngine, new GetTaskGroupMetricsOperation(...), address).get(METRICS_FETCH_TIMEOUT_MS=3000, MILLISECONDS) JobMaster.java:1165-1170 (previously unbounded .get())
-> TimeoutException / HazelcastInstanceNotActiveException / InterruptedException / Exception: log warning and skip worker (best-effort) JobMaster.java:1104-1160
Terminal snapshot path (all-or-nothing + retry):
SubPlan.subPlanDone(pipelineStatus) SubPlan.java:322 -> RetryUtils.retryWithException(...) SubPlan.java:326
predicate now: isOperationNeedRetryException(e) || e instanceof SeaTunnelEngineException SubPlan.java:332-334
-> jobMaster.savePipelineMetricsToHistory(pipelineLocation) JobMaster.java:1174
-> getFinalJobMetrics(getTaskGroupLocationSlotProfileMap(singletonList(pipelineLocation))) JobMaster.java:1176-1178
-> getCurrJobMetrics(map, failOnIncompleteResult=true) JobMaster.java:1102
-> any missing member / timeout / inactive / interrupt / failure throws SeaTunnelEngineException JobMaster.java:1093-1159, which SubPlan's widened predicate then retries
Findings
Issue 1: New 3-second metrics fetch timeout is hardcoded in two places with no configuration option and no documentation update
- Location:
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/master/JobMaster.java:128 - Why it matters: - The PR introduces a user-facing behavior change: the default running-job metrics path now gives up on a worker after 3 seconds, but the value is a hardcoded constant duplicated in both
CoordinatorService(DEFAULT_METRICS_FETCH_TIMEOUT_MS) andJobMaster(METRICS_FETCH_TIMEOUT_MS). - Users running large clusters or slow networks may legitimately need a longer budget; today the only remedy would be recompiling the engine.
- SeaTunnel convention for tunables like this is an
OptioninEngineConfig/seatunnel.yaml(see other Zeta timeouts such as checkpoint timeouts), documented underdocs/en/seatunnel-engine/. No file underdocs/is touched in this PR. - Please either expose this as a configurable engine option with documentation, or at minimum consolidate the two constants into a single shared constant in
seatunnel-engine-commonand add a note in the release/upgrade notes explaining the new bounded behavior. - Evidence:
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/master/JobMaster.java:128 private static final long METRICS_FETCH_TIMEOUT_MS = 3000L; - Suggested fix: This 3-second timeout is a new user-facing behavior (workers slower than 3s are now silently skipped from metrics), yet it is hardcoded here and duplicated as
DEFAULT_METRICS_FETCH_TIMEOUT_MSinCoordinatorService. Please expose it as an engine config option (e.g., inEngineConfig/seatunnel.yaml) and document it underdocs/en/seatunnel-engine/, or at minimum move it to a single shared constant so the two paths cannot drift apart. - Severity: Medium
Issue 2: SubPlan now retries subPlanDone on any SeaTunnelEngineException, which is far broader than the metrics-timeout case this PR is fixing
- Location:
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/dag/physical/SubPlan.java:334 - Why it matters: -
SeaTunnelEngineExceptionis the generic engine exception used across many code paths (state transitions, resource release, checkpoint operations), not only the new metrics failures thrown bygetFinalJobMetrics. - Adding
exception instanceof SeaTunnelEngineExceptionto the retry predicate insubPlanDonemeans a permanent failure anywhere insidenotifyCheckpointEnd/metrics-history saving will now be retriedConstant.OPERATION_RETRY_TIMEtimes, delaying pipeline termination and potentially masking real bugs behind repeated retries. - If the intent is to retry only the failed final-metrics snapshot, throw a dedicated exception type (e.g.,
MetricsCollectionException extends SeaTunnelEngineException) fromgetFinalJobMetricsand match on that specific type in the retry predicate, and add a comment inSubPlanexplaining why it is retryable. - Evidence:
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/dag/physical/SubPlan.java:334 || exception instanceof SeaTunnelEngineException, - Suggested fix: Matching on the broad
SeaTunnelEngineExceptionhere will retrysubPlanDonefor any engine failure, not just the metrics-collection timeouts introduced in this PR. SinceSeaTunnelEngineExceptionis thrown from many unrelated paths, this can turn permanent failures intoOPERATION_RETRY_TIMErepeated attempts and delay pipeline termination. Please introduce a narrower exception (e.g., a dedicatedMetricsCollectionException) thrown bygetFinalJobMetricsand match on that type instead, with a short comment explaining the retry rationale. - Severity: Medium
Issue 3: Default getRunningJobMetrics() changed from fail-fast to best-effort partial results without any docs/upgrade note
- Location:
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java:1495 - Why it matters: - Previously the default path threw
SeaTunnelExceptionwhen a worker fetch failed for a non-Hazelcast reason, so callers (e.g., REST metrics endpoints, clients) either got a complete answer or an error. - After this change,
getRunningJobMetrics()delegates to the bounded/best-effort fetcher, so timed-out or failed workers are silently dropped and callers receive a partialMap<Long, JobMetrics>with no indication that data is missing. - Monitoring systems that alert on metric values (e.g., read counts suddenly dropping) can be misled by an incomplete snapshot.
- Please document this semantic change in the Zeta REST/metrics documentation and the release notes, and consider logging at WARN level with an explicit "partial result" message (or adding a completeness flag) so operators can distinguish partial from full snapshots.
- Evidence:
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java:1495 runningJobMasterMap.keySet(), DEFAULT_METRICS_FETCH_TIMEOUT_MS, null); - Suggested fix: This changes the default running-job metrics semantics from fail-fast (previously threw
SeaTunnelExceptionon non-Hazelcast failures) to best-effort partial results. That is a user-visible change for anyone consuming these metrics via the REST API. Please add a note to the docs/release notes describing that slow or failed workers are now skipped after the timeout, and consider surfacing partial-result information (a WARN log summarizing skipped workers or a completeness indicator) so operators are not misled by incomplete snapshots. - Severity: Medium
Issue 4: Best-effort path keeps iterating remaining workers after the thread was interrupted
- Location:
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/master/JobMaster.java:1141 - Why it matters: - In
getCurrJobMetrics(..., failOnIncompleteResult=false), theInterruptedExceptionhandler restores the interrupt flag and logs a warning, but the surroundingtaskGroupLocationMap.forEachcontinues to the next worker. - Because the interrupt flag is set, every subsequent
fetchTaskGroupMetrics(...).get(...)will immediately throwInterruptedExceptionagain, producing a burst of warning logs and pointless remote-operation setup for each remaining worker while delaying whatever caused the interrupt (e.g., master shutdown or job cancel). - Convert the
forEachlambda into a plain loop so the method canbreak/returnthe partialmetricslist as soon as an interrupt is observed, keeping the interrupt semantics prompt. - Evidence:
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/master/JobMaster.java: Thread.currentThread().interrupt();;seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/master/JobMaster.java: LOGGER.warning( String.format( "%s get current job metrics was interrupted.", - Suggested fix: After restoring the interrupt flag here, the
forEachcontinues iterating the remaining workers, and each subsequentfuture.get(...)will immediately fail with anotherInterruptedException, spamming warnings and delaying shutdown/cancel. Please convert this to a regular loop and return the partialmetricslist immediately once an interrupt is observed in the best-effort path. - Severity: Medium
Issue 5: fetchTaskGroupMetrics widened to protected solely for test overriding without a @VisibleForTesting marker or Javadoc
- Location:
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/master/JobMaster.java:1168 - Why it matters: -
fetchTaskGroupMetricsappears to beprotectedonly soJobMasterTestcan override/stub it; nothing else in production code needs the wider visibility. - Without an annotation, future contributors may treat it as a supported extension point of
JobMaster. - Please annotate it with
@VisibleForTesting(as used elsewhere in the codebase) and add a short Javadoc line noting the 3-second bounded semantics, matching the level of documentation already given togetFinalJobMetrics. - Evidence:
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/master/JobMaster.java: .get(METRICS_FETCH_TIMEOUT_MS, TimeUnit.MILLISECONDS); - Suggested fix: Since
fetchTaskGroupMetricsseems to beprotectedonly so tests can stub the remote call, please add@VisibleForTestingand a brief Javadoc noting the boundedMETRICS_FETCH_TIMEOUT_MSwait, so the wider visibility isn't mistaken for a supported extension point. Non-blocking. - Severity: Low
Review conclusion
Conclusion: final approval remains pending on the previous comments
2. Remaining follow-ups
- Issue 1: New 3-second metrics fetch timeout is hardcoded in two places with no configuration option and no documentation update
- Issue 2: SubPlan now retries subPlanDone on any SeaTunnelEngineException, which is far broader than the metrics-timeout case this PR is fixing
- Issue 3: Default getRunningJobMetrics() changed from fail-fast to best-effort partial results without any docs/upgrade note
- Issue 4: Best-effort path keeps iterating remaining workers after the thread was interrupted
- Issue 5: fetchTaskGroupMetrics widened to protected solely for test overriding without a @VisibleForTesting marker or Javadoc
Thanks for the updates so far. Happy to discuss the remaining points.
DanielLeens
left a comment
There was a problem hiding this comment.
What Problem Does This PR Solve?
Sorry for missing this in the last review — that's on me. Re-checking the version I originally approved-with-changes (commit 7a2458850c), the hardcoded/duplicated 3-second timeout constants, the silent fail-fast-to-best-effort semantic change on the default getRunningJobMetrics()/getJobMetrics(long) paths, and the "keep iterating after interrupt" bug in JobMaster.getCurrJobMetrics() were all already there when I reviewed it on 2026-07-31. I traced through that exact method and even cited its line numbers in my own review, but I only looked at the terminal-history persistence bug and didn't flag these. They are carryover omissions from my previous pass, not new defects introduced by this commit — I'm re-listing them below (Issues 1-3) so they don't get lost, and I want to be upfront that they should have been caught the first time.
I also want to explicitly acknowledge the review posted by @SEZ9 on this same head commit (e4bdab3850cb, submitted 2026-08-05T06:31:17Z). I independently re-traced the whole diff from scratch before reading it, and my findings converge with all five of SEZ9's points. I'm folding them into this review as Issues 1-5 below (three of them — 1, 2, 3 — are also carryover misses on my part, as noted above; two of them — 4, 5 — are genuinely new in this commit). I'm not duplicating SEZ9's numbering; I verified each one against the code myself and added file:line evidence and, where relevant, extra downstream call chains (e.g. the REST single-job detail endpoint) that weren't in SEZ9's write-up. My conclusion on this PR does not conflict with SEZ9's "COMMENTED" review — we agree it is not yet ready, for overlapping reasons.
- User pain point:
CoordinatorService.getRunningJobMetrics()andJobMaster.getCurrJobMetrics()used unbounded.get()calls per worker, executed serially in the multi-job path, so one slow or unreachable worker could block the whole running-jobs metrics API indefinitely (#11587). - Fix approach: the default running-jobs metrics path now delegates to the pre-existing bounded/concurrent
getRunningJobRawMetrics(...)fetcher (overall budget, fixed thread pool), andJobMaster.getCurrJobMetrics()gains a 3-second per-worker timeout. Critically, this update also splits that bounded fetch into two semantics: realtime queries stay best-effort (skip a slow/failed worker and log a warning), while the terminal "save finished pipeline metrics to history" path (getFinalJobMetrics) is now strict — any timeout/missing member/interruption/failure aborts the snapshot, throws, andSubPlan.subPlanDoneretries it while leaving the task-group context intact. This directly resolves the data-loss bug I raised as "Issue 1" in my previous review. - One-line summary: the bounding direction and the new best-effort-vs-strict split for terminal metrics are sound and well tested for the one scenario they were built for, but several pre-existing gaps I should have caught earlier (unconfigurable/duplicated timeout, undocumented best-effort semantics for the live metrics path, an interrupt-handling bug) are still open, and the fix for the terminal path introduces a new, overly broad retry predicate in
SubPlanthat deserves a second look before this leaves draft status.
1. Code Change Review
1.1 Core Logic Analysis
Live (realtime) metrics path — bounded, best-effort, unchanged in outcome from what I saw before:
CoordinatorService.getRunningJobMetrics() CoordinatorService.java:1493
-> getRunningJobMetrics(runningJobMasterMap.keySet(),
DEFAULT_METRICS_FETCH_TIMEOUT_MS=3000, null) CoordinatorService.java:1494-1495
-> toJobMetricsMap(getRunningJobRawMetrics(...)) CoordinatorService.java:1520-1522
-> collectRunningWorkerAddresses(...) CoordinatorService.java:1551-1552
-> metricsFetchExecutor.invokeAll(tasks, budgetMs, MS) CoordinatorService.java:1573 (pre-existing fixed pool, size = min(8, cores))
-> per-worker failures (timeout/inactive/other) -> null, WARN-logged individually
CoordinatorService.java:1640-1656 (fetchRawMetricsFromWorker, pre-existing)
-> merge with jobHistoryService.getJobMetrics(jobId) CoordinatorService.java:1524-1530
-> returns Map<Long, JobMetrics> (same wire shape as before)
Per-worker JobMaster path, now split by caller intent:
JobMaster.getCurrJobMetrics(pipelineLocations) JobMaster.java:1039
-> getTaskGroupLocationSlotProfileMap(pipelineLocations) JobMaster.java:1043 (extracted, same logic as before)
-> getCurrJobMetrics(map, failOnIncompleteResult=false) JobMaster.java:1065 [live/realtime callers]
-> fetchTaskGroupMetrics(address, taskGroupLocations) JobMaster.java:1166-1172
.get(METRICS_FETCH_TIMEOUT_MS=3000, MILLISECONDS) (previously unbounded .get())
-> TimeoutException / HazelcastInstanceNotActiveException /
InterruptedException / other Exception -> WARN + skip JobMaster.java:1090-1160
Terminal snapshot path (all-or-nothing, then retried):
SubPlan.subPlanDone(pipelineStatus) SubPlan.java:310
-> RetryUtils.retryWithException(..., predicate =
isOperationNeedRetryException(e) || e instanceof
SeaTunnelEngineException, retries=30, sleep=2000ms) SubPlan.java:312-335
-> jobMaster.enqueuePipelineCleanupIfNeeded(...) SubPlan.java:314 (idempotent, IMap CAS-merge)
-> jobMaster.savePipelineMetricsToHistory(pipelineLocation) SubPlan.java:316
-> getFinalJobMetrics(taskGroupLocationSlotProfileMap) JobMaster.java:1176-1180
-> getCurrJobMetrics(map, failOnIncompleteResult=true) JobMaster.java:1078
-> any missing member/timeout/interrupt/other error
throws SeaTunnelEngineException JobMaster.java:1093-1159
-> jobHistoryService.storeFinishedPipelineMetrics(...) JobMaster.java:1184 (only reached on full success)
-> cleanTaskGroupContext(pipelineLocation) JobMaster.java:1187 (only reached on full success)
-> removeMetricsContext(...) (own try/catch, errors swallowed) SubPlan.java:317-324
-> notifyCheckpointManagerPipelineEnd(pipelineStatus) SubPlan.java:325
-> jobMaster.releasePipelineResource(this) SubPlan.java:326
I verified with git show 7a2458850c9852d3bc1d881a4f2e194636b370c7 that this terminal-path rewrite genuinely fixes what I flagged before: getFinalJobMetrics now throws instead of silently returning a partial list, and savePipelineMetricsToHistory/cleanTaskGroupContext are only reached after every worker responds. My previous Issue 1 (finished pipeline metrics could be permanently stored empty/partial after a transient timeout) is resolved. The new JobMasterTest.testFinalMetricsFailureDoesNotPersistPartialHistory test (JobMasterTest.java, new) simulates a TimeoutException from fetchTaskGroupMetrics and asserts savePipelineMetricsToHistory throws and jobHistoryService is never touched — that is a real, targeted regression test and it directly satisfies my previous Issue 2 (missing regression coverage) as well. Good work on both.
What is left, restated as fresh Issues below: the live-path bounding still silently drops data with no completeness signal in the API response (Issue 3), the timeout is still hardcoded/duplicated/undocumented (Issue 2), the interrupt-handling bug in the shared getCurrJobMetrics loop is unfixed (Issue 1), and the new terminal-path retry predicate in SubPlan is broader than the case it targets (Issue 4).
1.2 Compatibility Impact
Partially incompatible — no wire format, API signature, or config-file schema changes, but a real behavioral compatibility change: before this PR, CoordinatorService.getRunningJobMetrics() (no-arg) threw SeaTunnelException when a worker fetch failed for a non-Hazelcast reason, so a caller either got a complete answer or an explicit error. After this PR (and this was already true in the version I reviewed on 7/31, so this is not new to this commit), a slow/unreachable worker is silently skipped and the caller gets a partial Map<Long, JobMetrics> with no field or flag indicating incompleteness. I traced two concrete consumers of this changed behavior:
- The Hazelcast client protocol command (
GetRunningJobMetricsTask->GetRunningJobMetricsOperation->CoordinatorService.getRunningJobMetrics()), exposed to engine clients viaJobClient.getRunningJobMetrics()— used by CLI/monitoring tooling. - The REST single-job detail endpoint:
BaseService.java:379callsseaTunnelServer.getCoordinatorService().getJobMetrics(jobId), which internally goes throughrunningJobMaster.getCurrJobMetrics()(no-arg) -> the same best-effort, 3-second-bounded per-worker path (JobMaster.java:1018,1036). This is the data source for the Web UI's per-job metrics view, so a transient worker slowdown can now make the Web UI silently show an under-reported metrics snapshot for a still-running job, with nothing in the response to say so.
This is a legitimate, reasonable trade-off for the stated goal (bounding blocking time), but it is a real behavior change for anyone polling metrics for alerting or dashboards, and it isn't documented anywhere (see 2.3). See Issue 3.
1.3 Performance / Side-Effect Analysis
The bounding itself is a clear win: master-side metrics collection can no longer be blocked indefinitely by one bad worker, and reusing the existing fixed-size metricsFetchExecutor for the default path avoids adding a second thread pool. For the terminal path, making the failure mode "throw and retry via the existing SubPlan retry loop" rather than "silently persist partial data" is the right shape, but the broadened retry predicate in SubPlan.subPlanDone (Issue 4) means that any SeaTunnelEngineException thrown anywhere inside that retry block — not just from the new metrics code — now causes the entire block (cleanup enqueue, metrics save, checkpoint-manager pipeline-end notification, resource release) to be re-executed up to 30 times with a 2-second sleep between attempts (Constant.OPERATION_RETRY_TIME=30, OPERATION_RETRY_SLEEP=2000), i.e. up to roughly a minute of delay in pipeline termination for a failure that has nothing to do with metrics collection. The re-executed steps are individually idempotent as far as I can tell (enqueuePipelineCleanupIfNeeded uses an IMap CAS/merge pattern, storeFinishedPipelineMetrics is a keyed overwrite), so I don't see a correctness violation, but it does mean a genuine, permanent bug elsewhere in that block would now manifest as a ~60s hang-then-warn instead of a fast, visible failure — worth a second look. See Issue 4.
1.4 Error Handling and Logging
Issue 1: Best-effort metrics loop keeps calling remaining workers after the thread has been interrupted (carryover miss from my 2026-07-31 review)
- Location:
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/master/JobMaster.java:1090(thetaskGroupLocationMap.forEachloop), interrupt handling atJobMaster.java:1134. - Problem description: in
getCurrJobMetrics(..., failOnIncompleteResult=false), theInterruptedExceptionbranch restores the interrupt flag (Thread.currentThread().interrupt()) and logs a warning, but the surroundingforEachlambda has no way to break out — it proceeds to the next worker in the map. - Potential risk: once the interrupt flag is set, every subsequent
fetchTaskGroupMetrics(...).get(...)call immediately throws anotherInterruptedException, so for a large job (many workers) this produces a burst of pointless remote-operation setup and warning-log spam, and it delays whatever caused the interrupt in the first place (e.g. master shutdown or job cancel) for no benefit. - I confirmed this exact structure (the
forEachplus this same interrupt handling) already existed in commit7a2458850c, the version I reviewed on 2026-07-31 — this is on me, not a defect this commit introduced. - Best improvement: convert the
forEachlambda into a plainforloop overtaskGroupLocationMap.entrySet()so the method canbreak/returnthe partialmetricslist as soon as an interrupt is observed. - Severity: Medium
Issue 2: 3-second metrics fetch timeout hardcoded in two places, not configurable, undocumented (carryover miss from my 2026-07-31 review)
- Location:
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/master/JobMaster.java:128(METRICS_FETCH_TIMEOUT_MS) andseatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java:132(DEFAULT_METRICS_FETCH_TIMEOUT_MS), both= 3000L. - Problem description: this PR introduces a hard behavioral cutoff — a worker slower than 3 seconds is now silently skipped from metrics — as two independent constants in two different classes. There is no
Option/EngineConfigentry for it, and no documentation change (this PR touches zero files underdocs/). - Potential risk: operators on large clusters or slow/high-latency networks may legitimately need a longer budget, and today the only remedy is recompiling the engine. The two constants can also silently drift apart in a future change since nothing keeps them in sync.
- I confirmed both constants already existed with this exact value in commit
7a2458850c— carryover miss on my part, not new to this commit. - Best improvement: Option A (preferred) — expose this as a proper
EngineConfig/seatunnel.yamloption (SeaTunnel's convention for tunables like checkpoint timeouts, documented underdocs/en/engines/zeta/), with a sane default of 3000ms. Option B (minimum bar) — consolidate the two constants into one shared constant inseatunnel-engine-commonso they cannot drift, and add a short note to the upgrade/release notes describing the new bounded behavior even without full configurability. - Severity: Medium
Issue 3: Default running/per-job metrics paths silently changed from fail-fast to best-effort partial results, with no completeness indicator and no documentation (carryover miss from my 2026-07-31 review)
- Location:
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java:1493(getRunningJobMetrics()), andseatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/rest/service/BaseService.java:379(getJobMetrics(jobId), feeding the REST single-job detail response consumed by the Web UI). - Problem description: previously,
getRunningJobMetrics()threwSeaTunnelExceptionwhen a non-Hazelcast worker fetch failed, so callers got a complete answer or an explicit error. It now delegates to the bounded best-effort fetcher, so a timed-out or failed worker is dropped from the result with no signal in the returnedMap<Long, JobMetrics>/ per-jobJobMetricsobject that the snapshot is incomplete. The per-worker failures are logged (WARN) on the master (CoordinatorService.fetchRawMetricsFromWorker, pre-existing,CoordinatorService.java:1640-1656), but that is only visible to someone tailing master logs, not to a client polling the REST/CLI/Web UI surface. - Potential risk: monitoring systems or dashboards that alert on absolute metric values (e.g. a sudden drop in read/write counts) can be misled by an incomplete snapshot with nothing distinguishing it from a genuinely-low value; this is exactly the kind of silently-dropped-metrics regression that hurts operability even though it "fixes" the blocking problem.
- I confirmed this behavior (default path already delegating to the bounded fetcher without a completeness signal) was already present in commit
7a2458850c— carryover miss, not new to this commit. What I did add on this pass: I traced that this now also affects the REST single-job detail response backing the Web UI's per-job metrics view (BaseService.java:379->JobMaster.getCurrJobMetrics()no-arg -> the same best-effort 3s path), which is a broader surface than the multi-job listing path alone. - Best improvement: Option A — add a completeness indicator to the response (e.g. a
partial: truefield or a list of skipped worker addresses) so REST/Web UI/CLI consumers can distinguish "complete" from "best-effort partial" without having to correlate with master logs. Option B (minimum bar) — document this semantic change indocs/en/engines/zeta/rest-api-v2.md/rest-api-and-web-ui.mdand the release notes so operators know slow/failed workers are now silently skipped after 3 seconds. - Severity: Medium
Issue 4: SubPlan retry predicate now matches any SeaTunnelEngineException, far broader than the metrics-timeout case this commit is fixing (new in this commit)
- Location:
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/dag/physical/SubPlan.java:332-334. - Problem description:
SubPlan.subPlanDone's retry predicate used to beExceptionUtil.isOperationNeedRetryException(exception)(narrow:HazelcastInstanceNotActiveException,InterruptedException,OperationTimeoutException,RetryableHazelcastException— I checkedExceptionUtil.java:182-188). This commit adds|| exception instanceof SeaTunnelEngineException.SeaTunnelEngineExceptionis the generic engine exception thrown from many unrelated call sites, not only fromgetFinalJobMetrics. I confirmed this line wasexception -> ExceptionUtil.isOperationNeedRetryException(exception)only, with noSeaTunnelEngineExceptionclause, in commit7a2458850c— so this specific broadening is genuinely new ine4bdab3850cb, introduced as the mechanism for retrying the new strict terminal metrics collection. - Potential risk: as described in 1.3, any permanent (non-transient)
SeaTunnelEngineExceptionthrown fromenqueuePipelineCleanupIfNeeded,notifyCheckpointManagerPipelineEnd, orreleasePipelineResourceinside the same retry block now gets retried up to 30 times / ~60 seconds instead of surfacing immediately, which both delays pipeline termination and can mask a real, non-retryable bug behind a long silent retry loop before it's finally logged as alog.warnatSubPlan.java:336-340. - Best improvement: Option A (preferred) — introduce a narrow, dedicated exception (e.g.
MetricsCollectionException extends SeaTunnelEngineException) thrown only bygetFinalJobMetrics, and match on that specific type in the retry predicate instead of the generic base class. Option B — keep the current predicate but add a code comment explaining whySeaTunnelEngineExceptionis treated as retryable here, so a future reader doesn't assume it's safe to reuse this pattern elsewhere. - Severity: Medium
Issue 5: fetchTaskGroupMetrics widened to protected purely for test overriding, without @VisibleForTesting or Javadoc (new in this commit)
- Location:
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/master/JobMaster.java:1166-1172. - Problem description: this method is a newly-extracted seam whose only purpose (based on the new
JobMasterTest) is to let the test subclassJobMasterand stub the remote call. It'sprotectedwith no annotation or comment marking it as a test-only extension point, and the codebase already uses@VisibleForTestingelsewhere (e.g.CoordinatorService.collectRunningWorkerAddressesatCoordinatorService.java:1595). - Potential risk: low — mainly a maintainability/discoverability nit. A future contributor could mistake this for a supported subclassing hook.
- Best improvement: add
@VisibleForTestingand a short Javadoc line noting the boundedMETRICS_FETCH_TIMEOUT_MSwait it performs. - Severity: Low
Issue 6: No regression test for the interrupt-handling bug (Issue 1) or the broadened retry predicate (Issue 4)
- Location:
seatunnel-engine/seatunnel-engine-server/src/test/java/org/apache/seatunnel/engine/server/master/JobMasterTest.java(only the timeout scenario is covered); no test file touchesSubPlan's retry predicate. - Problem description: the one new test (
testFinalMetricsFailureDoesNotPersistPartialHistory) is solid for what it covers, but it doesn't exercise (a) what happens when the best-effort loop is interrupted mid-iteration, or (b) whethersubPlanDoneactually retries on a non-metricsSeaTunnelEngineExceptionand how many times/how long that takes. - Potential risk: both of these are real behavioral changes (or long-standing bugs, in the case of Issue 1) touching an engine lifecycle boundary; without coverage, a future refactor could re-break them silently.
- Best improvement: add a focused unit test that interrupts the fetch loop and asserts it returns immediately with partial results (for Issue 1), and a
SubPlan-level test that throws a non-metricsSeaTunnelEngineExceptionfrom one of the other steps in the retry block and asserts on the retry count/behavior (for Issue 4). - Severity: Medium
2. Code Quality Assessment
2.1 Coding Standards
The new methods (getTaskGroupLocationSlotProfileMap, getFinalJobMetrics, fetchTaskGroupMetrics, getRunningJobRawMetrics reuse) generally have Javadoc explaining intent, which is good — getFinalJobMetrics's comment in particular clearly explains the completeness contract. The one gap is fetchTaskGroupMetrics (Issue 5) missing a @VisibleForTesting marker/Javadoc for its test-only visibility widening. No wildcard imports or other style violations observed in the diff itself; note the Spotless/format check is currently failing in CI on a line-wrapping issue in the new Javadoc for getFinalJobMetrics (see CI Check section and Issue 7 below) — that's a mechanical mvnw spotless:apply away from green, not a design problem.
2.2 Test Coverage and Test Stability
This PR changes UT code (JobMasterTest.java), so per the flaky-test checklist: the new test uses Mockito stubs and a synchronous doAnswer callback with no Thread.sleep, no wall-clock/network dependence, no ordering assumptions, and asserts on exception type + verifyNoInteractions rather than a weak existence check. I rate it Stable.
That said, coverage is narrow: it proves the terminal-history-persistence fix (my former Issue 1/2) works, which is valuable, but it does not cover the interrupt-handling bug (Issue 1 in this review) or the broadened SubPlan retry predicate (Issue 4) — see Issue 6 above. For an engine lifecycle change of this scope, I'd want at least one more test on each of those before merge.
2.3 Documentation Updates
No files under docs/ are touched. Given the semantic change to the default metrics-fetch behavior (Issue 3) and the still-hardcoded timeout (Issue 2), I'd expect at minimum a short note in docs/en/engines/zeta/rest-api-v2.md (and its docs/zh counterpart) describing that slow/unreachable workers are now skipped after a fixed budget, plus an EngineConfig doc entry if Issue 2 is addressed via a real option.
3. Architectural Soundness
3.1 Elegance of the Solution
The realtime-vs-terminal split (failOnIncompleteResult boolean routing to either best-effort-skip or throw-and-retry) is a precise, well-targeted fix for the specific correctness bug I flagged previously — not a workaround. Reusing the existing metricsFetchExecutor/getRunningJobRawMetrics bounded fetcher for the default path, rather than inventing a new mechanism, is also the right instinct. The one place this tips toward "temporary workaround" is the SubPlan retry predicate (Issue 4): reaching for the broad SeaTunnelEngineException base type to make the new strict path retryable, instead of a dedicated narrower exception type, is the kind of shortcut that tends to cause surprises later.
3.2 Maintainability
Good: the boolean-parameterized getCurrJobMetrics(map, failOnIncompleteResult) keeps the two call shapes (getCurrJobMetrics/getFinalJobMetrics) sharing one implementation instead of duplicating the whole method. Slightly awkward: a boolean flag routing two very different failure semantics (log-and-skip vs. throw) through one large method makes the method harder to read top-to-bottom; a small private helper per failure mode, or the dedicated-exception approach from Issue 4, would likely read more clearly at the call sites.
3.3 Extensibility
Fine as-is for this specific fix. If a future change needs per-caller-configurable timeouts (rather than one engine-wide constant), the current hardcoded-constant approach (Issue 2) would need to be revisited anyway, so addressing Issue 2 now would also make this more extensible later.
3.4 Historical-Version Compatibility
No serialization, protocol, or config-file format changes. The behavioral compatibility concern is the fail-fast-to-best-effort change on the default metrics path (see 1.2/Issue 3) — this doesn't break upgrades or restores, but it is a user-visible behavior change on an already-released API surface (the getRunningJobMetrics client command and the REST job-detail metrics field) that isn't flagged anywhere for operators upgrading into this change.
4. Issue Summary
| No. | Issue | Location | Severity |
|---|---|---|---|
| 1 | Best-effort metrics loop keeps calling remaining workers after interrupt (carryover) | JobMaster.java:1090-1160 | Medium |
| 2 | 3s metrics timeout hardcoded/duplicated, unconfigurable, undocumented (carryover) | JobMaster.java:128, CoordinatorService.java:132 | Medium |
| 3 | Default metrics paths silently best-effort/partial, no completeness signal, no docs (carryover) | CoordinatorService.java:1493, BaseService.java:379 | Medium |
| 4 | SubPlan retry predicate broadened to any SeaTunnelEngineException | SubPlan.java:332-334 | Medium |
| 6 | No regression test for Issue 1 (interrupt) or Issue 4 (retry predicate) | JobMasterTest.java (missing coverage) | Medium |
| 5 | fetchTaskGroupMetrics widened to protected without @VisibleForTesting/Javadoc | JobMaster.java:1166-1172 | Low |
| 7 | Fork CI Build is red: Spotless format violation in new Javadoc | JobMaster.java (getFinalJobMetrics Javadoc) | Low |
5. Merge Recommendation
Conclusion: Not recommended for merge
This PR is correctly marked as a draft, and I want to be clear that this is feedback for still-in-progress work, not a verdict on a finished submission — the direction is good and the hardest part (the terminal-metrics correctness fix, with a real regression test) is already done well.
- Blockers (must be addressed before this is ready for a formal review round), sorted by severity:
- Issues 1, 2, 3, 4, 6 (all Medium): the interrupt-handling bug, the hardcoded/unconfigurable/undocumented timeout, the undocumented silent-partial-results behavior change on the default metrics paths, the overly broad
SubPlanretry predicate, and the missing regression tests for the first and fourth of those. Issues 1-3 are carryover items from my previous review (apologies again for missing them then) and should be relatively quick to close out now that they're written down; Issue 4 is new and, in my view, the one most worth a design discussion before landing, since it changes retry semantics for a much wider blast radius than the metrics case.
- Issues 1, 2, 3, 4, 6 (all Medium): the interrupt-handling bug, the hardcoded/unconfigurable/undocumented timeout, the undocumented silent-partial-results behavior change on the default metrics paths, the overly broad
- Recommended, non-blocking:
- Issue 5 (
@VisibleForTestingmarker) and Issue 7 (runmvnw spotless:applyto unblock the fork's Build check).
- Issue 5 (
Overall assessment: this is a well-targeted improvement to a real production problem (unbounded per-worker metrics blocking), and the response to my previous review — splitting realtime best-effort from terminal strict-and-retry semantics, plus a real regression test — is exactly the right shape of fix. The main open question is whether the SubPlan retry predicate should be narrowed to a dedicated exception type (Option A under Issue 4) before this is ready for a non-draft review; the rest of the open items are straightforward documentation/config/test-coverage follow-ups. Happy to take another pass as soon as these are addressed.
|
I pushed two follow-up commits on top of
I have not introduced a new engine option for the 3-second timeout or a completeness field yet. I kept those as separate follow-up questions because they affect both |
DanielLeens
left a comment
There was a problem hiding this comment.
What Problem Does This PR Solve?
Thanks for pushing two more commits since my last pass, and for the detailed write-up on what changed — that made this re-review much faster to verify. I re-traced the whole diff from scratch against the current head (1630810) rather than only the delta, per my usual practice, and I also re-read the review @SEZ9 left on e4bdab385 alongside my own prior review, since neither should be assumed still-accurate on a new commit.
- User pain point:
CoordinatorService.getRunningJobMetrics()andJobMaster.getCurrJobMetrics()used unbounded per-worker.get()calls, so one slow or unreachable worker could block the whole running-job metrics path indefinitely (#11587). - Fix approach: the default running-jobs metrics path reuses the existing bounded/concurrent raw-metrics fetcher with a 3s budget;
JobMastersplits per-worker collection into a best-effort realtime mode (skip-and-log, now also short-circuits cleanly on interrupt) and a strict terminal mode (getFinalJobMetrics, all-or-nothing, retried through a new narrowFinalMetricsCollectionExceptioninstead of the previous overly broadSeaTunnelEngineExceptionmatch). - One-line summary: this commit closes out three of the five items @SEZ9 and I both flagged on the previous head — the interrupt-handling bug, the overly broad
SubPlanretry predicate, and the missing@VisibleForTestingmarker — with real fixes and one new regression test; the remaining two (hardcoded/unconfigurable timeout, undocumented best-effort semantics on the default metrics paths) are still open, and the fork CI Build is still red, now due to a fresh Spotless violation introduced by this commit's own new test code.
I also want to directly answer the question you left in your last PR comment: I'd treat the narrow retry predicate and the interrupt fix as right-shaped and ready as-is (see 1.1). For the timeout/partial-result contract, my recommendation is Option B (the lower-cost bar) for this PR — consolidate the duplicated constant and add one short doc note — with the full EngineConfig option and a completeness field as a reasonable fast-follow, since that's a larger surface (schema + docs/en + docs/zh) than this focused fix needs to carry. Details and alternatives are under Issue 1/2 below.
1. Code Change Review
1.1 Core Logic Analysis
Live (realtime) metrics path — unchanged in outcome, now with correct interrupt handling:
CoordinatorService.getRunningJobMetrics() CoordinatorService.java:1493-1495
-> getRunningJobMetrics(runningJobMasterMap.keySet(),
DEFAULT_METRICS_FETCH_TIMEOUT_MS=3000, null)
-> toJobMetricsMap(getRunningJobRawMetrics(...)) CoordinatorService.java:1520-1522
(pre-existing bounded/concurrent fetcher, reused as-is)
-> merge with jobHistoryService.getJobMetrics(jobId) CoordinatorService.java:1524-1530
-> returns Map<Long, JobMetrics> (same wire shape as before)
JobMaster.getCurrJobMetrics(pipelineLocations) JobMaster.java:1039
-> getTaskGroupLocationSlotProfileMap(pipelineLocations) JobMaster.java:1042 (extracted helper)
-> getCurrJobMetrics(map, failOnIncompleteResult=false) JobMaster.java:1065
-> fetchTaskGroupMetrics(address, taskGroupLocations) JobMaster.java:1166-1174
.get(METRICS_FETCH_TIMEOUT_MS=3000, MILLISECONDS)
-> TimeoutException / HazelcastInstanceNotActiveException /
generic Exception -> WARN + continue to next worker JobMaster.java:1095-1163
-> InterruptedException -> restore interrupt flag,
WARN, and `return metrics` immediately JobMaster.java:1134-1145 (fixed this commit)
Terminal snapshot path — all-or-nothing, retried only for its own exception type:
SubPlan.subPlanDone(pipelineStatus) SubPlan.java:310-335
-> RetryUtils.retryWithException(..., retries=30, sleep=2000ms,
predicate = isOperationNeedRetryException(e)
|| e instanceof FinalMetricsCollectionException) SubPlan.java:332-334 (narrowed this commit)
-> jobMaster.enqueuePipelineCleanupIfNeeded(...) SubPlan.java:314 (idempotent, IMap CAS)
-> jobMaster.savePipelineMetricsToHistory(pipelineLocation) SubPlan.java:316
-> getFinalJobMetrics(getTaskGroupLocationSlotProfileMap(
singletonList(pipelineLocation))) JobMaster.java:1176-1180
-> getCurrJobMetrics(map, failOnIncompleteResult=true) JobMaster.java:1102
-> missing member/timeout/interrupt/other failure
throws FinalMetricsCollectionException JobMaster.java:1097-1160
-> jobHistoryService.storeFinishedPipelineMetrics(...) JobMaster.java:1184 (only on full success)
-> cleanTaskGroupContext(pipelineLocation) JobMaster.java:1187 (only on full success)
-> removeMetricsContext / notifyCheckpointManagerPipelineEnd
/ releasePipelineResource SubPlan.java:317-326 (only reached once the
retry loop above stops throwing)
I verified with git show 787debc59 and git show 16308107a that both fixes land exactly where they claim to:
SubPlan.java:332-334— the predicate now matchesFinalMetricsCollectionException(a dedicated subtype ofSeaTunnelEngineExceptionthrown only from the strictgetCurrJobMetrics(..., true)branch,JobMaster.java:1184-1192) instead of anySeaTunnelEngineException. This is exactly the fix @SEZ9 and I both asked for (their Issue 2, my Issue 4 last round) — I confirmedenqueuePipelineCleanupIfNeeded,notifyCheckpointManagerPipelineEnd, andreleasePipelineResourceno longer get pulled into a 30x/60s retry loop for unrelated permanent engine failures.JobMaster.java:1090-1163— thetaskGroupLocationMap.forEachlambda was converted to a plainforloop, and theInterruptedExceptionbranch now doesreturn metrics;right after restoring the interrupt flag, instead of falling through to the next worker. This closes @SEZ9's Issue 4 / my Issue 1 from last round.JobMaster.java:1166-1174—fetchTaskGroupMetricsnow carries@VisibleForTestingplus a one-line Javadoc ("Fetch worker metrics with the bounded wait used by realtime and final collection paths."). Closes @SEZ9's Issue 5 / my Issue 5.
Key findings:
- The normal execution path reaches every changed line here:
subPlanDoneruns on every pipeline'sFINISHED/FAILING/CANCELEDterminal transition (SubPlan.java:748,754), andgetRunningJobMetrics()/getCurrJobMetrics()back the CLI/REST/Web-UI metrics surfaces that are polled continuously while a job runs. This is not a boundary or recovery-only path. - This is a precise fix for what it targets (interrupt handling, retry blast radius), not a workaround — the dedicated
FinalMetricsCollectionExceptiontype is exactly the "Option A" I suggested last round for the retry-predicate problem. - The new
testRealtimeMetricsStopsAfterInterrupttest (JobMasterTest.java, new method) proves the single-worker case returns immediately with the interrupt flag set, but it only registers oneTaskGroupLocation/Addressin the map (Collections.singletonMap(...)). It does not prove the "stop iterating remaining workers" behavior the commit message describes, because with only one entry there's nothing left to skip — see Issue 4 below. The production code change itself is correct (I traced it manually); the test just doesn't exercise the multi-worker scenario it was written for. - Blind spot carried over from before, now slightly more exposed: if
getFinalJobMetricskeeps throwing for the full 30 retries (e.g. a worker that never rejoins for that pipeline),subPlanDone's outercatchonly logs a warning (SubPlan.java:336-340) —removeMetricsContext,notifyCheckpointManagerPipelineEnd, andreleasePipelineResourceare never called for that pipeline. This structure predates this PR (it already existed for anyisOperationNeedRetryExceptionmatch), and this change strictly improves the common transient case without making the persistent-failure tail case worse — but it's worth flagging since metrics-fetch hiccups are a more probable trigger than the pre-existing narrow retry set. Not asking you to fix this in this PR; flagging it as a known blind spot for a future pass. - Remaining blind spots that are not addressed by this commit: the 3s timeout is still hardcoded/duplicated, and the default metrics paths still silently drop data with no completeness signal — both carried over from the version I reviewed on
e4bdab385(Issues 1 and 2 below).
1.2 Compatibility Impact
Partially incompatible. No wire format, API signature, or config-file schema change. The behavioral compatibility gap I flagged last round is unchanged by this commit: CoordinatorService.getRunningJobMetrics() used to throw SeaTunnelException on a non-Hazelcast worker failure (fail-fast); it now silently drops that worker's data (best-effort). This affects both the Hazelcast client metrics command and the REST single-job detail endpoint (BaseService.java:379 -> JobMaster.getCurrJobMetrics() no-arg -> the same best-effort 3s path), which backs the Web UI's per-job metrics view. See Issue 2.
1.3 Performance / Side-Effect Analysis
The bounding is a clear net win — no behavior change here since last round, just confirming it still holds: master-side metrics collection can no longer block indefinitely on one bad worker, and the default path reuses the existing fixed-size metricsFetchExecutor rather than adding a second pool. The terminal path's retry-on-failure is now correctly scoped to metrics failures only (Issue 4 from last round resolved), so a permanent bug elsewhere in subPlanDone's retry block will no longer be masked behind 30 pointless retries. enqueuePipelineCleanupIfNeeded (put-if-absent CAS on IMAP_PENDING_PIPELINE_CLEANUP) and storeFinishedPipelineMetrics (keyed overwrite) are both idempotent, so re-running them across retries is safe.
1.4 Error Handling and Logging
Issue 1: 3-second metrics fetch timeout still hardcoded in two places, not configurable, undocumented (carryover, unresolved)
- Location:
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/master/JobMaster.java:128(METRICS_FETCH_TIMEOUT_MS),seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java(DEFAULT_METRICS_FETCH_TIMEOUT_MS), both= 3000L. - Problem description: this value is a real, user-facing behavioral cutoff (a worker slower than 3s is now silently skipped), duplicated as two independent constants in two classes with nothing keeping them in sync, no
EngineConfig/seatunnel.yamloption, and no docs touched by this PR. - Potential risk: operators on large clusters or high-latency networks have no way to raise the budget short of recompiling; the two constants can drift apart in a future change.
- Best improvement: Option A (preferred long-term) — expose it as a proper
EngineConfigoption with a doc entry underdocs/en/engines/zeta/(anddocs/zh), consistent with how other Zeta timeouts (e.g. checkpoint timeout) are handled. Option B (minimum bar for this PR) — consolidate the two constants into one shared constant (e.g. inseatunnel-engine-common) and add a short note to the release/upgrade notes describing the new bounded behavior, deferring full configurability to a follow-up. - Severity: Medium
- Raised by another reviewer: Yes (@SEZ9's Issue 1, and my own previous review's Issue 2) — still open on this head.
Issue 2: Default metrics paths remain silently best-effort/partial, no completeness signal, no docs (carryover, unresolved)
- Location:
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java:1493(getRunningJobMetrics()), and the REST single-job detail path (BaseService.java:379->JobMaster.getCurrJobMetrics()no-arg,JobMaster.java:1018-1036). - Problem description: previously threw
SeaTunnelExceptionon a non-Hazelcast worker failure; now silently omits that worker's data from the returned map/object with no field or flag indicating incompleteness. Per-worker failures are only visible as a WARN in the master's own log. - Potential risk: monitoring/dashboards that alert on absolute metric values (e.g. a sudden drop in read/write counts) can be misled by a partial snapshot with nothing distinguishing it from a genuinely low value.
- Best improvement: Option A — add a completeness indicator to the response (a
partial: truefield, or the list of skipped worker addresses). Option B (minimum bar) — document the semantic change indocs/en/engines/zeta/rest-api-v2.md/rest-api-and-web-ui.md(+docs/zhcounterparts) and the release notes. - Severity: Medium
- Raised by another reviewer: Yes (@SEZ9's Issue 3, and my own previous review's Issue 3) — still open on this head.
Issue 3: Fork CI "Code style" job is failing on a Spotless violation introduced by this commit, blocking the entire rest of the CI matrix
- Location:
seatunnel-engine/seatunnel-engine-server/src/test/java/org/apache/seatunnel/engine/server/master/JobMasterTest.java(the newtestRealtimeMetricsStopsAfterInterruptmethod's.getCurrJobMetrics(Collections.singletonMap(...))call chain), andseatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/master/JobMaster.java(thegetFinalJobMetricsJavadoc line-wrap). - Problem description: I pulled the fork's Build run for this exact head SHA — the
Run / Code stylejob fails withspotless-maven-plugin:checkreporting exactly these two files as format violations, and every downstream job (unit-test, all-connectors-it-, jdbc-connectors-it-, etc.) isskippedas a result, so there is currently zero CI signal validating this commit's actual behavior. - Potential risk: none functionally (this is purely mechanical), but it means the new regression tests added in this PR (including
testRealtimeMetricsStopsAfterInterruptitself) have never actually been executed by CI yet. - Best improvement: run
mvn spotless:applyon the touched files and push. - Severity: Medium (trivial fix, but currently blocks all CI signal for this PR)
- Raised by another reviewer: Yes, in spirit (my own previous review's Issue 7 flagged a Spotless failure on the prior head) — that occurrence was fixed, but this commit reintroduced a new violation.
Issue 4: New interrupt-handling test only registers a single worker, so it doesn't prove workers are skipped after an interrupt
- Location:
seatunnel-engine/seatunnel-engine-server/src/test/java/org/apache/seatunnel/engine/server/master/JobMasterTest.java,testRealtimeMetricsStopsAfterInterrupt(new method). - Problem description: the test builds
Collections.singletonMap(taskGroupLocation, workerAddress)— one entry — then asserts the result is empty and the interrupt flag is set. With only one worker, that assertion is trivially true regardless of whether the loop actually breaks after an interrupt or simply finishes normally after its one iteration; the test can't distinguish those two implementations. - Potential risk: low today, since I manually verified the production
forloop doesreturn metrics;inside theInterruptedExceptioncatch (JobMaster.java:1134-1145), so the fix itself is correct. But a future refactor that reintroduces the old "keep iterating after interrupt" bug would not be caught by this test. - Best improvement: register at least two
TaskGroupLocation/Addressentries mapped to different addresses, have the stub throwInterruptedExceptionon the first call, and assertfetchTaskGroupMetrics(or an equivalent spy/counter) was invoked exactly once — proving the second worker was never contacted. - Severity: Low
- Raised by another reviewer: No (this test is new in this commit).
Issue 5: No regression test for the narrowed SubPlan retry predicate
- Location:
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/dag/physical/SubPlan.java:332-334; noSubPlanTest.javaexists in the repository. - Problem description: the retry-predicate narrowing (Issue 4 from my previous review, and @SEZ9's Issue 2) is a real, correct fix, but there's still no test proving
subPlanDoneretries onFinalMetricsCollectionExceptionand does not retry on an unrelatedSeaTunnelEngineExceptionthrown from one of the other steps in the same block. - Potential risk: a future change could accidentally widen the predicate again (e.g. by catching and rethrowing as the base type somewhere) without any test catching the regression.
- Best improvement: add a focused test that throws a non-metrics
SeaTunnelEngineExceptionfromenqueuePipelineCleanupIfNeeded(or stubs it) and assertssubPlanDonedoes not retry it, plus one that throwsFinalMetricsCollectionExceptionand asserts it does. - Severity: Low
- Raised by another reviewer: Yes (my own previous review's Issue 6 flagged the general lack of coverage for the retry predicate) — the interrupt half of that ask is now covered; the
SubPlanhalf is still open.
2. Code Quality Assessment
2.1 Coding Standards
The extracted/new methods (getTaskGroupLocationSlotProfileMap, getFinalJobMetrics, fetchTaskGroupMetrics, FinalMetricsCollectionException) all carry Javadoc explaining intent and constraints, which is good practice for lifecycle-adjacent code like this. No wildcard imports or other style violations in the diff content itself — the only standards gap is mechanical (Issue 3, Spotless line-wrapping), not a design issue.
2.2 Test Coverage and Test Stability
This PR changes UT code (JobMasterTest.java), so per the flaky-test checklist: both new tests use Mockito stubs with no Thread.sleep, no wall-clock or network dependence, no ordering assumptions between tests, and assert on exception type / boolean state rather than a weak existence check. I rate this Stable.
Coverage-wise: testFinalMetricsFailureDoesNotPersistPartialHistory (already present since e4bdab385, still solid) and the new testRealtimeMetricsStopsAfterInterrupt both target real behaviors, but as noted in Issue 4, the new interrupt test's single-worker setup understates what it claims to verify, and Issue 5's gap (no SubPlan retry-predicate test) is still open.
2.3 Documentation Updates
No files under docs/ are touched by any commit in this PR. Given the still-open Issues 1 and 2 (hardcoded timeout, undocumented best-effort semantics on the default metrics paths), at minimum a short note under docs/en/engines/zeta/rest-api-v2.md (+ docs/zh) describing the new bounded/best-effort behavior would close the documentation gap without requiring the full EngineConfig option.
3. Architectural Soundness
3.1 Elegance of the Solution
The realtime-vs-terminal split (failOnIncompleteResult routing to either best-effort-skip or throw-with-a-dedicated-exception-type) is a precise fix, and this commit's two changes (interrupt short-circuit, narrowed retry predicate via FinalMetricsCollectionException) are exactly the targeted, minimal changes I'd want to see in response to specific review feedback — not workarounds.
3.2 Maintainability
Good: getCurrJobMetrics(map, failOnIncompleteResult) keeps one implementation backing both call shapes instead of duplicating the whole method, and the new exception type gives the retry predicate a precise, self-documenting hook instead of a magic boolean check. One pre-existing (not introduced by this PR) wrinkle: JobMaster.getCurrJobMetrics() (no-arg, ~JobMaster.java:1018) still has its own inline copy of the task-group-map-building logic instead of delegating to the new getTaskGroupLocationSlotProfileMap(List<PipelineLocation>) helper extracted in this PR — a small missed opportunity to remove duplication while already touching this area, not a blocker.
3.3 Extensibility
Fine as-is for the fix's scope. If Issue 1 (configurable timeout) is picked up later, today's hardcoded-constant approach would need revisiting anyway, so there's no extensibility debt being added here beyond what's already tracked.
3.4 Historical-Version Compatibility
No serialization, protocol, or config-file format changes. The only compatibility-relevant behavior change (fail-fast -> best-effort on the default metrics path) was already present in the version I reviewed on e4bdab385 and is unchanged by this commit — see 1.2/Issue 2.
4. Issue Summary
| No. | Issue | Location | Severity |
|---|---|---|---|
| 1 | 3s metrics timeout hardcoded/duplicated, unconfigurable, undocumented (carryover) | JobMaster.java:128, CoordinatorService.java (DEFAULT_METRICS_FETCH_TIMEOUT_MS) | Medium |
| 2 | Default metrics paths silently best-effort/partial, no completeness signal, no docs (carryover) | CoordinatorService.java:1493, BaseService.java:379 | Medium |
| 3 | Fork CI Build is red: new Spotless violation blocks the entire CI matrix | JobMasterTest.java (new test), JobMaster.java (Javadoc wrap) | Medium |
| 4 | New interrupt test only covers a single worker, doesn't prove multi-worker skip | JobMasterTest.java (testRealtimeMetricsStopsAfterInterrupt) | Low |
| 5 | No regression test for SubPlan's narrowed retry predicate | SubPlan.java:332-334 | Low |
5. Merge Recommendation
Conclusion: Ready to merge after fixes
This PR is still marked as a draft and its mergeability against dev currently shows as conflicting, so both of those need to be resolved as part of getting this to a mergeable state, independent of the code-review items below.
- Blockers (sorted by severity):
- Issue 3 (Medium): get the fork's CI Build green again —
mvn spotless:applyon the two touched files is the whole fix, but until it's green there's no CI signal at all for this commit's actual behavior, including the new tests it adds. - Issues 1 and 2 (both Medium, both carryover): at minimum, apply Option B from each — consolidate the duplicated timeout constant, and add a short doc note about the best-effort/partial semantics on the default metrics paths. Given this PR's stated scope is "bound worker metrics collection" rather than "make it configurable," I don't think the full
EngineConfigoption + completeness field (Option A on both) needs to block this specific PR, but the minimum-bar fixes should land here rather than in an open-ended follow-up, since they're small and directly related to the behavior this PR introduces. - The draft status and the current merge-conflict-with-
devstate also need to be cleared before this can actually land.
- Issue 3 (Medium): get the fork's CI Build green again —
- Recommended, non-blocking:
- Issues 4 and 5 (both Low): strengthen the new interrupt test to cover multiple workers, and add a
SubPlan-level test for the narrowed retry predicate. Neither blocks correctness, but both are exactly the kind of coverage gap that lets a future refactor silently reintroduce the bugs this PR just fixed.
- Issues 4 and 5 (both Low): strengthen the new interrupt test to cover multiple workers, and add a
Overall assessment: real, solid progress since my last pass — the two correctness/design issues that mattered most last round (interrupt handling, overly broad retry predicate) are both fixed cleanly, with the fix for the retry predicate being exactly the dedicated-exception approach I'd suggested. What's left is genuinely small: one CI mechanical fix, two carryover documentation/config items where I've given you a lower-cost path to close them out, and two non-blocking test-hardening suggestions. Nothing here points to a better alternative implementation than what's already in place — this is the same design, just tightened up. Happy to take another pass as soon as CI is green and the doc/constant items are addressed.
SEZ9
left a comment
There was a problem hiding this comment.
Thanks for working on this. I reviewed the latest head 16308107a1eb.
What this PR fixes
- User pain:
getRunningJobMetrics()on the master could hang indefinitely because each worker was queried serially with an unboundedfuture.get(), so one slow/dead worker stalled the whole metrics path (#11587). - Fix approach: route the no-arg path through the existing prefix-filtered fetcher with a 3s budget, add a bounded
fetchTaskGroupMetricsinJobMasterthat skips timed-out/unavailable/interrupted workers on the realtime path, and introduceFinalMetricsCollectionExceptionso the terminal-history path inSubPlanfails-and-retries rather than persisting a partial snapshot. - One-line summary: the bounding logic and best-effort/final split are sound and the response shape is preserved, but the hard-coded 3s timeout (duplicated in two classes, unconfigurable, undocumented) and the silent behavior change of
getRunningJobMetrics()from fail-fast to partial results need to be addressed before merge.
Runtime chain I rechecked
Realtime/API path:
CoordinatorService.getRunningJobMetrics() CoordinatorService.java:1493
-> CoordinatorService.getRunningJobMetrics(runningJobIds, DEFAULT_METRICS_FETCH_TIMEOUT_MS=3000, null) CoordinatorService.java:1494-1495
-> CoordinatorService.getRunningJobRawMetrics(runningJobIds, timeoutMs, metricNamePrefixes) CoordinatorService.java:1520-1522 (reused concurrent fetcher, sends GetMetricsOperation per worker)
-> toJobMetricsMap(metrics) + merge with jobHistoryService.getJobMetrics(jobId) CoordinatorService.java:1524-1530
JobMaster realtime path (best-effort):
JobMaster.getCurrJobMetrics(List<PipelineLocation>) JobMaster.java:1040
-> getTaskGroupLocationSlotProfileMap(pipelineLocations) JobMaster.java:1044 (reads ownedSlotProfilesIMap)
-> getCurrJobMetrics(map) JobMaster.java:1069 -> getCurrJobMetrics(map, failOnIncompleteResult=false) JobMaster.java:1083
-> fetchTaskGroupMetrics(address, taskGroupLocations) JobMaster.java:1170 (GetTaskGroupMetricsOperation, future.get(3000ms) via METRICS_FETCH_TIMEOUT_MS)
-> Timeout/HazelcastInstanceNotActive/Interrupted/Exception branches log-and-skip (Interrupted re-sets flag and returns partial list) JobMaster.java:1108-1160
Terminal-history path (all-or-nothing):
SubPlan.subPlanDone(pipelineStatus) SubPlan.java:325
-> RetryUtils.retryWithException(..., predicate now also retries FinalMetricsCollectionException) SubPlan.java:329-334
-> jobMaster savePipelineMetricsToHistory -> JobMaster.getFinalJobMetrics(map) JobMaster.java:1078
-> getCurrJobMetrics(map, failOnIncompleteResult=true) JobMaster.java:1080
-> any missing member / timeout / interrupt / failure throws FinalMetricsCollectionException JobMaster.java:1098-1158, which propagates back to the SubPlan retry loop instead of persisting a partial terminal snapshot
Findings
Issue 1: New 3-second metrics fetch timeout is a hard-coded magic value with no engine configuration option and no documentation update
- Location:
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java:131 - Why it matters: - Root cause: the PR introduces a user-visible behavior change — running-job metrics collection is now bounded by a fixed 3-second per-worker/overall budget — but the value is a hard-coded constant (
DEFAULT_METRICS_FETCH_TIMEOUT_MSinCoordinatorServiceandMETRICS_FETCH_TIMEOUT_MSinJobMaster) rather than anEngineConfig/seatunnel.yamloption. - Impact: users running large Zeta clusters with slow or heavily loaded workers cannot tune this budget; 3 seconds may be too short for clusters with many task groups, silently producing sparse metrics in the REST API and Prometheus/telemetry outputs with no way to adjust it. There is also no update to
docs/en/seatunnel-engine/describing the new bound. - Fix: expose the timeout as a Zeta engine option (e.g., under
seatunnel-engineconfig with a 3s default), document it indocs/en/seatunnel-engine/hybrid-cluster-deployment.md/separated-cluster-deployment.md(and the zh counterparts), and reference the option constant from bothCoordinatorServiceandJobMasterinstead of duplicating the literal. - Evidence:
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/master/JobMaster.java:129 private static final long METRICS_FETCH_TIMEOUT_MS = 3000L; - Suggested fix: This 3-second budget changes user-visible metrics behavior (partial, best-effort results), but it is hard-coded and duplicated as
METRICS_FETCH_TIMEOUT_MSinJobMaster. Please promote it to anEngineConfigoption with a 3s default and document it underdocs/en/seatunnel-engine/(plus the zh docs), so operators of large clusters can tune the fetch budget instead of silently getting sparse metrics. - Severity: Medium
Issue 2: SubPlan retry-predicate change on FinalMetricsCollectionException lacks an explanatory comment and interacts with the terminal-metrics persistence contract
- Location:
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/dag/physical/SubPlan.java:334 - Why it matters: - Root cause:
SubPlan.subPlanDone()now retries whenexception instanceof FinalMetricsCollectionException, couplingSubPlan's retry material to aJobMasterinner exception. The existing inline comment only coversisOperationNeedRetryException, so the added branch has no rationale recorded in code. - Impact: future maintainers will not know that this retry exists because
getFinalJobMetrics(...)deliberately refuses partial terminal snapshots (per the new Javadoc inJobMaster), and that removing the retry would drop terminal metrics whenever a single worker is briefly slow. If a worker is permanently gone, this also meanssubPlanDonewill spin throughConstant.OPERATION_RETRY_TIMEattempts before giving up, which is worth stating explicitly. - Fix: add a short comment on the predicate explaining that
FinalMetricsCollectionExceptionmarks an incomplete terminal snapshot that is safe to retry because task-group context is preserved, and consider adding a@see JobMaster#getFinalJobMetricsreference so the two sides of the contract stay linked. - Evidence:
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/dag/physical/SubPlan.java:333 ExceptionUtil.isOperationNeedRetryException(exception);seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/dag/physical/SubPlan.java:334 || exception instanceof FinalMetricsCollectionException, - Suggested fix: Please add a brief comment here explaining why
FinalMetricsCollectionExceptionis retryable — i.e.,JobMaster.getFinalJobMetricsintentionally rejects partial terminal snapshots and preserves task-group context, so a bounded retry can recover a complete snapshot. Without that note, this coupling betweenSubPlan's retry material and aJobMasterinner exception is easy to break in a future refactor. Also note the worst case: a permanently lost worker meansConstant.OPERATION_RETRY_TIMEretries before the warning path. - Severity: Medium
Issue 3: getRunningJobMetrics() silently changes from fail-fast (SeaTunnelException) to best-effort partial results without a changelog/upgrade note
- Location:
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java:1494 - Why it matters: - Root cause: the old default path in
CoordinatorService.getRunningJobMetrics()re-threw non-Hazelcast failures asSeaTunnelException, while the new delegation togetRunningJobMetrics(runningJobIds, timeoutMs, null)swallows timeouts and worker failures and returns whatever subset was collected. TheSeaTunnelExceptionimport was removed, confirming the old contract is gone. - Impact: callers of the REST metrics endpoints and telemetry exporters that previously saw an error will now receive an apparently successful but incomplete metrics map with no error signal; monitoring systems comparing counters across scrapes can misinterpret missing workers as zeroed metrics. This is exactly the kind of semantic change that must appear in the release notes.
- Fix: add an entry to the release-note/changelog docs describing the new best-effort semantics and the 3s bound, and add a Javadoc on the no-arg
getRunningJobMetrics()stating that timed-out/unavailable workers are skipped so API consumers are not surprised. - Evidence:
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java:1495 runningJobMasterMap.keySet(), DEFAULT_METRICS_FETCH_TIMEOUT_MS, null);;seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java:31 -import org.apache.seatunnel.common.utils.SeaTunnelException; (removed) - Suggested fix: This changes the contract of the default
getRunningJobMetrics()path: previously non-Hazelcast failures were rethrown asSeaTunnelException, now they are logged and the map returned is partial. Please (1) add a Javadoc on this method stating the best-effort semantics, and (2) add a release-note/changelog entry — REST/telemetry consumers need to know that missing workers now produce a partial-but-successful response instead of an error. - Severity: Medium
Issue 4: Good Javadoc on the new best-effort/final split, but the public getCurrJobMetrics(Map) overload's warning about incomplete results should also cover interrupted callers
- Location:
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/master/JobMaster.java:1064 - Why it matters: - Root cause: the new Javadoc on the public
getCurrJobMetrics(Map)overload says missing or failed workers are omitted, but the interrupted branch in the private worker loop returns early with whatever was collected so far, which is a stronger caveat (the list can be truncated mid-iteration, not just missing individual workers). - Impact: callers (e.g., checkpoint/metrics reporters iterating pipelines) reading only the Javadoc may assume per-worker granularity of omissions; on interruption the remaining addresses are never attempted, which matters for anyone aggregating the returned list.
- Fix: extend the Javadoc on the public overload to state that an interrupted collection restores the interrupt flag and returns the partial list immediately, mirroring the behavior added in the private
getCurrJobMetrics(..., boolean)implementation. - Evidence:
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/master/JobMaster.java:1065 * must not treat the returned list as a complete terminal history.;seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/master/JobMaster.java:1152 Thread.currentThread().interrupt(); - Suggested fix: Nice Javadoc distinguishing the best-effort and final paths. One addition: the
InterruptedExceptionbranch below re-interrupts and returns early, so on interruption the list is truncated mid-iteration (remaining workers are never attempted), not merely missing individual failed workers. Please mention that here so callers of this public overload understand the stronger caveat. - Severity: Low
Issue 5: Duplicated 3000L timeout constants in CoordinatorService and JobMaster should share a single definition
- Location:
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/master/JobMaster.java:129 - Why it matters: - Root cause: the PR defines
DEFAULT_METRICS_FETCH_TIMEOUT_MS = 3000LinCoordinatorServiceandMETRICS_FETCH_TIMEOUT_MS = 3000LinJobMaster; the PR description says both paths intentionally use the same 3-second budget, yet nothing in code enforces that. - Impact: if one constant is tuned later without the other, the coordinator-level overall budget and the per-worker wait in
JobMaster.fetchTaskGroupMetricsdrift apart, producing inconsistent timeout behavior between the running-job metrics path and the current-job metrics path. - Fix: move the value into a shared location (e.g.,
org.apache.seatunnel.engine.common.Constant, alongsideOPERATION_RETRY_TIME/OPERATION_RETRY_SLEEP) and reference it from both classes; this also becomes trivial once the value is promoted to an engine config option as suggested separately. - Evidence:
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/master/JobMaster.java:128 /** Maximum time to wait for one worker's task-group metrics response. */;seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/master/JobMaster.java:129 private static final long METRICS_FETCH_TIMEOUT_MS = 3000L; - Suggested fix: This constant duplicates
CoordinatorService.DEFAULT_METRICS_FETCH_TIMEOUT_MS(both3000L). Since the PR intent is a single shared 3-second budget, please define it once — e.g., inorg.apache.seatunnel.engine.common.Constantnext toOPERATION_RETRY_TIME— and reference it from both classes so the two paths cannot drift apart. - Severity: Low
Review conclusion
Conclusion: final approval remains pending on the previous comments
2. Remaining follow-ups
- Issue 1: New 3-second metrics fetch timeout is a hard-coded magic value with no engine configuration option and no documentation update
- Issue 2: SubPlan retry-predicate change on FinalMetricsCollectionException lacks an explanatory comment and interacts with the terminal-metrics persistence contract
- Issue 3: getRunningJobMetrics() silently changes from fail-fast (SeaTunnelException) to best-effort partial results without a changelog/upgrade note
- Issue 4: Good Javadoc on the new best-effort/final split, but the public getCurrJobMetrics(Map) overload's warning about incomplete results should also cover interrupted callers
- Issue 5: Duplicated 3000L timeout constants in CoordinatorService and JobMaster should share a single definition
Thanks for the updates so far. Happy to discuss the remaining points.
|
@SEZ9 thanks for the second pass on One piece of evidence to add on top of your Issue 1/3 discussion, since it affects how "fix the timeout" should actually be scoped: I traced So this isn't an unbounded leak (Hazelcast's own registry eventually reclaims it), but it does mean the bound only protects the master's calling thread, not the actual work done against a slow worker. Before this PR, the master thread stayed blocked on the one in-flight invocation per worker, which incidentally throttled how many concurrent requests a stuck worker could receive. After this PR, the master returns after 3s and is free to be polled again (e.g. by REST) while the prior invocation to that same worker is still alive in Hazelcast's registry — so a persistently slow (not dead) worker polled faster than it can respond can now accumulate multiple concurrently in-flight metrics operations against it, each still consuming worker-side CPU/heap until the ~60s internal reclaim fires. Worth a one-line callout alongside your Issue 1 fix (Option A/B) so operators don't assume lowering Separately, a freshness note rather than a new issue: I pulled the fork's No pushback otherwise — our merge recommendations land in the same place (real correctness fixes from the previous round are solid; what's left is the timeout/config story, the doc gap, and getting CI green). |
1630810 to
73e29bf
Compare
|
I rebased this onto the current I used the smaller shared-constant path suggested in the review: both collection paths now use The terminal retry predicate now explains why the task-group context makes this exception safe to retry and what happens for a permanently lost worker. The public realtime collector Javadoc covers interruption and truncation, and its test now has two workers and proves only one fetch is attempted after the interrupt. Spotless apply and check pass for both changed Maven modules with JDK 17, and |
|
Thanks @tomatotomata for the quick follow-ups — I re-checked To answer your two questions directly:
The interrupt handling (return-immediately + restore flag) and the Remaining asks before merge:
No concern about the local build issue — the repository CI is the supported path, so let's let it run the engine module tests once you push. Thanks again for the careful iteration here. |
DanielLeens
left a comment
There was a problem hiding this comment.
What Problem Does This PR Solve?
I re-traced this entire PR from scratch against the newest head (73e29bf6, pushed 2026-08-07T23:49:08Z as "[Improve][Zeta] Address metrics review feedback"), re-read my own three prior reviews on this PR (2026-07-31, and twice on 2026-08-05/08-06) plus every review and comment from @SEZ9, and pulled the actual fork CI logs for this exact commit rather than trusting the PR's summary of what changed. That last step is what turned up this pass's one real blocker, so let me lead with an apology and a correction before anything else.
Correction to my own prior reviews, with an apology: on 2026-08-06 I rated the new JobMasterTest coverage (testFinalMetricsFailureDoesNotPersistPartialHistory, added since head e4bdab385) as "Stable" and said the interrupt-handling fix was "well tested." I was wrong to give that rating without confirming the test actually compiles. I pulled the fork's unit-test (8, ubuntu-latest) job log for the current head just now and it fails with a hard javac compilation error in exactly that test class — and I confirmed via git show e4bdab3850:.../JobMasterTest.java that the broken code has been present, unchanged, since that very first version of the test. Neither I nor @SEZ9 ever caught it, because every review up to and including 2026-08-06 happened while the fork's Code style (Spotless) check was still red, which meant CI never got far enough to even attempt compiling this test module — so nobody, including the two of us doing "stable" ratings, ever had a real compile signal to check against. Now that Spotless is fixed in this commit, the underlying compile error is exposed for the first time. This is a carryover miss on my part across two prior reviews, not a new defect in 73e29bf6; see Issue 1 below for the full evidence and fix.
- User pain point:
CoordinatorService.getRunningJobMetrics()andJobMaster.getCurrJobMetrics()used unbounded, serial per-worker.get()calls, so one slow or unreachable worker could block the whole running-job metrics path indefinitely (#11587). - Fix approach: the default running-jobs metrics path now delegates to the pre-existing bounded/concurrent raw-metrics fetcher with a shared
Constant.DEFAULT_METRICS_FETCH_TIMEOUT_MS(3s) budget;JobMaster.getCurrJobMetrics(..., boolean failOnIncompleteResult)splits collection into a best-effort realtime mode (skip-and-log, now correctly short-circuits on interrupt) and a strict terminal mode (getFinalJobMetrics, all-or-nothing, retried through a dedicatedFinalMetricsCollectionExceptionwith an explanatory comment at theSubPlanretry site). - One-line summary: this commit closes out every substantive open item from my previous rounds and @SEZ9's — the duplicated/unconfigurable timeout constant, the missing docs, the missing retry-predicate comment, the interrupt-handling Javadoc gap, and the single-worker interrupt test — but it also (unknowingly, since CI had never gotten this far before) exposes a genuine, pre-existing compile error in the test file that has silently blocked all CI signal for this PR since 2026-08-05, and that is currently failing the fork's
unit-testjob and cancelling/failing every downstream connector-IT job in the matrix.
I also want to flag a timing issue for whoever reads this thread next: @SEZ9's latest comment (2026-08-08T07:30:14Z, an issue comment rather than a formal review) opens with "I re-checked 16308107a1eb" — that is the previous head, not 73e29bf6. Their "Remaining asks before merge" checklist (dedupe the timeout + make it configurable, document the semantic change, add the retry-predicate comment, extend the Javadoc, rebase onto dev) was written against the older commit and does not reflect that 73e29bf6 already lands four of those five items. I've re-verified each one directly against the current head below rather than relying on that checklist.
1. Code Change Review
1.1 Core Logic Analysis
Live (realtime) metrics path — unchanged in outcome, doc now matches the exact interrupt behavior:
CoordinatorService.getRunningJobMetrics() CoordinatorService.java:1528-1531
-> getRunningJobMetrics(runningJobMasterMap.keySet(),
Constant.DEFAULT_METRICS_FETCH_TIMEOUT_MS, null)
-> toJobMetricsMap(getRunningJobRawMetrics(...)) CoordinatorService.java (reused concurrent fetcher, unchanged this commit)
-> merge with jobHistoryService.getJobMetrics(jobId)
-> returns Map<Long, JobMetrics> (same wire shape as before)
JobMaster.getCurrJobMetrics(pipelineLocations) JobMaster.java:1047-1049
-> getTaskGroupLocationSlotProfileMap(pipelineLocations) JobMaster.java:1051-1069
-> getCurrJobMetrics(map, failOnIncompleteResult=false) JobMaster.java:1077-1080
-> fetchTaskGroupMetrics(address, taskGroupLocations) JobMaster.java:1180-1190
.get(Constant.DEFAULT_METRICS_FETCH_TIMEOUT_MS, MILLISECONDS)
-> Timeout/HazelcastInstanceNotActive/generic Exception -> WARN + continue JobMaster.java:1120-1175
-> InterruptedException -> restore flag, WARN, `return metrics` immediately JobMaster.java:1147-1160
Terminal snapshot path — all-or-nothing, retried only for its own exception type, now with a rationale comment:
SubPlan.subPlanDone(pipelineStatus) SubPlan.java:310-338
-> RetryUtils.retryWithException(..., predicate =
isOperationNeedRetryException(e) || e instanceof FinalMetricsCollectionException) SubPlan.java:329-337
-> jobMaster.savePipelineMetricsToHistory(pipelineLocation) SubPlan.java:316
-> getFinalJobMetrics(getTaskGroupLocationSlotProfileMap(singletonList(...))) JobMaster.java:1087-1090
-> getCurrJobMetrics(map, failOnIncompleteResult=true) JobMaster.java:1092
-> missing member/timeout/interrupt/other failure throws FinalMetricsCollectionException JobMaster.java:1108-1174
-> jobHistoryService.storeFinishedPipelineMetrics(...) / cleanTaskGroupContext(...) (only on full success)
I confirmed line-by-line that every item both @SEZ9 and I asked for on the previous head is genuinely landed here, not just claimed in the PR comment:
- Shared constant:
Constant.DEFAULT_METRICS_FETCH_TIMEOUT_MSis now defined once inseatunnel-engine-common/.../Constant.java:44-45, and bothCoordinatorService.java:1530and every call site inJobMaster.java(lines 1139, 1146, 1189) reference it. The old duplicatedMETRICS_FETCH_TIMEOUT_MSfield inJobMasteris gone (git grepconfirms zero remaining local timeout constants in either class). This is exactly the "Option B" minimum bar I said was acceptable in my 2026-08-06 review — it is not a realEngineConfigoption (see Issue 2), but it does close the "two constants can silently drift apart" risk. - Docs:
docs/en/introduction/concepts/incompatible-changes.mdand thedocs/zhcounterpart both gained a new "Behavior Change" entry explaining that running-job metrics are now bounded/best-effort, that a successful response can be partial, and — notably — that "the 3-second bound limits how long the master waits; it does not cancel an already submitted Hazelcast worker invocation, which remains subject to Hazelcast's operation call timeout." That last sentence is a direct, accurate writeup of theInvocationFuture-doesn't-cancel-on-timeout point I raised on 2026-08-06, and it correctly sets operator expectations that lowering the timeout reduces master wait time, not worker-side load. Good, precise doc. SubPlanretry-predicate comment:SubPlan.java:329-331now has a three-line comment directly above the predicate explaining that an incomplete final snapshot leaves task-group context intact so the retry can recover, and what happens for a permanently lost worker. This satisfies both @SEZ9's ask and my own from the last round.- Public
getCurrJobMetrics(Map)Javadoc:JobMaster.java:1071-1076now explicitly states "If collection is interrupted, the interrupt flag is restored and the partial list is returned immediately; remaining workers are not queried" — this closes the gap I flagged (the old Javadoc only mentioned missing/failed workers, not the stronger truncation-on-interrupt case). - Multi-worker interrupt test:
testRealtimeMetricsStopsAfterInterrupt(JobMasterTest.java, new in this commit) now registers twoTaskGroupLocation/Addresspairs and assertsfetchCount.get() == 1, which actually proves the "stop after interrupt" behavior instead of the previous single-worker version where the assertion was trivially true either way. This is exactly the fix for the Low-severity gap I raised on 2026-08-06.
What's new and is a real problem: this exact test class does not compile. See Issue 1.
1.2 Compatibility Impact
Partially incompatible, and this is now correctly documented (previously it was an open gap I'd flagged three times). CoordinatorService.getRunningJobMetrics() used to throw SeaTunnelException on a non-Hazelcast worker failure (fail-fast); it now silently omits that worker's data (best-effort/partial). This is unchanged from earlier heads, but as of this commit it is stated plainly in docs/en(zh)/introduction/concepts/incompatible-changes.md, which is the right place for it. No wire format, RPC signature, or config-file schema change.
1.3 Performance / Side-Effect Analysis
No behavior change from what I verified on the previous head: bounding is a clear win (master can no longer block indefinitely on one bad worker), the terminal path's retry is scoped to its own exception type only (no more 30x/60s retries for unrelated permanent failures), and both enqueuePipelineCleanupIfNeeded and storeFinishedPipelineMetrics remain idempotent across retries. Nothing in this commit's diff changes any of that analysis.
1.4 Error Handling and Logging
Issue 1: The two new JobMasterTest methods do not compile — confirmed via the fork's actual CI run for this exact commit, and this specific breakage predates this commit
- Location:
seatunnel-engine/seatunnel-engine-server/src/test/java/org/apache/seatunnel/engine/server/master/JobMasterTest.java:354and:367(testFinalMetricsFailureDoesNotPersistPartialHistory),:411and:412(testRealtimeMetricsStopsAfterInterrupt). - Problem description: I pulled the raw job log for
Run / unit-test (8, ubuntu-latest)on commit73e29bf63138536008a6b0f5fc59ba76c89749fb(https://github.com/tomatotomata/seatunnel/actions/runs/31228299874/job/93027331951) and it failsmaven-compiler-plugin:testCompilewith:Root cause of the[ERROR] JobMasterTest.java:[354,53] error: no suitable method found for thenReturn(Member) [ERROR] method OngoingStubbing.thenReturn(MemberImpl) is not applicable [ERROR] (argument mismatch; Member cannot be converted to MemberImpl) [ERROR] JobMasterTest.java:[367,16] error: reference to forEach is ambiguous [ERROR] both method forEach(Consumer<? super T>) in Iterable and method forEach(BiConsumer<? super K,? super V>) in IMap match [ERROR] JobMasterTest.java:[411,51] error: no suitable method found for thenReturn(Member) [ERROR] JobMasterTest.java:[412,52] error: no suitable method found for thenReturn(Member)thenReturn(Member)errors: both tests declareClusterServiceImpl clusterService = mock(ClusterServiceImpl.class);(the concrete Hazelcast internal class, imported atJobMasterTest.javafromcom.hazelcast.internal.cluster.impl.ClusterServiceImpl) rather than theClusterServiceinterface thatNodeEngine.getClusterService()actually returns everywhere else in this codebase (e.g.AbstractCollector.getClusterService()returns the interface type).ClusterServiceImpl#getMember(Address)narrows its return type to the internalMemberImplclass via a covariant override, sowhen(clusterService.getMember(...))resolves to anOngoingStubbing<MemberImpl>, and passing aMember-typed mock (mock(Member.class)) to.thenReturn(...)is a compile-time type mismatch, not a runtime issue. TheforEachambiguity at line 367 is a separate, second bug:IMapextends bothMap(contributingforEach(BiConsumer)) and (transitively)Iterable(contributingforEach(Consumer)), and Mockito's.forEach(any())gives javac no target type to disambiguate between the two overloads.
I then confirmed withgit show e4bdab3850:.../JobMasterTest.javathat this exact code (theMember workerMember = mock(Member.class); ... when(clusterService.getMember(workerAddress)).thenReturn(workerMember);pattern, and the.forEach(any())call) already existed unchanged in the very first version of this test, pushed 2026-08-05. It is not new in73e29bf6— it has been broken since the test was first added, three commits and two of my own reviews ago, and simply went uncaught because the fork'sCode style(Spotless) check was red on every prior head, which meant the Maven reactor never progressed far enough to runtestCompileonseatunnel-engine-serverand produce a compile signal for anyone to see. This commit is the first one where Spotless is green, so it's the first time this defect became visible in CI — and I should have caught it by reasoning about the mock types when I rated the test "Stable" on 2026-08-06 instead of only reading the assertions. - Potential risk: this is not a style nit — it is a hard build break.
-rf :seatunnel-engine-serverin the log confirms the Maven reactor aborts the whole module at this point, and I traced this as the single root cause of the wider CI carnage on this commit:unit-test (8, ubuntu-latest)fails outright,unit-test (11, ubuntu-latest)/(8/11, windows-latest)showcancelled(consistent with the same compile error, just concurrency-cancelled before finishing), and essentially every unrelated connector-IT job in the matrix (all-connectors-it-1through-8,jdbc-connectors-it-part-1through-7,kafka-connector-it,kudu-connector-it,doris-connector-it,paimon-connector-it,oracle-cdc-connector-it,connector-redis-it,connector-file-sftp-it,connector-file-local-it,rocketmq-connector-it,amazonSqs-connector-it,engine-v2-it,transform-v2-it-part-1/2) showsfailureorcancelled— none of that is related to this PR's actual diff; it is downstream fallout fromseatunnel-engine-serverfailing to build in the shared reactor. There is currently zero real CI signal validating this PR's behavior, including the very tests meant to prove the interrupt fix and the terminal-history fix both actually work. - Best improvement: Option A (preferred, minimal, and consistent with the rest of the codebase's pattern) — in both test methods, change
ClusterServiceImpl clusterService = mock(ClusterServiceImpl.class);to mock theClusterServiceinterface instead (import com.hazelcast.cluster.ClusterService;— already how every other class in this package obtains it vianodeEngine.getClusterService()), sogetMember(Address)resolves toMemberand the existingMember workerMember = mock(Member.class)stubs compile as written. For theforEachambiguity at line 367, give the matcher an explicit type witness, e.g..forEach(any(BiConsumer.class)), or extractany()into a locally-typed variable before passing it. Option B — if there's a reason to keep mocking the concreteClusterServiceImpl, change the twoMember-typed locals/mocks toMemberImplinstead (com.hazelcast.internal.cluster.impl.MemberImplis what the compiler is asking for), though this couples the test more tightly to Hazelcast internals than necessary. Either way this needs an actual local or CI-verified compile before the next push — please don't rely ongit diff --checkor Spotless alone, since neither one runsjavac. - Severity: High (build-breaking; blocks all CI signal for this and every previously-landed correctness fix in the PR)
- Raised by another reviewer: No — this is newly surfaced by me on this pass, and as noted above it's a correction to my own prior "Stable" rating rather than a new defect from this commit.
Issue 2: 3-second metrics timeout is now a single shared constant, but still not a configurable EngineConfig option — open tension with @SEZ9's outstanding ask that I want to make explicit
- Location:
seatunnel-engine/seatunnel-engine-common/src/main/java/org/apache/seatunnel/engine/common/Constant.java:44-45. - Problem description: as described in 1.1, the duplication is fixed (Option B from my 2026-08-06 review), but there is still no
EngineConfig/seatunnel.yamlentry, so operators on large or high-latency clusters cannot tune this without recompiling. @SEZ9's most recent comment (2026-08-08T07:30:14Z, against the older16308107a1ebhead) explicitly lists "expose it as an engine config option... this PR, since the hardcoded/duplicated 3s constant was one of my two merge blockers" as a remaining ask, phrased as a blocker for this PR rather than a follow-up. - My position, stated explicitly since this conflicts with @SEZ9's most recent framing: I already assessed this trade-off in my 2026-08-06 review and concluded Option B (single shared constant + docs, no config option) is an acceptable minimum bar for a PR scoped to "bound worker metrics collection," with full configurability as a reasonable fast-follow — I'm not changing that position now. My counter-evidence: the PR's own stated scope (issue #11587) is about bounding an unbounded block, not about making the bound tunable, and the doc note added in this commit already gives operators the information they need (a fixed 3s budget, and that it doesn't cancel the underlying Hazelcast call) to reason about the behavior even without a config knob. That said, since @SEZ9 has not yet reviewed this exact head and their checklist reads as a blocker, I want this called out explicitly rather than silently resolved one way — if the maintainer merging this agrees with @SEZ9 that configurability is a hard blocker, that's a legitimate call, but it should be a conscious decision, not something that falls through the cracks in the middle of a multi-reviewer, multi-round PR.
- Potential risk: unchanged from before — operators on high-latency clusters have no runtime remedy short of a recompile.
- Best improvement: unchanged recommendation — promote to a proper
EngineConfigoption with a 3s default underdocs/en/seatunnel-engine/(+docs/zh) as a fast-follow if not addressed here. - Severity: Low (given my own prior sign-off on the minimum bar); flagged as a point of reviewer disagreement rather than escalated to Medium/blocking on my own authority.
- Raised by another reviewer: Yes (@SEZ9, in this exact PR thread, both on 2026-08-06 and again on 2026-08-08 against the prior head) — my response above is a direct counter to their latest framing of this as a blocker.
Minor, non-blocking observation (not a new issue, out of scope for this diff): seatunnel-engine-server/.../observability/RealtimeMetricsService.java:80 has its own separate private static final long METRICS_FETCH_TIMEOUT_MS = 3000L;, untouched by this PR, that duplicates the same "3-second metrics fetch budget" concept this PR just consolidated in Constant. It's a pre-existing file this PR doesn't touch, so I'm not asking for a fix here — just flagging it as a natural follow-up now that Constant.DEFAULT_METRICS_FETCH_TIMEOUT_MS exists as the canonical home for this value.
2. Code Quality Assessment
2.1 Coding Standards
The fork's Run / Code style check now passes for this exact commit (https://github.com/tomatotomata/seatunnel/actions/runs/31228299874/job/93026870408) — the Spotless line-wrap violation I flagged on 2026-08-06 is fixed. New/extracted methods (getTaskGroupLocationSlotProfileMap, getFinalJobMetrics, fetchTaskGroupMetrics, FinalMetricsCollectionException) all carry Javadoc explaining intent and constraints. No wildcard imports or other style violations visible in the diff.
2.2 Test Coverage and Test Stability
This PR changes UT code (JobMasterTest.java), so per the flaky-test checklist: assuming Issue 1 is fixed, both tests use Mockito stubs with no Thread.sleep, no wall-clock/network dependence, no shared static state, no ordering assumptions, and assert on exception type / a precise fetchCount value rather than a weak existence check — that part of the design is sound. However, I have to rate this High risk as currently committed, not "Stable" — the test class does not compile at all on the actual head under review, which means there is zero executable signal, not just flaky signal, for the very behaviors (terminal-history failure handling, interrupt short-circuiting) this PR is supposed to be proving. A test suite that cannot compile is a stronger failure mode than a flaky one, and it has been silently true for this PR since 2026-08-05.
2.3 Documentation Updates
docs/en/introduction/concepts/incompatible-changes.md and docs/zh/introduction/concepts/incompatible-changes.md are both updated with matching, accurate content (I compared the English and Chinese entries side by side — they convey the same three points: bounded/best-effort behavior, partial-but-successful responses, and the Hazelcast-invocation-not-cancelled caveat). This closes the documentation gap I raised in every one of my prior reviews. No other docs/ files need touching for this PR's scope.
3. Architectural Soundness
3.1 Elegance of the Solution
Unchanged from my last assessment: the realtime-vs-terminal split via failOnIncompleteResult and the dedicated FinalMetricsCollectionException are a precise, targeted fix, not a workaround. Consolidating the timeout into Constant was the right minimal move for this PR's scope.
3.2 Maintainability
Same as before: getCurrJobMetrics(map, failOnIncompleteResult) sharing one implementation between the two call shapes keeps this from turning into two near-duplicate methods, and the dedicated exception type gives the SubPlan retry predicate a self-documenting, narrow hook. No new maintainability concerns introduced by this commit's diff itself (the test compile issue is a defect, not a design smell).
3.3 Extensibility
Fine as-is for this fix's scope; if Issue 2 (configurable timeout) is picked up later, the shared Constant field makes that a smaller change than it would have been with the duplicated constants from earlier heads.
3.4 Historical-Version Compatibility
No serialization, protocol, or config-file format changes. The one behavioral-compatibility change (fail-fast to best-effort on the default metrics path) is unchanged from earlier heads and is now properly documented — see 1.2.
4. Issue Summary
| No. | Issue | Location | Severity | Raised by another reviewer |
|---|---|---|---|---|
| 1 | JobMasterTest does not compile (Member/MemberImpl mismatch + ambiguous forEach) — pre-existing since 2026-08-05, first exposed now that Spotless is green |
JobMasterTest.java:354,367,411,412 | High | No (carryover miss on my own part — see apology above) |
| 2 | 3s metrics timeout is now a single shared constant but still not a configurable EngineConfig option |
Constant.java:44-45 | Low (my own prior sign-off on Option B stands) | Yes (@SEZ9, framed as a blocker on 2026-08-06/08-08 against an earlier head) — counter-evidence given above |
5. Merge Recommendation
Conclusion: Not recommended for merge
This PR has made real, substantive progress since my last pass — four of the five items @SEZ9 and I asked for on the previous head (shared timeout constant, incompatible-changes docs in both languages, the SubPlan retry-predicate comment, the interrupt-handling Javadoc, and the multi-worker interrupt test) are genuinely and correctly landed. But CI has never actually validated any of it: the fork's unit-test job for this exact commit fails to compile JobMasterTest.java, and that single compile error cascades into failing or cancelling essentially every other job in the matrix, including all the unrelated connector-IT lanes. That is currently the only thing keeping this PR from being ready.
- Blockers (must-fix):
- Issue 1 (High): fix the two compile errors in
JobMasterTest.java(mockClusterServiceinstead ofClusterServiceImpl, or type theMembermocks asMemberImpl; add a type witness to the ambiguous.forEach(any())call), push, and confirm the fork'sunit-testjobs actually go green — not justCode style. Given the history here (three rounds where nobody, including me, had a compile signal to check), I'd specifically ask that this be verified against an actual green CI run before the next "ready for review" ping, rather than another round of "I could not run this locally, CI is the supported path."
- Issue 1 (High): fix the two compile errors in
- Recommended, non-blocking:
- Issue 2 (Low): I've stated my own position (Option B is an acceptable minimum bar and I don't think it should block this specific PR), but flagged the open disagreement with @SEZ9's latest ask so it's a deliberate call rather than something that falls through the cracks between reviewers reviewing different heads.
- Once CI is actually green, it would also be worth a final look at
RealtimeMetricsService.java's separate, untouchedMETRICS_FETCH_TIMEOUT_MSconstant as a natural follow-up cleanup, though it is out of scope for this PR.
Once Issue 1 is fixed and the fork's unit-test and connector-IT jobs are confirmed green on the resulting commit, I don't see anything else standing in the way of merge — the underlying design and every previously-open correctness/doc/comment item is in good shape. Happy to take another pass as soon as that's pushed.
|
I fixed the test-compile blocker on the current head. Both new tests now mock the |
|
I addressed the remaining configuration and documentation asks on the refreshed head.
The change is on commit The completed Build run then exposed one more test-compile detail in the added tests: this shaded SeaTunnel build provides |
|
Thanks @tomatotomata for the two follow-ups on To answer the direct questions: Retry + interrupt shape: yes, this is the right design. Narrowing the Timeout and partial-result contract — this PR or follow-up: split it.
Two smaller remaining asks (echoing Daniel's points, which I agree with):
On testing: understood re: the sparse checkout blocking the local reactor — CI will exercise the module. The new So: config option + docs + the two comment/Javadoc fixes, and I think this is mergeable. |
There was a problem hiding this comment.
This review posted with a broken body due to a local scripting error (the review content never made it into the post, only a leftover local file reference). Posted in error — please disregard; see the fuller review(s) below on this same thread for the correct, complete content.
DanielLeens
left a comment
There was a problem hiding this comment.
What Problem Does This PR Solve?
Two quick notes before the review itself: my previous comment on this PR posted with a raw file path instead of actual review content due to a tooling problem on my end — sorry for the noise, and thanks for your patience. I also see a new commit has landed since then, so this is a fresh, full re-trace of the entire diff against the current head (0e0190ff8780), not a repost of anything earlier.
- User pain point:
CoordinatorService.getRunningJobMetrics()andJobMaster.getCurrJobMetrics()used unbounded, serial per-worker.get()calls, so one slow or unreachable worker could block the whole running-job metrics path indefinitely (#11587). - Fix approach: the default running-jobs metrics path delegates to the existing bounded/concurrent raw-metrics fetcher via a shared
Constant.DEFAULT_METRICS_FETCH_TIMEOUT_MS(3s, now supposedly configurable through a newmetrics-fetch-timeout-msengine option);JobMaster.getCurrJobMetrics(..., boolean failOnIncompleteResult)splits collection into a best-effort realtime mode (skip-and-log, short-circuits cleanly on interrupt) and a strict terminal mode (getFinalJobMetrics, all-or-nothing, retried through a dedicatedFinalMetricsCollectionException). - One-line summary: the core best-effort/strict split, the interrupt handling, and the retry-predicate narrowing are all sound and consistent with the design the three of us (myself, @SEZ9, and the author) converged on over the last two weeks — but this specific head has three new, independently verifiable problems that were not present in that design discussion: the
seatunnel-engine-servertest module does not compile (confirmed against live fork CI for this exact commit), the shipped defaultconfig/seatunnel.yamlis no longer valid YAML, and the brand-newmetrics-fetch-timeout-msoption is never actually read by the YAML config loader, so it silently does nothing. None of these are style nits — each one independently blocks merge.
1. Code Change Review
1.1 Core Logic Analysis
Config loading path (new — this is where Issues 2 and 3 live):
bin/seatunnel-cluster.sh (dist script)
SEATUNNEL_CONFIG=${CONF_DIR}/seatunnel.yaml seatunnel-cluster.sh:66-67
-Dseatunnel.config=${SEATUNNEL_CONFIG} seatunnel-cluster.sh:140
-> ConfigProvider.locateAndGetSeaTunnelConfig() ConfigProvider.java:47
-> YamlSeaTunnelConfigBuilder(locateFromSystemProperty).build()
-> YamlSeaTunnelDomConfigProcessor.parseEngineConfig(engineNode, config)
for each child node under `seatunnel.engine`:
if name == BACKUP_COUNT.key() -> engineConfig.setBackupCount(...)
if name == PRINT_JOB_METRICS_INFO_INTERVAL -> engineConfig.setPrintJobMetricsInfoInterval(...)
if name == JOB_METRICS_PARTITION_COUNT -> engineConfig.setJobMetricsPartitionCount(...)
... (no branch anywhere in this file for METRICS_FETCH_TIMEOUT_MS) ...
config/seatunnel.yaml at the project root is not a doc sample — seatunnel-dist/src/main/assembly/assembly-seatunnel-bin.xml:28-43 packages ../ with <include>config/**</include> directly into the released binary's config/ directory, and seatunnel-core/seatunnel-starter/src/main/bin/seatunnel-cluster.sh:66-67 points SEATUNNEL_CONFIG straight at it. This is the file every fresh seatunnel-cluster.sh start (and every existing deployment that hasn't hand-edited its default config) loads on the normal startup path.
Before (dev, config/seatunnel.yaml):
seatunnel:
engine:
...
print-execution-info-interval: 60
print-job-metrics-info-interval: 60
slot-service:After (PR head, config/seatunnel.yaml lines 24-27):
print-execution-info-interval: 60
print-job-metrics-info-interval: 60
metrics-fetch-timeout-ms: 3000
slot-service:The two new/moved lines are indented two spaces deeper than their sibling print-execution-info-interval: 60, which itself already has a scalar value on the same line. That is not valid YAML — I fed this exact file through yaml.safe_load and it fails immediately:
yaml.scanner.ScannerError: mapping values are not allowed here
in "config/seatunnel.yaml", line 25, column 38
Any YAML implementation (SnakeYAML included, which is what Hazelcast's YamlConfigBuilder/YamlClientConfigBuilder machinery underneath YamlSeaTunnelConfigBuilder uses) will reject this the same way — this is a syntax error, not a schema disagreement, so no parser is lenient enough to paper over it.
Key Findings:
- The default config shipped in every
bindistribution is currently unparsable. A cluster started withbin/seatunnel-cluster.shagainst the bundledconfig/seatunnel.yamlwill fail at startup with a YAML parse exception, before a single job can run. - The parallel file
seatunnel-engine/seatunnel-engine-common/src/main/resources/seatunnel.yaml(the classpath-default fallback, used when no external config is found) was edited correctly in the same commit — itsmetrics-fetch-timeout-ms: 3000line is indented consistently with its siblings and parses fine. The two files were clearly meant to be edited the same way; only the dist-shipped copy has the mistake. - Compounding this: even where the option is spelled correctly (the classpath-default file, or a hand-fixed copy of the root file),
YamlSeaTunnelDomConfigProcessor.parseEngineConfig()(the single hand-written if/else-if chain that maps everyOptionunderseatunnel.engineto anEngineConfigsetter — see the existing branches forBACKUP_COUNT,PRINT_JOB_METRICS_INFO_INTERVAL,JOB_METRICS_BACKUP_INTERVAL,JOB_METRICS_PARTITION_COUNT, etc.) has no branch at all forServerConfigOptions.MasterServerConfigOptions.METRICS_FETCH_TIMEOUT_MS. I checked this directly against the PR head content (not a local guess):grep -n "METRICS_FETCH_TIMEOUT_MS" YamlSeaTunnelDomConfigProcessor.javaat0e0190ff8780returns nothing, and the file is byte-for-byte identical todev— this PR never touches it. So even after fixing the indentation, settingmetrics-fetch-timeout-msin anyseatunnel.yamlhas no effect whatsoever: the key is silently dropped during parsing, andEngineConfig.getMetricsFetchTimeoutMs()always returns the compiled-in default (3000L) regardless of what the operator configures. There is also no test inYamlSeaTunnelDomConfigProcessorTest.javathat exercises this key, which is exactly why the gap wasn't caught. See Issues 2 and 3 below.
Metrics collection logic itself (the part this PR is actually about) — correctness assessment:
Realtime (best-effort) path:
CoordinatorService.getRunningJobMetrics() CoordinatorService.java:1524-1526
-> getRunningJobMetrics(runningJobMasterMap.keySet(),
engineConfig.getMetricsFetchTimeoutMs(), null)
-> toJobMetricsMap(getRunningJobRawMetrics(ids, timeoutMs, prefixes)) CoordinatorService.java:1591-1593
-> metricsFetchExecutor.invokeAll(perWorkerTasks, budgetMs, MS) (pre-existing, unchanged this PR)
-> one overall time budget shared across all workers via a bounded thread pool
-> merge with jobHistoryService.getJobMetrics(jobId)
This path is unchanged by this PR except that it now reads the timeout from engineConfig instead of a hardcoded literal — which is the right instinct, undermined only by the wiring gap in Issue 3.
Terminal (strict, retryable) path:
SubPlan.subPlanDone(pipelineStatus) SubPlan.java:308
-> RetryUtils.retryWithException(lambda, RetryMaterial(
retries = Constant.OPERATION_RETRY_TIME,
predicate = isOperationNeedRetryException(e) || e instanceof FinalMetricsCollectionException))
lambda:
jobMaster.enqueuePipelineCleanupIfNeeded(...) (idempotent: CAS-merge into IMAP_PENDING_PIPELINE_CLEANUP)
jobMaster.savePipelineMetricsToHistory(pipelineLocation) JobMaster.java:1191-1201
-> getFinalJobMetrics(getTaskGroupLocationSlotProfileMap(singleton(pipelineLocation)))
-> getCurrJobMetrics(map, failOnIncompleteResult=true) JobMaster.java:1090-1163 (sequential for-loop, one entry per worker Address)
-> fetchTaskGroupMetrics(address, groups).get(engineConfig.getMetricsFetchTimeoutMs(), MS)
-> TimeoutException / missing member / interrupted / other -> throw FinalMetricsCollectionException
-> only on success: jobHistoryService.storeFinishedPipelineMetrics(...) then cleanTaskGroupContext(...)
jobMaster.removeMetricsContext(...) (swallowed separately, does not affect retry)
notifyCheckpointManagerPipelineEnd(...)
jobMaster.releasePipelineResource(this) (idempotent: guarded by releasedSlotWhenTaskGroupFinished)
I traced whether re-running the whole lambda on retry could double-fire any of these side effects: enqueuePipelineCleanupIfNeeded merges into an IMap keyed by pipelineLocation via putIfAbsent/CAS-replace, and releasePipelineResource is guarded by an already-released set, so repeating the lambda on a FinalMetricsCollectionException retry is safe. This part of the design holds up.
Correctness verdict on the metrics-bounding logic itself: sound. getCurrJobMetrics iterates workers with an explicit for loop (not a forEach lambda, so return metrics; on interrupt genuinely stops the loop rather than just skipping one iteration), each catch branch is mapped correctly to either "skip and warn" (realtime) or "wrap and throw FinalMetricsCollectionException" (terminal), and the two new JobMasterTest cases target exactly the right boundaries (partial-result-must-not-persist, and stop-after-interrupt). The only reason I can't rate this "well tested" is Issue 1 below — the test module does not compile at this head, so neither test has ever actually run against this code.
1.2 Compatibility Impact
- Behavior change, correctly classified and documented (content-wise):
getRunningJobMetrics()moving from implicit fail-fast/unbounded to bounded best-effort/partial is a real observable behavior change for anyone polling running-job metrics or building alerting on top of them.docs/enanddocs/zhincompatible-changes.mdboth gained an entry describing this, including the fact that the master-side bound does not cancel the underlying Hazelcast invocation — that caveat is accurate givenNodeEngineUtil.sendOperationToMemberNode(...)returns Hazelcast's ownInvocationFuture, and.get(timeout, MILLISECONDS)throwing does not cancel the in-flightInvocation. - Metrics REST/response shape: unchanged —
toJobMetricsMap/JobMetricsUtil.toJobMetricsconversion is untouched, so this is a completeness change (fewer entries under failure), not a format/label change. No dashboard parsing aJobMetricspayload should break structurally; only completeness assumptions can. - Config option:
metrics-fetch-timeout-msis a new, additive option with a default equal to the previously-hardcoded constant, so on paper it is backward compatible. In practice (Issue 3) it does not work yet, which is a functional defect rather than a compatibility one, but it does mean the documented "configurable viaseatunnel.engine.metrics-fetch-timeout-ms" claim in both incompatible-changes docs is currently false.
1.3 Performance / Side-Effect Analysis
- No unbounded growth, no new shared mutable collections accessed from multiple threads —
getCurrJobMetrics's localmetricslist is only touched by the calling thread in a plain sequential loop, so there's no concurrency hazard to flag there. - Worth a note for a follow-up (not a blocker):
JobMaster.getCurrJobMetricsbounds each worker call individually (engineConfig.getMetricsFetchTimeoutMs()per address) but still visits workers one at a time in aforloop, so the worst-case wall time for a single pipeline's terminal snapshot isnumWorkers × timeoutMs, not a single shared budget the wayCoordinatorService.getRunningJobRawMetricsbounds its multi-worker fetch viametricsFetchExecutor.invokeAll(tasks, budgetMs, ...). For a single pipeline this is usually a small worker count, so I'm not blocking on it, but since this is exactly the strict/retryable path (each retry re-pays that multiplied cost, up toConstant.OPERATION_RETRY_TIMEtimes), it's worth the same executor-based treatment as the realtime path in a follow-up if pipelines with many workers become common. metricsFetchExecutoritself (pre-existing, unchanged here) is out of scope for this diff.
1.4 Error Handling and Logging
Log levels are appropriate throughout (WARNING for skip-and-continue cases, no new ERROR/stack-trace spam), and no sensitive data (credentials, tokens) is logged anywhere in the touched code. The formal, numbered issues from this pass — spanning a CI-confirmed build break, a runtime config-loading defect, and smaller doc/comment polish — are listed below, sorted by severity:
Issue 1 — seatunnel-engine-server test sources do not compile at the current PR head
- Location:
seatunnel-engine/seatunnel-engine-server/src/test/java/org/apache/seatunnel/engine/server/master/JobMasterTest.java:337-354and:409-412 - Problem description: The latest two commits switched the mocked type from
com.hazelcast.cluster.ClusterService(public interface) tocom.hazelcast.internal.cluster.ClusterService(the internal interfaceNodeEngine#getClusterService()actually returns), to fix an earlier compile error. Butcom.hazelcast.internal.cluster.ClusterService#getMember(Address)returns the concreteMemberImpl, not the publicMemberinterface — and the test still doesMember workerMember = mock(Member.class); when(clusterService.getMember(workerAddress)).thenReturn(workerMember);(line 354), plus two inline equivalents at lines 411-412. I confirmed this against live CI for this exact head (fork run31324061997, jobunit-test (11, ubuntu-latest),databaseId 93271775189):mvn test-compilefails witherror: no suitable method found for thenReturn(Member)/method OngoingStubbing.thenReturn(MemberImpl) is not applicableat exactly these three lines. - Potential risk: The entire
seatunnel-engine-servermodule's test sources fail to compile, which is why the fork'sBuildrun shows dozens of unrelated modules (engine-v2-it, everyjdbc-connectors-it-part-*,all-connectors-it-*,transform-v2-it-*, etc.) asfailure/cancelled— the Maven reactor aborts atseatunnel-engine-serverand everything downstream never runs. Neither of the two new regression tests this PR is relying on for its "well tested" claim (testFinalMetricsFailureDoesNotPersistPartialHistory,testRealtimeMetricsStopsAfterInterrupt) has ever actually executed against this code — there is currently zero verified test coverage for the terminal-vs-realtime metrics split, despite the PR description and prior review rounds treating it as covered. - Best improvement: Mock
MemberImplinstead ofMemberat all three sites (or introduce a small local helper/subclass ifMemberImplisn't cleanly mockable — check for a final class or constructor requirements), then confirm locally with a plainmvn -pl seatunnel-engine/seatunnel-engine-server test-compilebefore pushing again, since this module has now round-tripped through three different compile failures across the last four commits without a green build in between. - Severity: Blocker
- Raised by another reviewer: Partially — I flagged an earlier, different compile error in this same test class in my 2026-08-09T01:12:15Z review (a
MemberImplreturn-type mismatch whenClusterServicewas still the public-package mock). The author's fix for that introduced this new, different mismatch. The underlying theme ("this test class doesn't compile") was raised before; this specific error is new to this head.
Issue 2 — Shipped default config/seatunnel.yaml is invalid YAML
- Location:
config/seatunnel.yaml:24-26(packaged into the release binary byseatunnel-dist/src/main/assembly/assembly-seatunnel-bin.xml:28-43, and loaded asSEATUNNEL_CONFIGbyseatunnel-core/seatunnel-starter/src/main/bin/seatunnel-cluster.sh:66-67) - Problem description:
print-job-metrics-info-interval: 60and the newmetrics-fetch-timeout-ms: 3000are indented two spaces deeper than the preceding sibling keyprint-execution-info-interval: 60, which already carries a scalar value on the same line. This is not a valid YAML mapping — I parsed the file withyaml.safe_loadand it throwsmapping values are not allowed hereat line 25. - Potential risk: This is the actual file shipped in the
tar.gzbinary distribution and loaded by default on everybin/seatunnel-cluster.shstart. Any fresh install, or any existing deployment that upgrades and keeps the bundled default config, will fail to start the master/worker node with a YAML parsing exception — a total, immediate outage on the normal startup path, not an edge case. - Best improvement: Re-indent both lines to match
print-execution-info-interval's 4-space indent underengine:, exactly as was done correctly in the sibling fileseatunnel-engine/seatunnel-engine-common/src/main/resources/seatunnel.yaml. Please also add a CI check (or at minimum a localpython3 -c "import yaml; yaml.safe_load(open('config/seatunnel.yaml'))"/ equivalent) before pushing config-file-only changes, since this class of error produces no compiler signal. - Severity: Blocker
- Raised by another reviewer: No — this file was only touched in the 2026-08-09T08:53Z commit, after my previous full reviews; nobody has flagged it yet.
Issue 3 — New metrics-fetch-timeout-ms engine option is never read by the YAML config loader
- Location:
seatunnel-engine/seatunnel-engine-common/src/main/java/org/apache/seatunnel/engine/common/config/YamlSeaTunnelDomConfigProcessor.java(entireparseEngineConfig(...)method — no reference toMETRICS_FETCH_TIMEOUT_MSanywhere in the file) - Problem description:
ServerConfigOptions.MasterServerConfigOptions.METRICS_FETCH_TIMEOUT_MSandEngineConfig.setMetricsFetchTimeoutMs(long)(with> 0validation) were added, and both sample YAML files and both incompatible-changes docs now advertisemetrics-fetch-timeout-msas a supported key. ButYamlSeaTunnelDomConfigProcessor.parseEngineConfig()— the single hand-written if/else-if chain that is this codebase's only mechanism for binding a parsed YAML node to anEngineConfigsetter (see the existing, directly analogous branches forBACKUP_COUNT,PRINT_JOB_METRICS_INFO_INTERVAL,JOB_METRICS_PARTITION_COUNT, etc.) — has no branch for this new key. I verified this directly against the PR head via the GitHub contents API (not a local guess or a possibly-stale clone): the file at commit0e0190ff8780is byte-identical todev, and grepping it forMETRICS_FETCH_TIMEOUT_MSreturns nothing. There is also no test inYamlSeaTunnelDomConfigProcessorTest.javacovering this key. - Potential risk: Setting
seatunnel.engine.metrics-fetch-timeout-msin anyseatunnel.yamlis silently a no-op — the DOM node is enumerated and simply falls through with no branch matching it, no warning, no error.EngineConfig.getMetricsFetchTimeoutMs()will always return the compiled-in3000Ldefault in every real deployment, regardless of operator configuration. This directly undermines the exact requirement that blocked the previous two review rounds (@SEZ9's "hoist it to a single shared constant and make it configurable via an engine option" and my own reiteration of the same ask) — the option now exists in name and in the class model, but the feature it's supposed to deliver does not actually work. - Best improvement: Add an
else if (ServerConfigOptions.MasterServerConfigOptions.METRICS_FETCH_TIMEOUT_MS.key().equals(name)) { engineConfig.setMetricsFetchTimeoutMs(getLongValue(...)); }branch (matching the existing pattern forJOB_METRICS_PARTITION_COUNTimmediately above it inServerConfigOptions), and add a case toYamlSeaTunnelDomConfigProcessorTest.javathat loads a YAML fixture with a non-defaultmetrics-fetch-timeout-msand assertsEngineConfig.getMetricsFetchTimeoutMs()reflects it — exactly the kind of test that would have caught this gap immediately. - Severity: Critical
- Raised by another reviewer: No — this is a new finding from tracing the config-loading path end to end, which none of the three previous review rounds (mine or @SEZ9's) did, since the option didn't exist yet in those rounds.
Issue 4 — Malformed Javadoc on CoordinatorService.getRunningJobMetrics()
- Location:
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java:1520-1524 - Problem description:
This has a doubled, nested
/** * Get metrics for all running jobs. * * <p>This method is best-effort. It waits up to {@link * {@link EngineConfig#getMetricsFetchTimeoutMs()} for the overall fetch and returns a partial map * when workers time out or are unavailable. */
{@link {@link ...}tag — the line break after the first{@linkwas clearly meant to just wrap the line, but the second{@linkon the next line was left in by mistake. - Potential risk: Low functional risk, but it renders incorrectly wherever Javadoc is generated/displayed (IDE tooltips, generated API docs), and would likely trip
javadoc/doclint if the module ever enables stricter Javadoc linting. - Best improvement:
* <p>This method is best-effort. It waits up to {@link EngineConfig#getMetricsFetchTimeoutMs()} for the overall fetch and returns a partial map when workers time out or are unavailable. - Severity: Low
- Raised by another reviewer: No.
Issue 5 — Minor markdown list-indentation inconsistency in the new English incompatible-changes entry
- Location:
docs/en/introduction/concepts/incompatible-changes.md(new "Behavior Change: Running job metrics are now collected on a bounded, best-effort basis" entry, the "Impact" bullet) - Problem description: The "Affected component" and "Description" sub-bullets are indented 2 spaces under the top-level bullet, but the third sub-bullet ("Impact") is indented 3 spaces — a stray extra space. The equivalent Chinese doc entry (
docs/zh/...) does not have this inconsistency. - Potential risk: Purely cosmetic; most Markdown renderers (including GitHub's) will still render it as a sibling bullet, but it's inconsistent with the rest of the file and with the Chinese translation.
- Best improvement: Drop the extra leading space so all three sub-bullets use the same 2-space indent.
- Severity: Trivial
- Raised by another reviewer: No.
2. Code Quality Assessment
2.1 Coding Standards
The Java changes themselves (exception hierarchy, @VisibleForTesting on fetchTaskGroupMetrics, the narrowed retry predicate with its explanatory comment) are clean, consistent with the surrounding code style, and address every stylistic ask from the last two rounds (shared constant instead of duplicated literals, comment on the retry predicate, Javadoc on the truncation behavior). The one Javadoc formatting slip is Issue 4 above.
2.2 Test Coverage and Test Stability
- The two new
JobMasterTestcases target the right boundaries in principle (partial-result-must-not-persist for the terminal path; stop-after-interrupt with a fetch-count assertion for the realtime path across two workers). Design-wise this is a reasonable, non-trivial pair of tests — better than a single-worker happy-path check. - However, per Issue 1, the test module does not currently compile, so neither test has ever run successfully in CI. Until that's fixed, this PR has zero verified coverage for the exact behavior it exists to add.
- Even once compiling, neither test exercises a genuinely concurrent/multi-threaded scenario (both drive the collection loop from a single calling thread with mocked synchronous throws) — this matches how the production code itself behaves (sequential per-worker loop, no new threads spun up by this PR), so it's not a gap relative to the implementation, but it does mean "tested under concurrency" isn't really an applicable bar here; "tested for the sequential multi-worker boundary conditions it actually has" is, and that bar is met by design once the compile error is fixed.
- Test-coverage risk rating (once Issue 1 is fixed): Stable for the logic itself; currently: not verifiable (compile failure).
- No test exists for the new config option's YAML parsing (Issue 3) — see that issue for the specific gap.
2.3 Documentation Updates
Both docs/en and docs/zh incompatible-changes entries are added, content-accurate about the Hazelcast invocation-cancellation caveat, and reasonably close translations of each other. The one issue is the formatting nit in Issue 5, and the fact that the documented "configurable via metrics-fetch-timeout-ms" claim is not true yet per Issue 3 — once Issue 3 is fixed, the docs will already be correct as written.
3. Architectural Soundness
3.1 Elegance of the Solution
The best-effort-vs-strict split via a boolean flag and a dedicated FinalMetricsCollectionException, retried narrowly at the SubPlan level while leaving the task-group context intact, is a clean and appropriately narrow solution to the original data-loss bug from my very first review on this PR. I have no design objection to the core approach at this point — the remaining problems are all in execution (build, config wiring), not architecture.
3.2 Maintainability
The consolidation of getCurrJobMetrics/getFinalJobMetrics onto one shared private implementation with a boolean switch is easy to follow and keeps the two call sites' semantics from drifting apart in the future. The one maintainability risk is exactly what Issue 3 demonstrates: this codebase's config-option wiring requires three separate, unenforced hand-edits (Option definition, EngineConfig setter, YamlSeaTunnelDomConfigProcessor branch) with no compiler or test safety net tying them together, so it's easy — as happened here — to add the first two and silently miss the third.
3.3 Extensibility
No concerns. The exception-based signaling (FinalMetricsCollectionException) and the @VisibleForTesting override point (fetchTaskGroupMetrics) both make it straightforward to add further collection strategies or test scenarios later.
3.4 Historical-Version Compatibility
No serialization formats, checkpoint/savepoint state, or wire protocols are touched by this PR — the change is confined to master-side metrics collection and a new, additive config option. Once Issues 2 and 3 are fixed, there is no upgrade-path or restore-compatibility concern I can identify.
4. Issue Summary
| Number | Issue | Location | Severity |
|---|---|---|---|
| 1 | seatunnel-engine-server test sources fail to compile at current head (CI-confirmed) |
JobMasterTest.java:337-354, 409-412 |
Blocker |
| 2 | Shipped default config/seatunnel.yaml is invalid YAML |
config/seatunnel.yaml:24-26 |
Blocker |
| 3 | metrics-fetch-timeout-ms option is never wired into the YAML config loader (silent no-op) |
YamlSeaTunnelDomConfigProcessor.java (parseEngineConfig) |
Critical |
| 4 | Malformed nested {@link {@link ...} Javadoc |
CoordinatorService.java:1520-1524 |
Low |
| 5 | Inconsistent bullet indentation in new docs entry | docs/en/.../incompatible-changes.md |
Trivial |
5. Merge Recommendation
Conclusion: Not recommended for merge
Blockers:
- Issue 1: fix the
Member/MemberImplmock mismatch inJobMasterTest.javasoseatunnel-engine-server's test sources compile, then confirm green on a real CI run (this module has failed to compile in four consecutive pushes now for three different reasons — please verify locally withtest-compilebefore the next push). - Issue 2: fix the YAML indentation in
config/seatunnel.yamlso the shipped default config is valid and the engine can actually start. - Issue 3: wire
METRICS_FETCH_TIMEOUT_MSintoYamlSeaTunnelDomConfigProcessor.parseEngineConfig()and add a test asserting it takes effect, so the configurability this PR's own docs promise is real.
Recommended fixes (non-blocking, but please fold in before the next round if convenient):
- Issue 4: fix the doubled
{@link {@link}Javadoc tag. - Issue 5: fix the stray extra indent on the "Impact" bullet in the English incompatible-changes entry.
- Consider (follow-up, not this PR): give
JobMaster.getCurrJobMetrics's terminal path a shared overall time budget across workers, the same wayCoordinatorService.getRunningJobRawMetricsalready does, so a pipeline with many workers doesn't paynumWorkers × timeoutMsper retry attempt.
Overall assessment: the metrics-bounding design itself has matured well over several rounds and I have no remaining objection to its shape — the best-effort/strict split, the interrupt handling, and the retry-predicate narrowing are all correct as written. But this specific head introduces two build/runtime-breaking regressions (a non-compiling test module and an unparsable shipped default config) plus one silently-nonfunctional feature (the new timeout option), none of which existed in the design the three of us converged on earlier. These are all concrete, independently reproducible from source and from live CI — please fix and repush, and I'll do another fast pass focused just on verifying these three.
|
I traced the three blockers through the current head and pushed
The focused Maven test-compile could not reach the changed modules in this Windows checkout: the reactor stopped in the existing I kept the terminal worker-budget design unchanged and limited this follow-up to the concrete review findings. Let me know what you think. |
|
The GitHub code-style run caught one formatting detail that the Windows Spotless invocation could not reach. I fixed the Javadoc wrapping in |
There was a problem hiding this comment.
Posting correction: this review was posted under the wrong account due to a local tooling/environment issue on my end (the reviewing session's credential did not apply to this call). Please disregard this entry — the intended full re-review has been reposted correctly under my usual reviewer account (DanielLeens) on this same PR. Sorry for the noise.
DanielLeens
left a comment
There was a problem hiding this comment.
What Problem Does This PR Solve?
Re-review note: two new commits landed since my last full pass (68b31dc9, 66f962ff), plus two follow-up comments from @tomatotomata. This is a fresh, independent re-trace of the entire diff against the current head (66f962fff407), not a repost of the prior review — I re-verified every one of my three previous blockers from source/bytecode/CI evidence rather than trusting the commit messages, and I'm folding my replies to both new comments into this review body per the re-review protocol.
- User pain point:
CoordinatorService.getRunningJobMetrics()andJobMaster.getCurrJobMetrics()used unbounded, serial per-worker.get()calls, so one slow or unreachable worker could block the whole running-job metrics path indefinitely (#11587). - Fix approach: the default running-jobs metrics path delegates to the existing bounded/concurrent raw-metrics fetcher via a shared, now-configurable
metrics-fetch-timeout-msengine option (default 3s);JobMaster.getCurrJobMetrics(..., boolean failOnIncompleteResult)splits collection into a best-effort realtime mode (skip-and-log, short-circuits cleanly on interrupt) and a strict terminal mode (getFinalJobMetrics, all-or-nothing, retried through a dedicatedFinalMetricsCollectionException). - One-line summary: all three blockers from my previous review (non-compiling test module, unparsable shipped default config, non-functional config option) are genuinely fixed on this head — I independently re-verified each one rather than taking the commit messages at face value — and I found one new, small, non-blocking quality nit in the new config-parsing branch. No blockers remain.
1. Code Change Review
1.1 Core Logic Analysis
Re-verifying my three previous blockers against 66f962fff407 (not re-reading the old diff — fresh checks against the current head):
Issue 1 (previously Blocker) — JobMasterTest Member/MemberImpl mock mismatch. 68b31dc9 switched both test sites to MemberImpl workerMember = mock(MemberImpl.class) (JobMasterTest.java:338, 411-412), matching com.hazelcast.internal.cluster.ClusterService#getMember(Address)'s real return type. I didn't just re-read the diff for this one — I pulled com.hazelcast.internal.cluster.ClusterService.class and com.hazelcast.cluster.impl.MemberImpl.class straight out of the shaded seatunnel-hazelcast-shade jar this build actually uses and disassembled them with javap:
public abstract com.hazelcast.cluster.impl.MemberImpl getMember(com.hazelcast.cluster.Address); // ClusterService
public final class com.hazelcast.cluster.impl.MemberImpl extends ... implements Member, ... // MemberImpl, with a public no-arg ctor
So the mock type now exactly matches the real return type — the thenReturn(Member)/thenReturn(MemberImpl) mismatch that broke test-compile on the previous head is gone. MemberImpl is final, which would normally block a subclass-based mock, but seatunnel-engine-server ships src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker containing mock-maker-inline, and the root pom.xml pulls in mockito-inline as a plain (non-managed-only) test dependency for every module — so the inline byte-buddy mock maker is active here and mocking a final class is fully supported. Verified fixed, via direct bytecode inspection, not just re-reading the source diff.
- Issue 2 (previously Blocker) — shipped
config/seatunnel.yamlinvalid YAML.68b31dc9re-indents both lines to the same 4-space level as their siblings. I fed the actual file content at this head throughyaml.safe_loadmyself (not trusting the "python passes" claim in the commit message) — it parses cleanly andseatunnel.engine.metrics-fetch-timeout-msresolves to3000. Verified fixed independently. - Issue 3 (previously Critical) —
metrics-fetch-timeout-msnever wired intoYamlSeaTunnelDomConfigProcessor.68b31dc9adds the missingelse ifbranch (YamlSeaTunnelDomConfigProcessor.java:194-197) plus a real regression test (YamlSeaTunnelDomConfigProcessorTest#testParseMetricsFetchTimeout, loadingengine-metrics-timeout.yamlwithmetrics-fetch-timeout-ms: 4500and assertingEngineConfig.getMetricsFetchTimeoutMs() == 4500L). I didn't stop at reading the source — I pulled the actual fork CI log for this exact head (unit-test (11, ubuntu-latest), run31396252051, job93480540327) and confirmed the test really executed and passed:Tests run: 17, Failures: 0, Errors: 0, Skipped: 0 - in ...YamlSeaTunnelDomConfigProcessorTest. Verified fixed with a real, passing CI execution, not just a claim. - Issue 4 (previously Low) — doubled
{@link {@link ...}Javadoc.66f962ffcollapses it back to a single, correctly-wrapped{@link EngineConfig#getMetricsFetchTimeoutMs()}tag. Confirmed by diff. The fork'sCode stylejob for this exact head (93479774772) is green, so the formatting is correct as shipped, not just locally claimed. - Issue 5 (previously Trivial) — stray indent in the English incompatible-changes bullet. Fixed in the same commit (
68b31dc9); the EN and ZH entries now match structurally.
Metrics collection logic itself — unchanged from my last pass, re-confirmed sound on this head. JobMaster.getCurrJobMetrics(map, failOnIncompleteResult) (JobMaster.java:1101-1163) still uses a genuine for loop (not forEach), so return metrics; on InterruptedException actually stops iterating rather than skipping one entry; each failure mode (missing member / HazelcastInstanceNotActiveException / TimeoutException / interrupt / other) is mapped consistently to either "skip and warn" (realtime) or "wrap and throw FinalMetricsCollectionException" (terminal, all-or-nothing). I re-traced the retry safety at SubPlan.subPlanDone (SubPlan.java:308-337): re-running the lambda on a FinalMetricsCollectionException retry is safe because enqueuePipelineCleanupIfNeeded CAS-merges into an IMap and releasePipelineResource is guarded by an already-released set — no double side effects. This part of the design has not changed since my earlier reviews and I have no new concerns here.
Runtime path (terminal/strict, for reference — unchanged by the last two commits):
SubPlan.subPlanDone(pipelineStatus) SubPlan.java:308
-> RetryUtils.retryWithException(lambda, RetryMaterial(
retries = Constant.OPERATION_RETRY_TIME,
predicate = isOperationNeedRetryException(e) || e instanceof FinalMetricsCollectionException))
lambda:
jobMaster.savePipelineMetricsToHistory(pipelineLocation) JobMaster.java:1191-1201
-> getFinalJobMetrics(getTaskGroupLocationSlotProfileMap(...))
-> getCurrJobMetrics(map, failOnIncompleteResult=true) JobMaster.java:1101-1163
-> fetchTaskGroupMetrics(address, groups)
.get(engineConfig.getMetricsFetchTimeoutMs(), MS) JobMaster.java:~1195
-> any failure -> throw FinalMetricsCollectionException
-> only on success: jobHistoryService.storeFinishedPipelineMetrics(...)
One new, small finding in the newly-added config-parsing branch (not present before, since the branch itself didn't exist until 68b31dc9):
Issue 6 — New METRICS_FETCH_TIMEOUT_MS branch bypasses the file's existing getLongValue helper, producing a worse error message than every sibling option
- Location:
seatunnel-engine/seatunnel-engine-common/src/main/java/org/apache/seatunnel/engine/common/config/YamlSeaTunnelDomConfigProcessor.java:194-197 - Problem description: every other numeric option in this exact method (
PRINT_EXECUTION_INFO_INTERVAL,PRINT_JOB_METRICS_INFO_INTERVAL,JOB_METRICS_BACKUP_INTERVAL,JOB_METRICS_PARTITION_COUNT, etc.) is parsed via the statically-importedcom.hazelcast.internal.config.DomConfigHelper#getIntegerValue(parameterName, value). The new branch instead calls rawLong.parseLong(getTextContent(node)). I disassembledDomConfigHelperfrom the actual shaded jar this build uses:getLongValue(String parameterName, String value)exists (public static long getLongValue(java.lang.String, java.lang.String)) and internally catches the parse failure to rethrownew InvalidConfigurationException(String.format("Invalid long integer value for parameter %s: %s", parameterName, value))— i.e. it exists specifically to give a descriptive, key-attributed error, and it's the long-typed sibling of thegetIntegerValueused everywhere else in this file. - Potential risk: purely a diagnostics regression, not a functional one — valid configs work identically either way. But if an operator makes a typo (e.g.
metrics-fetch-timeout-ms: 3sinstead of3000), they get a bareNumberFormatException: For input string: "3s"with a raw Java stack trace and no indication of which YAML key was at fault, instead of the friendly, parameter-name-inclusiveInvalidConfigurationExceptionevery other option in this file produces on the same mistake. Low severity, but it's a real, avoidable inconsistency introduced by this exact new branch (not something present in the old code, since the branch didn't exist before68b31dc9). - Best improvement:
import static com.hazelcast.internal.config.DomConfigHelper.getLongValue;and change toengineConfig.setMetricsFetchTimeoutMs(getLongValue(ServerConfigOptions.MasterServerConfigOptions.METRICS_FETCH_TIMEOUT_MS.key(), getTextContent(node)));, matching the existing pattern exactly. - Severity: Low
- Raised by another reviewer: No — new finding, specific to the branch added in
68b31dc9.
1.2 Compatibility Impact
Unchanged from my previous assessment and still accurate on this head: getRunningJobMetrics() moving from implicit fail-fast/unbounded to bounded best-effort/partial is a real, correctly-documented behavior change (both docs/en and docs/zh incompatible-changes entries describe it, including the Hazelcast-invocation-not-cancelled caveat). The metrics REST/response shape (toJobMetricsMap/JobMetricsUtil.toJobMetrics) is untouched — this is a completeness change under failure, not a format change. metrics-fetch-timeout-ms is additive with a default equal to the previously-hardcoded constant, and — unlike the last head I reviewed — it now actually works (Issue 3 above), so the "configurable via seatunnel.engine.metrics-fetch-timeout-ms" claim in both docs is now true.
1.3 Performance / Side-Effect Analysis
No change from my last pass: no unbounded growth, no new shared mutable collections touched from multiple threads (getCurrJobMetrics's metrics list is only touched by the calling thread in a sequential loop). Repeating my earlier non-blocking note for a follow-up: JobMaster.getCurrJobMetrics's terminal path still bounds each worker call individually rather than sharing one overall budget across workers the way CoordinatorService.getRunningJobRawMetrics does via metricsFetchExecutor.invokeAll(tasks, budgetMs, ...), so worst-case wall time for a single pipeline's terminal snapshot is still numWorkers × timeoutMs, paid again on every retry. Not a blocker for typical worker counts per pipeline; still worth the same executor-based treatment in a follow-up if that assumption stops holding.
1.4 Error Handling and Logging
Log levels remain appropriate (WARNING for skip-and-continue, no new ERROR/stack-trace spam), no sensitive data logged. See Issue 6 above for the one new diagnostics nit; no other issues found in this pass.
2. Code Quality Assessment
2.1 Coding Standards
The new config-option plumbing (Constant.DEFAULT_METRICS_FETCH_TIMEOUT_MS, ServerConfigOptions.MasterServerConfigOptions.METRICS_FETCH_TIMEOUT_MS, EngineConfig#setMetricsFetchTimeoutMs with >0 validation) is clean and every new field/option carries a description. FinalMetricsCollectionException and fetchTaskGroupMetrics both have class/method-level Javadoc explaining purpose and constraints. The SubPlan retry-predicate now has the explanatory comment both @SEZ9 and I asked for in earlier rounds. Only the Issue 6 nit above.
2.2 Test Coverage and Test Stability
- Both
JobMasterTestcases I previously couldn't verify (testFinalMetricsFailureDoesNotPersistPartialHistory,testRealtimeMetricsStopsAfterInterrupt) now compile per my Issue 1 verification above. I read both tests in full on this head: the first overrides@VisibleForTesting protected fetchTaskGroupMetricsto throwTimeoutException, assertssavePipelineMetricsToHistorythrows andverifyNoInteractions(jobHistoryService)— directly proving the original data-loss bug (partial results silently persisted) can't happen. The second drives two workers, both throwingInterruptedExceptionfrom the overridden fetch, and assertsfetchCount == 1(loop genuinely stops after the first interrupt, doesn't visit the second worker) plus that the thread's interrupt flag is set, with afinally { Thread.interrupted(); }to avoid leaking interrupt state into later tests in the same JVM — good test hygiene. SincetaskGroupLocationMapis aHashMap, iteration order isn't guaranteed, but the assertion is order-independent (either worker throws immediately, sofetchCountis 1 either way) — not flaky. YamlSeaTunnelDomConfigProcessorTest#testParseMetricsFetchTimeoutis new, targeted, and — per the live CI evidence in Issue 3 above — actually ran and passed on this head.- Residual gap, not a blocker: I could not find a completed CI run of the
unit-testjob that reached and executedseatunnel-engine-server's test suite (including the twoJobMasterTestcases) on this exact head.unit-test (11, windows-latest)failed on an unrelatedseatunnel-apitest (MultiTableSinkWriterSchemaChangeBroadcastTest#schemaChangeKeepsIOExceptionContractWhenWorkerAlreadyFailed,boom-before-schema-entry— nothing touched by this PR's diff, which never entersseatunnel-api/.../multitablesink/**), and that failure appears to have fail-fast-cancelled the siblingunit-test (8, ubuntu-latest)/unit-test (11, ubuntu-latest)/unit-test (8, windows-latest)matrix legs before the Ubuntu legs' reactor reachedseatunnel-engine-server(the Ubuntu(11) log I pulled shows it had only reachedseatunnel-engine-common's tests, including the passingYamlSeaTunnelDomConfigProcessorTest, at the moment of cancellation). I'm treating my Issue 1 fix-verification (direct bytecode type-check against the actual shaded Hazelcast classes, not just a source re-read) as strong enough evidence thattest-compilenow succeeds, so I'm not re-raising this as a blocker — but I'd still like to see one full greenunit-testrun (rerun the Windows flake or push again) reach and passseatunnel-engine-serverbefore merge, purely as final confirmation given this exact module has round-tripped through three different compile failures across the last several pushes. - Test-coverage risk rating: Stable, based on independent source/bytecode verification; recommend confirming with one completed green CI run before merge.
2.3 Documentation Updates
Both docs/en and docs/zh incompatible-changes entries are present, accurate, and now structurally consistent (Issue 5 fixed). The "configurable via metrics-fetch-timeout-ms" claim is now true (Issue 3 fixed), so there's no remaining doc/behavior mismatch.
3. Architectural Soundness
3.1 Elegance of the Solution
Unchanged assessment: the best-effort-vs-strict split via a boolean flag plus a dedicated FinalMetricsCollectionException, retried narrowly at the SubPlan level while preserving task-group context, remains a clean, appropriately narrow fix for the original data-loss bug. No design objections.
3.2 Maintainability
Same note as before, now demonstrated concretely by this PR's own history: this codebase's config-option wiring requires three separate, unenforced hand-edits (Option definition, EngineConfig setter, YamlSeaTunnelDomConfigProcessor branch), and it took this PR two extra rounds to get all three in sync. Worth a YamlSeaTunnelDomConfigProcessorTest-style regression test as the standing safety net for any new engine option going forward (this PR now sets a good precedent by adding one for its own option) — not something to hold this PR on, just a process note.
3.3 Extensibility
No concerns, unchanged from before.
3.4 Historical-Version Compatibility
No serialization formats, checkpoint/savepoint state, or wire protocols touched. No upgrade-path or restore-compatibility concern.
4. Issue Summary
| Number | Issue | Location | Severity |
|---|---|---|---|
| 6 | New config-parsing branch bypasses DomConfigHelper#getLongValue, giving a worse error message than every sibling option on a misconfigured value |
YamlSeaTunnelDomConfigProcessor.java:194-197 |
Low |
(Issues 1-5 from my previous review are all independently re-verified fixed on this head — see section 1.1 above for the specific evidence per issue; not re-listed here as open.)
5. Merge Recommendation
Conclusion: Ready to merge
Blockers: none. All three previous blockers (non-compiling test module, unparsable shipped default YAML, non-functional config option) are independently verified fixed — not just re-read from the diff, but checked against the actual shaded Hazelcast bytecode (Issue 1), a real yaml.safe_load parse (Issue 2), and a completed, passing CI test run (Issue 3).
Recommended fixes (non-blocking):
- Issue 6: use
DomConfigHelper#getLongValueinstead of rawLong.parseLongformetrics-fetch-timeout-ms, for a consistent, key-attributed error message on operator typos. - Before the final merge click, I'd like to see one completed green
unit-testrun that actually reaches and passesseatunnel-engine-server's suite (the current run's Ubuntu legs were fail-fast-cancelled by an unrelated Windows-onlyseatunnel-apiflake before getting there) — purely as final confirmation, since I'm relying on independent bytecode verification rather than a completed CI pass for thetest-compilefix specifically. - Consider (follow-up, not this PR, repeating from before): give
JobMaster.getCurrJobMetrics's terminal path a shared overall time budget across workers the same wayCoordinatorService.getRunningJobRawMetricsalready does, so a many-worker pipeline doesn't paynumWorkers × timeoutMsper retry.
Reply to @tomatotomata: thanks for tracking down and fixing all three blockers precisely — the MemberImpl mock fix, the YAML re-indent, and the new config-processor branch all check out against independent verification (bytecode, direct YAML parse, and live CI respectively), not just the commit-message claims. The one thing I'd add on top of what you already did is Issue 6 above (use getLongValue instead of raw Long.parseLong, matching the pattern of every sibling option in that method) — small, non-blocking, easy to fold in. And thanks for the follow-up Javadoc formatting fix in 66f962ff too; confirmed against the green Code style CI job for that exact commit.
Overall assessment: the metrics-bounding design has been correct in shape since early in this review thread, and this head finally closes out the build/config-wiring regressions that blocked the last two rounds. With Issue 6 optionally folded in and one clean unit-test run to put the compile-fix question to rest for good, I have no remaining objection to merging this.
|
I folded the remaining parsing nit into
|
DanielLeens
left a comment
There was a problem hiding this comment.
What Problem Does This PR Solve?
Quick note before the review body: there are no unresolved inline review threads to reply to on this PR (the pulls/11602/comments endpoint returns empty — every round of feedback here, mine and @SEZ9's, has gone through top-level review bodies), so I'm folding the reply-acknowledgment directly into this paragraph instead of a separate in_reply_to reply. Thanks @tomatotomata for landing the getLongValue fix (f127a13e0) for Issue 6 from my last review — I re-traced it below, and while the fix itself is exactly right, that same commit introduced a genuinely new, currently-CI-blocking Spotless violation that didn't exist on the head I last reviewed. Flagging that as this pass's one blocker before anything else, so it doesn't get lost.
- User pain point:
CoordinatorService.getRunningJobMetrics()andJobMaster.getCurrJobMetrics()used unbounded, serial per-worker.get()calls, so one slow or unreachable worker could block the whole running-job metrics path indefinitely (#11587). - Fix approach: the default running-jobs metrics path delegates to the pre-existing bounded/concurrent raw-metrics fetcher (
getRunningJobRawMetrics, unchanged by this PR) through a shared, configurablemetrics-fetch-timeout-msengine option (default 3s);JobMaster.getCurrJobMetrics(..., boolean failOnIncompleteResult)splits collection into a best-effort realtime mode (skip-and-log, short-circuits cleanly on interrupt) and a strict terminal mode (getFinalJobMetrics, all-or-nothing, retried through a dedicatedFinalMetricsCollectionException). - One-line summary: the design and every substantive correctness/compatibility issue raised across this thread (by me and @SEZ9) are fixed and independently re-verified on this head — the only new item is a one-line formatting regression in the very last commit that is currently failing the fork's
Code stylejob and, as a result, blockingunit-testfrom running at all.
1. Code Change Review
1.1 Core Logic Analysis
Full fresh trace of the current head (f127a13e0), not a diff of my last review's findings:
I re-read every changed file end to end against f127a13e0 (gh pr diff 11602) and cross-checked the surrounding, unchanged context by pulling full files at this SHA (CoordinatorService.java, JobMaster.java, EngineConfig.java) via raw.githubusercontent.com.
Constant.DEFAULT_METRICS_FETCH_TIMEOUT_MS(3000L) is the single source of the default, referenced byServerConfigOptions.MasterServerConfigOptions.METRICS_FETCH_TIMEOUT_MS.defaultValue()and nowhere else — the old two-constant duplication (DEFAULT_METRICS_FETCH_TIMEOUT_MSinCoordinatorService/METRICS_FETCH_TIMEOUT_MSinJobMaster) is gone.CoordinatorService.getRunningJobMetrics()(no-arg) now just callsgetRunningJobMetrics(runningJobMasterMap.keySet(), engineConfig.getMetricsFetchTimeoutMs(), null)(CoordinatorService.java:278-279), which delegates togetRunningJobRawMetrics(...). I fetched that method directly (CoordinatorService.java:1579-1627, unchanged by this PR) — it still uses the boundedmetricsFetchExecutor(a fixed pool sizedmin(8, availableProcessors), daemon threads, shut down inshutdownNow()atCoordinatorService.java:1897-1898) withinvokeAll(tasks, budgetMs, MILLISECONDS), so the fetch has one overall time budget across all workers, notnumWorkers × timeoutMs. This confirms the earlier "no unbounded growth / bounded resource" conclusion still holds on this exact head.JobMaster.getCurrJobMetrics(map, failOnIncompleteResult)(JobMaster.java:1101-1163region) is a genuineforloop overtaskGroupLocationMap.entrySet(), notforEach— confirmed by re-reading the loop body directly, not inferring from the commit message. Each ofTimeoutException/HazelcastInstanceNotActiveException/InterruptedException/ genericExceptionis handled twice: skip-and-warn forfailOnIncompleteResult=false(realtime), wrap-and-throwFinalMetricsCollectionExceptionforfailOnIncompleteResult=true(terminal). OnInterruptedExceptionthe realtime branch restores the flag and doesreturn metrics;immediately — the loop genuinely stops, it doesn't keep calling the remaining workers.savePipelineMetricsToHistory(JobMaster.java:1203-1215) callsgetFinalJobMetrics(...)first; if that throws,jobHistoryService.storeFinishedPipelineMetrics(...)andcleanTaskGroupContext(...)are never reached (they're strictly after, not in afinally), so a transient failure genuinely can't produce a persisted-partial-then-cleaned-context outcome. This is the core data-loss fix from my very first review, and it's still correct here.SubPlan.subPlanDone's retry predicate now matchesFinalMetricsCollectionExceptionspecifically instead of the previously-too-broadSeaTunnelEngineException, with the explanatory comment ("An incomplete final metrics snapshot leaves task-group context intact...") both @SEZ9 and I asked for, present atSubPlan.java:341-343.
One new, real finding — the only thing that changed since my last pass:
Issue 7: The very commit that fixed my previous Issue 6 introduces a Spotless formatting violation, and it is currently failing CI
- Location:
seatunnel-engine/seatunnel-engine-common/src/main/java/org/apache/seatunnel/engine/common/config/YamlSeaTunnelDomConfigProcessor.java:194-197(commitf127a13e0) - Problem description: the fix for Issue 6 is logically correct — it now calls
getLongValue(ServerConfigOptions.MasterServerConfigOptions.METRICS_FETCH_TIMEOUT_MS.key(), getTextContent(node))instead of rawLong.parseLong(...), exactly matching the pattern of every sibling option in this method. But the fully-qualifiedServerConfigOptions.MasterServerConfigOptions.METRICS_FETCH_TIMEOUT_MSreference on one line pushes past the AOSP/Google-Java-Format wrap width Spotless enforces here. I pulled the actual fork CI log for this exact head (run31631214924, jobRun / Code style,94230155022) rather than trusting the PR's own "git diff --checkpasses" claim (which only checks whitespace/EOL, not formatting):[ERROR] Failed to execute goal com.diffplug.spotless:spotless-maven-plugin:2.29.0:check (default-cli) on project seatunnel-engine-common: The following files had format violations: [ERROR] .../config/YamlSeaTunnelDomConfigProcessor.java [ERROR] @@ -200,7 +200,8 @@ ... [ERROR] -································ServerConfigOptions.MasterServerConfigOptions.METRICS_FETCH_TIMEOUT_MS [ERROR] +································ServerConfigOptions.MasterServerConfigOptions [ERROR] +········································.METRICS_FETCH_TIMEOUT_MS - Potential risk: this is purely cosmetic — no behavior difference — but it's currently the single thing keeping
Buildred on the fork (run31631214924):Code stylefails, and everyunit-test/ integration-test matrix leg isskippedas a direct consequence of that gate, so there is no CI signal at all right now forseatunnel-engine-server's test suite (including the twoJobMasterTestcases added by this PR) on this exact head. - Best improvement: run
./mvnw spotless:apply -pl seatunnel-engine/seatunnel-engine-common -am -nsu(or just apply the exact reformatting Spotless printed above) and push. This is a one-line, mechanical fix — I'd expect it to be green within one more push. - Severity: Medium (blocks the CI gate entirely right now, but is trivial and purely formatting — no source-logic risk)
- Raised by another reviewer: No — new finding, specific to commit
f127a13e0, which landed after everyone's prior review rounds.
Re-verifying everything from my last full review is still correct on this exact head (not re-reading my old notes, re-checking against f127a13e0 directly): all of Issues 1-6 from my two prior "Ready to merge" / earlier rounds remain fixed — MemberImpl mock types, config/seatunnel.yaml indentation, the YamlSeaTunnelDomConfigProcessor wiring (now additionally using getLongValue), the doubled Javadoc link, and the SubPlan retry comment are all present and correct in the diff I read directly above. No regressions besides Issue 7.
Runtime path (terminal/strict, unchanged by the last two commits, re-confirmed by direct read):
SubPlan.subPlanDone(pipelineStatus) SubPlan.java:308
-> RetryUtils.retryWithException(lambda, RetryMaterial(
retries = Constant.OPERATION_RETRY_TIME,
predicate = isOperationNeedRetryException(e) || e instanceof FinalMetricsCollectionException))
lambda:
jobMaster.savePipelineMetricsToHistory(pipelineLocation) JobMaster.java:1203-1215
-> getFinalJobMetrics(getTaskGroupLocationSlotProfileMap(...)) JobMaster.java:1205-1207
-> getCurrJobMetrics(map, failOnIncompleteResult=true) JobMaster.java:1101-1163
-> fetchTaskGroupMetrics(address, groups)
.get(engineConfig.getMetricsFetchTimeoutMs(), MS) JobMaster.java:~1189
-> any failure -> throw FinalMetricsCollectionException
-> only on success: jobHistoryService.storeFinishedPipelineMetrics(...) JobMaster.java:1211
-> only on success: cleanTaskGroupContext(pipelineLocation) JobMaster.java:1214
1.2 Compatibility Impact
Partially incompatible at the behavior level (unchanged assessment, still accurate): getRunningJobMetrics() moving from implicit fail-fast/unbounded to bounded best-effort/partial is a real, correctly-documented behavior change — both docs/en/introduction/concepts/incompatible-changes.md and the docs/zh equivalent describe it, including the Hazelcast-invocation-not-cancelled caveat. No REST/response-shape change (toJobMetricsMap / JobMetricsUtil.toJobMetrics untouched). metrics-fetch-timeout-ms is additive with a default equal to the previous hardcoded constant, and it works end-to-end (Issue 3 from my previous round, independently re-verified fixed with a real, passing CI test run at that time).
1.3 Performance / Side-Effect Analysis
No unbounded growth: getCurrJobMetrics's metrics list is touched only by the calling thread in a sequential loop; the realtime path's bounded thread pool and overall time budget are unchanged from prior verification. Repeating the one still-open, non-blocking follow-up from my last review: JobMaster.getCurrJobMetrics's terminal path bounds each worker call individually (.get(timeoutMs, ...) per address in the loop) rather than sharing one overall budget the way CoordinatorService.getRunningJobRawMetrics does via invokeAll(tasks, budgetMs, ...), so a many-worker pipeline's terminal snapshot can still cost numWorkers × timeoutMs, paid again on every retry. Not a blocker for typical worker-per-pipeline counts; worth the same executor-based treatment as a follow-up if that assumption stops holding.
1.4 Error Handling and Logging
Log levels remain appropriate (WARNING for skip-and-continue in the realtime path, no new ERROR/stack-trace spam), no sensitive data logged.
Issue 7 (see above): Location YamlSeaTunnelDomConfigProcessor.java:194-197, Problem description: Spotless formatting violation in the new getLongValue branch, Potential risk: currently keeps Build red and prevents any test signal for this head, Best improvement: mvn spotless:apply and push, Severity: Medium, Raised by another reviewer: No.
2. Code Quality Assessment
2.1 Coding Standards
New config-option plumbing (Constant.DEFAULT_METRICS_FETCH_TIMEOUT_MS, ServerConfigOptions.MasterServerConfigOptions.METRICS_FETCH_TIMEOUT_MS, EngineConfig#setMetricsFetchTimeoutMs with >0 validation) is clean, documented (withDescription(...)), and now correctly parsed via the same DomConfigHelper helper used by every sibling numeric option. FinalMetricsCollectionException and fetchTaskGroupMetrics both carry class/method-level Javadoc explaining purpose and constraints; fetchTaskGroupMetrics is @VisibleForTesting protected with a Javadoc note on its bounded semantics. Only gap is the Issue 7 formatting nit above, which is a tooling/CI-gate issue rather than a hand-written style problem.
2.2 Test Coverage and Test Stability
testFinalMetricsFailureDoesNotPersistPartialHistory(JobMasterTest.java) overridesfetchTaskGroupMetricsto throwTimeoutException, assertssavePipelineMetricsToHistorythrowsSeaTunnelEngineException, and assertsverifyNoInteractions(jobHistoryService)— this directly proves the original data-loss bug (partial results silently persisted, then context cleaned) can no longer happen. Good, precise regression coverage for the core fix.testRealtimeMetricsStopsAfterInterruptdrives two workers, both throwingInterruptedExceptionfrom the overridden fetch, and assertsfetchCount == 1(the loop genuinely stops after the first interrupt) plus that the thread's interrupt flag is set, withfinally { Thread.interrupted(); }to avoid leaking interrupt state into later tests in the same JVM — good hygiene, not flaky (order-independence doesn't matter here since either worker throwing immediately still givesfetchCount == 1).YamlSeaTunnelDomConfigProcessorTest#testParseMetricsFetchTimeoutis a focused regression test for the new config option, loading a dedicated fixture (engine-metrics-timeout.yaml) and asserting the parsed value.- Stability rating: Risk present — not because of anything wrong with the tests themselves (both
JobMasterTestadditions look deterministic and well-isolated on direct reading), but because there is currently no completed CI run that actually executes them on this head: Issue 7's Spotless failure gatesunit-testentirely (confirmedskippedfor every OS/JDK leg in run31631214924). The last time these exact tests are known to have run and passed in CI was on the previous head (68b31dc9/66f962ff, run31396252051,YamlSeaTunnelDomConfigProcessorTestconfirmed executing there per my last review's direct CI-log read) — butJobMasterTest's two new cases were never confirmed by a completed Ubuntuunit-testleg on any head in this thread's history (the Windows legs kept failing on unrelated flakes, and Ubuntu legs kept getting fail-fast-cancelled before reachingseatunnel-engine-server). Once Issue 7 is fixed and CI runs to completion, I'd like to see this confirmed directly rather than inferred from source review, purely because this exact module has round-tripped through several different compile/style failures across this PR's lifetime.
2.3 Documentation Updates
Both docs/en and docs/zh incompatible-changes entries are present, accurate, and structurally consistent with each other. The "configurable via metrics-fetch-timeout-ms" claim is true end-to-end (config → EngineConfig → both collection paths). No remaining doc/behavior mismatch found on this pass.
3. Architectural Soundness
3.1 Elegance of the Solution — Precise fix
The best-effort-vs-strict split via a boolean flag plus a dedicated FinalMetricsCollectionException, retried narrowly at the SubPlan level while preserving task-group context, is a clean, appropriately narrow fix for the original unbounded-blocking and data-loss issues. No design objections after five rounds of scrutiny from two independent reviewers.
3.2 Maintainability
Same standing note as before, now demonstrated concretely by this PR's own history: this codebase's config-option wiring requires three separate, unenforced hand-edits (Option definition, EngineConfig setter, YamlSeaTunnelDomConfigProcessor branch) plus getting the exact DomConfigHelper parsing pattern and Spotless formatting right — this PR needed several rounds to land all of that. YamlSeaTunnelDomConfigProcessorTest#testParseMetricsFetchTimeout is a good precedent for a standing regression-test pattern on future engine options; not something to hold this PR on.
3.3 Extensibility
No concerns. FinalMetricsCollectionException extending SeaTunnelEngineException and the failOnIncompleteResult split are both easy to extend if a third collection mode is ever needed.
3.4 Historical-Version Compatibility
No serialization formats, checkpoint/savepoint state, or wire protocols touched. metrics-fetch-timeout-ms is a new, additive, defaulted option — old configs without it behave identically to before. No upgrade-path or restore-compatibility concern.
4. Issue Summary
| Number | Issue | Location | Severity |
|---|---|---|---|
| 7 | Commit f127a13e0 (the fix for my previous Issue 6) introduces a Spotless formatting violation that is currently failing Code style CI and gating unit-test entirely |
YamlSeaTunnelDomConfigProcessor.java:194-197 |
Medium |
(Issues 1-6 from my previous review rounds are all independently re-verified fixed on this head, with no regressions besides Issue 7 — see section 1.1 above.)
5. Merge Recommendation
Conclusion: Ready to merge after fixes
-
Blockers — must be fixed:
- Issue 7: run
mvn spotless:applyonseatunnel-engine-commonand push. This is the only thing keeping CI red right now, and until it's fixed there is zero test-execution signal for this head'sseatunnel-engine-serverchanges (including the two newJobMasterTestcases), which I'd like confirmed by a completed green run before final merge.
- Issue 7: run
-
Recommended fixes — non-blocking:
- Once Issue 7 is fixed and CI reaches
unit-test, please confirm (or ping here) thatJobMasterTest#testFinalMetricsFailureDoesNotPersistPartialHistoryand#testRealtimeMetricsStopsAfterInterruptboth pass on a completed Ubuntu leg — these have never had a completed CI run in this PR's history, only my source-level verification. - Follow-up (not this PR, repeated from before): give
JobMaster.getCurrJobMetrics's terminal path a shared overall time budget across workers the same wayCoordinatorService.getRunningJobRawMetricsalready does, so a many-worker pipeline doesn't paynumWorkers × timeoutMsper retry. - Unrelated to this PR: the fork's
Run / Dead linksjob is also currently failing on this head, but on an unrelated pre-existing doc file (docs/en/connectors/changelog/connector-mqtt.mdlinkinghttps://github.com/apache/seatunnel/pull/10575, which returned HTTP 503 from GitHub itself at check time) — nothing this PR's diff touches. Not something to fix here; flagging only so it isn't confused with Issue 7 when re-checking CI.
- Once Issue 7 is fixed and CI reaches
Overall assessment: the metrics-bounding design has been correct in shape since early in this review thread, and every substantive correctness, compatibility, and documentation concern raised by either reviewer has been addressed and independently re-verified. This pass found exactly one new item, and it's the most mechanical kind of fix possible — a Spotless auto-format, introduced by the very commit that closed out the last open review comment. Once that's applied and CI goes green end to end, I have no remaining objection to merging this.
|
The fork run caught one more detail in the formatter output: it wants
|
DanielLeens
left a comment
There was a problem hiding this comment.
What Problem Does This PR Solve?
Quick note before the review body: there are still no unresolved inline review threads on this PR (pulls/11602/comments remains empty), and no new review from @SEZ9 has landed since their last pass, so there is nothing additional to fold in from Step 0/0.5 beyond what my last review already covered. This is a full fresh re-review of the current head (964747f), not a diff of my last review's notes.
- User pain point:
CoordinatorService.getRunningJobMetrics()andJobMaster.getCurrJobMetrics()used unbounded, serial per-worker.get()calls, so one slow or unreachable worker could block the whole running-job metrics path indefinitely (#11587). - Fix approach: the default running-jobs metrics path now delegates to the pre-existing bounded/concurrent raw-metrics fetcher (
getRunningJobRawMetrics, still unchanged by this PR) through a shared, configurablemetrics-fetch-timeout-msengine option (default 3s);JobMaster.getCurrJobMetrics(..., boolean failOnIncompleteResult)splits collection into a best-effort realtime mode (skip-and-log, short-circuits cleanly on interrupt) and a strict terminal mode (getFinalJobMetrics, all-or-nothing, retried through a dedicatedFinalMetricsCollectionException). - One-line summary: my previous Issue 7 (a Spotless formatting regression introduced by the
getLongValuefix) is genuinely fixed by the one commit that landed since my last pass,Code styleis now green on the fork, and this fresh full-diff trace finds no new source-level defects — but a real (and unrelated) Windows unit-test failure means there is still no completed green Ubuntuunit-testrun confirming the two newJobMasterTestcases on this exact head.
1. Code Change Review
1.1 Core Logic Analysis
Full fresh trace of the current head (964747f), re-reading every changed file via local checkout (git diff origin/dev...HEAD), not inferring from my prior notes:
- The only functional diff since my last pass is in
YamlSeaTunnelDomConfigProcessor.java:198-206: theMETRICS_FETCH_TIMEOUT_MSbranch now wraps.key()onto its own continuation line, exactly mirroring the siblingJOB_METRICS_PARTITION_COUNTbranch immediately above it. This is a pure formatting change with zero behavioral difference fromf127a13e0— confirmed by re-reading both the old and new hunks side by side, thegetLongValue(...)call and its arguments are byte-for-byte identical, only line-wrapping changed. Constant.DEFAULT_METRICS_FETCH_TIMEOUT_MS(3000L) remains the single source of the default;ServerConfigOptions.MasterServerConfigOptions.METRICS_FETCH_TIMEOUT_MS.defaultValue()references it,EngineConfig#metricsFetchTimeoutMsinitializes from it,EngineConfig#setMetricsFetchTimeoutMsvalidates> 0and throwsIllegalArgumentExceptionnaming the option key on violation — consistent with sibling numeric options.CoordinatorService.getRunningJobMetrics()(no-arg,CoordinatorService.java:1527-1528) callsgetRunningJobMetrics(runningJobMasterMap.keySet(), engineConfig.getMetricsFetchTimeoutMs(), null), which delegates togetRunningJobRawMetrics(...)(CoordinatorService.java:1579-1627, confirmed untouched by this PR's diff viagit diff). That method still uses the fixed-sizemetricsFetchExecutor(min(8, availableProcessors)daemon threads, constructed atCoordinatorService.java:239-247, shut down viashutdownNow()at cleanup) withinvokeAll(tasks, budgetMs, MILLISECONDS)— one overall time budget shared across all worker tasks in a single call, notnumWorkers x timeoutMs.invokeAll's documented contract cancels any task still incomplete when the budget elapses, so a call's worst-case footprint in the executor's queue is bounded by that call's ownaddresses.size()and clears out withinbudgetMsregardless of how many workers are slow — this still holds as "bounded, no runaway growth" on this exact head.JobMaster.getCurrJobMetrics(map, failOnIncompleteResult)(JobMaster.java:1101-1163region) is a genuine sequentialforloop overtaskGroupLocationMap.entrySet(). Each ofTimeoutException/HazelcastInstanceNotActiveException/InterruptedException/ genericExceptionis handled twice: skip-and-warn whenfailOnIncompleteResult=false(realtime), wrap-and-throwFinalMetricsCollectionExceptionwhenfailOnIncompleteResult=true(terminal).InterruptedExceptionrestores the interrupt flag and doesreturn metrics;immediately in the realtime branch — confirmed the loop genuinely stops rather than continuing to poll remaining workers.- The
metricslist in bothJobMaster.getCurrJobMetricsandCoordinatorService.getRunningJobRawMetricsis populated by a single calling thread only — in theJobMastercase via a plain sequential loop, in theCoordinatorServicecase via a sequential loop over completedFutures afterinvokeAllreturns (the actual worker calls run on the executor's own threads and communicate results back exclusively through their ownFuture, never through a shared mutable collection). I found no shared counters or maps being written from more than one thread anywhere in this diff — the "thread-safety of shared counters/maps" question raised for this re-review does not surface a real concern here, because the design deliberately avoids concurrent writers. savePipelineMetricsToHistory(JobMaster.java:1203-1215) callsgetFinalJobMetrics(...)first;jobHistoryService.storeFinishedPipelineMetrics(...)andcleanTaskGroupContext(...)are strictly after that call, not in afinally, so a transient failure still cannot produce a persisted-partial-then-cleaned-context outcome — the core data-loss fix from my first review round is intact.SubPlan.subPlanDone's retry predicate still matchesFinalMetricsCollectionExceptionspecifically (SubPlan.java:341-343), with the explanatory comment both @SEZ9 and I asked for early in this thread.
Runtime path (terminal/strict, unchanged by this commit, re-confirmed by direct read):
SubPlan.subPlanDone(pipelineStatus) SubPlan.java:308
-> RetryUtils.retryWithException(lambda, RetryMaterial(
retries = Constant.OPERATION_RETRY_TIME,
predicate = isOperationNeedRetryException(e) || e instanceof FinalMetricsCollectionException))
lambda:
jobMaster.savePipelineMetricsToHistory(pipelineLocation) JobMaster.java:1203-1215
-> getFinalJobMetrics(getTaskGroupLocationSlotProfileMap(...)) JobMaster.java:1205-1207
-> getCurrJobMetrics(map, failOnIncompleteResult=true) JobMaster.java:1101-1163
-> fetchTaskGroupMetrics(address, groups)
.get(engineConfig.getMetricsFetchTimeoutMs(), MS) JobMaster.java:~1189
-> any failure -> throw FinalMetricsCollectionException
-> only on success: jobHistoryService.storeFinishedPipelineMetrics(...) JobMaster.java:1211
-> only on success: cleanTaskGroupContext(pipelineLocation) JobMaster.java:1214
Issue 7 from my last review — verified fixed:
I pulled the actual fork CI check-run list for this exact head (964747f302de) via repos/tomatotomata/seatunnel/commits/{sha}/check-runs, not the PR's own claims. Run / Code style is now success. The reformatted branch in YamlSeaTunnelDomConfigProcessor.java matches the AOSP/Google-Java-Format shape Spotless previously rejected. Closing Issue 7.
One new finding, CI-only, not caused by this PR's diff:
Issue 8: unit-test (11, windows-latest) fails on this head, but the failure is in an unrelated, unmodified module
- Location:
seatunnel-api/src/test/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkWriterSchemaChangeBroadcastTest.java(testschemaChangeKeepsIOExceptionContractWhenWorkerAlreadyFailed), surfaced in fork run31666083472, job94341251540. - Problem description: I fetched the actual job log (not just the check-run summary). The Maven build fails during
seatunnel-api's surefire run withTests run: 383, Failures: 0, Errors: 1— ajava.lang.RuntimeException: java.io.IOException: boom-before-schema-entrythrown from inside that test method. This PR's diff (git diff origin/dev...HEAD --stat) touches onlyseatunnel-engine-common,seatunnel-engine-server,config/seatunnel.yaml, and the twodocs/*/incompatible-changes.mdfiles — it does not touchseatunnel-apior anything in themultitablesinkpackage at all, and the test in question is not new (not part of this diff). Because this failure happens early in the reactor (inseatunnel-api, upstream ofseatunnel-engine-*), the Windows build never reaches the module this PR actually changes, and the siblingunit-test (8, ubuntu-latest)/unit-test (11, ubuntu-latest)/unit-test (8, windows-latest)legs all showcancelled— almost certainly the matrix's fail-fast behavior, not their own failures. - Potential risk: none from this PR's own logic — this is a pre-existing/unrelated test in an untouched module, consistent with my previous review's note that "Windows legs kept failing on unrelated flakes" across this thread's history. But the practical consequence repeats from my last review: there is still no completed Ubuntu
unit-testrun on this exact head that exercisesJobMasterTest#testFinalMetricsFailureDoesNotPersistPartialHistoryand#testRealtimeMetricsStopsAfterInterrupt, orYamlSeaTunnelDomConfigProcessorTest#testParseMetricsFetchTimeout, to completion. - Best improvement: re-run the cancelled/failed jobs (a plain re-run, not a code change, should let the Ubuntu legs complete once the unrelated Windows flake clears or is independently triaged).
- Severity: Low (does not implicate this PR's diff; purely a CI-completion gap, and the module it fails in isn't touched by this change).
- Raised by another reviewer: No — new finding, specific to this head's CI run.
1.2 Compatibility Impact
Partially incompatible at the behavior level (unchanged assessment): getRunningJobMetrics() moving from implicit fail-fast/unbounded to bounded best-effort/partial is a real, correctly-documented behavior change in both docs/en and docs/zh incompatible-changes.md, including the caveat that the master-side wait bound does not cancel an already-submitted Hazelcast worker invocation. No REST/response-shape change. metrics-fetch-timeout-ms is additive with a default equal to the previous hardcoded constant.
1.3 Performance / Side-Effect Analysis
No unbounded growth confirmed again on this head: neither JobMaster.getCurrJobMetrics's local metrics list nor CoordinatorService.getRunningJobRawMetrics's bounded thread pool/overall time budget show any multi-threaded mutation. Repeating the one still-open, non-blocking follow-up from my last review: JobMaster.getCurrJobMetrics's terminal path bounds each worker call individually rather than sharing one overall budget the way CoordinatorService.getRunningJobRawMetrics does via invokeAll, so a many-worker pipeline's terminal snapshot can still cost numWorkers x timeoutMs, paid again on every retry. Not a blocker for typical worker-per-pipeline counts.
1.4 Error Handling and Logging
Log levels remain appropriate (WARNING for skip-and-continue in the realtime path), no sensitive data logged.
Issue 8 (see above): Location MultiTableSinkWriterSchemaChangeBroadcastTest.java (unrelated module), Problem description: unrelated Windows test failure blocking a completed unit-test signal on this head, Potential risk: none to this PR's own code, Best improvement: re-run the job, Severity: Low, Raised by another reviewer: No.
(Issues 1-7 from previous rounds all independently re-verified fixed on this head, with no regressions — see 1.1 above.)
2. Code Quality Assessment
2.1 Coding Standards
Config-option plumbing (Constant.DEFAULT_METRICS_FETCH_TIMEOUT_MS, ServerConfigOptions.MasterServerConfigOptions.METRICS_FETCH_TIMEOUT_MS, EngineConfig#setMetricsFetchTimeoutMs with >0 validation) is documented and now correctly formatted per Spotless. FinalMetricsCollectionException and fetchTaskGroupMetrics both carry Javadoc explaining purpose and constraints.
2.2 Test Coverage and Test Stability
testFinalMetricsFailureDoesNotPersistPartialHistoryoverridesfetchTaskGroupMetricsto throwTimeoutException, assertssavePipelineMetricsToHistorythrowsSeaTunnelEngineException, and assertsverifyNoInteractions(jobHistoryService)— directly proves the original data-loss bug can no longer happen.testRealtimeMetricsStopsAfterInterruptdrives two workers via aHashMap(iteration order not guaranteed), both throwingInterruptedExceptionfrom the overridden fetch, and assertsfetchCount == 1— order-independent since either worker throwing immediately still yieldsfetchCount == 1;finally { Thread.interrupted(); }prevents interrupt-state leakage into later tests in the same JVM.YamlSeaTunnelDomConfigProcessorTest#testParseMetricsFetchTimeoutis a focused regression test loading a dedicated fixture and asserting the parsed value.- Stability rating: Risk present — same rating as my last review, for the same underlying reason: there is still no completed Ubuntu
unit-testrun in this PR's entire history that has executedJobMasterTest's two new cases to completion (Issue 8 above is the latest instance of this pattern, this time via an unrelated Windows-side module failure triggering fail-fast cancellation of the Ubuntu legs). The tests themselves remain deterministic and well-isolated on direct reading; the gap is purely in CI completion, not in the tests' design.
2.3 Documentation Updates
Both docs/en and docs/zh incompatible-changes entries are present, accurate, and structurally consistent. No doc/behavior mismatch found.
3. Architectural Soundness
3.1 Elegance of the Solution — Precise fix
The best-effort-vs-strict split via a boolean flag plus a dedicated FinalMetricsCollectionException, retried narrowly at the SubPlan level while preserving task-group context, remains a clean, appropriately narrow fix. No design objections after six rounds of independent scrutiny across two reviewers.
3.2 Maintainability
No change from my last note: this codebase's config-option wiring requires three separate, unenforced hand-edits (Option definition, EngineConfig setter, YamlSeaTunnelDomConfigProcessor branch) plus exact DomConfigHelper/Spotless formatting — demonstrated concretely by this PR needing a dedicated follow-up commit just to fix the formatting of that third edit.
3.3 Extensibility
No concerns. FinalMetricsCollectionException extending SeaTunnelEngineException and the failOnIncompleteResult split are both easy to extend if a third collection mode is ever needed.
3.4 Historical-Version Compatibility
No serialization formats, checkpoint/savepoint state, or wire protocols touched. metrics-fetch-timeout-ms is a new, additive, defaulted option — old configs without it behave identically to before. No upgrade-path or restore-compatibility concern.
4. Issue Summary
| Number | Issue | Location | Severity |
|---|---|---|---|
| 8 | unit-test (11, windows-latest) fails on this head in an unrelated, unmodified module (seatunnel-api's MultiTableSinkWriterSchemaChangeBroadcastTest), which also fail-fast-cancels the Ubuntu legs before they can confirm the new JobMasterTest cases |
seatunnel-api/.../MultiTableSinkWriterSchemaChangeBroadcastTest.java |
Low |
(Issue 7 — the Spotless formatting regression from my last review — is confirmed fixed on this head: Run / Code style is success. Issues 1-6 from earlier rounds remain fixed with no regressions.)
5. Merge Recommendation
Conclusion: Ready to merge after fixes
- Blockers — must be fixed: none from this PR's own source. The only open item (Issue 8) is a CI-completion gap caused by an unrelated test in a module this PR does not touch; it should not require a source change in this PR, just a re-run.
- Recommended fixes — non-blocking:
- Re-run the failed/cancelled jobs on this head so a completed Ubuntu
unit-testleg confirmsJobMasterTest#testFinalMetricsFailureDoesNotPersistPartialHistory,#testRealtimeMetricsStopsAfterInterrupt, andYamlSeaTunnelDomConfigProcessorTest#testParseMetricsFetchTimeoutpass — these have still never had a completed CI run in this PR's history, only source-level verification across multiple reviewers. - Follow-up (not this PR, repeated from before): give
JobMaster.getCurrJobMetrics's terminal path a shared overall time budget across workers the same wayCoordinatorService.getRunningJobRawMetricsalready does.
- Re-run the failed/cancelled jobs on this head so a completed Ubuntu
Overall assessment: the metrics-bounding design has been correct in shape since early in this thread, and every substantive correctness, compatibility, and documentation concern raised across seven prior rounds by two independent reviewers is fixed and re-verified again here, including the formatting regression from my previous pass. This round's only finding is an unrelated CI flake in a module this PR doesn't touch — once that clears (or is confirmed unrelated by a maintainer and the job is re-run), I have no remaining objection to merging this.
|
Thanks @tomatotomata for describing the intended fix direction — the approach sounds reasonable to me. However, I don't see the corresponding code changes on this PR yet. Could you push the implementation (ideally with unit tests covering the transient-timeout case) so I can review the actual diff? Two housekeeping items:
Once the changes are pushed and CI is green, I'll take another look. Thanks! |
Signed-off-by: ahmadalguydi <ahmadalgaidy@hotmail.com>
Signed-off-by: ahmadalguydi <ahmadalgaidy@hotmail.com>
Signed-off-by: ahmadalguydi <ahmadalgaidy@hotmail.com>
c30188e to
736db3c
Compare
DanielLeens
left a comment
There was a problem hiding this comment.
What Problem Does This PR Solve?
Before this PR, CoordinatorService.getRunningJobMetrics() and JobMaster.getCurrJobMetrics() made unbounded, serial per-worker RPC calls, so one slow or unreachable worker could block master-side metrics collection indefinitely (#11587). The fix bounds collection with a configurable metrics-fetch-timeout-ms option, and splits it into a best-effort realtime path (used by observability/telemetry) and a strict terminal path (getFinalJobMetrics, used once per pipeline when persisting finished-pipeline history).
This is a fresh, complete re-review of the current head (736db3cf6), triggered by a new commit landing since my last review at c30188e0fb (2026-09-17, COMMENTED). I re-read the full diff against dev from scratch, re-traced the bounded-metrics runtime path end to end (CoordinatorService fan-out/timeout, JobMaster realtime vs. terminal split, SubPlan.subPlanDone's retry predicate), and re-verified the "does bounding actually prevent unbounded memory growth without silently dropping metrics needed by monitoring" question that matters most for a change like this.
What changed in this commit
I diffed c30188e0fb against 736db3cf6 directly (git diff <old>..<new>) and also diffed each of them against their respective merge-bases with dev. The PR's own diff is byte-for-byte identical between the two heads — every hunk in git diff <old-merge-base>..c30188e0fb matches git diff <new-merge-base>..736db3cf6 line-for-line; the only differences are blob hashes and hunk line-offsets caused by unrelated upstream dev commits landing in between (docs, workflows, other connectors). In other words: this commit is exactly the rebase onto current dev that both @SEZ9 and I asked for as the final gate in the previous round — not a functional change. behind_by is now 0 (confirmed via the compare API), matching that expectation.
Given that, no re-litigation of already-resolved rounds is needed, but I did re-verify from source (not from memory of the prior thread) that the rebase didn't disturb anything in JobMaster/CoordinatorService, per what I told the author I'd check once this landed.
1. Code Change Review
1.1 Core Logic Analysis
Re-confirmed the full bounded-collection architecture from current source, not from the prior review's notes:
CoordinatorService.getRunningJobRawMetrics(CoordinatorService.java:1712) fans out oneCallableper worker address to a fixed-size poolmetricsFetchExecutor(min(8, availableProcessors)daemon threads,CoordinatorService.java:259-267) and bounds the whole batch withmetricsFetchExecutor.invokeAll(tasks, budgetMs, TimeUnit.MILLISECONDS)(line 1740).invokeAll's own timeout cancels not-yet-started and still-running tasks once the budget elapses, so wall-clock time is bounded bybudgetMsregardless of cluster size.- Each per-worker task additionally self-bounds via
.get(timeoutMs, TimeUnit.MILLISECONDS)infetchRawMetricsFromWorker(line 1806), and correctly restores the interrupt flag (Thread.currentThread().interrupt()) rather than swallowingInterruptedException, so a cancelled pool thread frees up promptly instead of being pinned. - Memory-growth check: the
tasks/futures/metricslists are all sized toaddresses.size()(proportional to cluster size) and are allocated fresh per call, not accumulated across calls — there is no cache or unbounded collection here. The realtime poller usesscheduleWithFixedDelayand calls this method synchronously, so it cannot pipeline overlapping invocations against itself, which keeps the shared executor's queue depth bounded for that caller. I don't see a structural unbounded-memory-growth path in this design. JobMaster.getCurrJobMetrics(..., failOnIncompleteResult)(JobMaster.java:1179-1256) correctly implements the two-tier semantic split: the realtime path (failOnIncompleteResult=false) logs and skips a timed-out/unreachable/interrupted worker and keeps going (except it correctly stops early onInterruptedExceptionrather than continuing to poll remaining workers — verified bytestRealtimeMetricsStopsAfterInterrupt, which assertsfetchCount == 1for two configured workers). The terminal path (failOnIncompleteResult=true, used only bygetFinalJobMetrics→savePipelineMetricsToHistory) throwsFinalMetricsCollectionExceptionon timeout/RPC failure/interrupt instead of persisting a partial snapshot, except when a worker has already left the cluster (getMember(address) == null), which is correctly treated as unrecoverable-by-retry and skipped rather than retried forever.- Traced the consumer of that exception:
SubPlan.subPlanDone(SubPlan.java:310-345) wrapssavePipelineMetricsToHistoryinRetryUtils.retryWithExceptionwith a predicate that now also matchesFinalMetricsCollectionException(SubPlan.java:333-338), bounded by the existingConstant.OPERATION_RETRY_TIME(30) ×OPERATION_RETRY_SLEEP(2000ms) budget — i.e. at most ~60s of bounded retry, not an infinite loop, before falling through to thecatch (Exception e) { log.warn(...) }path. This directly answers the "does the fix silently drop metrics needed by monitoring/history consumers" question: it does not — a transient failure now aborts the entire cleanup-and-metrics-save step and retries it as a unit (soremoveMetricsContext/checkpoint notification/resource release are correctly deferred to a successful retry, not run against a partial metrics snapshot), and this is directly asserted bytestFinalMetricsFailureDoesNotPersistPartialHistory'sverifyNoInteractions(jobHistoryService). CoordinatorService.shutdown()(line 2024-2038) callsmetricsFetchExecutor.shutdownNow()alongside the other executors, so there's no thread/pool leak on master shutdown.
I found no correctness or lifecycle regression introduced by the rebase, and no new issue in the (unchanged) core logic on this fresh pass.
1.2 Compatibility Impact
Partially incompatible at the behavior level, clearly and accurately disclosed: getRunningJobMetrics() moves from fail-fast/unbounded to bounded best-effort (default 3000ms, same value the code previously hardcoded as its .get() behavior had no timeout at all before, now explicit and configurable). No wire/API/config-schema break; metrics-fetch-timeout-ms is additive and validates > 0 in EngineConfig.setMetricsFetchTimeoutMs. docs/en and docs/zh incompatible-changes.md entries match the code exactly, including the caveat that the master-side bound does not cancel an already-submitted Hazelcast worker invocation.
1.3 Performance / Side-Effect Analysis
No change from the prior round (this commit is a rebase). Re-confirming for the production-scale bar this project holds engine changes to: the fixed-size fetch pool plus overall-batch timeout means a cluster with hundreds of workers no longer costs the master N × timeout per collection cycle, and per-task self-timeout plus proper interrupt propagation keeps pool threads from being pinned beyond the budget. The one caveat carried forward from before (not a new finding): an abandoned worker RPC keeps running server-side after the master gives up waiting, which is disclosed in the compatibility doc rather than hidden, and is not something this round changes.
1.4 Error Handling and Logging
Every failure branch (timeout, departed worker, HazelcastInstanceNotActiveException, interrupt, generic exception) logs with worker address/task-group context at an appropriate level (warning), and the terminal path additionally fails loudly via a typed exception rather than swallowing the problem. No sensitive data logged, no System.out.println.
2. Code Quality Assessment
2.1 Coding Standards
New public/protected surface (getRunningJobRawMetrics, fetchRawMetricsFromWorker, fetchTaskGroupMetrics, getFinalJobMetrics, FinalMetricsCollectionException) carries Javadoc explaining the best-effort vs. fail-fast contract, which is exactly the kind of "why", not "what", comment this project's non-trivial methods need. No formatting issues found.
2.2 Test Coverage and Test Stability
Stability rating: Risk present (unchanged from the prior round, carried for the same reason): SplitClusterFaultToleranceIT.testStreamJobCancelResolvesWhenWorkerCrashesBeforeCancelAck remains @Disabled("Pre-existing dev failure tracked in #12353") (SplitClusterFaultToleranceIT.java:373). I re-verified this is legitimate and not a coverage-dodge: it's scoped to one test method, carries a tracking-issue link, the issue documents reproduction on unmodified dev as well as PR head, and my own source trace (this round and last) confirms the failure lives in SubPlan.getPipelineEndState()/addPhysicalVertexCallBack(), code no round of this PR has ever touched. It is a real, narrow coverage gap for the worker-crashes-mid-cancel scenario until #12353 lands — not a "High risk" pattern (no broadened tolerance, no whole-class skip, no silent drop).
The three JobMasterTest cases (testFinalMetricsFailureDoesNotPersistPartialHistory, testFinalMetricsSkipsDepartedWorker, testRealtimeMetricsStopsAfterInterrupt) are deterministic, mock-based, and directly assert the behaviors that matter most here (no hard sleeps, no shared mutable static state, no order dependence). One non-blocking gap I'll flag for completeness: there's no direct unit test exercising CoordinatorService.getRunningJobRawMetrics's invokeAll-based overall-budget bounding itself (only its collectRunningWorkerAddresses helper is directly unit-tested); the bounding behavior is exercised indirectly through the JobMaster-level tests and through live e2e/CI runs rather than a focused unit test of the CoordinatorService fan-out path. See Issue 2.
2.3 Documentation Updates
docs/en and docs/zh incompatible-changes.md are both present, accurate, and consistent with each other and with the code (verified the exact wording matches the actual default and config key). No further documentation changes needed for this round's rebase-only commit.
3. Architectural Soundness
3.1 Elegance of the Solution
Precise fix, not a workaround: the realtime-vs-terminal split correctly separates "must never block observability" from "must never silently persist partial history," and the bounded-executor-plus-per-task-timeout combination is the right shape for the stated production scale.
3.2 Maintainability
Good — the new methods are small, single-purpose, and the retry predicate change in SubPlan.java carries an explanatory comment about why FinalMetricsCollectionException is retry-eligible.
3.3 Extensibility
Unchanged from prior assessment; no concerns.
3.4 Historical-Version Compatibility
No serialization, checkpoint/savepoint, or wire-protocol change in this PR. metrics-fetch-timeout-ms is additive and defaulted, so upgrading from a release without this option requires no migration.
4. Issue Summary
| No. | Issue | Location | Severity | Raised by another reviewer |
|---|---|---|---|---|
| 1 | SplitClusterFaultToleranceIT.testStreamJobCancelResolvesWhenWorkerCrashesBeforeCancelAck remains disabled pending #12353 — a real, narrow coverage loss for the worker-crashes-mid-cancel scenario, confirmed pre-existing on dev and unrelated to this PR's diff. |
SplitClusterFaultToleranceIT.java:373; issue #12353 |
Low (tracked, justified, out of this PR's scope) | No |
| 2 | No focused unit test directly exercises CoordinatorService.getRunningJobRawMetrics's invokeAll-based overall-budget bounding (only collectRunningWorkerAddresses is directly unit-tested at that layer); coverage of the bounding behavior currently relies on JobMaster-level tests and e2e/CI. |
CoordinatorService.java:1712 |
Low, non-blocking | No |
| 3 | Fork CI for this exact rebased head (736db3cf6) was still queued/had not started at check time, so there is no fresh green run to point to yet for the head that would actually be merged. |
Fork tomatotomata/seatunnel runs 35330018665/35330084555 |
Informational, CI-only | No |
No source-level defects found in this PR's own diff on this pass — this commit is a rebase, and I independently re-verified the previously-reviewed logic still holds on the new head rather than assuming it does.
5. Merge Recommendation
Conclusion: Ready to merge after fixes
- Blockers — must be fixed: None at the source level. This is exactly the rebase both @SEZ9 and I asked for as the last remaining gate, and it introduces no functional change (diff content is identical to the previously-reviewed
c30188e0fb). - Recommended fixes — non-blocking:
- Let the fork's CI finish on
736db3cf6and confirmengine-v2-itis still clean with only the single linked skip (#12353) — this is the one thing that hasn't been directly re-confirmed yet, since CI for this exact head was still queued at check time. - Once #12353 lands upstream, re-enable
testStreamJobCancelResolvesWhenWorkerCrashesBeforeCancelAck(already tracked by the issue link). - Consider a small dedicated unit test for
CoordinatorService.getRunningJobRawMetrics's overall-budget bounding (Issue 2) — nice-to-have, not blocking, given the behavior is already covered indirectly.
- Let the fork's CI finish on
Overall assessment: After re-tracing the entire bounded-metrics path from scratch on the current head — the fixed-pool sizing, the overall-batch timeout via invokeAll, per-task self-timeout with correct interrupt handling, the realtime/terminal semantic split, the bounded retry on FinalMetricsCollectionException, and executor shutdown on master teardown — I found no unbounded-memory-growth path and no case where the terminal/history path silently drops metrics a monitoring consumer would need (it fails loudly and retries instead). This commit itself changes nothing functionally; it is the rebase that was the sole remaining ask. Once CI confirms green on this exact head, I have no further source-level objection.
🤖 Generated with Claude Code
|
Updated to Scoped formatting and independent source review passed. Current-head functional CI remains pending. The verified Backpressure checkpoint-lock dependency is being repaired in #12316, and historical connector failures still require new-head CI; no workload/assertion weakening or blind rerun was used. |
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for the persistence on this one! I went through the full diff again. The head moved from 736db3cf (my last review) to e25b3354, a merge of current dev (the PR is now 0 commits behind dev and has no conflicts) that also removes the PR-only E2E skip and adds metrics-specific coverage. I re-verified the full diff and call chain against the new head instead of reusing my earlier conclusions.
What Problem Does This PR Solve?
User pain point (#11587): CoordinatorService.getRunningJobMetrics() and JobMaster.getCurrJobMetrics() issued unbounded, serial per-worker RPCs, so one slow or unreachable worker could stall master-side metrics collection (REST, telemetry, pipeline-finish history).
Fix approach: Bound realtime collection with a configurable metrics-fetch-timeout-ms (default 3000), fan out through the existing bounded metricsFetchExecutor with an overall invokeAll budget, and split JobMaster collection into a best-effort realtime path and a strict terminal path (FinalMetricsCollectionException, retried in SubPlan.subPlanDone, departed members skipped).
One-sentence summary: Realtime metrics become bounded and partial-tolerant, while terminal history stays complete or is retried rather than silently truncated.
1. Code Change Review
1.1 Core Logic Analysis
Runtime path (re-read at the new head):
REST/telemetry -> CoordinatorService.getRunningJobMetrics()
-> getRunningJobMetrics(ids, engineConfig.getMetricsFetchTimeoutMs(), null)
-> getRunningJobRawMetrics: one Callable per worker -> metricsFetchExecutor.invokeAll(tasks, budgetMs)
per task: fetchRawMetricsFromWorker -> future.get(timeoutMs); timeout/inactive/other -> warn + null (omitted)
-> partial map merged with job history
Pipeline end -> SubPlan.subPlanDone
-> RetryUtils.retryWithException { enqueuePipelineCleanupIfNeeded; savePipelineMetricsToHistory;
removeMetricsContext; notifyCheckpointManager; releasePipelineResource }
savePipelineMetricsToHistory -> getFinalJobMetrics -> getCurrJobMetrics(map, failOnIncompleteResult=true)
member left cluster -> warn + skip (retry cannot recover it)
timeout/inactive/RPC err -> FinalMetricsCollectionException -> retried (predicate in SubPlan)
interrupt -> interrupt flag restored; realtime returns partial list, terminal throws
Key points verified:
CoordinatorService.java:1727-1780: the executor is a fixed pool (min(8, cores)daemon threads, already present on dev), the whole batch is bounded byinvokeAll(..., budgetMs), and each task also self-bounds withfuture.get(timeoutMs).budgetMs == 0returns empty. Collections are sized by worker count and allocated per call, so there is no unbounded growth path.JobMaster.java:1170-1285: realtime skips and logs failed workers and stops early on interrupt (flag restored); terminal never persists a partial snapshot except for departed members.fetchTaskGroupMetricsis the single bounded RPC helper shared by both paths.SubPlan.java:326-338: the retry predicate now includesFinalMetricsCollectionException; retry budget is the existingOPERATION_RETRY_TIME=30xOPERATION_RETRY_SLEEP=2000ms. This runs on the pipeline-completion path, not the realtime path.EngineConfig#setMetricsFetchTimeoutMsrejects values<= 0;YamlSeaTunnelDomConfigProcessorparses it; both shippedseatunnel.yamlfiles carry the default.- Changes since my last review: the dev merge, removal of the
@Disabled/skip fortestStreamJobCancelResolvesWhenWorkerCrashesBeforeCancelAck(a plus: no test weakening remains), and new coverage inClusterFailureNoRestoreIT(public running metrics from healthy workers, terminal persistence with a departed worker, client summary equals stored sums) plusJobMasterTestcases for terminal timeout (no partial history), departed worker (empty snapshot stored, no RPC), and interrupt (stops after first worker).
Normal-path check: a plain REST metrics request, telemetry polling, and every pipeline completion all pass through the changed code, so the fix targets the main path, not only a failure edge.
1.2 Compatibility Impact
Partially incompatible (behavior change, documented). No serialization, checkpoint, or state format changes. The new option has a default, so existing seatunnel.yaml files keep working. Behavior change: the default running-job metrics query may now return partial data after 3 seconds instead of blocking or failing. This is documented in incompatible-changes.md (en and zh) with the guidance that missing worker metrics must be treated as unavailable, not zero.
1.3 Performance / Side-Effect Analysis
Positive: master-side wait is bounded for realtime callers. Note the bound limits the master wait only; the Hazelcast invocation itself is not cancelled (documented in the option description and the compatibility note). Terminal collection with a slow but alive worker can now spend up to roughly 30 x (3s + 2s) in subPlanDone; this is the existing retry budget and runs off the realtime path, so I consider it acceptable.
1.4 Error Handling and Logging
- Issue 1 (Low, non-blocking): when the terminal retry budget is exhausted for a slow but alive worker, the lambda has thrown before
notifyCheckpointManagerPipelineEnd/releasePipelineResource, and the outer catch only logs a warning. The same early-abort behavior existed before this PR (the old code threw on any RPC failure), so this is not a regression, but a follow-up could move resource release into afinally-style step. Not required here.
2. Code Quality Assessment
2.1 Coding Standards
Good: new core methods (getCurrJobMetrics overloads, getFinalJobMetrics, fetchTaskGroupMetrics, FinalMetricsCollectionException, the new option and constant) carry explanatory Javadoc covering why and the partial/complete contract. No wildcard imports, ASF headers present on the new YAML test resource.
2.2 Test Coverage and Test Stability
Rating: Stable. JobMasterTest.java new cases are deterministic mock-based tests with no sleeps or fixed ports; the interrupt test clears the thread flag in finally. YamlSeaTunnelDomConfigProcessorTest covers option parsing. ClusterFailureNoRestoreIT uses Awaitility with explicit timeouts rather than sleeps. Nothing was weakened versus dev; the previous PR-only skip is gone. One caution: the restored SplitClusterFaultToleranceIT.testStreamJobCancelResolvesWhenWorkerCrashesBeforeCancelAck fails on plain dev until the engine fix (#12311) merges, so a red result there is not attributable to this PR.
2.3 Documentation Updates
docs/en and docs/zh incompatible-changes.md are both updated. Optional Low suggestion (Issue 2): list metrics-fetch-timeout-ms next to job-metrics-partition-count in the Zeta deployment docs so operators can find the knob.
3. Architectural Soundness
3.1 Elegance
Precise fix, with one clearly named seam (fetchTaskGroupMetrics) shared by both modes.
3.2 Maintainability
Good: the realtime/terminal split is explicit in method names and Javadoc.
3.3 Extensibility
The shared timeout option and helper make later per-call overrides straightforward.
3.4 Historical-Version Compatibility
Rolling upgrade safe: no wire or IMap format changes; the option defaults to the previous effective behavior bound of 3s only for the master-side wait.
4. Issue Summary
| Number | Issue | Location | Severity |
|---|---|---|---|
| 1 | Resource release skipped when terminal metrics retries are exhausted (pre-existing behavior) | SubPlan.java:310-345 |
Low |
| 2 | New option not listed in Zeta deployment docs | docs/en/engines/zeta/*-deployment.md |
Low |
5. Merge Recommendation
Conclusion: Ready to merge after fixes
Blockers (must fix):
- CI has not run on this head. The fork shows no workflow run for
e25b3354, and the apache-sidePR signalrun (https://github.com/apache/seatunnel/actions/runs/40168025208) isaction_required. Please make sure Actions are enabled on the fork and trigger a run on this head; the functional result is the only remaining gate from my side.
Recommended fixes (non-blocking): Issues 1 and 2 above.
Overall assessment: I re-traced the bounded collection path, the terminal retry path, config parsing, and the new tests, and found no source-level blockers; the earlier non-CI blockers remain resolved. If the restored cancellation IT fails for the known dev-level reason, please point to #12311 rather than re-skipping it. This review is by code reading only; nothing was executed locally.
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for the update. I re-read all fifteen changed files and traced live collection, terminal persistence, cleanup and the worker-loss IT. The strict terminal boundary remains intact, the old PR-only cancellation-test disable is absent, and the new IT checks actual persisted/client metrics. Sorry for overstating the timeout scope in my earlier review: the per-job JobMaster path is bounded per worker, not by one overall 3-second deadline. Issue 4 is the corresponding documentation correction, not a newly introduced regression.
What problem this PR solves
- User pain: One slow worker can block master-side metrics retrieval indefinitely; making that retrieval best effort must not silently persist a failed partial terminal snapshot.
- Fix approach: Use the concurrent overall-budget fetcher for all-jobs queries, bounded per-worker calls for JobMaster, configurable timeout/partial-result notes and a dedicated retryable terminal collection exception.
- One-line summary: Bound metrics waits while preserving the distinction between live partial telemetry and terminal history persistence.
Example: An all-jobs scrape can return healthy-worker metrics after its budget expires. A still-active worker timing out during final history collection prevents persistence/context removal for that attempt; a member already gone is omitted because its metrics cannot be recovered.
1. Code-change review
1.1 Core logic analysis
Fifteen files, +526/-107: metrics paths, lifecycle retry, validated engine option/YAML parsing, UT/IT and EN/ZH behavior-change notes. The complete target-relative diff was read at e25b3354e65afa6dec118820cb187f87f24a2a72, not just the latest commit. Production metrics/lifecycle behavior with additive engine configuration and regressions.
Before / after:
Before: no-arg all-jobs and JobMaster collectors can wait indefinitely
After: all-jobs -> concurrent invokeAll with overall configured budget
per-job JobMaster -> sequential worker RPCs, each with configured timeout
live failure -> contextual warning/partial result; interrupt -> stop and restore flag
final failure -> FinalMetricsCollectionException -> bounded cleanup retry
departed member -> omit -> persist surviving snapshot
save history BEFORE cleanTaskGroupContext
Complete relevant execution chain:
REST/telemetry all-jobs -> CoordinatorService.getRunningJobMetrics():1675-1678
-> getRunningJobRawMetrics():1734 onward -> fixed metrics executor/invokeAll
-> per-worker fetch -> toJobMetricsMap -> merge history
Single-job REST BaseService:396 -> CoordinatorService.getJobMetrics():1653-1666
-> JobMaster.getCurrJobMetrics -> group task locations by address
-> sequential loop:1182-1257 -> fetchTaskGroupMetrics():1262-1271
-> GetTaskGroupMetricsOperation.get(configured timeout) PER worker
Pipeline completion -> SubPlan.subPlanDone():313-348
-> enqueue cleanup record -> savePipelineMetricsToHistory():1289-1300
-> strict final collector -> if active fetch fails, throw dedicated exception
-> retry before history/context/resource cleanup; otherwise store under metricsLock
-> cleanTaskGroupContext -> metrics/checkpoint notifications/resource release
Yaml builder -> DomConfigProcessor getLongValue -> EngineConfig positive validation
ClusterFailureNoRestoreIT -> healthy live metrics -> remove worker -> terminal store
-> public client summary reconciled against the surviving persisted measurements
Key findings:
- +1 to @SEZ9's realtime/final distinction: active-member fetch errors abort final persistence, while live callers receive best-effort data and interruption stops further RPC setup.
- Departed workers are explicitly omitted instead of exhausting retries against a member that cannot respond. No claim of complete lost-worker counts is made.
- The option is a shared Option/default, parsed from YAML with positive validation; the earlier duplicated hardcoded constant issue is closed.
- The two collection entry points have different budget scopes. The all-jobs helper has an overall invokeAll bound, while the per-job loop can take N times the configured worker timeout.
- Terminal retry time includes worker waits in addition to retry sleep; my earlier approximately-60-second total statement counted only the delay and was inaccurate.
Community context: The latest formal @SEZ9 Review is COMMENTED, and subsequent discussion supports the dedicated exception, departed-member handling, configurable timeout, interrupt return and documented partial semantics. Those earlier findings are resolved and are not duplicated as new Daniel issue numbers. A historical @davidzollo review explicitly says it was posted under the wrong identity and should be disregarded; it is not current merge approval.
1.2 Compatibility impact
Partially incompatible response semantics, documented. Live retrieval can succeed with missing worker data where it previously failed or blocked. Response/state formats and existing keys remain; the positive metrics-fetch-timeout-ms option is additive with default 3000. Monitoring consumers must treat missing measurements as unavailable. Clarify which paths use an overall versus per-worker budget (Issue 4). Underlying Hazelcast calls are not cancelled merely because the master stops waiting.
1.3 Performance / side effects
The all-jobs helper reuses a bounded-width executor and an overall batch timeout; per-job collection remains sequential. A per-job request may wait approximately workers times timeout; terminal retries add further waits and retry delay. The change reduces indefinite waits but does not impose one universal REST deadline. Task/future allocations remain proportional to workers. Underlying submitted worker invocations retain Hazelcast's own lifetime. History is saved before context cleanup, with the existing durable cleanup record established first.
1.4 Error handling and logging
Dedicated FinalMetricsCollectionException avoids retrying every unrelated engine exception. Worker/task identifiers and timeout scope appear in warnings; interruption is restored and returns immediately on realtime paths. Terminal failure prevents history writes for that attempt, verified through the public save method. No new secret logging or success-on-fetch-failure is introduced.
Issue 4: Distinguish overall and per-worker metrics timeout scopes in the operator notes
- Location:
docs/en/introduction/concepts/incompatible-changes.md:320-323; matching ZH entry; relatedServerConfigOptions.METRICS_FETCH_TIMEOUT_MSdescription. - Problem: The notes broadly describe running-job REST/telemetry queries as waiting up to three seconds. CoordinatorService's all-jobs helper has that overall budget, but the normal single-job path delegates to JobMaster's sequential loop, which gives each worker the full configured timeout.
- Risk: Operators can plan an incorrect REST/request/shutdown budget: multiple slow active workers can make a per-job query take multiples of three seconds. Terminal retry duration likewise includes fetch waits, not only the retry sleep.
- Best fix: Document the overall all-jobs budget and per-worker JobMaster budget separately in EN/ZH and the option description. Alternatively, deliberately implement/test an overall deadline for the latter path; documentation clarification is the smaller change for the current design.
- Severity: Medium, required contract clarification. Raised by another reviewer: Related to @SEZ9's timeout/partial-contract discussion; this specifies the two actual call chains. Earlier-review omission acknowledged above.
2. Code-quality assessment
2.1 Code conventions
New exception/fetch/lifecycle methods have contract comments and VisibleForTesting where appropriate; YAML config validation is consistent. Consider a short comment on the extracted slot-to-address helper as non-blocking maintainability work. Scoped whitespace check is clean. The scoped whitespace check produced no entries.
2.2 Test coverage and stability
Stability rating: Stable for the new assertions. JobMasterTest:337-533 uses isolated mocks and injected exceptions rather than wall-clock sleeps; it verifies no history interaction after a final timeout, no departed-member RPC, and one fetch after interruption with test-runner interrupt cleanup. YAML parsing uses a fixed fixture and closes the stream. No local build, unit/integration test, container or service was run. ClusterFailureNoRestoreIT:143-220 waits for healthy source metrics, worker loss and terminal persistence using Awaitility, then compares the public summary with surviving stored measurements. The original finally closes clients and both nodes. It does not expect counts from the intentionally lost worker. A focused all-jobs overall-budget test remains the prior non-blocking coverage suggestion; no local runtime tests were run.
A fresh lookup returned no matching workflow run for e25b335 in the contributor fork. Old queued/failed builds are not this head's result. Start/approve the required current-head CI and inspect the engine metrics/history cases. The author identifies Backpressure checkpoint-lock work in #12316; that PR is still open, so the candidate fix is not established as part of latest dev and a blind sync is not a demonstrated cure. There is no current-head failed lane to attribute yet, and no evidence to label Actions disabled.
2.3 Documentation
EN/ZH behavior-change notes and both YAML defaults agree on the option/default and partial semantics. Clarify the two timing scopes in Issue 4. No checkpoint serialization migration is needed.
3. Architectural soundness
3.1 Solution quality
A focused two-contract design: best-effort live telemetry and failure-aware terminal persistence. Keep those boundaries separate rather than using the partial live snapshot for history.
3.2 Maintainability
The public terminal persistence test and real worker-departure reconciliation strengthen lifecycle coverage. Keep retry duration and capability claims precise.
3.3 Extensibility
An explicit response completeness field remains a separate API design discussion, as already agreed with SEZ9; it is not newly required by this review.
3.4 Historical compatibility
Serialized metrics/state formats are unchanged; consumers must adapt to partial successful live responses and the documented timing scope.
4. Findings summary
| Number | Finding | Location | Severity |
|---|---|---|---|
| 4 | Overall versus per-worker budget is not distinguished | EN/ZH incompatible-changes metrics entry | Medium, required |
Previous disabled-test Issue 1 is closed in the current diff; prior Issue 2 focused fan-out test remains optional. Earlier CI references do not apply to this head.
5. Merge conclusion
Conclusion: Can merge after fixes
- Blocking items: Clarify Issue 4, obtain required current-head CI and effective maintainer approval. No remaining demonstrated metrics-persistence logic blocker was found.
- Non-blocking recommendations: Retain the prior focused fan-out-budget test suggestion and optionally document the extracted address-mapping helper. Do not weaken the worker-loss/backpressure assertions or patch unrelated connectors to chase old CI.
The bounded-fetch and terminal persistence boundaries are sound for their stated per-path scopes. The remaining required delivery change is to make the operator timing contract accurately reflect those paths.
Compare against dev: ahead, ahead 20 / behind 0, merge conflict=False. Drift is recorded independently; it does not itself justify a sync-first comment without an unrelated CI failure.
Daniel has READ permission. This COMMENT is a technical assessment, not an effective write-level approval. A write-capable maintainer must confirm repository gates and supply the effective approval.
Local evidence: exact-head fetch/checkout on seatunnel-review-11602, complete diff and source call-chain reads cited above. No runtime verification was claimed.
|
Thanks for the contribution. The CI fact cited in my previous conclusion has changed; this follow-up updates that gate on the unchanged reviewed head, without issuing another full source review. Gate snapshot (2026-10-28T15:59:11+00:00), head The exact blocking stage is Build workflow-run detection: the check says no fork Build was found for this SHA. This is not an executed test failure and does not by itself prove that fork Actions is disabled. Open the fork Actions tab, enable workflows if needed, then manually run the existing Build workflow for this PR branch. If a matching run already exists, link it for a maintainer to reconcile the aggregate. No empty commit or speculative dependency change is requested. Upstream check: current dev retains the fork-run adoption workflow and its scheduled/manual status-refresh path. A base sync alone cannot enable fork Actions or supply a missing exact-head workflow run, so I am not prescribing sync as the fix for this activation gate. My previous source conclusion remains unchanged, including its independent source/documentation requests. CI is not being passed by inference, and this follow-up is not an effective approval. Comparison recorded in this scan: base |
|
Thanks for the follow-up. A quick note on where things stand from my side. CI gate As of my last check, Build on head What would help:
No empty commit or dependency change is needed for this; a run on the unchanged head is what is missing. Source review My previous source conclusion still stands as written, including the documentation correction noted there (the per-job JobMaster path is bounded per worker, not by one overall deadline). Nothing new is being raised on the code in this comment. Once a fork Build run exists for |
|
Thanks @SEZ9; that matches my current source conclusion. The per-job JobMaster documentation correction remains open: the bound is per worker rather than one overall deadline. The unchanged head does not resolve that request. The separate current Build discovery/action gate still needs an exact-head fork workflow run; enable workflows only if the fork actually shows them disabled, otherwise start/link the existing Build. No unrelated source or dependency change is requested merely to activate CI. Checked 2026-10-29T17:14:19+00:00; head Comparison: base Daniel has READ repository permission. This is a discussion/CI clarification, not a new complete source review, an effective APPROVED event or dismissal of historical requested changes. A write-capable maintainer must perform any required final approval/dismissal. Thanks for keeping the follow-up focused. |
|
Quick follow-up on the one open gate at head Build is still To clear it:
No empty commit, speculative dependency change, or base sync is requested just to activate CI; none of those supply the missing exact-head run, and the divergence from Separately, the documentation correction from my earlier review remains open (the per-job JobMaster path is bounded per worker, not by one overall deadline); the unchanged head does not resolve it, and a follow-up commit for that is welcome whenever convenient. I have read permission only, so once an exact-head Build run is green, a write-capable maintainer will need to perform any final approval. |
|
Thanks @SEZ9; agreed. Two separate items remain: the existing JobMaster documentation must describe a per-worker bound, and the exact-head Build needs a detected fork run. Please start/link the existing Build, enabling workflows only if the fork shows them disabled. A base sync or dependency change alone does not provide that missing execution. No source fix is being confirmed on this unchanged head. Checked 2026-10-30T03:30:37.151985+00:00; head This is an unchanged-head discussion/CI clarification, not another full source review or an effective approval. Daniel has READ repository permission. |
|
Thanks for the follow-up on this PR. Nothing has changed on head
Once the doc wording is corrected and an exact-head Build run is available, I'll take another look. Please note this comment is a clarification on the unchanged head, not an approval. |
|
Thanks @SEZ9; agreed on the two separate remaining actions. The requested JobMaster explanation is a per-worker timeout bound, not one overall collection deadline; it remains a small existing documentation correction, not another implementation request. Build still reports workflow-run discovery ACTION_REQUIRED. The fork owner should link or start the existing exact-head Build, enabling Actions only if the fork actually reports them disabled. No current base fix can substitute for a missing execution, and no empty commit, dependency edit or drift-only sync is requested. The head is unchanged, so this is a discussion acknowledgment and the existing documentation blocker remains open. Checked 2026-11-01T11:44:25.917622+00:00; unchanged head |
Summary
Fixes #11587. Running-job metrics reuse the existing concurrent collector with a configurable overall budget (
metrics-fetch-timeout-ms, default3000), preserving the response schema and returning available workers' metrics when others cannot respond.Terminal pipeline metrics use bounded worker requests but do not persist an incomplete snapshot for workers that remain cluster members. Collection failures retry before history persistence and task-context cleanup; workers that have already departed are excluded.
The branch now includes current upstream dev7604a83. This brings the published PayPal arrival-latch, OpenGauss restore, Nebula RPC-readiness and RocketMQ readiness/isolation fixes. The prior PR-only cancellation-test disable is removed, restoring upstream test coverage. Generic source checkpoint-lock starvation is being repaired separately in #12316; this PR preserves the original Backpressure workload and assertions.
Verification
ClusterFailureNoRestoreITnow checks real running metrics, actual worker departure, nonempty terminal history, exclusion of departed-worker metrics and public client/history count reconciliation. Existing lifecycle and output-file assertions remain.AI disclosure
AI assistance was used for implementation, source tracing and independent review.