Repository navigation
[Feature][Zeta] Add running job slot usage API - #11597
DanielLeens wants to merge 14 commits into
Conversation
|
Thanks for your contribution for Apache SeaTunnel. To facilitate focused communication among contributors, we’ve created a brand-new dedicated #contributors channel in official Slack workspace. This channel is designed for technical discussions, feature design brainstorming, roadmap sync and direct communication with project core Contributors. Everyone who contributes code, docs, test cases or community ideas is warmly invited to join, share thoughts and collaborate together under The Apache Way. Welcome to join us😄 |
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for working on this. I reviewed the latest head on Monday, August 3, 2026, and traced the full runtime path from the new REST endpoint down to the slot ownership sources inside the coordinator and resource manager. The API direction is useful, but I found one blocker in the current aggregation logic.
What Problem Does This PR Solve
- User pain point: today there is no dedicated REST endpoint that tells operators how many slots each running Zeta job is currently using, broken down by pipeline and worker.
- Fix approach: this PR adds a new
/running-jobs/slot-usageendpoint (plus the v1 path), a master-side operation, a builder that aggregates slot ownership, one unit test, and the corresponding English/Chinese REST docs. - One-sentence summary: this PR tries to expose per-running-job slot usage as a new Zeta diagnostics API.
I. Code Change Review
1.1 Core Logic Analysis
Precise change summary:
- The user-visible feature is a new REST endpoint registered in
JettyServiceandRestHttpGetCommandProcessor. - The critical logic lives in
RunningJobSlotUsageBuilder.build(...). - The key correctness question is whether the builder uses an authoritative, current source of slot ownership for running jobs.
Before / after snippets:
Before:
No dedicated running-job slot usage endpoint exists.
After:
ResourceManager resourceManager =
server.getCoordinatorService().getInitializedResourceManager();
List<SlotProfile> assignedSlots =
resourceManager == null
? Collections.emptyList()
: resourceManager.getAssignedSlots(Collections.emptyMap());
...
taskGroupSlots.values().stream()
.filter(slotProfile -> isAssignedToJob(slotProfile, assignedSlotSet))
.forEach(slotProfile -> usage.addSlot(...));Key findings:
- The endpoint wiring itself is straightforward and consistent with the existing REST patterns.
- The builder does not aggregate directly from
ownedSlotProfilesIMap; it first filters those entries throughresourceManager.getAssignedSlots(...). - That filtering source is already documented elsewhere in the engine as not real-time.
- As a result, the new API can undercount or even return
slotCount = 0for a still-running job when the assigned-slot view lags behind the coordinator-owned slot map. - The current unit test only covers one stale-slot reuse case; it does not cover the lagging-assigned-slots / uninitialized-resource-manager undercount case.
Deep correctness analysis:
Actual current flow:
REST request
-> /running-jobs/slot-usage
-> RunningJobSlotUsageServlet.doGet()
[RunningJobSlotUsageServlet.java]
-> RunningJobSlotUsageService.getRunningJobSlotUsageJson()
[RunningJobSlotUsageService.java:35-42]
-> local master build or worker-to-master operation forward
Master-side aggregation
-> GetRunningJobSlotUsageOperation.run()
[GetRunningJobSlotUsageOperation.java:47-53]
-> RunningJobSlotUsageBuilder.build(server)
[RunningJobSlotUsageBuilder.java:48-75]
-> running job ids from IMAP_RUNNING_JOB_INFO
-> owned slot profiles from IMAP_OWNED_SLOT_PROFILES
-> assigned slots from resourceManager.getAssignedSlots(...)
-> intersect ownedSlotProfiles with assignedSlotSet
[RunningJobSlotUsageBuilder.java:80-129]
Coordinator / resource-manager evidence
-> owned slot profiles are written by JobMaster before release / reuse handling
[ResourceUtils.java:61-68]
-> the engine already documents that worker assigned-slot state is not updated in real time
[SlotRatioStrategy.java:64-69]
[JobMaster.java:514-518]
The blocker is the last step in that chain. ownedSlotProfilesIMap is the coordinator-owned view that the job runtime uses, but the new API drops entries unless they also appear in resourceManager.getAssignedSlots(...). The problem is that the engine already documents that the underlying worker assigned-slot view is not updated in real time. So this endpoint can report fewer slots than the running job actually owns, even though ownedSlotProfilesIMap already contains the slot ownership.
There is an even simpler edge case in the same method: when getInitializedResourceManager() returns null, the builder forces assignedSlots = Collections.emptyList() and therefore every running job is rendered with slotCount = 0, even if ownedSlotProfilesIMap already has live slot ownership data.
For a diagnostics API whose sole purpose is to answer “how many slots is this running job using right now?”, that is a correctness problem.
1.2 Compatibility Impact
- Fully compatible at the API surface level in the sense that this adds a new endpoint and does not break existing ones.
- No config change.
- No default-value change.
- No protocol break for existing callers.
- The issue is not backward compatibility; it is that the new endpoint's current runtime semantics are not reliable enough yet.
1.3 Performance / Side-Effect Analysis
- CPU: light aggregation only.
- Memory: small maps and sets only.
- Network: one master operation hop from worker nodes, which is fine for a diagnostics endpoint.
- Concurrency safety: read-only path, but correctness depends on choosing the right live data source.
- Retry / idempotency: not applicable for this read-only endpoint.
- Resource release: not applicable.
1.4 Error Handling And Logging
Issue 1: The new slot-usage endpoint filters through a known non-real-time assigned-slot view
- Location:
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/trace/RunningJobSlotUsageBuilder.java:68-75,:114-116 - Problem description: this builder first loads
ownedSlotProfilesIMap, which is the coordinator-side slot ownership map, but then it only counts entries that also appear inresourceManager.getAssignedSlots(Collections.emptyMap()). The engine already documents thatworker.getAssignedSlots()/registerWorkerare not updated in real time (SlotRatioStrategy.java:64-69,JobMaster.java:514-518). That means a valid slot already recorded inownedSlotProfilesIMapcan still be filtered out of the response. The same method also forcesassignedSlots = emptywhen the resource manager is not initialized yet, which makes every running job appear asslotCount = 0even if coordinator-owned slot data already exists. - Potential risk: the endpoint can under-report or zero-report slot usage during live running / master-transition windows, which is exactly when operators would use this API for diagnosis. That makes the new API contract unreliable.
- Best improvement suggestion: use an authoritative live source for slot ownership instead of filtering through
resourceManager.getAssignedSlots(...). IfownedSlotProfilesIMapis the intended coordinator truth, aggregate from that map directly and only apply additional guards for truly stale data, such as worker existence or explicit active-slot validation. At minimum, please add coverage for a case whereownedSlotProfilesIMapcontains a live slot butassignedSlotslags behind or the resource manager is stillnull, and verify that the endpoint does not undercount. - Severity: Medium
- Already raised by others: No
II. Code Quality Evaluation
2.1 Code Style
- The endpoint wiring is clean and consistent with the surrounding REST code.
- The new classes are scoped well and the comments are helpful.
- The blocker is logical, not stylistic.
Comment check:
- The new non-trivial methods do have comments, which is good.
2.2 Test Coverage And Test Stability
- Unit tests: one dedicated builder test was added.
- Integration tests: none.
- Regression tests: partial only.
Test stability rating: Stable
- The added builder test is deterministic and mock-free.
- I did not see timing, concurrency, external network, or environment-sensitive assertions.
Coverage gap:
- The current test does not cover the undercount path where
ownedSlotProfilesIMapalready contains live slot ownership butassignedSlotsis stale or unavailable.
2.3 Documentation Updates
docs/enanddocs/zhwere both updated, which is correct for a new REST endpoint.- The docs currently match the implementation shape, but the source-side counting semantics need to be corrected first so the documented contract stays trustworthy.
III. Architectural Reasonableness
3.1 Elegance Of The Solution
- The REST plumbing is a reasonable and minimal addition.
- The weak spot is the choice of aggregation source, not the endpoint structure.
3.2 Maintainability
- Splitting the feature into servlet/service/operation/builder/test is maintainable.
- The main maintainability risk is future debugging confusion if the API becomes known for stale or zeroed counts.
3.3 Extensibility
- A slot-usage endpoint is a good foundation for future UI or diagnostics work.
- But it needs a reliable ownership source first, otherwise downstream tooling will inherit inaccurate data.
3.4 Historical Compatibility
- Existing REST APIs remain compatible.
- No upgrade note is required as long as the new endpoint is fixed before merge.
IV. Problem Summary
| No. | Problem | Location | Severity |
|---|---|---|---|
| 1 | Slot usage is filtered through a known non-real-time assigned-slot view, so the new API can undercount or zero-report live slot ownership | RunningJobSlotUsageBuilder.java:68-75, 114-116 |
Medium |
V. Merge Conclusion
Conclusion: Can be merged after fixes
- Blocking items (must fix)
- Issue 1: the new endpoint currently depends on a slot-assignment view that the engine itself documents as non-real-time, so the reported slot counts are not reliable enough yet.
- Suggested improvements (non-blocking)
- None beyond the blocker above from my side.
Overall assessment:
- The API is worth having, and the endpoint structure looks good.
- The remaining work is to base the count on a trustworthy runtime ownership source.
- After that, this should be a useful addition to Zeta diagnostics.
Alternative implementation:
- Option A: aggregate directly from
ownedSlotProfilesIMapfor non-end jobs and validate worker existence separately. - Option B: if the resource-manager path must stay involved, expose a genuinely real-time assigned-slot source instead of
worker.getAssignedSlots().
DanielLeens
left a comment
There was a problem hiding this comment.
Re-reviewed from scratch at head 20538ae1ebe78cc2d35871fbd02e1d79b960e154 (merge of dev into the feature branch). My previous comment on this PR is from 2026-08-03, so I re-traced the whole path again rather than trusting it, and I am correcting one claim I made in that round.
Two corrections/apologies up front, since this is my own change and I should have caught these on the first pass:
- In my 2026-08-03 comment I said the assigned-slot view is "not updated in real time" and implied a wide steady-state staleness window. That was overstated.
ResourceRequestHandler.singleResourceRequestToMembercallsresourceManager.heartbeat(slotAndWorkerProfile.getWorkerProfile())synchronously right after every successful slot request (ResourceRequestHandler.java:253), andAbstractResourceManager.releaseResourcedoesfuture.thenAccept(this::heartbeat). SoregisterWorkeris refreshed on the assign and release paths, not only on the 5s periodic heartbeat. The degradation is real but its window is narrower and more specific than I described. Corrected below in Issue 1. - I missed two things entirely last round, both flagged now as carryover: the aggregation runs inline on a Hazelcast operation thread (Issue 3), and
getCoordinatorService()is invoked once per running job inside the collection lambda where it can sleep (Issue 2). Apologies for letting those through the first review.
behind_by against dev is 3, and all three commits are JDBC connector/doc changes with zero overlap with the engine REST classes touched here, so the drift does not affect this evaluation and no rebase is needed to review it cleanly.
What Problem Does This PR Solve?
- User pain point: Zeta exposes cluster-wide slot totals through
/overview, but there is no endpoint that answers "how many slots is each running job holding right now, and on which workers". Operators diagnosing a stuck or over-provisioned cluster have to infer it from logs. - Fix approach: add a read-only REST endpoint
/running-jobs/slot-usage(Jetty v2) and/hazelcast/rest/maps/running-jobs/slot-usage(Hazelcast v1), backed by a master-side operation and a stateless aggregation helper that intersects the coordinator's owned-slot map with the resource manager's assigned-slot snapshot, grouped by job, pipeline and worker. - One-sentence summary: this PR adds a purely additive, read-only per-job slot usage diagnostics endpoint to the Zeta REST API.
Simple example:
curl http://127.0.0.1:8080/running-jobs/slot-usage[
{
"jobId": "733584788375093248",
"slotCount": 3,
"pipelineSlotCounts": { "1": 2, "2": 1 },
"workerSlotCounts": { "10.0.0.8:5801": 2, "10.0.0.9:5801": 1 }
}
]1. Code Change Review
1.1 Core Logic Analysis
Real request-handling path, traced against the current head:
HTTP GET /running-jobs/slot-usage (Jetty v2)
-> JettyService.java:190,230
ServletHolder mapped via convertUrlToPath() -> "/running-jobs/slot-usage/*"
-> RunningJobSlotUsageServlet.doGet()
RunningJobSlotUsageServlet.java:40-44
-> RunningJobSlotUsageService.getRunningJobSlotUsageJson()
RunningJobSlotUsageService.java:35-43
|
+-- this node IS master (getSeaTunnelServer(true) != null)
| -> RunningJobSlotUsageBuilder.build(server) [in-process, Jetty thread]
|
+-- this node is NOT master
-> NodeEngineUtil.sendOperationToMasterNode(GetRunningJobSlotUsageOperation)
NodeEngineUtil.java:33-43 (sets SERVICE_NAME on the invocation)
-> master: GetRunningJobSlotUsageOperation.run()
GetRunningJobSlotUsageOperation.java:49-52
[runs on a Hazelcast generic operation thread - see Issue 3]
-> RunningJobSlotUsageBuilder.build(server)
HTTP GET /hazelcast/rest/maps/running-jobs/slot-usage (v1)
-> RestHttpGetCommandProcessor.handle()
ordering: RUNNING_JOBS_SUMMARY -> RUNNING_JOBS_SLOT_USAGE -> RUNNING_JOBS
-> handleRunningJobsSlotUsage() -> same RunningJobSlotUsageService
Aggregation (RunningJobSlotUsageBuilder.build, both entries converge here)
step 1 IMAP_RUNNING_JOB_INFO.keySet() [line 50-56, 59-66]
filter by coordinatorService.shouldShowAsRunningJob(jobId)
-> CoordinatorService.java:1502-1505 -> getJobStatus() -> !isEndState()
step 2 coordinatorService.getInitializedResourceManager() [line 68-69]
-> CoordinatorService.java:1247-1249, returns the volatile field, NO lazy init
resourceManager == null ? emptyList() : getAssignedSlots(emptyMap()) [line 70-73]
-> AbstractResourceManager.java:328-332
-> streams registerWorker.values() -> WorkerProfile.getAssignedSlots()
step 3 IMAP_OWNED_SLOT_PROFILES.forEach(...) [line 89-92]
per pipeline: keep only slots whose SlotKey is in the assigned set
SlotKey = (worker, slotId, ownerJobId, sequence) [line 115, 132-134, 155-161]
step 4 SlotUsage.addSlot() -> slotCount / pipelineSlotCounts / workerSlotCounts
[line 189-195] -> toResponse() [line 197-205] -> JsonUtils.toJsonString
What "usage" actually means here, verified against the sources rather than the naming:
- The numerator is the set of entries in
IMAP_OWNED_SLOT_PROFILES(coordinator-side, cluster-replicated, written byJobMaster.setOwnedSlotProfiles,JobMaster.java:1303-1321) that also appear inResourceManager.getAssignedSlots(...)(master-localregisterWorkersnapshot). - So it is "coordinator-owned task-group slots that the current master also believes are assigned on a worker". That is neither purely "allocated" nor purely "in use"; it is the intersection of two views with different freshness characteristics. The docs describe it as "the number of assigned task group slots owned by the running job", which is an accurate description of what the code counts, so docs and implementation do agree. The gap is that the endpoint name and the
slotCountfield read as "distinct slots occupied" (see Issue 7).
Things I verified positively and want on the record, because each of them could have been a hard bug:
SlotProfile.ownerJobIDis serialized inwriteData/readData(SlotProfile.java:139-155). SinceSlotKeyincludesownerJobId, a non-serialized owner id would have made every intersection miss andslotCountpermanently0on any multi-node cluster. It is serialized, so the intersection genuinely works over the wire.CoordinatorService.resourceManageris declaredvolatile(CoordinatorService.java:138). The new unsynchronized read ingetInitializedResourceManager()is therefore safely published; this is not a broken double-checked-locking read.- The new serializer class id
17does not collide. CurrentdevClientToServerOperationDataSerializerHooktops out atGET_JOB_TASK_MAPPING_OPERATION = 16. - Servlet routing is correct.
JettyService.convertUrlToPath()appends/*, so/running-jobs/slot-usage/*is a strictly longer path prefix than/running-jobs/*and wins under the Servlet spec longest-prefix rule. The v1startsWithchain also putsSLOT_USAGEbeforeRUNNING_JOBS, so it does not get swallowed. getService()resolves correctly even though the operation does not overridegetServiceName(), becauseNodeEngineUtil.sendOperationToMasterNodebuilds the invocation withSeaTunnelServer.SERVICE_NAME(NodeEngineUtil.java:37-40).
Read-only verification (requested explicitly): I walked every call the new code makes. IMap.keySet(), IMap.forEach, CoordinatorService.shouldShowAsRunningJob (getJobStatus only reads pendingJobQueue / runningJobMasterMap / jobHistoryService), getInitializedResourceManager() (plain field read) and AbstractResourceManager.getAssignedSlots (stream over registerWorker) are all reads. Nothing calls requestResource, releaseResource, slotActiveCheck, heartbeat or ResetResourceOperation. There is no slot allocation or deallocation side effect from querying this endpoint. Confirmed clean.
Notably, using getInitializedResourceManager() instead of getResourceManager() is the right call and I want to credit it: getResourceManager() lazily constructs and init()s the resource manager (CoordinatorService.java:1223-1235), which fires cluster RPCs. GetOverviewOperation.java:82 still uses the lazy-init variant, so /overview can create runtime state as a side effect of being read; this endpoint deliberately does not. The cost of that correct choice is Issue 1.
1.2 Compatibility Impact
Explicit conclusion: fully compatible. This is purely additive.
- New constant
REST_URL_RUNNING_JOBS_SLOT_USAGE, new servlet, new service, new operation, new serializer class id. No existing constant, servlet mapping, service method or response shape was modified. The diff onJettyService,RestHttpGetCommandProcessor,RestConstantandClientToServerOperationDataSerializerHookis insert-only (13 files, 626 additions, 0 deletions). - No existing endpoint's contract changed.
/running-jobs,/running-jobs/summary,/overview,/job-infoall keep their exact response shapes. - No config option added, renamed or defaulted differently.
- One behavioural nuance worth stating rather than hiding: before this PR,
GET /running-jobs/slot-usagefell through to the running-jobs list on both the v1 and v2 paths. Nothing documents that as a contract and no client could reasonably depend on it, so I do not treat it as a break. - Rolling-upgrade note: operation class id
17is only ever sent worker -> master. In a mixed-version cluster where a new-version node serves the REST call but an old-version node is master, the old master's factory hitsthrow new IllegalArgumentException("Unknown type id " + typeId). That failure is confined to this new endpoint, which no old client calls, so it does not break any existing upgrade path. It is still worth one line in the PR description. - No checkpoint, savepoint, state-serialization or job-restore surface is touched.
1.3 Performance/Side-Effect Analysis
Iteration safety under concurrent job submission/completion (requested explicitly): no ConcurrentModificationException is possible. IMap.forEach falls through to the default Map.forEach, which walks entrySet(); Hazelcast returns a materialized snapshot set, not a live view. AbstractResourceManager.registerWorker is a ConcurrentHashMap, whose iterator is weakly consistent. SlotUsage instances are confined to a single call. No shared mutable state, no locks taken, no lock ordering introduced.
Torn reads are possible and are inherent to the design: the running-job id set, the assigned-slot snapshot and the owned-slot map are read at three different instants with no consistency barrier between them. A job that completes mid-call can appear with a stale slot count; a job that starts mid-call can appear with a partial one. For a diagnostics endpoint that is acceptable, but it is not documented, and combined with Issue 1 the caller has no way to tell a torn read from a real zero.
Cost under a large cluster:
- CPU and allocation in the aggregation itself are linear in (pipelines x task groups) with
HashSet/TreeMaplookups; nothing quadratic. That part is fine. - The real cost is data movement, not CPU:
IMAP_OWNED_SLOT_PROFILES.forEachpulls and deserializes every pipeline entry in the cluster to the calling member, including pipelines belonging to jobs that are immediately discarded atRunningJobSlotUsageBuilder.java:110-112.IMAP_RUNNING_JOB_INFO.keySet()is likewise a distributed operation. So the wire cost scales with total cluster state, not with the number of running jobs, on every single request, with no caching and no rate limit. See Issue 4. - The worst case is not CPU at all, it is thread blocking:
getCoordinatorService()canThread.sleepup to 3 x 500ms and it is called once per running job (Issue 2), on a Hazelcast operation thread (Issue 3).
Retry/idempotency: read-only and idempotent. Resource release: nothing to release.
1.4 Error Handling and Logging
- Querying a non-existent or racing job id degrades correctly in the sense that there is no per-job path at all: the endpoint always returns the full running-job list, and a job that ends between step 1 and step 3 simply comes back with a stale or zero count rather than throwing. No 404/500 from that race.
- The whole new path contains zero log statements. When the assigned-slot source is unavailable and the endpoint silently returns all-zero counts, nothing is written anywhere. For a diagnostics API that is the wrong default.
- On the worker -> master path,
RunningJobSlotUsageService.java:37-41calls.join()with no try/catch. If the master throwsSeaTunnelEngineException("This is not a master node now.")the caller sees an unhandledCompletionException-> Jetty 500 with a stack trace. The retryable variant (SeaTunnelEngineRetryableException) is handled correctly by Hazelcast invocation retry, so the coordinator-not-ready case is fine; only the mastership-lost case degrades badly. RunningJobSlotUsageService.java:36and:42callgetSeaTunnelServer(true)and thengetSeaTunnelServer(false)as two separate calls. If mastership is lost between them,build()reachesgetCoordinatorService()on a now-inactive master and throwsSeaTunnelEngineException("Please don't get coordinator service from an inactive master node")-> 500.
I want to be fair here: the last two points match the existing pattern in RunningJobsServlet / JobInfoService, so they are consistency-level nits rather than regressions introduced by this PR. I am flagging them at Low, not blocking on them.
Issue 1: The endpoint silently reports slotCount: 0 when the assigned-slot source is unavailable, and 0 is also a documented legitimate value
- Location:
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/trace/RunningJobSlotUsageBuilder.java:68-73,:115,:132-134 - Problem description:
getInitializedResourceManager()deliberately never lazy-inits, so it returnsnullwhenever the resource manager has not yet been touched on this master; the builder then forcesassignedSlots = Collections.emptyList(),buildAssignedSlotSetreturns an empty set,isAssignedToJobrejects everything, and every running job is rendered withslotCount: 0even thoughIMAP_OWNED_SLOT_PROFILESalready holds full ownership data. The same all-zero outcome occurs on a fresh master after failover, becauseAbstractResourceManager.registerWorkeris master-local in-memory state that starts empty and refills only from worker heartbeats (DefaultSlotService.java:59,DEFAULT_HEARTBEAT_TIMEOUT = 5000) or from a subsequent assign/release. Correcting my 2026-08-03 claim: in steady stateregisterWorkeris refreshed synchronously on assign (ResourceRequestHandler.java:253) and release (AbstractResourceManager.releaseResource), so this is not a permanent staleness problem; it is a failover/cold-start window problem. The reason it still matters is that the docs (docs/en/engines/zeta/rest-api-v2.md, "A running job that has not received any slot yet is returned withslotCountset to0") make0a legitimate business value, so the caller cannot distinguish "this job genuinely holds no slots" from "we could not read the slot source at all". - Potential risk: an operator investigating a master failover - precisely the moment this API is most useful - is shown
slotCount: 0for every still-running job and may conclude the jobs have lost their resources. Any UI or alerting rule built on this field inherits the same false signal, with no log line anywhere to contradict it. - Best improvement: make unavailability explicit rather than encoding it as
0. Either (a) add a boolean such asslotSourceAvailable/degradedto each response object (and document it), or (b) whenresourceManager == nullorgetAssignedSlots(...)comes back empty whileownedSlotProfilesis non-empty, fall back to counting directly fromIMAP_OWNED_SLOT_PROFILESand mark the response as an unverified/coordinator-only view. Either way, log once at WARN with the job count so the condition is visible in the master log. Add a unit test asserting the degraded case. - Severity: Medium
- Raised by another reviewer: No (carryover from my own 2026-08-03 comment, still unfixed; the staleness rationale is corrected above)
Issue 2: getCoordinatorService() is invoked once per running job inside the collection lambda, and it can sleep
- Location:
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/trace/RunningJobSlotUsageBuilder.java:59-66 - Problem description: the filter lambda calls
server.getCoordinatorService().shouldShowAsRunningJob(jobId), sogetCoordinatorService()runs once per entry inIMAP_RUNNING_JOB_INFO. That method is not a plain getter:SeaTunnelServer.java:286-303runs a retry loop of up to 3 iterations withThread.sleep(500)while the coordinator is not yet active, and logs a WARNING on each iteration. With N running jobs, a coordinator that is briefly inactive turns one request into up to N x 1.5s of sleeping plus N warning lines. The reference is loop-invariant and should be hoisted;JobInfoService.getRunningJobsSummaryJsonalready resolves the server once outside its loop, though it too re-entersgetCoordinatorService()per job through its private helper. - Potential risk: on a large cluster during master transition, a single REST call blocks its thread for tens of seconds and floods the master log. Combined with Issue 3 that thread is a Hazelcast operation thread. A UI polling this endpoint turns a transient coordinator hiccup into sustained thread exhaustion.
- Best improvement: resolve
CoordinatorService coordinatorService = server.getCoordinatorService();once before the loop at line 59 and use the local reference for both theshouldShowAsRunningJobfilter and thegetInitializedResourceManager()call at line 69. That is a two-line change and removes the amplification entirely. - Severity: Medium
- Raised by another reviewer: No (missed in my own 2026-08-03 review; carryover apology noted above)
Issue 3: The master operation performs the whole aggregation inline on a Hazelcast operation thread, unlike its sibling operation
- Location:
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/operation/GetRunningJobSlotUsageOperation.java:49-52 - Problem description:
run()callsRunningJobSlotUsageBuilder.build(service)directly on the invoking thread. The operation declares no partition id, so it executes on a Hazelcast generic operation thread - a small, shared, cluster-wide pool. The work it does there includes two distributedIMapreads (keySet()and a fullentrySet()walk) and the potentially sleepinggetCoordinatorService()calls from Issue 2. The directly comparable operation in the same package,GetRunningJobMetricsOperation.run()(GetRunningJobMetricsOperation.java:63-78), deliberately offloads its body togetNodeEngine().getExecutionService().getExecutor("get_running_job_metrics_operation")for exactly this reason. The new operation also carriesAllowedDuringPassiveState, so it can be invoked while the cluster is passive, when the coordinator is most likely to be inactive and the sleep path most likely to trigger. - Potential risk: blocking generic operation threads degrades unrelated cluster operations, not just this endpoint. Under a polling UI plus a coordinator transition this is a plausible route to cluster-wide operation-thread starvation, which on a production Zeta cluster is a job-availability incident, not a monitoring inconvenience.
- Best improvement: mirror the metrics operation - offload the
build(...)call to a named executor obtained fromgetNodeEngine().getExecutionService(), and complete the response from there. Fixing Issue 2 first reduces the blocking, but does not remove the distributed-map cost from the operation thread, so both are needed. - Severity: Medium
- Raised by another reviewer: No (missed in my own 2026-08-03 review; carryover apology noted above)
Issue 4: Every request materializes the entire owned-slot map for the whole cluster, including jobs it will discard
- Location:
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/trace/RunningJobSlotUsageBuilder.java:50-56,:89-92,:110-112 - Problem description:
ownedSlotProfiles.forEach(...)on a HazelcastIMapresolves to the defaultMap.forEach, which iteratesentrySet()- a distributed operation that fetches and deserializes everyMap<TaskGroupLocation, SlotProfile>in the cluster to the calling member. Entries for jobs that are not running are then thrown away at line 110-112 after having already been transferred and deserialized.runningJobInfo.keySet()is likewise a distributed call. So per-request cost scales with total cluster state rather than with the number of running jobs, and there is no caching, no TTL and no rate limit on the endpoint. To be fair, this same pattern already exists inCoordinatorService.collectRunningWorkerAddressesandJobMaster.getCurrJobMetrics, so it is consistent with existing engine code - but those are internal, periodic paths, whereas this one is externally triggerable at whatever rate a caller chooses. - Potential risk: on a cluster with many pipelines, a tight polling loop or a monitoring scrape turns into repeated full-map deserialization on the master, amplified by Issue 3 because it happens on an operation thread.
- Best improvement: restrict the fetch to what is needed - build the running-job id set first, then use
ownedSlotProfiles.getAll(keysForRunningJobs)or a predicate-based read instead of a fullforEach. If that is awkward givenPipelineLocationkeys, the fallback is a short TTL cache in front of the aggregation, following the existingBaseServicerunning-job DAG cache precedent. At minimum, state the cost characteristic in the docs so operators do not build a 1s poll on it. - Severity: Low
- Raised by another reviewer: No
Issue 5: No logging anywhere in the new path, and the forwarded call surfaces mastership loss as a 500
- Location:
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/rest/service/RunningJobSlotUsageService.java:35-43;.../trace/RunningJobSlotUsageBuilder.java:48-75 - Problem description: two parts. (a) The entire feature - servlet, service, operation, builder - contains no log statement, so the silent-zero condition from Issue 1 leaves no trace in the master log. (b)
getRunningJobSlotUsageJson()callsgetSeaTunnelServer(true)at line 36 andgetSeaTunnelServer(false)at line 42 as two independent calls, and.join()s the forwarded invocation at line 37-41 with no try/catch. If mastership changes between line 36 and line 42,build()hitsgetCoordinatorService()on an inactive master and throwsSeaTunnelEngineException; on the forwarded branch the same exception arrives wrapped in aCompletionException. Both reach Jetty as an unhandled 500 with a stack trace. The retryable case (SeaTunnelEngineRetryableException, coordinator not ready yet) is handled correctly by Hazelcast invocation retry - only the mastership-lost case degrades. This mirrors the existing pattern inRunningJobsServlet/JobInfoService, so it is not a regression introduced here. - Potential risk: a monitoring scrape sees an opaque 500 during a routine master change rather than a clean transient error, and the silent-zero path is undiagnosable after the fact because nothing was logged.
- Best improvement: capture the server reference once into a local variable instead of calling
getSeaTunnelServertwice; wrap the.join()and the local build in a try/catch that logs at WARN and returns an empty array with a503-style status (or at minimum a logged, structured error body). Add a single WARN whengetInitializedResourceManager()returnsnullwhile running jobs exist. - Severity: Low
- Raised by another reviewer: No
Issue 6: Test coverage does not reach the failure modes, the public entry point, or the REST layer
- Location:
seatunnel-engine/seatunnel-engine-server/src/test/java/org/apache/seatunnel/engine/server/trace/RunningJobSlotUsageBuilderTest.java:40-82 - Problem description: the single test is good as far as it goes - it exercises the package-private 3-arg overload, asserts real numeric values (
slotCount2 and 0, per-pipeline and per-worker counts) rather than a bare 200, correctly covers the reused-slot-from-another-job case, and is deterministic becauseSlotUsageordering comes from aTreeMap<Long>. What it does not cover: (a)assignedSlots == nullor empty whileownedSlotProfilesis populated - the exact Issue 1 degradation, and the thing my previous review asked for; (b) the publicbuild(SeaTunnelServer)entry at line 48, which is where all the interesting failure modes live; (c) a serializer round-trip for the new class id17, so nothing proves the operation survives the wire; (d) any REST-level assertion at all. The repo has clear precedent for the last one:RestApiIT,PendingJobsRestIT,RealtimeMetricsRestITandJobInfoDagStabilityRestITall live inseatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-baseand assert real endpoint output. As it stands, nothing in CI proves this endpoint returns anything at all. - Potential risk: the feature is unproven end to end. A routing regression, a serialization regression on id
17, or a JSON shape change would all pass CI silently. - Best improvement: add the two missing unit cases (null resource manager, lagging assigned-slot set) asserting that the response is either non-zero or explicitly marked degraded; add a
RunningJobSlotUsageRestITin the engine e2e base module that submits a job and assertsslotCountequals the job's real parallelism, following thePendingJobsRestITstructure. No flaky pattern in the existing test - it is mock-free, has no timing, network or environment dependency, and no sleeps. - Severity: Low
- Raised by another reviewer: No
Issue 7: slotCount counts task-group entries, not distinct slots, which the endpoint name does not convey
- Location:
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/trace/RunningJobSlotUsageBuilder.java:113-118,:189-195 - Problem description:
addSlotincrements once perTaskGroupLocationentry that passes the filter. If the same physicalSlotProfileever appears under two task groups, or the same pipeline is represented under twoPipelineLocationkeys, it is counted twice - whereasSlotProfile.equals/hashCode(SlotProfile.java:85-99, keyed on worker + slotID + sequence) would treat those as one slot. The docs word this carefully ("assigned task group slots"), so docs and code do agree; the mismatch is between the code and the endpoint's own name plus the bare field nameslotCount, which both read as "distinct slots occupied". - Potential risk: capacity-planning conclusions drawn from
slotCountcould overstate real slot occupancy, and the divergence would be invisible because the two numbers agree in the common case. - Best improvement: de-duplicate by
SlotKeybefore counting (aSet<SlotKey>perSlotUsage, incrementing only on first insert), which makes the field mean what its name says; or keep the current semantics and rename the field totaskGroupSlotCountso the counting unit is unambiguous. Either way, keep the docs in sync. - Severity: Low
- Raised by another reviewer: No
2. Code Quality Assessment
2.1 Coding Standards
- ASF license headers present on all 9 new source files. Verified.
- Formatting is consistent with AOSP/Spotless style; the PR reports
spotless:applyandspotless:checkwere run and I see no formatting drift in the diff. - No wildcard imports; shaded
org.apache.seatunnel.shade.*conventions respected where applicable. - Comment discipline is good: every new class has a class-level Javadoc, and the non-trivial methods (
build,aggregatePipelineSlots,run,getRunningJobSlotUsageJson) carry explanatory comments. This meets the bar. - The one gap: the comments describe what each method does but not the freshness contract of the two data sources it joins. Given Issue 1,
build(SeaTunnelServer)should carry a comment stating thatgetAssignedSlotsis a master-local snapshot that can be empty on a fresh master, and what the response means in that case. - Placement in the
server.tracepackage is consistent with the existingTaskMappingBuilderin the same package, so I withdraw any concern about that - it follows precedent. GetRunningJobSlotUsageOperationomits the emptywriteInternal/readInternaloverrides thatGetRunningJobMetricsOperationcarries. Functionally irrelevant (both delegate tosuper), purely cosmetic, not worth a change.
2.2 Test Coverage and Test Stability
- Unit tests: one, on the package-private overload. Quality of what it does test is good - real value assertions, deterministic ordering, no mocks.
- Integration/REST tests: none. See Issue 6 for the precedent set by the four existing
*RestITclasses. - Flaky-pattern check: clean.
RunningJobSlotUsageBuilderTesthas noThread.sleep, noAwaitility, no network, no container, no shared static state, no ordering dependency beyond the deterministicTreeMap. Nothing here will contribute to CI flakiness. - Test stability rating: Stable.
- Coverage gap: the failure modes are exactly the untested ones. That is the wrong side of the line for a diagnostics API whose whole value proposition is being trustworthy during incidents.
2.3 Documentation Updates
- All four REST reference files updated:
docs/en/engines/zeta/rest-api-v1.md,docs/en/engines/zeta/rest-api-v2.md,docs/zh/engines/zeta/rest-api-v1.md,docs/zh/engines/zeta/rest-api-v2.md. Both languages, both API versions. This is the correct and complete set, and the zh version is a real translation, not a copy. - The example payload matches the code exactly:
jobIdis a string (String.valueOf(jobId)at line 199),slotCountan int,pipelineSlotCountskeyed by pipeline id,workerSlotCountskeyed byAddress.toString(). The v1 doc correctly uses the/hazelcast/rest/maps/prefix. Verified field by field. - The four explanatory notes are accurate for the normal path.
- Missing: the documented meaning of
slotCount: 0is currently ambiguous (Issue 1), the counting unit is not spelled out (Issue 7), and the per-request cost characteristic is not mentioned (Issue 4). All three are doc-side follow-ups to the code fixes rather than independent doc bugs.
3. Architectural Soundness
3.1 Elegance of the Solution
The servlet -> service -> operation -> builder decomposition matches the established shape of every other Zeta REST endpoint, and reusing BaseServlet/BaseService keeps the new code small. Splitting the pure aggregation into a static builder with a package-private overload is the right call - it is what made a mock-free unit test possible.
The one architectural choice I am not comfortable with is the two-source join itself. Intersecting a cluster-replicated IMap with a master-local in-memory snapshot means the answer is only as good as the weaker source, and the weaker source is empty in exactly the scenario the API exists to diagnose. A single authoritative source, or an explicit "which sources did we manage to read" field, would be a more honest design.
3.2 Maintainability
Good. Small classes, clear names, no inheritance tricks, no shared mutable state, easy to unit test. The main maintainability risk is reputational rather than structural: if operators learn that this endpoint sometimes reports zeros they cannot explain, the API loses its value and future debugging of the API itself becomes the problem. Fixing Issue 1 and adding the WARN from Issue 5 removes that risk.
3.3 Extensibility
A per-job, per-pipeline, per-worker breakdown is a good foundation for a Web UI panel and for future slot-pressure alerting. The response shape leaves room for additional fields without breaking callers. Worth keeping in mind that once a UI polls it, Issues 3 and 4 stop being theoretical.
3.4 Historical-Version Compatibility
- No existing REST contract, config option, default value, serialized state, checkpoint or savepoint format is touched. Old clients are entirely unaffected.
- New serializer id
17does not collide with anything on currentdev(max16), so no state or protocol conflict. - Mixed-version rolling upgrade: the only exposure is a new-version node forwarding the new operation to an old-version master, which throws
IllegalArgumentException("Unknown type id 17"). That is confined to the new endpoint and breaks no pre-existing path. Worth one sentence in the PR description; not a blocker. - No upgrade note or
incompatible-changes.mdentry is required.
4. Issue Summary
| # | Issue | Location | Severity |
|---|---|---|---|
| 1 | Silent slotCount: 0 when the assigned-slot source is unavailable, indistinguishable from a documented legitimate zero |
RunningJobSlotUsageBuilder.java:68-73, 115, 132-134 |
Medium |
| 2 | getCoordinatorService() called once per running job inside the loop; it can sleep up to 1.5s per call |
RunningJobSlotUsageBuilder.java:59-66 |
Medium |
| 3 | Aggregation runs inline on a Hazelcast operation thread; the sibling metrics operation deliberately offloads | GetRunningJobSlotUsageOperation.java:49-52 |
Medium |
| 4 | Full cluster-wide owned-slot map materialized per request, including discarded jobs; no cache or rate limit | RunningJobSlotUsageBuilder.java:50-56, 89-92, 110-112 |
Low |
| 5 | No logging in the entire new path; mastership loss surfaces as an unhandled 500 | RunningJobSlotUsageService.java:35-43 |
Low |
| 6 | No coverage of the degraded path, the public entry point, serializer round-trip, or the REST layer | RunningJobSlotUsageBuilderTest.java:40-82 |
Low |
| 7 | slotCount counts task-group entries rather than distinct slots; name implies otherwise |
RunningJobSlotUsageBuilder.java:113-118, 189-195 |
Low |
5. Merge Recommendation
Conclusion: Can be merged after fixes
Blockers (must fix before merge)
- Issue 1 - a diagnostics endpoint must not encode "I could not read the data" as the same value it uses for "the answer is genuinely zero". This is the carryover from my 2026-08-03 comment and is still unaddressed at the current head.
- Issue 2 - hoist
getCoordinatorService()out of the per-job lambda. Two-line fix, removes an O(N) x 1.5s blocking amplification. - Issue 3 - offload the aggregation off the Hazelcast operation thread, following the
GetRunningJobMetricsOperationprecedent in the same package. Blocking shared operation threads is an engine-wide hazard, not an endpoint-local one.
Recommended (non-blocking)
- Issue 4 - narrow the IMap read to running-job keys, or cache with a short TTL.
- Issue 5 - single server lookup, try/catch around the forwarded
join(), and a WARN when the slot source is unavailable. - Issue 6 - add the two degraded-path unit cases and one REST-level IT asserting real slot counts.
- Issue 7 - de-duplicate by
SlotKeyor rename the field so the counting unit is unambiguous.
Overall assessment
The feature is worth having and the plumbing is genuinely well done: routing is correct on both API versions, the serializer id is free, SlotProfile.ownerJobID really is on the wire so the intersection works, the resource-manager field is properly volatile, the endpoint is verifiably free of any allocation or deallocation side effect, iteration is CME-safe, compatibility is cleanly additive, and all four doc files are updated accurately in both languages. Choosing getInitializedResourceManager() over the lazy-initializing variant was the right instinct for a read path.
What holds it back is that the three blockers all cluster around the same theme: the endpoint behaves worst exactly when it is needed most. During a master transition it can return all zeros with no log line, while blocking a shared cluster thread for up to 1.5s per running job. Two of those three are fixes of a handful of lines; the third (Issue 1) needs a deliberate decision about whether to expose a degraded flag or fall back to the coordinator-only view. Once those land and there is a REST-level test proving real slot counts end to end, this is a solid addition to Zeta diagnostics.
CI status at the time of this review: the apache-side Build check is red. The real run is in the fork, and the failure is infrastructure, not code: the single failed job is paimon-connector-it (11, ubuntu-latest), whose log shows ERROR 429: Too Many Requests while downloading the Maven wrapper, followed by Could not find or load main class org.apache.maven.wrapper.MavenWrapperMain. No Java test ever started. Two sibling jobs (paimon-connector-it (8), jdbc-connectors-it-ddl (8)) were cancelled by fail-fast. This needs a rerun; note that rerunning the fork run alone will not refresh the apache-side check, so a new push will be needed to turn it green regardless.
|
Re-checking my own PR today. Since GitHub does not allow self-approval, I'm leaving this as a plain comment with my technical conclusion instead of a formal review. I independently re-traced the whole diff against the current head What Problem Does This PR Solve?
Simple example: curl http://127.0.0.1:8080/running-jobs/slot-usage[
{
"jobId": "733584788375093248",
"slotCount": 3,
"pipelineSlotCounts": { "1": 2, "2": 1 },
"workerSlotCounts": { "10.0.0.8:5801": 2, "10.0.0.9:5801": 1 }
}
]1. Code Change Review1.1 Core Logic AnalysisRuntime path, re-traced against the current head with What "slot usage" actually means here: the numerator is the set of entries in Read-only verification (re-checked, not assumed): every call in the new path — Iteration safety under concurrent job submission/completion, re-verified: no 1.2 Compatibility ImpactFully compatible. Purely additive: new constant, new servlet, new service, new operation, new serializer class id ( 1.3 Performance/Side-Effect Analysis
1.4 Error Handling and Logging
Formal issues (verified against the current head, all still present in unmodified code, same numbering as my 2026-08-16 comment): Issue 1: The endpoint silently reports
Issue 2:
Issue 3: The master operation performs the whole aggregation inline on a Hazelcast operation thread, unlike its sibling operation
Issue 4: Every request materializes the entire owned-slot map for the whole cluster, including jobs it will discard
Issue 5: No logging anywhere in the new path, and the forwarded call surfaces mastership loss as a 500
Issue 6: Test coverage does not reach the failure modes, the public entry point, or the REST layer
Issue 7:
2. Code Quality Assessment2.1 Coding StandardsASF license headers present on all 9 new source files. Formatting matches AOSP/Spotless, no wildcard imports. Comment discipline is good — every new class has a class-level Javadoc and the non-trivial methods carry explanatory comments; the one gap is that 2.2 Test Coverage and Test StabilityUnit tests: one, on the package-private overload, with real value assertions and deterministic Test stability rating: Stable. Nothing in the existing test contributes flakiness risk; the gap is coverage of the failure modes, not stability of what's there. 2.3 Documentation UpdatesAll four REST reference files updated ( 3. Architectural Soundness3.1 Elegance of the SolutionPrecise fix within a temporary-workaround aggregation choice. The servlet -> service -> operation -> builder decomposition matches every other Zeta REST endpoint and is a clean, minimal addition. The one architectural choice I'm still not fully comfortable with is intersecting a cluster-replicated IMap with a master-local in-memory snapshot as the source of truth — the answer is only as good as the weaker source, and the weaker source is empty in exactly the scenario (failover) the API exists to diagnose. 3.2 MaintainabilityGood — small classes, clear names, no shared mutable state, easy to unit test. The main risk is reputational: if operators learn this endpoint sometimes reports unexplained zeros, the API loses its diagnostic value. Fixing Issues 1 and 5 removes that risk. 3.3 ExtensibilityA per-job, per-pipeline, per-worker breakdown is a good foundation for a future UI panel or slot-pressure alerting. Once something polls it, Issues 3 and 4 stop being theoretical. 3.4 Historical-Version CompatibilityNo existing REST contract, config option, default value, serialized state, checkpoint, or savepoint format is touched; old clients are unaffected. New serializer id 4. Issue Summary
5. Merge RecommendationConclusion: Ready to merge after fixes1. Blockers — must be fixed
2. Recommended fixes — non-blocking
CI correction (supersedes my 2026-08-16 note): I previously wrote that the apache-side Since GitHub blocks self-approval on my own PR, Overall assessment: the feature is worth having and the plumbing is genuinely solid — routing is correct on both API versions, the serializer id is free, Alternative implementation:
|
|
Re-reviewed from scratch at head What Problem Does This PR Solve?
1. Code Change Review1.1 Core Logic AnalysisRuntime path, re-traced against the current head: Things I checked myself rather than take on faith, because each one would have been a real bug if wrong:
What "usage" actually measures, verified against the code rather than the field names: the numerator is the set of 1.2 Compatibility Impact — Fully compatible
1.3 Performance / Side-Effect Analysis
1.4 Error Handling and Logging
Issue 1:
Issue 2:
Issue 3: The master operation aggregates inline on a shared Hazelcast operation thread; the directly comparable sibling operation deliberately doesn't
Issue 4: Every request materializes the entire cluster-wide owned-slot map, including entries it immediately discards
Issue 5: No logging anywhere in the new path; mastership loss on the forwarding branch surfaces as an unhandled 500
Issue 6: Test coverage doesn't reach the degraded path, the public entry point, or the REST layer
Issue 7:
2. Code Quality Assessment2.1 Coding Standards
2.2 Test Coverage and Test Stability
2.3 Documentation Updates
3. Architectural Soundness3.1 Elegance — Precise fix with one debatable design choiceThe servlet -> service -> operation -> builder decomposition matches every other Zeta REST endpoint's shape, and reusing 3.2 MaintainabilityGood — small classes, clear names, no inheritance tricks, no shared mutable state, easy to unit test in isolation. The main maintainability risk is reputational: if operators learn this endpoint sometimes reports unexplained zeros, the API loses its diagnostic value. Fixing Issue 1 plus the Issue 5 WARN removes that risk. 3.3 ExtensibilityA per-job/per-pipeline/per-worker breakdown is a solid foundation for a future Web UI panel or slot-pressure alerting, and the response shape leaves room for additional fields (e.g. a degraded flag) without breaking existing callers. Once something actually polls it in production, Issues 3 and 4 stop being theoretical. 3.4 Historical-Version CompatibilityNo existing REST contract, config option, default value, serialized state, checkpoint, or savepoint format is touched; old clients are unaffected. New serializer id 4. Issue Summary
5. Merge RecommendationConclusion: Ready to merge after fixes1. Blockers (must fix before merge)
2. Recommended fixes (non-blocking)
Overall assessment The feature is worth having and the plumbing is well done: routing is correct on both API versions, the serializer id is free, What's holding it back is that the three blockers cluster around the same theme: the endpoint behaves worst exactly when it's needed most — during a master transition it can silently return all zeros while blocking a shared cluster thread for up to 1.5s per running job, with nothing logged anywhere to explain why. Two of the three blockers are a handful of lines each (Issues 2 and 3); Issue 1 needs one deliberate decision (degraded flag vs. coordinator-only fallback) plus a test for it. Once those land, with a REST-level test proving real slot counts end to end, this is a solid, useful addition to Zeta diagnostics. CI status at the time of this review: |
DanielLeens
left a comment
There was a problem hiding this comment.
Re-checking my own PR again today. Head is still 20538ae1ebe78cc2d35871fbd02e1d79b960e154 — no new commits, and no new comments or reviews from anyone since my last round on 2026-08-19. I re-skimmed the diff and it still matches exactly what I reviewed then: the new running-job slot-usage REST API plus its doc updates. Build on the apache-side check is green (SUCCESS), same as at my last review. My prior conclusion stands: ready to merge, pending a maintainer with approval rights since GitHub blocks self-approval on this account.
|
Thanks @DanielLeens for the thorough self-review at The feature looks reasonable to me: a purely additive, read-only per-job slot-usage endpoint fills a real gap, since A few things before I can approve:
Once those are addressed I'm happy to do the formal approval, since self-approval is blocked on your account. |
DanielLeens
left a comment
There was a problem hiding this comment.
What Problem Does This PR Solve?
- User pain point: Zeta's
/overviewendpoint only reports cluster-wide slot totals; operators diagnosing a stuck or over-provisioned cluster have no way to ask "how many slots is running job X holding right now, and on which workers/pipelines". - Fix approach: a read-only REST endpoint,
/running-jobs/slot-usage(v2, Jetty) and/hazelcast/rest/maps/running-jobs/slot-usage(v1), backed by a stateless aggregation helper (RunningJobSlotUsageBuilder) that intersects the coordinator's owned-slot map with the resource manager's assigned-slot snapshot, grouped by job/pipeline/worker. - One-sentence summary: a purely additive, read-only per-running-job slot-usage diagnostics endpoint for the Zeta REST API.
1. Code Change Review
1.1 Core Logic Analysis
This is a verification round, not a from-scratch re-review of unchanged code. The current head, 20538ae1ebe78cc2d35871fbd02e1d79b960e154, is byte-identical to what I already reviewed in full on 2026-08-03 and 2026-08-16, and re-verified line-by-line against source again on 2026-08-19 — no commits have landed since. Per the review protocol, I am not re-deriving that analysis from scratch a fourth time; I re-confirmed the runtime path, the compatibility analysis, and all seven open issues still hold exactly as last stated, and I'm focusing this round on what's actually new: reviewer SEZ9's 2026-08-21 comment.
Responding to SEZ9's three points, each checked against current source rather than taken at face value:
-
"Does the diff include unit tests for
RunningJobSlotUsageBuilderand e2e coverage for v1/v2, including non-master forwarding?" No — this is the same gap I already flagged as Issue 6 below (open since 2026-08-03). The one existing test,RunningJobSlotUsageBuilderTest, exercises the package-private 3-arg aggregation overload with real numeric assertions (including a correctly-constructed slot-reuse race case), but does not reach the publicbuild(SeaTunnelServer)entry point, the degraded-resource-manager path, the serializer round-trip for the new operation class id17, or either REST layer (v1/v2, including the non-master-forwards-to-master branch). I agree withSEZ9this needs aRunningJobSlotUsageRestITfollowing the existingPendingJobsRestIT/RealtimeMetricsRestITprecedent, plus the two missing unit cases for Issue 1's degraded path. -
"Rebase — behind_by=28 relative to
dev." Re-checked independently:git compare dev...20538ae1ebnow reportsahead_by: 3, behind_by: 46(grown fromSEZ9's28since their check, as expected with time). I confirm this diff (ahead_by: 3, ~626 additions across 13 files, ~0 deletions) does not touch any file that would conflict withdev's intervening 46 commits based on the file list, but a rebase before merge is still the right call to get a CI run against a current base rather than a stale one, especially given how far behind this now is. -
"
jobIdserialized as a string — intentional and consistent between v1/v2?" Confirmed from source, not just from the doc examples: both the v1 (/hazelcast/rest/maps/running-jobs/slot-usage) and v2 (/running-jobs/slot-usage) entry points converge on the sameRunningJobSlotUsageService.getRunningJobSlotUsageJson()→RunningJobSlotUsageBuilder.build()→SlotUsage.toResponse()call chain (traced in my 2026-08-19 round; re-verified this round).SlotUsage.toResponse()(RunningJobSlotUsageBuilder.java:199) doesresponse.put("jobId", String.valueOf(jobId))— one code path, so v1 and v2 are guaranteed identical by construction, not by convention. This is also the right choice, not just a consistent one: Zeta job ids are Snowflake-style longs that can exceed2^53, so a raw JSON number would silently lose precision in JavaScript consumers; stringifying avoids that. Worth a one-line doc note on why, but not a defect.
Runtime path (unchanged, re-confirmed accurate at this head — not re-derived, carried forward from my verified 2026-08-19 trace):
HTTP GET /running-jobs/slot-usage (v2) or /hazelcast/rest/maps/running-jobs/slot-usage (v1)
-> RunningJobSlotUsageService.getRunningJobSlotUsageJson()
master? -> RunningJobSlotUsageBuilder.build(server) [in-process]
not master -> sendOperationToMasterNode(GetRunningJobSlotUsageOperation)
-> master: RunningJobSlotUsageBuilder.build(server) [shared Hazelcast op thread, see Issue 3]
Aggregation: IMAP_RUNNING_JOB_INFO keys (filtered by shouldShowAsRunningJob)
intersected with getInitializedResourceManager().getAssignedSlots(...) via SlotKey
grouped into per-job/pipeline/worker SlotUsage -> toResponse()
1.2 Compatibility Impact
Fully compatible, unchanged from prior rounds: purely additive REST surface, new serializer class id 17 (verified non-colliding, dev currently tops out at 16), no existing endpoint, config option, or serialized/checkpoint state touched. The rolling-upgrade nuance (a new-version node forwarding this new operation to an old-version master would hit IllegalArgumentException("Unknown type id 17")) is confined to this new endpoint and breaks nothing pre-existing.
1.3 Performance / Side-Effect Analysis
Unchanged from prior rounds — see Issues 2, 3, 4 below. No new findings this round.
1.4 Error Handling and Logging
No formal issues are new this round; the seven previously-identified issues are unchanged and re-confirmed still present at this head (I re-read each cited line range this round rather than assuming staleness-proofing from the earlier rounds):
Issue 1: slotCount: 0 is indistinguishable from "couldn't read the slot source" (Medium, unchanged)
- Location:
RunningJobSlotUsageBuilder.java:68-73, 446-448. Still open.
Issue 2: getCoordinatorService() called once per running job inside the filter lambda; can sleep up to 1.5s per call (Medium, unchanged)
- Location:
RunningJobSlotUsageBuilder.java:59-66. Still open — trivially hoistable, two-line fix.
Issue 3: Aggregation runs inline on a shared Hazelcast generic operation thread instead of a dedicated executor, unlike the directly comparable sibling operation (Medium, unchanged)
- Location:
GetRunningJobSlotUsageOperation.java:92-96. Still open.
Issue 4: Full cluster-wide owned-slot map materialized per request, no cache/TTL/rate limit (Low, unchanged)
- Location:
RunningJobSlotUsageBuilder.java:88-92, 423-426.
Issue 5: No logging anywhere in the new path; mastership loss on the forwarding branch surfaces as an unhandled 500 (Low, unchanged, matches pre-existing sibling-servlet pattern)
- Location:
RunningJobSlotUsageService.java:35-43.
Issue 6: No coverage of the degraded path, the public build(SeaTunnelServer) entry point, serializer round-trip, or REST layer (Low, unchanged — independently corroborated by SEZ9 this round)
- Location:
RunningJobSlotUsageBuilderTest.java. Raised by another reviewer: Yes (@SEZ9, 2026-08-21).
Issue 7: slotCount counts task-group entries, not distinct physical slots; field/endpoint name implies otherwise (Low, unchanged)
- Location:
RunningJobSlotUsageBuilder.java:428-433, 503-509.
Issue 8 (new this round): branch is 46 commits behind dev (Low, informational)
- Location: branch state. Not a code defect — the diff itself doesn't touch anything that looks conflict-prone — but per
SEZ9's point, worth rebasing before merge so CI runs against a current base rather than one nearly four dozen commits stale. Raised by another reviewer: Yes (@SEZ9, 2026-08-21).
2. Code Quality Assessment
2.1 Coding Standards
Unchanged from prior rounds: ASF headers present, no wildcard imports, every new class carries a class-level Javadoc, non-trivial methods have explanatory comments. The one documented gap (Javadoc on build(SeaTunnelServer) should state the freshness/consistency contract between the two joined data sources, given Issue 1) remains open.
2.2 Test Coverage and Test Stability
Rating: Stable for what exists (no Thread.sleep, no Awaitility/polling, no shared static state, no order-sensitive or floating-point assertions — nothing here can contribute to CI flakiness). The coverage gap (Issue 6) is real and now independently flagged by a second reviewer, but it's a completeness problem, not a stability problem — nothing in the existing test suite is flaky.
2.3 Documentation Updates
Unchanged from prior rounds: all four REST reference docs (docs/en|zh/engines/zeta/rest-api-v1.md, rest-api-v2.md) updated accurately in both languages, example payload matches the code exactly (including the jobId-as-string choice confirmed above). Missing doc follow-ups remain: slotCount: 0 ambiguity (Issue 1), counting unit (Issue 7), per-request cost characteristic (Issue 4).
3. Architectural Soundness
3.1 Elegance of the Solution
Precise fix with one debatable design choice, unchanged assessment: the servlet → service → operation → builder decomposition matches every other Zeta REST endpoint; the two-source join (cluster-replicated IMap vs. master-local heartbeat-refreshed snapshot) is architecturally honest about what it measures, but its weaker source is empty in exactly the failover scenario this endpoint exists to help diagnose (Issue 1).
3.2 Maintainability
Unchanged: small classes, clear names, no shared mutable state, easy to unit test in isolation once Issue 6 is addressed.
3.3 Extensibility
Unchanged: solid foundation for a future Web UI panel or slot-pressure alerting.
3.4 Historical-Version Compatibility
Unchanged: no existing REST contract, config, serialized state, checkpoint, or savepoint format touched; new serializer id 17 is collision-free against current dev. No incompatible-changes.md entry required.
4. Issue Summary
| # | Issue | Location | Severity | Raised by another reviewer |
|---|---|---|---|---|
| 1 | slotCount: 0 indistinguishable from "couldn't read the slot source" during failover/cold-start |
RunningJobSlotUsageBuilder.java:68-73, 446-448 |
Medium | No |
| 2 | getCoordinatorService() called per-job in filter lambda, can sleep up to 1.5s/call |
RunningJobSlotUsageBuilder.java:59-66 |
Medium | No |
| 3 | Aggregation runs inline on shared Hazelcast generic operation thread | GetRunningJobSlotUsageOperation.java:92-96 |
Medium | No |
| 4 | Full cluster-wide owned-slot map read per request, no cache/rate limit | RunningJobSlotUsageBuilder.java:88-92, 423-426 |
Low | No |
| 5 | No logging in new path; forwarding-branch mastership loss is unhandled 500 | RunningJobSlotUsageService.java:35-43 |
Low | No |
| 6 | No coverage of degraded path, public entry point, serializer round-trip, or REST layer | RunningJobSlotUsageBuilderTest.java |
Low | Yes (@SEZ9) |
| 7 | slotCount counts task-group entries, not distinct slots |
RunningJobSlotUsageBuilder.java:428-433, 503-509 |
Low | No |
| 8 | Branch 46 commits behind dev; rebase before merge |
branch state | Low | Yes (@SEZ9) |
5. Merge Recommendation
Conclusion: Ready to merge after fixes
1. Blockers — must be fixed before merge:
- Issue 1 — make "couldn't read the slot source" distinguishable from "genuinely zero slots" (degraded flag or coordinator-only fallback, plus a test for it). Unaddressed since my first review of this code on 2026-08-03.
- Issue 2 — hoist
getCoordinatorService()out of the per-job lambda; trivial two-line fix. - Issue 3 — offload the aggregation off the shared Hazelcast operation thread, following the
GetRunningJobMetricsOperationprecedent already in the same package. - Issue 6 — add the REST-layer IT and the two degraded-path unit cases. This is not new this round, but
SEZ9's independent flag of the same gap raises its priority; I'm keeping it non-blocking-severity (Low) per my own technical assessment, but recommend treating it as a practical precondition for merge alongside the three severity-Medium blockers, since a Medium-severity behavior fix (Issue 1) without a regression test for it isn't really closed.
2. Recommended fixes — non-blocking:
- Issue 4 — narrow the
IMapread or add a short-TTL cache. - Issue 5 — single server lookup, try/catch around the forwarded
.join(), WARN on degraded slot source. - Issue 7 — de-duplicate by
SlotKeyor rename the field so the counting unit is unambiguous. - Issue 8 — rebase onto current
devbefore the final merge so CI runs against a current base.
Overall assessment. No code has changed since my 2026-08-19 round, and nothing in SEZ9's 2026-08-21 comment identifies a new defect — all three of their points either corroborate an issue I'd already raised (tests) or are new-but-non-blocking process items (rebase, and a documentation confirmation that checks out correctly against source). The feature itself remains worth having and the plumbing is sound (routing, serializer id, wire-safety of ownerJobID, CME-safety, compatibility all verified against source across multiple rounds); what's holding it back is that the endpoint behaves worst exactly when it's needed most — during a master transition it can silently report all-zero slot counts while blocking a shared cluster thread for up to 1.5s per running job, with nothing logged to explain why. This posts as a comment rather than an approval: it is my own PR, and GitHub does not permit self-approval on it. Since SEZ9 said they're "happy to do the formal approval" once their points are addressed, and two of their three points are process items already satisfied or clarified by this comment, the main remaining gate for an external approval is the same three Medium-severity code fixes I've been tracking since 2026-08-03.
What Problem Does This PR Solve?
This is a genuinely fresh, from-scratch verification pass rather than a rehash of the earlier rounds on this PR. I did not trust the prior write-ups; I pulled every changed file straight from the GitHub Contents API at the exact head commit ( Simple example: 1. Code Change Review1.1 Core Logic AnalysisRuntime path, traced end to end against the current head: I independently re-verified the full registration matrix (this PR touches connector-adjacent REST wiring, so I checked it like a plugin registration even though it isn't one):
Key findings (all independently confirmed by reading the actual files, not by trusting a prior summary):
Correction to the location citations in this PR's own review history. While fetching the actual files to verify each issue, I found that several previously-reported secondary line ranges do not exist in the real file: 1.2 Compatibility ImpactFully compatible. Purely additive REST surface ( 1.3 Performance / Side-Effect AnalysisSee Issues 2 and 3 above for the concurrency-relevant findings (per-job blocking sleep, on a shared operation thread). Beyond that: the full 1.4 Error Handling and Logging
Formal issues, sorted by severity: Issue 1 (Medium):
Issue 2 (Medium):
Issue 3 (Medium): aggregation runs inline on the invoking thread instead of a dedicated executor, unlike the directly comparable sibling operation
Issue 4 (Low): full cluster-wide owned-slot map read per request, no cache/TTL
Issue 5 (Low): no logging in the new path; forwarding-branch mastership loss surfaces as an unhandled 500
Issue 6 (Low): no coverage of the degraded path, the public
Issue 7 (Low):
Issue 8 (Low, informational): branch drift
2. Code Quality Assessment2.1 Coding StandardsASF headers present on all new files; no wildcard imports; every new class carries a class-level Javadoc; non-trivial methods have explanatory comments. One real gap: 2.2 Test Coverage and Test StabilityRating: Stable. I read the one existing test end to end: no 2.3 Documentation UpdatesAll four REST reference docs ( 3. Architectural Soundness3.1 Elegance of the SolutionPrecise fix with one debatable design choice. The servlet -> service -> operation -> builder decomposition matches every other Zeta REST endpoint I cross-checked in this module. The two-source join (cluster-replicated 3.2 MaintainabilitySmall, focused classes; clear names; no shared mutable state; the aggregation logic is already unit-testable in isolation (proven by the existing test using the package-private overload) — closing Issue 6 is straightforward from here. 3.3 ExtensibilitySolid foundation for a future Web UI panel or slot-pressure alerting on top of this data. 3.4 Historical-Version CompatibilityNo existing REST contract, config option, serialized job/checkpoint/savepoint state is touched. New serializer id 4. Issue Summary
5. Merge RecommendationConclusion: Ready to merge after fixes1. Blockers — must be fixed before merge:
2. Recommended fixes — non-blocking:
Overall assessment. I re-derived every technical conclusion above directly from source rather than trusting the PR's own review history, and I reach the same bottom line the last round did: the feature is genuinely useful and the plumbing (routing, serializer id, compatibility) is sound, but the endpoint currently behaves worst exactly when it would be needed most — during a master/coordinator transition it can silently report all-zero slot counts while blocking a thread shared with other cluster-internal work for up to 1.5s per running job, with nothing logged to explain why. Live CI at review time is green ( |
20538ae to
7c43aaf
Compare
DanielLeens
left a comment
There was a problem hiding this comment.
What Problem Does This PR Solve?
- User pain point: Zeta's
/overviewendpoint only reports cluster-wide slot totals; operators diagnosing a stuck, over-provisioned, or unbalanced cluster have no way to ask "how many slots is running job X holding right now, and on which pipelines/workers?" - Fix approach: a read-only REST endpoint,
/running-jobs/slot-usage(v2, Jetty) and/hazelcast/rest/maps/running-jobs/slot-usage(v1), backed by a stateless aggregation helper (RunningJobSlotUsageBuilder) that intersects the coordinator's owned-slot map (IMAP_OWNED_SLOT_PROFILES) with the resource manager's assigned-slot snapshot, grouped by job/pipeline/worker. - One-sentence summary: a purely additive, read-only per-running-job slot-usage diagnostics endpoint for the Zeta REST API.
This is a re-review of my own PR since two more commits landed after my 2026-08-22 08:39 UTC round (head was 20538ae1eb..., now 7c43aaf8): [Improve][Zeta] Clarify running job slot usage diagnostics and [Improve][Zeta] Preserve retryable slot usage failures. Rather than trust that earlier write-up, I re-read every changed file at the current head from scratch and checked each of the three declared blockers (Issues 1-3) against the actual current source.
1. Code Change Review
1.1 Core Logic Analysis
Runtime path is unchanged from the prior round and still traces cleanly end to end:
HTTP GET /running-jobs/slot-usage (v2) HTTP GET /hazelcast/rest/maps/running-jobs/slot-usage (v1)
-> RunningJobSlotUsageServlet.doGet() -> RestHttpGetCommandProcessor.handleRunningJobsSlotUsage()
-> RunningJobSlotUsageService.getRunningJobSlotUsageJson() <----------------------------------------------------/
+-- this node IS master -> RunningJobSlotUsageBuilder.build(server) [in-process]
+-- this node NOT master -> NodeEngineUtil.sendOperationToMasterNode(new GetRunningJobSlotUsageOperation()).join()
-> master: GetRunningJobSlotUsageOperation.run()
-> CompletableFuture.supplyAsync(() -> build(service), getExecutor(...))
Status of the three blockers from my 2026-08-22 round, re-verified against the current head:
- Issue 1 (was Medium, "slotCount: 0 indistinguishable from source-not-ready") — confirmed fixed.
RunningJobSlotUsageBuilder.javanow threads anassignedSlotSourceInitializedflag throughbuild(...)and derivesslotSourceAvailableinaggregateSlotUsage(...): it isfalsewhenever the resource manager isn't initialized, and alsofalsewhenassignedSlotscomes back completely empty while owned-slot entries exist for running jobs (a global "stale snapshot" signal). Two new tests lock this in:shouldMarkSlotSourceUnavailableWhenResourceManagerIsNotInitializedandshouldMarkSlotSourceUnavailableWhenAssignedSlotsLagBehindOwnedSlots. The REST-layer E2E test (RestApiIT.testGetRunningJobSlotUsage) also now assertsslotSourceAvailable == trueon the happy path. - Issue 2 (was Medium, "getCoordinatorService() called per running job, up to 1.5s sleep per call") — confirmed fixed.
build(SeaTunnelServer)now doesCoordinatorService coordinatorService = server.getCoordinatorService();once, before therunningJobInfo.keySet().forEach(...)loop, and the loop body only callscoordinatorService.shouldShowAsRunningJob(jobId)on the already-resolved reference. - Issue 3 (was Medium, "aggregation runs inline on the invoking operation thread, no executor hand-off") — not reproducible at the current head. I read
GetRunningJobSlotUsageOperation.javain full:run()already wraps the work inCompletableFuture.supplyAsync(() -> ..., getNodeEngine().getExecutionService().getExecutor("get_running_job_slot_usage_operation")), byte-for-byte the same pattern as the siblingGetRunningJobMetricsOperationI compared it against last round. Neither of the two follow-up commits touches this part of the file, so this either was already correct when I looked before and I mis-cited it, or an earlier intermediate state genuinely lacked it — either way, the current source is correct and I'm retracting Issue 3 rather than propagate a stale claim.
New finding from this round (not previously raised):
- The
slotSourceAvailablefix only detects the global degenerate case:assignedSlotSetis entirely empty while some running job owns slots. It does not detect per-job partial staleness: ifassignedSlotsalready contains entries for other running jobs but is momentarily missing the entries for one specific job (e.g. that job's slots were just written intoIMAP_OWNED_SLOT_PROFILESbyPhysicalVertexbut haven't yet round-tripped into the resource manager's heartbeat-refreshedWorkerProfile.getAssignedSlots()— these are two independently-updated data structures with no shared consistency token),slotSourceRequiresVerificationisfalse(becauseassignedSlotSetisn't empty), soslotSourceAvailableis reportedtruefor that response while the affected job'sslotCountis0. That directly contradicts the documented contract ("slotSourceAvailableindicates whether the master-side assigned-slot snapshot was available for this response"). It's self-healing (resolves on the next request once the resource-manager view catches up) and the existing E2E test already tolerates the transient window viaAwaitility.await().atMost(2, MINUTES).untilAsserted(...), which suggests this exact class of transient mismatch was anticipated in practice — but the production-facing flag doesn't fully cover it, only the all-or-nothing case. See Issue 1 below.
1.2 Compatibility Impact
Fully compatible. Purely additive REST surface; new serializer class id 17 in ClientToServerOperationDataSerializerHook. I re-checked this live against the current dev HEAD via the GitHub Contents API (dev is now 23 commits ahead of this PR's merge-base) and the highest existing id there is still 16, so 17 remains collision-free. No existing endpoint, config Option, default value, or checkpoint/savepoint/job-state serialization is touched. jobId is serialized as a string consistently on both v1 and v2 paths, correctly avoiding JS Number precision loss for Snowflake-style ids.
1.3 Performance / Side-Effect Analysis
No new locking, retries, or resource-release concerns (strictly read-only). The full IMAP_OWNED_SLOT_PROFILES map is still iterated per request with no cache/TTL (carried-forward Issue, see Issue 4). The operation offloads work to its own named executor rather than blocking a shared operation thread, so the earlier concurrency concern (former Issue 3) does not apply to the current code.
1.4 Error Handling and Logging
GetRunningJobSlotUsageOperation.awaitResponse(...) (added this round) now correctly distinguishes InterruptedException (restores the interrupt flag, wraps as RuntimeException) from ExecutionException (throw ExceptionUtil.rethrow(e.getCause()), preserving the original exception type instead of erasing it into a generic wrapper). This matters concretely for SeaTunnelEngineRetryableException: before this fix, a retryable failure surfaced from the async computation would have been re-wrapped and lost its retryable-ness to any caller that pattern-matches on exception type; ExceptionUtil.rethrow is the same pre-existing Hazelcast-derived utility used elsewhere in this module, so this is a safe, well-established fix, not new machinery. GetRunningJobSlotUsageOperationTest covers both the retryable-unwrap path and the plain success path with future.get(); it does not cover the InterruptedException branch specifically (Low, see Issue 6).
Formal issues, sorted by severity:
Issue 1 (Medium): slotSourceAvailable only catches the all-empty case, not per-job partial staleness
- Location:
RunningJobSlotUsageBuilder.java,aggregateSlotUsage(...)(theslotSourceRequiresVerification/hasOwnedSlotsForRunningJobscomputation). - Problem: as described in section 1.1 above — a specific running job's owned slots can be excluded from
slotCountwhileslotSourceAvailablestill reportstrue, if other jobs already have entries inassignedSlots. - Potential risk: an operator querying a job that just started (or just had a slot reassigned) can see
slotCount: 0, slotSourceAvailable: trueand reasonably conclude the job holds no slots, when it's actually a transient snapshot lag. - Best improvement: track readiness per job (e.g. compare the set of job ids observed in
assignedSlotsagainst the set of job ids with owned-slot entries) instead of one global boolean; or explicitly document this as a known, self-healing, best-effort limitation and adjust the wording so "available" doesn't overstate the guarantee. Either way, add a unit test for "some assigned slots present for job A, job B has a fresh owned-slot entry not yet reflected in assignedSlots" to pin down the intended behavior. - Severity: Medium (correctness of a diagnostics-purpose flag whose entire job is to prevent exactly this kind of misread; narrow window, self-healing, not a stability risk).
- Raised by another reviewer: No.
Issue 2 (Low): build(SeaTunnelServer) Javadoc still doesn't document the two-source freshness contract
- Location:
RunningJobSlotUsageBuilder.java, class/method Javadoc. - This was already requested in my 2026-08-22 round's Coding Standards note and is now more relevant given Issue 1 above — a one-line addition explaining that
IMAP_OWNED_SLOT_PROFILESand the resource manager's assigned-slot snapshot are independently updated and can transiently disagree would help future readers. - Raised by another reviewer: No (carried forward from my own prior coding-standards note, now sharpened).
Issue 3 (Low, carried forward unaddressed): full cluster-wide owned-slot map scan per request, no cache/TTL
- Location:
RunningJobSlotUsageBuilder.java(ownedSlotProfiles.forEach(...)inaggregateSlotUsage). - Bounded cost, not a leak, but worth noting for large clusters with many pipelines.
- Raised by another reviewer: No (carried forward from my own 2026-08-22 round).
Issue 4 (Low, carried forward unaddressed): no logging on the non-master forwarding branch
- Location:
RunningJobSlotUsageService.java,getRunningJobSlotUsageJson()—NodeEngineUtil.sendOperationToMasterNode(...).join()with no try/catch/log; a failure during mastership loss surfaces as a generic unhandled exception with no diagnostic line. Matches the pre-existing pattern of sibling servlets in this module, so not a regression, just a missed opportunity. - Raised by another reviewer: No (carried forward from my own 2026-08-22 round).
Issue 5 (Low): sibling Get*Operation classes still use the pre-fix exception-wrapping pattern
- Location: e.g.
GetRunningJobMetricsOperation.java(catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); }), and several others in the same package. - This PR's own
awaitResponsefix (section 1.4) is correctly scoped to the new operation only; fixing the siblings is out of scope for a "new REST API" PR per the project's PR-scope convention, but flagging it as a good, low-risk follow-up for module-wide consistency. - Raised by another reviewer: No.
Issue 6 (Low, substantially closed this round): test coverage gaps
- What's now covered that wasn't at my 2026-08-22 round: the public
build(SeaTunnelServer)entry point via a fully mockedSeaTunnelServer/CoordinatorService/IMap(shouldMarkSlotSourceUnavailable...x2), and the operation's exception-unwrap behavior (GetRunningJobSlotUsageOperationTest, 2 tests). - What's still missing: the
InterruptedExceptionbranch ofawaitResponse(interrupt-flag restoration) has no dedicated test; there's no serializer round-trip test for the new class id17inClientToServerOperationDataSerializerHookTest-style coverage (if such a test class exists for this hook elsewhere in the module). - Raised by another reviewer: Yes (@SEZ9, 2026-08-21) for the original gap — now mostly closed.
Issue 7 (Low, carried forward unaddressed): slotCount counts task-group entries, not deduplicated distinct slots
- Location:
RunningJobSlotUsageBuilder.java,aggregatePipelineSlots(...)/SlotUsage.addSlot(...). - If a single physical slot is ever shared by more than one task group of the same job, this would double-count it under the current field semantics. No counter-example found in the diff that rules this out; a narrow naming/semantics mismatch, not confirmed to be reachable today.
- Raised by another reviewer: No (carried forward from my own 2026-08-22 round).
Issue 8 (Low, informational): branch drift
- Live re-check:
dev...7c43aaf8compare isahead_by: 3, behind_by: 23, status: diverged. Not a blocker, but please rebase before final merge for a clean CI baseline. - Raised by another reviewer: Yes (@SEZ9, 2026-08-21).
2. Code Quality Assessment
2.1 Coding Standards
ASF headers present on all new files; no wildcard imports; new classes carry class-level Javadoc. See Issue 2 above for the one remaining gap (freshness-contract documentation).
2.2 Test Coverage and Test Stability
Rating: Stable. Read both test files (RunningJobSlotUsageBuilderTest, 218 lines, 3 tests; GetRunningJobSlotUsageOperationTest, 48 lines, 2 tests) end to end: no Thread.sleep, no shared static state, no order-sensitive or floating-point assertions. The E2E test's Awaitility.await().atMost(2, TimeUnit.MINUTES).untilAsserted(...) is the correct pattern for polling an eventually-consistent REST response rather than a fixed sleep, and it now also validates internal consistency (slotCount == sum(pipelineSlotCounts) == sum(workerSlotCounts)) in addition to the raw endpoint shape. No stability risk identified; remaining gaps are coverage-completeness only (Issue 6).
2.3 Documentation Updates
All four REST reference docs (docs/en|zh/engines/zeta/rest-api-v1.md, rest-api-v2.md) are updated consistently and match the code's actual response shape, including the new slotSourceAvailable field and its caveat note. See Issue 2 for the one remaining internal-Javadoc gap (user-facing docs are fine as-is).
3. Architectural Soundness
3.1 Elegance of the Solution
The servlet -> service -> operation -> builder decomposition matches every other Zeta REST endpoint in this module, and the executor offload in the operation now matches its closest sibling exactly. The two-source join (cluster-replicated IMap for ownership vs. a master-local, heartbeat-refreshed snapshot for assignment) is architecturally honest about what each source represents; the slotSourceAvailable flag is a reasonable choice to surface disagreement rather than silently trusting one source, though its coverage is narrower than the current documentation implies (Issue 1).
3.2 Maintainability
Small, focused classes; clear names; no shared mutable state; the aggregation logic remains unit-testable in isolation and is now exercised through both the internal and public entry points.
3.3 Extensibility
Solid foundation for a future Web UI panel or slot-pressure alerting on top of this data.
3.4 Historical-Version Compatibility
No existing REST contract, config option, or serialized job/checkpoint/savepoint state is touched. New serializer id 17 re-verified collision-free against the current live dev HEAD. No docs/en/introduction/concepts/incompatible-changes.md entry is required.
4. Issue Summary
| # | Issue | Location | Severity | Raised by another reviewer |
|---|---|---|---|---|
| 1 | slotSourceAvailable only catches the all-empty case, not per-job partial staleness |
RunningJobSlotUsageBuilder.java (aggregateSlotUsage) |
Medium | No |
| 2 | build(SeaTunnelServer) Javadoc missing freshness-contract note |
RunningJobSlotUsageBuilder.java |
Low | No (self-carried) |
| 3 | Full cluster-wide owned-slot map scan per request, no cache | RunningJobSlotUsageBuilder.java |
Low | No (self-carried) |
| 4 | No logging on non-master forwarding branch | RunningJobSlotUsageService.java |
Low | No (self-carried) |
| 5 | Sibling operations still use pre-fix exception wrapping (out of scope) | e.g. GetRunningJobMetricsOperation.java |
Low | No |
| 6 | Minor remaining test gaps (InterruptedException branch, serializer round-trip) | GetRunningJobSlotUsageOperationTest.java |
Low | Yes (@SEZ9, mostly closed) |
| 7 | slotCount counts task-group entries, not deduplicated distinct slots |
RunningJobSlotUsageBuilder.java |
Low | No (self-carried) |
| 8 | Branch diverged from dev (ahead_by 3, behind_by 23) |
branch state | Low | Yes (@SEZ9) |
5. Merge Recommendation
Conclusion: Ready to merge after fixes
1. Blockers — must be fixed:
- Issue 1 — either tighten
slotSourceAvailableto detect per-job staleness, or adjust the documented guarantee so it doesn't overstate what the flag actually covers, with a regression test either way.
2. Recommended fixes — non-blocking:
- Issue 2 — add the freshness-contract note to the Javadoc.
- Issue 3 — consider a short-TTL cache for the full-map scan if this endpoint is expected to be polled frequently.
- Issue 4 — add a WARN log on the forwarding-branch failure path.
- Issue 6 — add the
InterruptedException-branch test. - Issue 7 — de-duplicate by
SlotKeyor rename the field so the counting unit is unambiguous. - Issue 8 — rebase onto current
devbefore the final merge.
Overall assessment. All three previously-declared blockers from my 2026-08-22 round were checked directly against the current source: two (Issues 1 and 2 from that round) are genuinely fixed with regression tests, and the third (former Issue 3, executor hand-off) turned out not to be present in the current code, so I'm retracting it rather than repeating it. The one new finding from this round (current Issue 1 here) is narrower than the original all-or-nothing gap it replaces, self-healing, and doesn't change the overall direction of the PR — the plumbing (routing, serializer id, compatibility, executor offload, exception semantics) is now solid. CI (Build) is currently pending on the fork run for this head; I'll leave the final "ready to merge" call pending a green build and a maintainer with approval rights, since GitHub does not allow self-approval on this account.
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for the continued work on this one. This is my sixth pass on this PR (previous rounds: Aug 3, Aug 16, Aug 21 x2, Aug 23). The current head (7c43aaf8fa7) is unchanged since my last round, so per the community review protocol I re-read the whole diff from scratch, re-traced the runtime call chain end to end, and — critically — this time I waited for the fork CI run for this exact head to finish, since my Aug 23 review was written while Build was still pending. That run has since completed, and it changes the bottom line, so I'm posting a fresh consolidated review rather than a short follow-up comment.
What Problem Does This PR Solve?
- User pain point: operators have no dedicated REST endpoint to see how many slots each running Zeta job currently holds, broken down by pipeline and worker.
- Fix approach: a new
/running-jobs/slot-usage(v2 Jetty) and/hazelcast/rest/maps/running-jobs/slot-usage(v1) endpoint, backed byRunningJobSlotUsageBuilder, which cross-references the coordinator-owned slot map with the resource manager's assigned-slot snapshot and now also reports aslotSourceAvailableflag when the two sources disagree. - One-sentence summary: this PR adds a per-running-job slot usage diagnostics API, with an explicit staleness signal instead of silently reporting
0.
1. Code Change Review
1.1 Core Logic Analysis
Runtime path (traced directly from source at the current head):
REST request
-> /running-jobs/slot-usage (Jetty) or /hazelcast/rest/maps/running-jobs/slot-usage (legacy)
-> RunningJobSlotUsageServlet.doGet() / RestHttpGetCommandProcessor.handleRunningJobsSlotUsage()
-> RunningJobSlotUsageService.getRunningJobSlotUsageJson()
- on master: builds locally
- on worker: forwards to master via GetRunningJobSlotUsageOperation
Master-side aggregation
-> GetRunningJobSlotUsageOperation.run()
- offloads to executor "get_running_job_slot_usage_operation", blocks on future.get()
-> RunningJobSlotUsageBuilder.build(server)
- runningJobIds: IMAP_RUNNING_JOB_INFO.keySet() filtered by coordinatorService.shouldShowAsRunningJob(jobId)
- ownedSlotProfiles: IMAP_OWNED_SLOT_PROFILES (cluster-replicated IMap)
- assignedSlots: coordinatorService.getInitializedResourceManager().getAssignedSlots(...) (master-local, heartbeat-refreshed snapshot), or emptyList() if resource manager not yet initialized
-> aggregateSlotUsage(...) intersects ownedSlotProfiles with assignedSlotSet and derives slotSourceAvailable
Key findings from this round's independent re-read:
- The endpoint wiring is solid and CI-tested end to end.
JettyService,RestConstant,RestHttpGetCommandProcessor, the new servlet/service/operation/serializer-hook classes all follow the exact same shape as their siblings (RunningJobsServlet,GetRunningJobMetricsOperation, etc.). Serializer id17is new; I checked it against currentdevHEAD (ClientToServerOperationDataSerializerHook.java, ids used there top out at16), so there is no collision. slotSourceAvailablecorrectly detects the all-empty staleness case, but not per-job partial staleness — carryover, still present. I re-derived this independently fromRunningJobSlotUsageBuilder.java:723-749(aggregateSlotUsage): the flag only flips tofalsewhenassignedSlotSetis empty cluster-wide while owned slots exist for a running job. If the resource manager's assigned-slot view is current for job A but lagging specifically for job B (a very plausible per-job/per-worker heartbeat-timing scenario, not just an all-or-nothing "resource manager not initialized" scenario),assignedSlotSetis non-empty overall,slotSourceRequiresVerificationisfalse, and job B is reported withslotCount: 0, slotSourceAvailable: true— a real result, not a degraded one. This is exactly Issue 1 from my Aug 23 round; it is still open in the current source and I'm carrying it forward rather than re-numbering it as new. Raised by another reviewer: No (self-carried).- New blocking finding this round: the current head does not compile, and it's caused by this PR's own new test file, not by anything in
dev. See Issue 1 below — this supersedes everything else until fixed.
1.2 Compatibility Impact
Fully compatible. New endpoint only, no existing REST route, config Option, or serialized job/checkpoint/savepoint format is touched. No entry needed in docs/en/introduction/concepts/incompatible-changes.md.
1.3 Performance / Side-Effect Analysis
RunningJobSlotUsageBuilder.builddoes a full scan ofIMAP_OWNED_SLOT_PROFILESper request with no caching or TTL. For a cluster with many running jobs/pipelines polled frequently (e.g. from a UI auto-refresh), this is a repeated full cluster-wideIMapscan; not a correctness bug, but worth a short-TTL cache if this is expected to be polled at sub-second intervals (carried over as a non-blocking Low item, same as my Aug 23 round).- The master-side operation offloads the actual aggregation to a dedicated executor and blocks the invoking thread on
future.get(). I confirmed this matches the same async-hand-off pattern used by its closest sibling operation in this module, so it isn't a new concurrency risk introduced by this PR specifically — it's consistent with existing precedent here, for better or worse. - Reads from
IMAP_RUNNING_JOB_INFOandIMAP_OWNED_SLOT_PROFILESare lock-free, best-effort snapshots of live distributed state, so a job that starts/finishes mid-request can appear or disappear between the two reads. That's inherent to a diagnostics endpoint over live cluster state and is the same characteristic every other/running-jobs*endpoint in this module already has — this PR doesn't introduce a new consistency guarantee gap relative to its siblings, it just makes the known staleness source (assigned-slot lag) partially, not fully, visible (see the carryover finding above).
1.4 Error Handling and Logging
Issue 1: The current PR head fails to compile — CI-confirmed, PR-caused, blocking.
- Location:
seatunnel-engine/seatunnel-engine-server/src/test/java/org/apache/seatunnel/engine/server/trace/RunningJobSlotUsageBuilderTest.java:196 - Problem description:
Mockito.doAnswer(...).when(ownedSlotProfilesMap).forEach(Mockito.any());failsjavacwitherror: reference to forEach is ambiguous — both method forEach(Consumer<? super T>) in Iterable and method forEach(BiConsumer<? super K,? super V>) in IMap match. In the Hazelcast version this module depends on,IMapis bothIterableand declares its ownforEach(BiConsumer), so an untypedMockito.any()argument gives the compiler two equally-applicable overloads to satisfy and it can't pick one. I confirmed this against the actual fork CI log for this exact head (DanielLeens/seatunnelrun32612091485, jobunit-test (8, ubuntu-latest)):[ERROR] Failed to execute goal ... maven-compiler-plugin:3.10.1:testCompile ... on project seatunnel-engine-server: Compilation failure, same file/line. This is a brand-new test file introduced by this PR, so the break is unambiguously PR-caused, not an environmental/pre-existingdevissue. - Potential risk: this is why literally every job in the fork's build matrix is red right now —
unit-teston both JDKs/both OSes and every single connector/IT job (jdbc-, all-connectors-it-, cdc, kafka, mysql-cdc, etc.) failed.seatunnel-engine-servertest-compile is an early, shared reactor step, so one ambiguous overload in one new test file takes down the entire CI matrix. Nothing else needs investigating here — this is fully explained by this one line. - Best improvement: give the mock a concrete generic type witness so the overload is unambiguous, e.g.
Mockito.doAnswer(...).when(ownedSlotProfilesMap).forEach(Mockito.<BiConsumer<PipelineLocation, Map<TaskGroupLocation, SlotProfile>>>any());, or.forEach((BiConsumer<PipelineLocation, Map<TaskGroupLocation, SlotProfile>>) Mockito.any());. Either compiles cleanly and keeps the existing stubbing behavior; no test logic needs to change. - Severity: High (blocking)
- Raised by another reviewer: No (new this round — CI had not finished at the time of my Aug 23 review)
Issue 2 (carryover from my Aug 3 / Aug 21 / Aug 23 rounds): slotSourceAvailable only detects cluster-wide all-empty staleness, not per-job partial staleness.
- Location:
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/trace/RunningJobSlotUsageBuilder.java:711-749(aggregateSlotUsage) - Problem description: see the detailed walk-through in section 1.1 above. In short, the flag is computed once for the whole response batch from a single cluster-wide
assignedSlotSet.isEmpty()check, so a job whose assigned-slot data is specifically stale (while other jobs' data is current) is indistinguishable from a job that genuinely holds zero slots — both come back asslotCount: 0, slotSourceAvailable: true. - Potential risk: an operator (or an alerting rule built on this field) can be told a specific job holds no slots when the truth is "we don't know for this job right now." This is the scenario the flag was added to solve, and it solves the coarse-grained (whole-response) version but not the fine-grained (per-job) version.
- Best improvement: Option A — compute
slotSourceAvailableper job by checking whether that job's own owned-slot entries are present inassignedSlotSet, rather than a single cluster-wide check. Option B — if per-job detection is judged too complex for this iteration, tighten the doc wording indocs/en|zh/engines/zeta/rest-api-v1.md/rest-api-v2.mdso it doesn't imply per-job accuracy it doesn't have, and file a fast-follow issue for the finer-grained version. Either way, add a regression test for the "one job stale, one job current" case, which none of the three current unit tests cover. - Severity: Medium
- Raised by another reviewer: No (self-carried across four prior rounds)
All other items from my Aug 23 review (Javadoc freshness-contract note, no short-TTL cache, no WARN log on the forwarding-branch failure path, slotCount counting task-group entries rather than de-duplicated distinct slots, sibling operations still using older exception-wrapping style, branch being behind dev) are unchanged in the current source and remain open as non-blocking Low items — I won't re-paste all of them verbatim here to avoid duplicating my own prior comment, but they still apply and are listed in the Issue Summary table below for completeness.
2. Code Quality Assessment
2.1 Coding Standards
ASF headers present on all new files, no wildcard imports, new public/package-private classes carry class-level Javadoc. The one gap I've noted before (build(SeaTunnelServer) doesn't document the freshness contract of its two data sources) is still present — Low, listed in the table.
2.2 Test Coverage and Test Stability
Rating: currently non-executable (Issue 1); design itself is Stable once that's fixed.
I read all three test classes end to end:
RunningJobSlotUsageBuilderTest(218 lines, 3 tests) — noThread.sleep, no shared static state, no order-dependent or floating-point assertions. Covers: normal aggregation with slot reuse across jobs, resource-manager-not-initialized, and assigned-slots-empty-while-owned-slots-exist. It does not cover the per-job partial-staleness case from Issue 2, nor does it exercise the exactforEachstubbing pattern in a way that would have caught Issue 1 before CI did (the ambiguity is a compile-time error, so no amount of localmvn teston a passing baseline would show it unless test-compile is actually run — which is exactly what happened here).GetRunningJobSlotUsageOperationTest(48 lines, 2 tests) — verifies the retryable-exception-unwrap path and the plain success path forawaitResponse. Small and focused, deterministic.RestApiIT.testGetRunningJobSlotUsage— usesAwaitility.await().atMost(2, TimeUnit.MINUTES).untilAsserted(...), the correct pattern for polling an eventually-consistent REST response, and assertsslotCount == sum(pipelineSlotCounts) == sum(workerSlotCounts)in addition to the raw shape. No stability red flags.
Once Issue 1 is fixed, my stability read from Aug 23 stands: no flaky patterns identified. The only real gap is coverage-completeness for Issue 2 (Medium, not a stability issue).
2.3 Documentation Updates
docs/en|zh/engines/zeta/rest-api-v1.md and rest-api-v2.md are all updated consistently and the JSON shape/field descriptions match the code, including slotSourceAvailable and its caveat note. Given Issue 2, the caveat note is technically narrower than reality (it doesn't mention that the flag can be true even when a specific job's data is stale) — see Option B above.
3. Architectural Soundness
3.1 Elegance of the Solution
The servlet -> service -> operation -> builder decomposition matches every other Zeta REST endpoint in this module. The two-source join (cluster-replicated IMap for ownership vs. master-local heartbeat-refreshed snapshot for assignment) is an honest representation of what each source actually is, and slotSourceAvailable is a reasonable mechanism to surface disagreement — its current scope (cluster-wide, not per-job) is the one remaining gap.
3.2 Maintainability
Small, focused, well-named classes; no shared mutable state outside the request scope; the aggregation logic is unit-testable in isolation (once it compiles).
3.3 Extensibility
Good foundation for a future Web UI slot-usage panel or slot-pressure alerting.
3.4 Historical-Version Compatibility
No existing REST contract, config option, or checkpoint/savepoint-serialized state is touched. Serializer id 17 re-verified collision-free against current dev HEAD as of this review.
4. Issue Summary
| # | Issue | Location | Severity | Raised by another reviewer |
|---|---|---|---|---|
| 1 | Current head fails testCompile — ambiguous forEach overload in new test file, confirmed via fork CI log |
RunningJobSlotUsageBuilderTest.java:196 |
High (blocking) | No |
| 2 | slotSourceAvailable only detects cluster-wide all-empty staleness, not per-job partial staleness |
RunningJobSlotUsageBuilder.java (aggregateSlotUsage) |
Medium | No (self-carried, 4th round) |
| 3 | build(SeaTunnelServer) Javadoc missing freshness-contract note |
RunningJobSlotUsageBuilder.java |
Low | No (self-carried) |
| 4 | Full cluster-wide owned-slot map scan per request, no cache | RunningJobSlotUsageBuilder.java |
Low | No (self-carried) |
| 5 | No logging on the non-master forwarding branch's failure path | RunningJobSlotUsageService.java |
Low | No (self-carried) |
| 6 | slotCount counts task-group entries, not de-duplicated distinct slots |
RunningJobSlotUsageBuilder.java |
Low | No (self-carried) |
| 7 | Sibling operations still use pre-fix exception wrapping (out of scope for this PR) | e.g. GetRunningJobMetricsOperation.java |
Low | No |
| 8 | Branch diverged from dev (34 commits behind as of this round) |
branch state | Low | Yes (@SEZ9, previously) |
5. Merge Recommendation
Conclusion: Not recommended for merge (in its current state)
1. Blockers — must be fixed:
- Issue 1 — fix the ambiguous
forEachmock stub soseatunnel-engine-servertest-compile succeeds again. This is a one-line, mechanical fix (add a generic type witness or cast) with no behavioral change; once it lands, a green re-run of the full CI matrix is needed to confirm nothing else regressed, since the current run never got pasttestCompile. - Issue 2 — either extend
slotSourceAvailableto detect per-job staleness, or narrow the documented guarantee so it doesn't overstate what the flag covers today, with a regression test for whichever direction is chosen.
2. Recommended fixes — non-blocking:
- Issues 3–8 as listed above (Javadoc, caching, logging, slot de-duplication semantics, sibling exception-wrapping consistency, rebase onto current
dev).
Overall assessment. The design direction here is good and hasn't changed across five rounds of review: the servlet/service/operation/builder layering is consistent with the rest of the module, the endpoint is wired into the same authentication filter chain as every other REST endpoint in JettyService (BasicAuthFilter is registered on context.addFilter(..., "/*", ...), which covers the new servlet identically to its siblings — I checked this specifically given the "any new REST endpoint" framing of this review round, and found no access-control gap relative to existing endpoints), and the serializer id doesn't collide with current dev. What's blocking merge right now is much more mundane than architecture: the PR's own newest commit introduced a test file that doesn't compile, so CI never actually validated anything beyond testCompile for this head — I'd treat the "all tests green" bar as not yet attempted, not as passed-then-regressed. Once Issue 1 is fixed and the full matrix goes green, Issue 2 is the only substantive open item left from my side, and it has a clear, scoped path to resolution in either direction (A or B above). I don't see a better alternative architecture worth trading for — this is the right shape for the feature.
|
Thanks @DanielLeens for the thorough, repeated passes on this — the end-to-end trace of both the v2 Jetty path and the legacy A few things I'd like nailed down before we can move forward:
On the substance itself: the design — a purely additive, read-only endpoint with worker-to-master forwarding via |
|
Thanks for following up. Both questions were already answered in my most recent round (the Aug 24 15:05 UTC comment) — repeating and reconfirming here since the head hasn't moved since then (still
So the bottom line is unchanged since Aug 24: not ready to merge — the compile failure blocks any CI signal at all, and the per-job staleness gap in |
DanielLeens
left a comment
There was a problem hiding this comment.
What Problem Does This PR Solve?
- User pain point: Zeta's
/overviewendpoint only reports cluster-wide slot totals; operators diagnosing a stuck, over-provisioned, or unbalanced cluster have no way to ask "how many slots is running job X holding right now, and on which pipelines/workers?" - Fix approach: a read-only REST endpoint,
/running-jobs/slot-usage(v2, Jetty) and/hazelcast/rest/maps/running-jobs/slot-usage(v1), backed by a stateless aggregation helper (RunningJobSlotUsageBuilder) that intersects the coordinator's owned-slot map (IMAP_OWNED_SLOT_PROFILES) with the resource manager's assigned-slot snapshot, grouped by job/pipeline/worker, plus aslotSourceAvailablestaleness signal. - One-sentence summary: a purely additive, read-only per-running-job slot-usage diagnostics endpoint for the Zeta REST API.
This is round 8 on this PR (previous rounds: Aug 3, Aug 16, Aug 19 x2, Aug 21 x2, Aug 22, Aug 23, Aug 24). Head has not moved since my Aug 24 round (7c43aaf8fa7ffbf42098fea7085d83c792392c27, last commit 2026-08-23T02:07:51Z, independently re-confirmed live via the PR API's commit list) and there have been no new comments from anyone since my own Aug 25 15:07 reply. Per the review protocol, I am not re-deriving the whole analysis from scratch a ninth time; instead I re-verified every open item directly against the current authoritative source (fetched fresh via the GitHub Contents API at this exact commit, not trusted from any prior write-up) and I'm reporting what changed and what didn't.
1. Code Change Review
1.1 Core Logic Analysis
Runtime path (unchanged, re-confirmed by re-reading the actual files at the current head rather than carried forward blindly):
HTTP GET /running-jobs/slot-usage (v2) HTTP GET /hazelcast/rest/maps/running-jobs/slot-usage (v1)
-> RunningJobSlotUsageServlet.doGet() -> RestHttpGetCommandProcessor.handleRunningJobsSlotUsage()
-> RunningJobSlotUsageService.getRunningJobSlotUsageJson() <---------------------------------------------------/
+-- this node IS master -> RunningJobSlotUsageBuilder.build(server) [in-process]
+-- this node NOT master -> forward GetRunningJobSlotUsageOperation to master
-> offloaded to executor "get_running_job_slot_usage_operation"
-> RunningJobSlotUsageBuilder.build(server)
RunningJobSlotUsageBuilder.build(SeaTunnelServer) [lines 55-78 at current head]
CoordinatorService coordinatorService = server.getCoordinatorService(); // resolved ONCE (Issue 2 from Aug 22 - fix confirmed still present)
runningJobInfo.keySet().forEach(jobId -> coordinatorService.shouldShowAsRunningJob(jobId) ...)
ResourceManager resourceManager = coordinatorService.getInitializedResourceManager();
boolean assignedSlotSourceInitialized = resourceManager != null; // Issue 1 from Aug 3/16/19 - fix confirmed still present
assignedSlots = !assignedSlotSourceInitialized ? emptyList() : resourceManager.getAssignedSlots(...)
-> aggregateSlotUsage(...) intersects ownedSlotProfiles with assignedSlotSet, derives slotSourceAvailable
I re-pulled RunningJobSlotUsageBuilder.java fresh (257 lines) and GetRunningJobSlotUsageOperation.java fresh at 7c43aaf8fa7f and confirm lines 61-78 are byte-identical to what I reviewed on Aug 23/24: coordinatorService is still resolved once before the loop, and assignedSlotSourceInitialized still correctly distinguishes "resource manager not initialized" from "genuinely zero." Both fixes from my earlier rounds are holding. I am not re-opening either.
What has NOT changed and is still open:
- The
slotSourceAvailableper-job partial-staleness gap from my Aug 23/24 rounds (Issue 2 below) — the flag is computed once per response batch from a cluster-wideassignedSlotSet.isEmpty()check, so a specific job whose assigned-slot data hasn't round-tripped yet (while other jobs' data is current) still reportsslotCount: 0, slotSourceAvailable: true. No code in this area has changed since Aug 23, so this remains open exactly as last described. Location unchanged:RunningJobSlotUsageBuilder.java(aggregateSlotUsage). - The compile-breaking test file (Issue 1 below) — still broken, see 1.4.
New this round: the PR can no longer be merged cleanly. gh api repos/apache/seatunnel/pulls/11597 now reports "mergeable": false, "mergeable_state": "dirty" — a change from every prior round, where mergeable_state was blocked (self-approval gate only) and mergeable was true/MERGEABLE. I did not take this at face value; I traced the cause: dev...7c43aaf8fa7f is now ahead_by: 3, behind_by: 78 (up from behind_by: 48 at my Aug 22 round and 23 at Aug 23/24 — dev has moved fast). Comparing this PR's changed-file list against dev's commit history since this PR's base commit, I found three separate REST-API-adding PRs merged into dev on 2026-08-29, all touching the exact same four doc files this PR touches:
0071e8fa60—[Feature][Zeta] Add worker resource REST API (#11909)9ec9c4fe8a—[Feature][Zeta] Read and change log levels on the v2 REST API (#11984)c44f5b3388—[Improve][Zeta] Expose job/pipeline restart and state-transition signals in job-info REST (#11982)
All three edit docs/en/engines/zeta/rest-api-v1.md / rest-api-v2.md (and presumably their zh counterparts) — the same reference-doc files this PR appends a new endpoint section to. I independently confirmed zero overlap in the Java source files: none of dev's commits since this PR's merge-base touch RunningJobSlotUsageBuilder.java, GetRunningJobSlotUsageOperation.java, JettyService.java, RestConstant.java, RestHttpGetCommandProcessor.java, or the serializer hook — so this is not a semantic/functional conflict in the engine code, it's textual contention in the growing REST API reference doc from three concurrently-merged sibling features. Still a real, blocking merge conflict that needs a rebase to resolve (see Issue 3).
1.2 Compatibility Impact
Fully compatible, unchanged from every prior round: purely additive REST surface, new serializer class id 17 (re-verified non-colliding against current dev HEAD as of this round — dev's ClientToServerOperationDataSerializerHook still tops out below 17, since the three new PRs I found above don't touch that file). No existing endpoint, config Option, default value, or checkpoint/savepoint/job-state serialization is touched. No incompatible-changes.md entry required.
1.3 Performance / Side-Effect Analysis
Unchanged from my Aug 23/24 rounds — the operation offloads aggregation to a dedicated executor (confirmed still present at this head, see 1.1), getCoordinatorService() is no longer called per-job, and the full-map scan of IMAP_OWNED_SLOT_PROFILES per request with no cache/TTL remains a non-blocking Low item (Issue 5). No new performance findings this round.
1.4 Error Handling and Logging
Issue 1 (High, blocking, unchanged from my Aug 24 round): the current head still fails testCompile.
- Location:
seatunnel-engine/seatunnel-engine-server/src/test/java/org/apache/seatunnel/engine/server/trace/RunningJobSlotUsageBuilderTest.java:196 - I re-fetched this exact file fresh from the GitHub Contents API at
7c43aaf8fa7f(not trusted from my prior write-up) and confirm line 196 is unchanged:Mockito.doAnswer( invocation -> { BiConsumer<PipelineLocation, Map<TaskGroupLocation, SlotProfile>> consumer = invocation.getArgument(0); ownedSlotProfiles.forEach(consumer); return null; }) .when(ownedSlotProfilesMap) .forEach(Mockito.any());
Mockito.any()with no type witness is ambiguous betweenIterable.forEach(Consumer)andIMap.forEach(BiConsumer), whichjavaccannot resolve. This is the exact same line I diagnosed against the fork CI log on Aug 24/25 (run32612091485, jobunit-test,seatunnel-engine-servertestCompilefailure). The apache-sideBuildcheck-run for this head (https://github.com/apache/seatunnel/runs/97126644419) is unchanged:conclusion: failure,completed_at: 2026-08-24T00:17:37Z— this is the same run, not a new one; no CI has re-run since this file was last touched. - Potential risk: this one line takes down
seatunnel-engine-server's shared test-compile step, which fails the entire CI matrix (every unit-test and connector-IT job), so there is still zero CI signal on this PR beyond "it doesn't compile." - Best improvement: give the mock a generic type witness, e.g.
Mockito.<BiConsumer<PipelineLocation, Map<TaskGroupLocation, SlotProfile>>>any(), or cast:.forEach((BiConsumer<PipelineLocation, Map<TaskGroupLocation, SlotProfile>>) Mockito.any()). Mechanical, no behavior change. - Severity: High (blocking)
- Raised by another reviewer: No (self-carried, unfixed since Aug 24)
Issue 2 (Medium, unchanged from Aug 23/24): slotSourceAvailable only detects cluster-wide all-empty staleness, not per-job partial staleness.
- Location:
RunningJobSlotUsageBuilder.java(aggregateSlotUsage) - Re-verified against the current head this round (see 1.1) — no change since Aug 23. A job whose own owned-slot entries haven't round-tripped into the resource manager's assigned-slot snapshot yet, while other jobs' data is current, is reported as
slotCount: 0, slotSourceAvailable: truerather than being flagged as unverified. - Best improvement: track staleness per job (compare the set of job ids observed in
assignedSlotsagainst the set of job ids with owned-slot entries), or narrow the documented guarantee so it doesn't overstate per-job accuracy, with a regression test for the "one job stale, one job current" case. - Severity: Medium
- Raised by another reviewer: No (self-carried, 5th round)
Issue 3 (Low, new this round): PR now has a real merge conflict against dev (mergeable: false, mergeable_state: dirty).
- Location: branch state; root-caused above in 1.1 to three doc-only collisions in
docs/en|zh/engines/zeta/rest-api-v1.md/v2.mdfrom PRs #11909, #11984, #11982 merged intodevon 2026-08-29. - Potential risk: none beyond needing manual conflict resolution before merge — confirmed no Java source file overlap, so this is not a functional/semantic risk, just doc-section contention from three concurrently-landed sibling REST endpoints.
- Best improvement: rebase onto current
devand manually merge the four doc files (each PR likely appends a new endpoint subsection to the same reference list). - Severity: Low (mechanical, docs-only)
- Raised by another reviewer: No
All other previously-identified Low items are unchanged and still open (not re-derived this round since nothing in their code has moved): build(SeaTunnelServer) Javadoc still doesn't document the two-source freshness contract; full cluster-wide owned-slot map scan per request with no cache; no logging on the non-master forwarding branch's failure path; slotCount counts task-group entries rather than de-duplicated distinct slots; sibling Get*Operation classes still use the pre-fix exception-wrapping pattern (out of scope for this PR). Listed in the table below for completeness (Issues 4-8).
2. Code Quality Assessment
2.1 Coding Standards
Unchanged: ASF headers present on all new files, no wildcard imports, class-level Javadoc on all new classes. The one open gap (freshness-contract note on build(SeaTunnelServer)) remains, tracked as Issue 6.
2.2 Test Coverage and Test Stability
I re-read all three test files fresh at the current head (RunningJobSlotUsageBuilderTest.java, GetRunningJobSlotUsageOperationTest.java, and RestApiIT.testGetRunningJobSlotUsage): no Thread.sleep, no shared static state, no order-sensitive or floating-point assertions. The E2E test's Awaitility.await().atMost(2, TimeUnit.MINUTES).untilAsserted(...) remains the correct pattern for polling an eventually-consistent REST response.
Test stability rating: currently non-executable (Issue 1 blocks testCompile entirely); the test design itself, where it can run, is Stable. This is the same rating as my Aug 24 round — nothing has changed to improve or worsen it. A "Stable" design rating does not offset a High-severity compile break: until Issue 1 is fixed, none of these tests provide any signal to CI at all, which is why I keep the merge recommendation at "not ready."
2.3 Documentation Updates
All four REST reference docs (docs/en|zh/engines/zeta/rest-api-v1.md, rest-api-v2.md) are updated consistently and accurately describe the current response shape, including slotSourceAvailable. Given Issue 3, these are also the exact files with the new merge conflict — worth flagging so whoever rebases knows to expect textual conflicts here specifically, not just "run git rebase and see."
3. Architectural Soundness
3.1 Elegance of the Solution
Unchanged assessment: the servlet -> service -> operation -> builder decomposition matches every other Zeta REST endpoint, and the executor offload plus the slotSourceAvailable staleness signal are both reasonable, previously-validated design choices. The one remaining architectural gap is the per-job (vs. cluster-wide) granularity of that staleness signal (Issue 2).
3.2 Maintainability
Unchanged: small, focused classes, no shared mutable state, easy to unit test in isolation once Issue 1 is fixed.
3.3 Extensibility
Unchanged: good foundation for a future Web UI slot-usage panel or slot-pressure alerting. Worth noting that three sibling REST-diagnostics PRs (#11909, #11984, #11982) landed in dev in the days since this PR's last update, confirming this area of the codebase is actively growing — all the more reason to land this cleanly rather than let it drift further.
3.4 Historical-Version Compatibility
Unchanged: no existing REST contract, config option, or checkpoint/savepoint-serialized state is touched. Serializer id 17 re-verified collision-free against current live dev HEAD as of this round.
4. Issue Summary
| # | Issue | Location | Severity | Raised by another reviewer |
|---|---|---|---|---|
| 1 | Current head still fails testCompile — ambiguous forEach overload in new test file, unfixed since Aug 24, same fork CI run still red |
RunningJobSlotUsageBuilderTest.java:196 |
High (blocking) | No |
| 2 | slotSourceAvailable only detects cluster-wide all-empty staleness, not per-job partial staleness |
RunningJobSlotUsageBuilder.java (aggregateSlotUsage) |
Medium | No (self-carried, 5th round) |
| 3 | PR now has a real merge conflict against dev (mergeable: false, dirty); root-caused to doc-only collisions with 3 sibling REST-endpoint PRs merged 2026-08-29 |
branch state; docs/en|zh/engines/zeta/rest-api-v1.md, v2.md |
Low | No (new this round) |
| 4 | build(SeaTunnelServer) Javadoc missing freshness-contract note |
RunningJobSlotUsageBuilder.java |
Low | No (self-carried) |
| 5 | Full cluster-wide owned-slot map scan per request, no cache | RunningJobSlotUsageBuilder.java |
Low | No (self-carried) |
| 6 | No logging on the non-master forwarding branch's failure path | RunningJobSlotUsageService.java |
Low | No (self-carried) |
| 7 | slotCount counts task-group entries, not de-duplicated distinct slots |
RunningJobSlotUsageBuilder.java |
Low | No (self-carried) |
| 8 | Sibling operations still use pre-fix exception wrapping (out of scope for this PR) | e.g. GetRunningJobMetricsOperation.java |
Low | No |
5. Merge Recommendation
Conclusion: Not recommended for merge
Blockers (must fix before merge):
- Issue 1 (High) — fix the ambiguous
forEachmock stub soseatunnel-engine-servertest-compile succeeds. One-line, mechanical fix, no behavior change. This has now been outstanding, unfixed, for 7 days across two review rounds (Aug 24, Aug 31) with no new commit pushed. - Issue 3 (Low but blocking in the literal GitHub-merge sense) — rebase onto current
devand resolve the doc-only conflicts inrest-api-v1.md/v2.md(en + zh) against the three sibling REST-endpoint PRs merged 2026-08-29. - Issue 2 (Medium) — either extend
slotSourceAvailableto detect per-job staleness, or explicitly narrow the documented guarantee so it doesn't overstate what the flag covers today, with a regression test for whichever direction is chosen.
Recommended fixes (non-blocking): Issues 4-8 as listed in the table (Javadoc freshness-contract note, short-TTL cache, forwarding-branch logging, slot de-duplication semantics, sibling exception-wrapping consistency).
Overall assessment. The design direction remains sound and unchanged across eight rounds of review: the servlet/service/operation/builder layering is consistent with the rest of the module, the endpoint is wired into the same authentication filter chain as every other REST endpoint, the serializer id doesn't collide, and both previously-fixed blockers (per-job getCoordinatorService() sleeps, inline aggregation on a shared operation thread) are holding at the current head. What's actually new this round is not a code regression — it's that six days have passed with the PR sitting on the exact same broken commit while dev kept moving: a compile-breaking test file that was already fully diagnosed with a one-line fix on Aug 24/25 is still unfixed, and in the meantime three other REST-diagnostics PRs landed in dev and now collide with this PR's doc changes, adding a mechanical-but-real rebase requirement on top. None of this needs new design work — it needs the pending one-line test fix pushed, followed by a rebase. Once that lands and CI actually runs (it hasn't gotten past testCompile since Aug 23), the remaining substantive item is the Medium per-job staleness gap in Issue 2, and this would be ready for an independent maintainer's approval. Since this is my own PR, I'm posting this as a plain comment rather than a formal review/approval — GitHub does not permit self-approval on this account, so a maintainer with approval rights remains the gate regardless of my own conclusion here.
CI diagnosis (explicit, per this round's check): gh pr checks 11597 currently shows Build: fail, pointing to https://github.com/apache/seatunnel/runs/97126644419. I confirmed via repos/apache/seatunnel/commits/7c43aaf8fa7f.../check-runs that this is the same completed check-run already diagnosed on Aug 24/25 (completed_at: 2026-08-24T00:17:37Z) — no new CI run has occurred since, which is expected since no new commit has been pushed. The failure is precisely and only the testCompile ambiguity in Issue 1; nothing else needs investigating on the CI side until that's fixed and a fresh run happens.
DanielLeens
left a comment
There was a problem hiding this comment.
What Problem Does This PR Solve?
- User pain point: Zeta's
/overviewendpoint only reports cluster-wide slot totals. An operator diagnosing a stuck, over-provisioned, or unbalanced cluster has no way to ask "how many slots is running job X holding right now, and on which pipelines/workers?" - Fix approach: adds a read-only REST endpoint —
/running-jobs/slot-usage(v2, Jetty) and the legacy/hazelcast/rest/maps/running-jobs/slot-usage(v1) — backed by a stateless aggregation helper (RunningJobSlotUsageBuilder) that intersects the coordinator's owned-slot map with the resource manager's assigned-slot snapshot, grouped by job/pipeline/worker, plus aslotSourceAvailablestaleness signal. - One-sentence summary: a purely additive, read-only diagnostics API for per-job slot usage, with no impact on scheduling, checkpointing, or any existing endpoint's contract.
Re-review note: this is a fresh, full re-review of the current head 07510c5530e6, triggered by a new commit landing since my last full review (that review was posted at head 2995a72ff664, 2026-09-13). I independently re-pulled git diff dev...HEAD at the current head and it is byte-for-byte identical, file for file, to the diff I reviewed at 2995a72ff664 — the only thing that changed was a routine Merge branch 'dev' into ... commit that pulled in ~487 unrelated files from dev (Python transform, FilterRowKind, embedding transform, etc.) and touched zero files this PR owns. I verified this with git diff 2995a72ff664 HEAD -- <all 15 PR-owned files>, which returns empty. So this round's full analysis is unchanged from my last review; what follows restates it with refreshed CI/compatibility verification rather than a different conclusion.
1. Code Change Review
1.1 Core Logic Analysis
Files with the core changes: RestHttpGetCommandProcessor.java, RunningJobSlotUsageBuilder.java, RunningJobSlotUsageService.java, GetRunningJobSlotUsageOperation.java, RunningJobSlotUsageServlet.java, JettyService.java, RestConstant.java, ClientToServerOperationDataSerializerHook.java, plus EN/ZH docs and tests.
Critical path: JettyService registers RunningJobSlotUsageServlet at /running-jobs/slot-usage → RunningJobSlotUsageService.getRunningJobSlotUsageJson() forwards to the master via GetRunningJobSlotUsageOperation (serializer id 18) if the local node isn't master → RunningJobSlotUsageBuilder.build(SeaTunnelServer) reads IMAP_RUNNING_JOB_INFO / IMAP_OWNED_SLOT_PROFILES and ResourceManager.getAssignedSlots(...) and returns an aggregated JSON payload. The legacy v1 path goes through RestHttpGetCommandProcessor.handleRunningJobsSlotUsage.
Before -> after (the only functional delta versus the prior round, carried in this diff):
// before (text/plain bug on the v1 legacy path)
this.prepareResponse(command, runningJobSlotUsageService.getRunningJobSlotUsageJson());
// after (RestHttpGetCommandProcessor.java:260-267)
this.prepareResponse(
command, Json.parse(runningJobSlotUsageService.getRunningJobSlotUsageJson()).asArray());I independently verified this against Hazelcast 5.1's actual HttpCommandProcessor.prepareResponse(HttpStatusCode, HttpCommand, Object) dispatch: value instanceof JsonValue → CONTENT_TYPE_JSON, value instanceof String → CONTENT_TYPE_PLAIN_TEXT. Json.parse(...).asArray() returns a JsonArray, a JsonValue subtype, so this now hits the JSON branch. This matches the file's own existing convention at two other call sites (Json.parse(response).asObject()), so it isn't a new pattern invented for this endpoint.
Key findings
- The normal operator path (calling the new v1 or v2 endpoint) directly reaches every line of this diff — there is no boundary/recovery-path gap here.
- Scope is strictly read-only diagnostics:
RunningJobSlotUsageBuilder.build(...)only calls getters onIMap/ResourceManager, never a scheduling or slot-allocation mutator. - This is a precise fix layered onto an already-reviewed, additive feature, not a workaround.
- One real, pre-existing, out-of-scope observation surfaced by re-reading this file end-to-end:
handleRunningJobsInfoandhandleRunningJobsSummaryInfoboth still pass a rawStringstraight toprepareResponse, meaning they likely carry the identicaltext/plainContent-Type bug this PR just fixed for its own new endpoint — just never caught because no existing test does strict.as(TypeRef...)JSON deserialization against those two v1 endpoints. This PR doesn't touch those methods, so it's not a blocker here (see Issue 5 below, out of scope).
In-depth correctness analysis: the fix only changes how an already-built String is wrapped for the HTTP response; it does not change how RunningJobSlotUsageBuilder builds that string, so the aggregation logic (job/pipeline/worker grouping, slotSourceAvailable staleness) is unaffected by this round. The v2 Jetty path (RunningJobSlotUsageServlet → BaseServlet.writeJsonString) already set the correct content type and needed no change.
Complete runtime path (this touches seatunnel-engine, so provided per Section 6.5):
Operator calls GET /hazelcast/rest/maps/running-jobs/slot-usage (v1) or GET /running-jobs/slot-usage (v2)
-> RestHttpGetCommandProcessor.handleRunningJobsSlotUsage [v1] / RunningJobSlotUsageServlet [v2]
-> RunningJobSlotUsageService.getRunningJobSlotUsageJson()
-> if local node is master: RunningJobSlotUsageBuilder.build(seaTunnelServer) directly
-> else: GetRunningJobSlotUsageOperation forwarded to master via NodeEngine InvocationBuilder
-> master executes on the "get_running_job_slot_usage_operation" executor
-> RunningJobSlotUsageBuilder.build(...) reads IMAP_RUNNING_JOB_INFO / IMAP_OWNED_SLOT_PROFILES,
ResourceManager.getAssignedSlots(...) -- all read-only
-> result returned as a JSON String, unwrapped via ExceptionUtil.rethrow(e.getCause())
-> v1: Json.parse(json).asArray() -> prepareResponse (JSON content-type branch, this round's fix)
-> v2: BaseServlet.writeJsonString (already correct before this round)
1.2 Compatibility Impact
Fully compatible. Purely additive: new REST paths, a new operation type id (18, the next free slot after 17, correctly avoiding the collision flagged in an earlier round), no change to any existing endpoint's request/response contract other than the Content-Type header on this PR's own brand-new, not-yet-released endpoint. No API, config default, protocol, or serialization-format change affects any released behavior. No checkpoint/savepoint or restore surface is touched.
1.3 Performance / Side-Effect Analysis
Unchanged from prior rounds: on-demand, read-only aggregation over existing IMap/ResourceManager structures, executed on a dedicated executor. No writes to scheduling or slot-allocation state, so there is no contention risk against the hot scheduling path. No unbounded loops, no new background threads, no retry amplification. The v1 fix this round only changes the wrapper type of an already-built string before writing to the HTTP response — no additional CPU/memory cost of note (only one JSON parse per request, unavoidable given Hazelcast's dispatch-by-type behavior).
1.4 Error Handling and Logging
Unchanged from prior rounds. GetRunningJobSlotUsageOperation.awaitResponse correctly unwraps ExecutionException via ExceptionUtil.rethrow(e.getCause()), preserving retryable-exception semantics (covered by GetRunningJobSlotUsageOperationTest). No exception is swallowed, no sensitive data (job configs, credentials) is included in the response payload — only job/pipeline/worker IDs and slot counts.
Issues carried and newly observed in this round:
- Issue 1 (Medium):
slotSourceAvailableonly detects cluster-wide staleness, not per-job, whiledocs/en|zh/engines/zeta/rest-api-v2.mdstill reads as if the guarantee were per-entry. Location:RunningJobSlotUsageBuilder.java(aggregateSlotUsage). Unchanged across every round since it was first raised; still open at the current head. Best improvement: either implement per-job staleness detection, or narrow the documented guarantee explicitly so it can't be misread as per-entry. Raised by another reviewer: No. - Issue 2 (Low):
handleRunningJobsInfo/handleRunningJobsSummaryInfoinRestHttpGetCommandProcessor.javalikely carry the same v1text/plainContent-Type bug this PR just fixed for its own endpoint, since both still pass a rawStringtoprepareResponse. Out of scope for this PR (pre-existing, not introduced by this diff) — recommend a separate tracking issue rather than growing this diff. Raised by another reviewer: No. - Issue 3 (Low):
build(SeaTunnelServer)Javadoc onRunningJobSlotUsageBuilderis missing an explicit freshness-contract note (i.e., what "current" means when the snapshot straddles a concurrent slot reassignment). Carried over, unchanged. Raised by another reviewer: No. - Issue 4 (Low):
RunningJobSlotUsageBuilderdoes a full cluster-wide owned-slot map scan per request with no cache; acceptable for a low-frequency diagnostics endpoint, but worth a comment noting the intentional trade-off if job/slot counts grow very large. Carried over, unchanged. Raised by another reviewer: No. - Issue 5 (Low): No logging on the non-master forwarding branch's failure path in
RunningJobSlotUsageService.java, which would make a forwarding failure harder to diagnose in production than necessary. Carried over, unchanged. Raised by another reviewer: No. - Issue 6 (Low):
slotCountcounts task-group entries rather than de-duplicated distinct slots, which can overcount when a slot backs multiple task groups. Carried over, unchanged. Raised by another reviewer: No.
2. Code Quality Assessment
2.1 Coding Standards
The new Content-Type fix carries a clear, accurate comment explaining why the Json.parse(...).asArray() wrapping is necessary — the right level of "why", not a restatement of "what". No license-header or style issues in the touched lines. All new fields/methods on RunningJobSlotUsageBuilder and the operation classes carry Javadoc except the freshness-contract gap noted in Issue 3.
2.2 Test Coverage and Test Stability
RestApiIT.testGetRunningJobSlotUsage exercises both the v1 (hazelcastPort) and v2 (Jetty httpPort) paths through the same Awaitility.await().atMost(2, TimeUnit.MINUTES).untilAsserted(...) pattern already used elsewhere in this suite, asserts slotCount > 0, and cross-checks that slotCount equals the sum of both pipelineSlotCounts and workerSlotCounts — a real consistency check, not just a status-code check.
Stability rating: Stable. No Thread.sleep, no order-dependent assertions, no shared mutable static state, no floating-point comparisons, no hard-coded ports. GetRunningJobSlotUsageOperationTest and RunningJobSlotUsageBuilderTest are plain unit tests with deterministic fixtures. This is unchanged from the last round's assessment since none of the test files changed in this diff.
2.3 Documentation Updates
EN/ZH docs for rest-api-v1.md and rest-api-v2.md are present and symmetric, unchanged by this round (correctly — the fix is response-encoding-only, not a contract change). Issue 1 above is a documentation-precision gap, not a missing-update gap.
3. Architectural Soundness
3.1 Elegance of the Solution
Precise fix. The Content-Type fix is minimal and root-cause (parse to JsonValue at the one call site producing the wrong header) rather than a broader rewrite; it deliberately does not also fix the two sibling endpoints that likely share the same latent bug (Issue 2), which is the right scope decision for this PR.
3.2 Maintainability
Following the file's own existing Json.parse(response).asObject() idiom (rather than introducing a new pattern) is the maintainable choice — a future reader scanning this file will recognize the shape immediately.
3.3 Extensibility
No change to this axis this round; the builder/service/operation separation from earlier rounds still gives a clean seam for a future per-job staleness signal (Issue 1) without touching the REST layer.
3.4 Historical-Version Compatibility
No impact — this is a new, unreleased endpoint; there is no historical client behavior to preserve, and no checkpoint/savepoint/serialization surface is touched.
CI Status
The apache-side Build check on the current head is still IN_PROGRESS/queued (fork run 34763554737, created for this exact head 07510c5530e6, has not produced job results yet). The most recent completed fork run for this PR's actual reviewed code (34688526716, at 2995a72ff664, whose owned-file diff is identical to the current head) shows:
engine-v2-it (11, ubuntu-latest): successengine-v2-it (8, ubuntu-latest): success (this had not finished at review time in my prior round; it is now confirmed green, resolving the one open CI question from that round)- Overall run conclusion was
failure, but every failing job in that run (all-connectors-it-2/6/7,doris-connector-it,paimon-connector-it,rocketmq-connector-it) is in a connector module this PR's diff never touches (engine-server REST/servlet/operation code only) and matches this project's known recurring environmental flakes (Couchbase container bootstrap, Paimon classloader/container issues, Doris/RocketMQ container flakiness) — not regressions introduced by this diff.
Since the owned-file diff at the current head is identical to 2995a72ff664, I'd expect the current head's engine-relevant jobs to reproduce the same green result once the queued run completes; I'm not asserting that as observed fact for this exact head, only as a reasoned inference from the file-identical diff.
4. Issue Summary
| # | Issue | Location | Severity |
|---|---|---|---|
| 1 | slotSourceAvailable only cluster-wide, docs read as per-entry |
RunningJobSlotUsageBuilder.java; docs/en|zh/engines/zeta/rest-api-v2.md |
Medium |
| 2 | handleRunningJobsInfo/handleRunningJobsSummaryInfo likely share the same v1 Content-Type bug (out of scope, pre-existing) |
RestHttpGetCommandProcessor.java |
Low |
| 3 | build(SeaTunnelServer) Javadoc missing freshness-contract note |
RunningJobSlotUsageBuilder.java |
Low |
| 4 | Full cluster-wide owned-slot map scan per request, no cache | RunningJobSlotUsageBuilder.java |
Low |
| 5 | No logging on the non-master forwarding failure path | RunningJobSlotUsageService.java |
Low |
| 6 | slotCount counts task-group entries, not de-duplicated distinct slots |
RunningJobSlotUsageBuilder.java |
Low |
5. Merge Recommendation
Conclusion: Ready to merge after fixes
-
Blockers — must be fixed
- Issue 1 (Medium): unchanged across every round so far — either implement per-job staleness detection or explicitly narrow the documented guarantee so
slotSourceAvailablecan't be misread as per-entry when it's actually cluster-wide. - CI: the queued run on the current exact head (
07510c5530e6) needs to actually complete green before this is callable fully CI-clean; I'm treating the file-identical prior green result as strong supporting evidence, not a substitute for observing this head's own result.
- Issue 1 (Medium): unchanged across every round so far — either implement per-job staleness detection or explicitly narrow the documented guarantee so
-
Recommended fixes — non-blocking
- Issues 2-6: all Low severity, all carried over from prior rounds with no change this round. None of them block merge; Issue 2 in particular is genuinely out of this PR's scope and is better tracked separately so this diff doesn't grow to cover pre-existing bugs it didn't introduce.
Overall assessment. This is a clean, well-scoped, read-only diagnostics addition. The only remaining code-level gate (Issue 1) has been stable across many rounds and is a documentation/implementation precision issue rather than a functional defect — reasonable for a maintainer to accept with a follow-up doc PR if that's the project's preference, but I'm keeping it listed as a blocker since it hasn't moved. Self-approval remains unavailable on this account regardless; an independent maintainer's sign-off is still required for merge.
🤖 Generated with Claude Code
DanielLeens
left a comment
There was a problem hiding this comment.
Follow-up on the CI state only — no new commit and no other new activity since my last full review at this exact head (07510c5530e6).
CI fact changed since my last review. At the time of my previous round, the Build check on this head was still queued/in-progress, so I listed "observe an actual green run on the exact head" as the outstanding CI item. It has since completed, and it is not green — Build finished with FAILURE on 07510c5530e6. That's a materially different fact from what I reported before, so here's the actual diagnosis rather than leaving the stale "wait for it to finish" guidance standing.
Failing jobs on this head, from the fork run (DanielLeens/seatunnel actions run 34763554737):
engine-v2-it (8, ubuntu-latest)/engine-v2-it (11, ubuntu-latest)— failures inSplitClusterFaultToleranceITandCheckpointCoordinatorFailoverIT. Both are pre-existing Zeta fault-tolerance/checkpoint E2E suites this PR's diff (RestHttpGetCommandProcessor.java,RunningJobSlotUsageBuilder.java,RunningJobSlotUsageService.java,GetRunningJobSlotUsageOperation.java,RunningJobSlotUsageServlet.java,JettyService.java,RestConstant.java, the client-side operation-data-serializer wiring) does not touch.all-connectors-it-2 (8/11, ubuntu-latest)—OpengaussCDCIT.testAddFieldWithRestore(AwaitilityConditionTimeoutException). Worth noting: I saw this exact same test fail, on the same day, in an entirely unrelated PR's CI run — one that doesn't touch this REST-endpoint code at all. That's a strong signal this specific failure is pre-existing/environmental rather than something this PR's diff introduces.all-connectors-it-7 (8, ubuntu-latest)—S3FileConnectDryRunIT. This one I can actually resolve for you: this branch isbehind_by=5againstdev, and one of those 5 missing commits is[Fix][CI] Use MinIO mirror for S3 dry-run tests, which addresses exactly this failure mode. Syncing the latestdevshould clear this job.
None of the three failing categories touch a file this PR owns, so I don't see evidence this is a regression introduced by the diff itself. The lowest-cost next step is: sync the latest dev (picks up the S3 dry-run fix) and rerun CI. If engine-v2-it / all-connectors-it-2 still fail after that, they're worth a rerun-in-isolation before treating them as PR-caused, since both test classes are known to be timing-sensitive under CI load.
This does not change the non-CI blocker from my last review. Issue 1 (Medium) — the slotSourceAvailable staleness-signal precision gap — is unchanged and still open regardless of CI outcome, so the overall conclusion stays Ready to merge after fixes, not approvable on a green CI alone. Self-approval remains unavailable on this account either way; an independent maintainer still needs to give the final sign-off.
🤖 Generated with Claude Code
|
Thanks for the update and for the detailed CI breakdown. To summarize where I think this stands on the one point that's been raised: The diff at On the
Concrete asks before I can move this forward:
The earlier comment also mentions a separate non-CI blocker, but that part of the thread is cut off on my end. Could you restate what that outstanding item is so we're working from the same list? |
|
Restating the non-CI item first, since that part of the thread got cut off for you. Non-CI blocker: v1 REST path Content-Type mismatch (from the 2026-09-12 comment). This is already fixed at the current head, in commit this.prepareResponse(
command,
Json.parse(runningJobSlotUsageService.getRunningJobSlotUsageJson()).asArray());Parsing the JSON string into a On the three CI-side asks:
🤖 Generated with Claude Code |
DanielLeens
left a comment
There was a problem hiding this comment.
What Problem Does This PR Solve?
Zeta's /overview endpoint only reports cluster-wide slot totals. An operator diagnosing a stuck, over-provisioned, or unbalanced cluster has no way to ask "how many slots is running job X holding right now, and on which pipelines/workers?" This PR adds a read-only REST endpoint - /running-jobs/slot-usage (v2, Jetty) and the legacy /hazelcast/rest/maps/running-jobs/slot-usage (v1) - backed by a stateless aggregation helper (RunningJobSlotUsageBuilder) that intersects the coordinator's owned-slot map with the resource manager's assigned-slot snapshot, grouped by job/pipeline/worker, plus a slotSourceAvailable staleness signal.
Example:
curl http://127.0.0.1:8080/running-jobs/slot-usage[
{
"jobId": "733584788375093248",
"slotCount": 3,
"slotSourceAvailable": true,
"pipelineSlotCounts": { "1": 2, "2": 1 },
"workerSlotCounts": { "10.0.0.8:5801": 2, "10.0.0.9:5801": 1 }
}
]This is a re-review at the current head 6ce47234d404c8dfd56f8f419a3fd77526f2465b, requested because a new commit landed since the last formal review. I re-pulled the whole diff and re-traced the call chain from scratch against the current head rather than trusting the prior write-ups on this thread, and I want to be upfront about the result: git diff 07510c5530e6 6ce47234d404 -- <all 15 PR-owned files> is empty. The only commit between the last fully-reviewed head and this one is a Merge branch 'dev' into ... that pulled in unrelated changes (BigQuery schema evolution, CheckpointCoordinator, finished-jobs pagination docs, an S3 dry-run CI fix) and touched zero files this PR owns. So the code-level conclusions below are unchanged from the last round; what's new is the CI/branch-drift picture, which I re-checked live.
1. Code Change Review
1.1 Core Logic Analysis
Runtime path, re-traced against the current head with file:line evidence:
GET /running-jobs/slot-usage (v2, Jetty) GET /hazelcast/rest/maps/running-jobs/slot-usage (v1)
-> JettyService registers RunningJobSlotUsageServlet -> RestHttpGetCommandProcessor.handleRunningJobsSlotUsage
-> RunningJobSlotUsageServlet.doGet() Json.parse(json).asArray() before prepareResponse,
-> RunningJobSlotUsageService.getRunningJobSlotUsageJson() so the response is served as application/json
(RunningJobSlotUsageService.java:35-43)
-- this node IS master -> RunningJobSlotUsageBuilder.build(server), in-process
-- this node NOT master -> GetRunningJobSlotUsageOperation forwarded to master, offloaded onto the
"get_running_job_slot_usage_operation" executor
(GetRunningJobSlotUsageOperation.java:53-63)
RunningJobSlotUsageBuilder.build(SeaTunnelServer) (RunningJobSlotUsageBuilder.java:49-78)
step 1 IMAP_RUNNING_JOB_INFO.keySet().forEach(jobId -> coordinatorService.shouldShowAsRunningJob(jobId))
coordinatorService resolved once (line 58) and reused, not per-iteration
step 2 resourceManager = coordinatorService.getInitializedResourceManager() (line 70)
assignedSlotSourceInitialized = resourceManager != null (line 71)
assignedSlots = initialized ? resourceManager.getAssignedSlots(...) : emptyList()
step 3 aggregateSlotUsage(...) intersects IMAP_OWNED_SLOT_PROFILES entries with the assigned-slot set by
SlotKey(worker, slotId, ownerJobId, sequence), and also derives one cluster-wide
`slotSourceAvailable` boolean (line 98-103, 110-136)
step 4 every job in the response gets the *same* slotSourceAvailable value (line 106)
I independently verified the mechanics I'd consider load-bearing rather than trusting the summary:
getCoordinatorService()is resolved once into a local (RunningJobSlotUsageBuilder.java:58) and reused for both the running-job filter and the resource-manager lookup, so there is no per-job blocking-sleep amplification.GetRunningJobSlotUsageOperation.run()genuinely offloads the aggregation onto a dedicated executor (GetRunningJobSlotUsageOperation.java:55-60) rather than running inline on the Hazelcast generic operation thread.- Serializer class id
18(ClientToServerOperationDataSerializerHook.java:85) does not collide with anything on the current head - id17is now taken by an unrelatedGET_JOB_DIAGNOSTICS_OPERATIONthat landed via adevmerge, and this PR's id was bumped accordingly. - The v1 legacy path wraps the JSON string via
Json.parse(...).asArray()beforeprepareResponse, which is the correct fix for Hazelcast's type-based Content-Type dispatch (String->text/plain,JsonValue->application/json) - this is what unblockedRestApiIT.testGetRunningJobSlotUsageon the v1 path. - Read-only invariant holds: every call in the new path (
IMap.keySet(),IMap.forEach,shouldShowAsRunningJob,getInitializedResourceManager(),getAssignedSlots) is a getter/read. Nothing callsrequestResource,releaseResource, or any scheduling mutator.
The one substantive gap, confirmed still present by reading the current file end to end: slotSourceAvailable is computed exactly once per request in aggregateSlotUsage (RunningJobSlotUsageBuilder.java:98-103, 110-136) and applied identically to every job in the response (usageByJob.values().forEach(usage -> result.add(usage.toResponse(slotSourceAvailable))), line 106). It is a single cluster-wide flag, not a per-job one. So if job A's owned-slot entries have round-tripped into the resource manager's assigned-slot snapshot but job B's haven't yet (a real possibility right after job B is scheduled, since the two data sources refresh independently), both jobs are stamped with the same slotSourceAvailable value - true if there's any verifiable assignment anywhere in the cluster, even though it may not verify job B's own zero.
The documentation compounds this rather than clarifying it: docs/en/engines/zeta/rest-api-v2.md:416 says "slotSourceAvailable indicates whether the master-side assigned-slot snapshot was available for this response," placed directly under a JSON example where the field sits inside one array element. A reader has every reason to assume this is per-job, when it is actually computed once for the whole request and copied onto every element. Docs and code are internally consistent with each other (both describe a single, cluster-wide value), but the wording ("for this response") is genuinely easy to misread as "for this job entry," and nothing in the docs states the cluster-wide scope explicitly.
This is not a new finding - it has been open and unchanged across the review history of this PR (RunningJobSlotUsageBuilder.java's relevant logic is byte-for-byte the same as it was several rounds ago) - but I want to record it here from my own independent read rather than just cite the thread, since that's what a from-scratch re-review means.
1.2 Compatibility Impact
Fully compatible. Purely additive: 15 files changed, 942 insertions, 0 deletions (git diff dev...HEAD --stat). New REST paths, new servlet/service/operation classes, new serializer class id 18 (no collision on current dev). No existing endpoint's response shape, config option, default value, or serialization format is touched. No checkpoint/savepoint/state-restore surface is touched. This is a new, unreleased endpoint, so there's no historical client contract to preserve either.
1.3 Performance / Side-Effect Analysis
- CPU/memory: linear aggregation over existing in-memory structures, nothing quadratic.
- The aggregation still does a full scan of
IMAP_OWNED_SLOT_PROFILESon every request (RunningJobSlotUsageBuilder.java:119-132), including entries for jobs that are immediately discarded because they aren't inrunningJobIds. There's no cache or TTL. For a low-frequency diagnostics endpoint this is an acceptable, bounded cost, not a leak - but it does mean a tight polling loop scales with total cluster state, not with the number of running jobs. - Threading: confirmed the aggregation runs on a dedicated executor rather than a shared Hazelcast operation thread (see 1.1), so this doesn't risk starving unrelated cluster operations the way an inline implementation would have.
- Read-only, idempotent, no retries, nothing to release.
1.4 Error Handling and Logging
- The entire new path (servlet, service, operation, builder) contains zero log statements. Combined with the
slotSourceAvailablegranularity gap above, an operator who seesslotCount: 0, slotSourceAvailable: truefor a job that just started has no log line anywhere to help them understand why. RunningJobSlotUsageService.getRunningJobSlotUsageJson()callsgetSeaTunnelServer(true)andgetSeaTunnelServer(false)as two separate calls (RunningJobSlotUsageService.java:36,42) and.join()s the forwarded invocation with no try/catch. A mastership change between the two calls would surface as an unhandled exception -> HTTP 500 rather than a clean transient error. I checked this against sibling servlets in the same package and confirmed the same gap already exists there, so this is a consistency-level nit inherited from the existing pattern, not a regression introduced by this PR.GetRunningJobSlotUsageOperation.awaitResponsecorrectly unwrapsExecutionExceptionviaExceptionUtil.rethrow(e.getCause())(line 71-73), preserving retryable-exception semantics rather than masking them.- No sensitive data (credentials, job configs) is included in the response - only job/pipeline/worker IDs and slot counts.
2. Code Quality Assessment
2.1 Coding Standards
ASF license headers present on all new files. No wildcard imports. Every new class carries a class-level Javadoc, and the non-trivial methods have explanatory comments (including a genuinely useful one on the test's forEach cast explaining the IMap/Iterable overload ambiguity). The one gap: build(SeaTunnelServer)'s Javadoc (RunningJobSlotUsageBuilder.java:48) is a one-line summary and doesn't document the freshness/consistency contract between the two data sources it joins, which is exactly the subtlety behind the slotSourceAvailable granularity issue above - worth a sentence once that's addressed.
2.2 Test Coverage and Test Stability
I read both test files in full at the current head:
RunningJobSlotUsageBuilderTest.java(223 lines, 3 tests) exercises the publicbuild(SeaTunnelServer)entry point via a mockedSeaTunnelServer, not just the package-private overload, and explicitly covers both degraded cases: resource manager not initialized (shouldMarkSlotSourceUnavailableWhenResourceManagerIsNotInitialized) and assigned slots lagging behind owned slots (shouldMarkSlotSourceUnavailableWhenAssignedSlotsLagBehindOwnedSlots). This is a real improvement over earlier rounds where only the happy path was covered, and it directly tests the mechanism behind theslotSourceAvailableflag - it just doesn't (and structurally can't, as currently designed) test per-job partial staleness, because the implementation itself doesn't distinguish per job.RestApiIT.testGetRunningJobSlotUsage(RestApiIT.java:420-443, assertion helper at1522-1547) exercises both the v1 (hazelcastPort) and v2 (Jetty httpPort) URLs throughAwaitility.await().atMost(2, TimeUnit.MINUTES).untilAsserted(...), assertsslotCount > 0,slotSourceAvailable == true, and cross-checks thatslotCountequals the sum of bothpipelineSlotCountsandworkerSlotCounts- a real consistency check, not just a status-code check. This closes the "no REST-layer coverage" gap that existed in earlier rounds of this PR.
Flaky-test check on both files: no Thread.sleep, no shared static state, no order-dependent assertions, no floating-point comparisons, no hard-coded timing assumptions. The one Awaitility usage has a generous 2-minute bound and polls a real condition (statusCode(200) plus the actual assertions), which is the correct pattern rather than a fixed sleep.
Test stability rating: Stable.
2.3 Documentation Updates
All four REST reference files are updated (docs/en and docs/zh, both v1 and v2), and the zh content is a real translation. The example payload matches the code's actual output field-for-field, including jobId as a string (avoiding JS precision loss on Snowflake-style long IDs) and the slotSourceAvailable field. The one documentation gap is the granularity ambiguity on slotSourceAvailable described in 1.1 - it needs either an explicit "this applies to the whole response, not per job" note, or the underlying implementation needs to actually go per-job.
3. Architectural Soundness
3.1 Elegance of the Solution
The servlet -> service -> operation -> builder decomposition matches every other Zeta REST endpoint in this module, and splitting the pure aggregation into a static builder with package-private overloads is what makes a mock-free, deterministic unit test possible for the aggregation logic itself. The one design choice I'd still push back on: intersecting a cluster-replicated IMap (IMAP_OWNED_SLOT_PROFILES) with a master-local, heartbeat-refreshed snapshot (ResourceManager.getAssignedSlots) as the source of truth means the answer is only as fresh as the weaker source, and a single boolean can't tell the caller which job's data is affected when they diverge.
3.2 Maintainability
Good - small classes, clear names, no shared mutable state, and the aggregation logic is unit-testable in isolation (proven by the current tests). The reputational risk is that if operators learn this endpoint can report slotSourceAvailable: true for a job whose count just hasn't caught up yet, the flag stops being trusted for the one job where it matters most.
3.3 Extensibility
A per-job/per-pipeline/per-worker breakdown is a solid foundation for a future UI panel or slot-pressure alerting. The response shape leaves room to add a genuinely per-job flag later without breaking existing callers, which is a reasonable path if the maintainers prefer to ship the coarse-grained signal now and refine it in a follow-up.
3.4 Historical-Version Compatibility
No existing REST contract, config option, default value, checkpoint, savepoint, or serialized state is touched. This is a brand-new, unreleased endpoint, so there is no old-client behavior to preserve. New serializer id 18 is collision-free against current dev.
4. Issue Summary
| # | Issue | Location | Severity |
|---|---|---|---|
| 1 | slotSourceAvailable is computed once per request and applied to every job identically; it cannot distinguish "this specific job's data is stale" from "some job somewhere is stale," and the docs' "for this response" wording reads as per-entry when it is actually cluster-wide |
RunningJobSlotUsageBuilder.java:98-106, 110-136; docs/en|zh/engines/zeta/rest-api-v2.md (~line 416) |
Medium |
| 2 | build(SeaTunnelServer) Javadoc doesn't state the freshness contract between the two joined data sources |
RunningJobSlotUsageBuilder.java:48 |
Low |
| 3 | Full cluster-wide owned-slot map scan on every request, no cache/TTL | RunningJobSlotUsageBuilder.java:119-132 |
Low |
| 4 | No logging anywhere in the new path; the non-master forwarding branch's mastership-loss case surfaces as an unhandled exception (matches an existing sibling-servlet pattern, not a regression) | RunningJobSlotUsageService.java:35-43 |
Low |
| 5 | slotCount increments once per TaskGroupLocation entry rather than de-duplicating by physical SlotProfile/SlotKey, which could overcount if a slot were ever shared across task groups |
RunningJobSlotUsageBuilder.java:152-156, 238-244 |
Low |
None of these are new - all five have been raised and tracked across earlier rounds of this same PR. I'm not aware of anything in the current diff that a prior review missed; my own from-scratch trace lands on the same conclusions as the most recent prior round.
5. Merge Recommendation
Conclusion: Ready to merge after fixes
-
Blockers - must be fixed
- Issue 1 (Medium): either implement genuine per-job staleness detection, or narrow the documented guarantee so
slotSourceAvailablecan't be misread as per-entry when it is actually computed once for the whole response. This has been open, unchanged, across every round of this PR - it's a real doc/implementation precision gap on a field whose entire purpose is to be trustworthy during an incident, not a hard functional defect, so a reasonable maintainer could also choose to accept it with a same-day doc follow-up. I'm keeping it listed as a blocker since that bar hasn't moved. - CI: the exact current head (
6ce47234d404) has not completed a full CI run at review time - the fork run (DanielLeens/seatunnelrun34922186875, created 2026-09-15T02:42Z) is still queued for the e2e/IT jobs roughly 7.5 hours after being created, with only the lint/license/dead-links jobs completed so far. The previous head (07510c5530e6) hadBuild: FAILURE, but every failing job (engine-v2-itfault-tolerance suites,OpengaussCDCIT,S3FileConnectDryRunIT) is outside the 15 files this PR owns, and thedevmerge that produced the current head specifically pulls in a checkpoint-coordinator fix and the[Fix][CI] Use MinIO mirror for S3 dry-run testscommit that directly targets one of those failures. I'd treat that as a reasonable basis for optimism, not as a substitute for watching this exact head's run land green.
- Issue 1 (Medium): either implement genuine per-job staleness detection, or narrow the documented guarantee so
-
Recommended fixes - non-blocking
- Issues 2-5 as listed: a one-line Javadoc addition, an optional cache/TTL for the full-map scan, a WARN log plus single server-reference capture on the forwarding path, and de-duplicating
slotCountbySlotKey(or renaming the field to make the current per-task-group semantics explicit).
- Issues 2-5 as listed: a one-line Javadoc addition, an optional cache/TTL for the full-map scan, a WARN log plus single server-reference capture on the forwarding path, and de-duplicating
Overall assessment. The feature fills a real gap - /overview only gives cluster totals, and this gives per-job, per-pipeline, per-worker visibility with no impact on scheduling or checkpointing. The plumbing is solid: routing is correct on both API versions, the serializer id is collision-free, the read-only invariant holds end to end, the coordinator-service lookup is properly hoisted out of the per-job loop, the aggregation is offloaded to a dedicated executor rather than blocking a shared Hazelcast thread, the v1 Content-Type bug is fixed and verified against Hazelcast's actual dispatch logic, and test coverage now reaches the degraded path, the public entry point, and the REST layer with a stable, non-flaky test design. What's kept this at "ready after fixes" for several rounds now is a single, narrow, well-understood gap: a coarse-grained staleness signal whose name and doc wording promise more precision than the implementation currently delivers. That's a reasonable thing to fix in this PR or to explicitly scope down in the docs and follow up separately - either resolves it. Since GitHub blocks self-approval on this account, this remains a comment rather than a formal approve/request-changes, and an independent maintainer's sign-off is still the actual gate regardless of my own conclusion here.
Alternative implementation for Issue 1, for whichever the maintainers prefer:
- Option A: track
slotSourceAvailableper job (e.g. per-SlotUsageinstead of one shared boolean), which is a bounded change toaggregateSlotUsage/SlotUsage.toResponse. - Option B: keep the current cluster-wide flag but rename it or rewrite the doc note to state explicitly that it reflects "any verified assignment in the cluster this request," not per-job freshness.
🤖 Generated with Claude Code
|
Review and CI update:
|
|
Authoritative status from the PR author: commit |
DanielLeens
left a comment
There was a problem hiding this comment.
Sorry for missing the operation-thread wait in the earlier review. In particular, the earlier statement that the named executor keeps the Hazelcast operation thread free was incorrect: the receiver immediately waits on that executor's future. I re-read the full 15-file diff and traced the current execution and aggregation paths at de507b8e2c7814f2d2f5bba6256c1946e9562db9.
Basic information
- PR: #11597 — Add running job slot usage API, author
DanielLeens, targetdev. - Reviewed head:
de507b8e2c7814f2d2f5bba6256c1946e9562db9; base1882a579236c451df59ae8782a53c4460fb926f1; 15 files, +949 / -0. - Report time: 2026-10-28 02:44:06 EDT (UTC-04:00).
- Local fetched ref:
codex-review-webslots-11597-20261028; isolated checkout requested at/Volumes/disk8/tmp/seatunnel-review-webslots-11597-20261028; exact committed content was read withgit showwhile filesystem checkout progressed. - This is a source COMMENT, not independent human approval when submitted through the PR author's account.
What this PR changes
An operator can query the slots currently attributed to each running job through /running-jobs/slot-usage or its Hazelcast REST equivalent. For example, a job holding three slots returns a total of three with pipeline and worker breakdowns, rather than requiring the operator to infer its share from cluster totals.
1. Code review and complete findings
Key findings
- Both REST entry points reach the same read-only aggregation. The legacy path parses the forwarded JSON into a JsonArray before response preparation, preserving JSON response handling.
- Slot matching includes worker address, slot ID, owner job ID and sequence; released/reused assignments are excluded. The previously ambiguous source flag is now explicitly documented and commented as a cluster-wide snapshot-availability value, not a per-job freshness guarantee.
- The worker-to-master operation still holds a shared operation thread while the complete cluster aggregation runs. The named executor alone does not remove that wait.
Finding 1 — Return the forwarded diagnostic response asynchronously
Severity: High (P1). Blocks merge: Yes.
Location: seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/operation/GetRunningJobSlotUsageOperation.java:53-67.
The forwarding path is RunningJobSlotUsageService.getRunningJobSlotUsageJson() → NodeEngineUtil.sendOperationToMasterNode() → GetRunningJobSlotUsageOperation.run(). run() starts supplyAsync(...) on a named executor but immediately calls awaitResponse(future), whose future.get() blocks until the aggregation and JSON serialization finish. setAsync() in NodeEngineUtil affects the caller invocation; it does not make the receiver's Operation.run() an asynchronous response handler.
This matters because RunningJobSlotUsageBuilder.build() performs distributed IMap.keySet() / forEach() reads and per-job status lookups across the complete running/owned-slot data set (RunningJobSlotUsageBuilder.java:54-82,126-137). During slow map reads or coordinator startup, a diagnostic request therefore holds a generic operation thread for that duration, with no operation-level aggregation deadline. Concurrent worker-port polling multiplies those held threads. The default engine configuration has a finite shared generic-operation pool (seatunnel-engine-common/src/main/resources/hazelcast.yaml, hazelcast.operation.generic.thread.count: 50); the endpoint's expensive work should not occupy that control-plane pool while waiting. This is a directly observable source-level blocking path, not a claimed reproduced outage or benchmark result.
Root cause/current change point: response lifecycle in the new forwarded operation, rather than the arithmetic aggregation. The repository already provides the appropriate boundary in .../operation/AsyncOperation.java:43-67: return from the receiver, keep the invocation live, and send success/failure when the computation future completes. The smallest safe fix is to implement this new operation with that asynchronous response lifecycle (or an equivalent supported nonblocking completion), preserving retryable-exception unwrapping and interruption/cleanup semantics. Add a test that leaves aggregation pending and proves the receiver returns before completion, then checks exactly one success or exceptional response; the current tests only pass already-completed futures to awaitResponse, so they cannot detect the shared-thread wait.
The global best fix for this PR is the same operation boundary. A wider conversion of older synchronous diagnostic operations is a separate audit and is not required here. Keeping a named executor while continuing to call get() does not fix the boundary; simply deleting the executor moves the same full scan directly onto the operation thread. The recommended change preserves response schema, serializer IDs and old task/state contracts, with focused operation-lifecycle verification cost.
Other correctness, compatibility and resource checks
- The aggregation is read-only: no slot allocation, release, scheduling mutation or checkpoint state changes. It filters running job IDs and intersects owned profiles with assigned-slot identity before counting. Empty/uninitialized source handling is distinct from a verified zero-slot result.
slotSourceAvailableremains cluster-wide by design. All four English/Chinese REST docs now say so explicitly, and the builder Javadoc matches. It must not be interpreted as proof of a particular job's freshness; this is an acknowledged snapshot contract rather than a remaining undocumented defect.- The response uses string job IDs, preventing JavaScript precision loss. Pipeline/worker counts sum the counted assignments. No credentials or job configuration are included.
- New serializer ID 18 is additive and does not replace existing ID 17 (
GET_JOB_DIAGNOSTICS_OPERATION). Existing operation identifiers, options/defaults, connector registrations, saved task JSON, import/export and checkpoint formats are not removed or changed. New callers still require nodes that implement the new operation; this review does not claim the new endpoint works against an older master. - CPU/memory cost is proportional to scanned slot/job state, with deterministic sorted summaries and no retained cache. The concern in Finding 1 is the thread on which the caller waits, rather than an invented memory leak.
2. Tests, docs and actual verification
- Read
RunningJobSlotUsageBuilderTestcompletely. Exact total/pipeline/worker assertions protect aggregation, owner reuse, null entries, non-running jobs, uninitialized resource manager and a wholly lagging assigned-slot snapshot.GetRunningJobSlotUsageOperationTestchecks successful return and retryable-exception unwrapping from completed futures; it does not check that a pending computation releases the operation thread. - The updated
RestApiITreaches both node transports through live HTTP, waits for positive slot usage and checks pipeline/worker sums against the reported total. It is meaningful end-to-end routing coverage, but not a substitute for nonblocking-operation lifecycle coverage. - English/Chinese REST v1/v2 examples and flag descriptions were checked against the builder fields. No existing tests/coverage are deleted or assertions relaxed in the full diff.
- Actual commands:
gh pr view 11597 --json ...(passed, exact head/gates recorded);git fetch upstream pull/11597/head:codex-review-webslots-11597-20261028(passed); fullgit diff <base>...<head>plusgit show/git grepfor all 15 files, operation lifecycle, resource manager and coordinator callers (passed);git diff --check <base>...<head>(passed);gh api .../commits/<head>/check-runsand fork run job listing (passed). Hazelcast operation runner source was also inspected from the locally available source JAR as supporting static context, rather than claiming a local build/runtime result. - Local compilation, unit tests, integration/E2E, package/startup/load testing: not executed, under the SeaTunnel CI-only functional-validation rule. No previously built modules were reused or represented as validated.
3. Architecture and best change location
A shared stateless builder behind the two REST routes is an appropriate responsibility split. Assignment verification belongs with the diagnostic aggregation rather than modifying the resource manager's scheduling semantics. The current worker-forwarding response lifecycle is not the best boundary: AsyncOperation is the available component for releasing receiver threads while asynchronous work proceeds. A focused conversion of this operation plus pending-future lifecycle coverage is both the minimum safe and the preferred long-term change for this endpoint.
4. Exhaustiveness and merge conclusion
Full scan completed: all 15 changed files; Jetty and Hazelcast routing, master forwarding/serialization/exceptions, complete slot identity aggregation and availability semantics, coordinator/resource-manager reads, low-level and live REST tests, bilingual docs, compatibility and current CI/conflict/approval gates. Finding 1 is the consolidated source issue for this head.
Do not merge yet. Correct Finding 1 and obtain a green required Build for the resulting head. At the snapshot GitHub reports MERGEABLE, BLOCKED, REVIEW_REQUIRED, and a failed current-head Build (check, underlying fork run). That run lists failures in Dead links, transform-v2-it-part-1 (JDK 8), google-pubsub (JDK 8), and engine-v2-it (JDK 11 and 8). Their root causes were not established in this review, so the failures are not attributed to this PR's implementation merely from the job names. This source review is separate from CI acceptance and required human approval.
Publication gate snapshot (2026-10-28 02:52:32 EDT (UTC-0400)): reviewed head de507b8e2c7814f2d2f5bba6256c1946e9562db9 remains current; mergeable=MERGEABLE, mergeStateStatus=BLOCKED, reviewDecision=REVIEW_REQUIRED. Exact-head checks: Notify test workflow COMPLETED/SUCCESS; labeler COMPLETED/SUCCESS; Build COMPLETED/FAILURE. This latest snapshot supersedes earlier gate observations above; it does not replace required runtime coverage or approval.
|
Following up on the CI point only. @davidzollo, thanks for the update. The thread records that the previous Build was cancelled at workflow level after about 24 hours with most jobs still queued, so it did not show a product-code failure, and that a fresh Build was queued for I can't verify the current state from here, so could you confirm:
Once that is confirmed, I'll do the final pass on this point. No new asks beyond the CI follow-up. |
|
Thanks @SEZ9. I queried all fork workflow runs for the exact head de507b8: the only matching Build returned is DanielLeens/seatunnel run 38351240468, completed with failure on October 14, attempt 1. I could not find a newer matching queued/requeued run, so that claim is not yet confirmed. In the retrieved failed logs, Dead links gets HTTP 429 from the DeepWiki page/badge; the JDK 8 transform and Pub/Sub jobs fail on Maven Central connection resets/cached failed BOM downloads, not a demonstrated slot-usage assertion. Other failed engine jobs still need their own reports, so I am not calling the whole run unrelated or passed. Please rerun the affected existing jobs after the transfer/rate-limit conditions clear, or link the intended newer exact-head run. Latest dev uses a local badge but still links the remote project page; a sync alone does not repair external 429 or connection resets. Keep dependencies unchanged for those transfer failures. Separately, Finding 1 from my source review (forwarded operation waits on the aggregation future) remains a merge blocker; a green retry would not clear it. Checked 2026-10-29T17:14:27+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. |
|
Following up on the one open point from the earlier review: the operation-thread wait in To restate the correction: running the aggregation on a named executor does not, by itself, free the Hazelcast operation thread, because the receiving side immediately waits on that executor's future. So a shared operation thread is held for the full cluster-wide aggregation, which is what the executor was meant to avoid. The earlier wording that suggested otherwise was wrong. For the next revision:
Once that change is pushed I'll re-check this point specifically. Thanks for staying with it. |
|
Thanks @SEZ9. +1: moving aggregation to an executor does not release the receiving Hazelcast operation thread while GetRunningJobSlotUsageOperation.java:53-67 still waits for its future. The focused next revision is asynchronous completion with a response on both success and failure, preserving the read-only aggregation semantics. That existing source blocker remains; a green retry of the separately diagnosed transport/website CI failure would not clear it. No speculative sync or unrelated dependency patch is requested. Checked 2026-10-30T03:30:37.152075+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. |
GetRunningJobSlotUsageOperation now extends AsyncOperation: doRun() hands the cluster-wide aggregation to the named executor and returns a PassiveCompletableFuture immediately, so the Hazelcast generic operation thread is released instead of waiting on the executor future. The success or failure response is sent from the future completion callback with the original exception peeled, so the REST caller still observes the same response payload and failure type. Serializer factory id, class id and the String response type are unchanged. The operation test now drives run() with a deferred executor to prove the receiver returns before the aggregation completes and that exactly one success or exceptional response is sent afterwards.
|
@SEZ9 thanks for restating the point; the asynchronous revision is pushed as What changed
Why the operation thread is now released
Merge note Merged Validation Only |
|
Thanks for pushing the asynchronous revision as On the source blocker from the earlier review (the forwarded operation waiting on the aggregation future on the operation thread): the described shape — extending Separately, CI on the new head: the only Build result in this thread is for This is a follow-up within the previously raised scope, not a final approval; a write-capable maintainer still needs to perform that. |
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for the asynchronous revision. +1 to @SEZ9’s requested verification: I checked the new operation and pending-task lifecycle tests against the complete current diff. The prior operation-thread blocking finding is resolved. I did identify a remaining required-comment gap in the unchanged aggregation portion that earlier reviews missed; that is the sole source blocker below.
What Problem Does This PR Solve?
User pain point: Operators need job-level slot totals and pipeline/worker breakdowns, while diagnostic forwarding must not hold a shared Hazelcast operation thread during cluster-wide aggregation.
Fix approach: Expose one stateless slot-usage builder through legacy Hazelcast and Jetty REST, forward worker requests to the master, and send forwarded responses through AsyncOperation completion.
One-sentence summary and example: A running job with three current assignments returns slotCount=3 and matching pipeline/worker totals. A worker request schedules aggregation and releases the receiving operation thread before its JSON is ready.
1. Code Change Review
1.1 Core Logic Analysis
RunningJobSlotUsageService builds locally on master or joins a forwarded operation from the HTTP/request context. GetRunningJobSlotUsageOperation now extends AsyncOperation and returns a PassiveCompletableFuture from doRun without get/join. AsyncOperation returnsResponse=false, handles synchronous scheduling failure and sends a peeled success/failure response on completion while deregistering the live operation. The builder intersects owned profiles with assigned identity (worker, slot ID, owner job ID, sequence), filters non-terminal jobs, and emits sorted summaries.
Before:
CompletableFuture<String> future = supplyAsync(...);
response = awaitResponse(future); // receiver waited on future.get()After:
protected PassiveCompletableFuture<String> doRun() {
return new PassiveCompletableFuture<>(
CompletableFuture.supplyAsync(() -> buildResponse(service), executor));
}
// AsyncOperation sends response when complete, without blocking run().Key Findings
- Both REST routes reach the same builder; legacy routing checks slot-usage before the broader running-jobs prefix.
- The legacy handler parses forwarded JSON to JsonArray, while Jetty writeJsonString sets JSON content type and UTF-8.
- The forwarded receiver no longer waits for aggregation. The outer HTTP/request thread still waits for its response; those are different thread pools and contracts.
- Assigned-slot identity excludes released/reused assignments. Available=false distinguishes an uninitialized source or wholly lagging assigned set from a verified empty ownership snapshot.
- Availability is computed once per response and copied to all jobs, exactly as all four guides now state. It is not per-job freshness or an atomic cross-map snapshot.
- Serializer ID 18 is additive; existing diagnostics ID 17 and all prior IDs remain unchanged.
- No allocation/release, scheduling mutation or checkpoint state is performed by this endpoint.
Complete runtime path
GET legacy /hazelcast/rest/maps/running-jobs/slot-usage or Jetty /running-jobs/slot-usage
-> shared service -> local master builder OR worker forwarding
-> GetRunningJobSlotUsageOperation.doRun -> named executor -> pending future
-> operation run returns -> builder reads running/owned/assigned state
-> JSON serialization -> AsyncOperation completion -> live-operation deregistration/response
-> request thread -> JSON HTTP response
The revised lifecycle follows the repository’s supported asynchronous operation contract, including exceptional completion and scheduling exceptions. The new deferred executor test would hang/fail if the receiver resumed waiting on a pending future. Builder reads remain a diagnostic snapshot across independently changing maps; the docs correctly avoid a freshness guarantee. Current job visibility includes non-terminal states through shouldShowAsRunningJob, so zero-assignment entries are expected.
1.2 Compatibility Impact
Additive API with a new-node requirement. Existing routes, operation IDs, task/checkpoint state, options/defaults and plugin packaging are unchanged. Job IDs are strings to avoid JavaScript precision loss. New forwarding requests require a master that understands operation ID 18; do not call the new API through an upgraded worker against an older master and assume mixed-version support. No prior response field is removed.
1.3 Performance / Side-Effect Analysis
Each request scans running-job IDs, owned slot profiles and assigned slots, then allocates response-local maps/sets. Cost scales with current cluster data; there is no retained result cache. Moving aggregation to a named executor frees the control-plane operation thread but does not eliminate HTTP waiting, distributed reads or concurrent polling cost. This change is not a throughput benchmark.
1.4 Error Handling and Logging
AsyncOperation handles immediate scheduling errors and peels CompletionException before responding; its existing fallback handles an exception that cannot be serialized. The new test asserts original retryable-exception identity. Output contains job/worker identifiers and counts, not job configuration or credentials. Existing REST error/authentication mechanisms remain the owning boundary.
Issue 1: Document the new aggregation helpers and slot-identity state
- Location:
RunningJobSlotUsageBuilder.java:96-222 - Problem description: The four-argument build overload, aggregateSlotUsage, aggregatePipelineSlots, belongsToRunningJob, containsOwnedSlots, buildAssignedSlotSet, isAssignedToJob and SlotKey ownership/sequence fields lack explanatory comments. These encode nontrivial snapshot-availability and stale-slot rejection rules; comments only on the public builder and three-argument wrapper do not explain those individual contracts.
- Potential risk: A later change can accidentally treat cluster availability as per-job freshness or match a reused slot without its owner/sequence identity. The current logic is readable but does not meet the required new-core-method/nontrivial-field comment rule.
- Best improvement: Add short comments describing each helper’s role and the four-part slot identity, plus the counting/response helpers where their invariants are not obvious. Keep the implementation unchanged unless a concrete defect is found.
- Severity: Medium; blocking.
- Raised by another reviewer: No
Issue 2: Add focused boundary controls when extending the new API tests
- Location:
RunningJobSlotUsageBuilderTest; GetRunningJobSlotUsageOperationTest; RestApiIT.assertRunningJobSlotUsageEndpoint - Problem description: Current tests cover wholly unavailable assigned state, reused ownership and pending success/failure, but do not explicitly assert a partial-lag cluster-wide flag, sequence-only reuse, synchronous executor rejection, JSON content type or jobId’s actual JSON string type.
- Potential risk: Those documented boundaries could regress while numeric/value comparisons still pass; no current incorrect response is demonstrated.
- Best improvement: Add small focused controls for these contracts when strengthening the suite, retaining the pending-future test and both live HTTP transports.
- Severity: Low; non-blocking.
- Raised by another reviewer: No
2. Code Quality Assessment
2.1 Coding Standards
The revised operation and response-building seam have useful Javadoc. The remaining aggregation comment gap is Issue 1; sorry for overlooking it in the earlier full pass. Existing serializer factory wiring and route registration are complete, and no unrelated ability was removed.
2.2 Test Coverage and Test Stability
Test stability: Stable for the added tests. Builder cases use deterministic in-memory maps and exact totals. The operation test defers the runnable explicitly, asserts no response before execution, then checks exactly one success or original exception; a generous five-second watchdog detects blocking. RestApiIT polls the actual endpoints on both nodes/transports until the running fixture owns slots and then checks group sums. The integration fixture is required for runtime proof; no local execution occurred and current-head CI is queued.
Local analysis: fetched the head, created independent branch seatunnel-review-11597-r2, read the complete 15-file diff and traced affected callers with git show/git grep. No local compilation, unit tests, integration tests, E2E, containers, or job execution was performed, as requested. These are source-analysis conclusions; execution evidence is the current-head CI below.
2.3 Documentation Updates
EN/ZH REST v1/v2 examples match the builder schema, string job IDs and cluster-wide availability semantics. A short mixed-version operational note would be useful for the new serializer ID; existing endpoint contracts are not changed.
3. Architectural Soundness
3.1 Elegance of the Solution
Correct asynchronous response boundary. The shared stateless builder and existing AsyncOperation base are the right scope. The minimal fix and preferred design coincide: release the receiving operation thread, preserve response/error behavior, and test a genuinely pending computation. A broad rewrite of other diagnostics is unnecessary.
3.2 Maintainability
Keep aggregation, forwarding lifecycle and HTTP formatting separate. Explain stale identity and availability rules so later callers do not assume a stronger snapshot contract.
3.3 Extensibility
Additional diagnostic fields can reuse the builder without changing resource allocation. Any future polling/load limit should be evaluated with measured cluster workloads; it is not provided by asynchronous dispatch alone.
3.4 Historical-Version Compatibility
No stored job or checkpoint formats change. Operation IDs remain stable, but only upgraded receivers know the added operation. Existing APIs retain their old routing and schemas.
4. Issue Summary
| Number | Issue | Location | Severity |
|---|---|---|---|
| 1 | Document the new aggregation helpers and slot-identity state | RunningJobSlotUsageBuilder.java:96-222 |
Medium |
| 2 | Add focused boundary controls when extending the new API tests | RunningJobSlotUsageBuilderTest; GetRunningJobSlotUsageOperationTest; RestApiIT.assertRunningJobSlotUsageEndpoint |
Low |
5. Merge Recommendation
Conclusion: Ready to merge after fixes
- Blockers — must be fixed
- Issue 1: Document the new aggregation helpers and slot-identity state Resolve Issue 1. The former operation-thread blocker is closed. Required current-head Build and independent maintainer approval remain outstanding.
- Recommended fixes — non-blocking
- Issue 2: Add focused boundary controls when extending the new API tests
Overall assessment: The requested lifecycle revision is verified from source and the test mechanism, not accepted from its description alone. Remaining source work is the required explanatory comments.
Existing-review reconciliation: +1 to @SEZ9’s latest follow-up: AsyncOperation, PassiveCompletableFuture, completion-response peeling and a pending aggregation are all verified at this head. This resolves that specific prior finding without adding a duplicate numbered version. The old failed Build belongs to de507b8 and is not the result for 38f1ca0. No independent final approval is inferred from the follow-up; Daniel is the author. Author replies have been incorporated into this single full review.
Head 38f1ca01d7bace05a0dec8627c5143f6002ddca6. Live base dev at 3ac2d1cec6aa7b3741c4dacdd23020f778e23c02; comparison ahead, ahead 13 / behind 0; merge state BLOCKED. Behind/diverged alone is recorded metadata, not a request to synchronize upstream. Checks: No current-head checks reported.
No upstream current-head checks are reported. Exact-head fork Build is queued. The historical dead-link/transport/engine failures are not reclassified without a completed new-head run and logs. No age-only synchronization or dependency change is requested.
Daniel has READ repository permission. This COMMENT records the technical conclusion; it is not an effective maintainer approval or a dismissal of any historical requested-changes entry. A write-capable maintainer owns the final repository approval gate.
|
The CI fact in my existing full review of this exact head has changed. That source review is already published; this is a gate clarification, not another full source review on the same version. Source status: the existing slot-aggregation helper/state contract comments remain open. CI progress does not clear those source requests. The exact-head fork Build is now The current base comparison is recorded separately. Missing Apache check adoption is distinct from the fork conclusion, and neither is an effective independent approval. Daniel is the author and has READ repository permission. Checked 2026-11-01T12:13:58.916896+00:00; unchanged head |
|
Thanks for pushing the asynchronous revision in On the operation-thread blocking point: Separately, the fork Build run |
|
@SEZ9 thanks for verifying the asynchronous operation against the diff and for closing that finding. CI. Agreed, there is no executed evidence for One remaining source item, which is mine. My own review of this head left a comment-only request open: the new helpers in The smaller non-blocking test controls from my review (partial-lag cluster flag, sequence-only slot reuse, synchronous executor rejection, JSON content type) are also not added yet. |
…les in RunningJobSlotUsageBuilder Comment-only change: explain why owned slots are verified against the assigned-slot snapshot, when the response reports slotSourceAvailable = false, and why SlotKey includes the owner job and allocation sequence. No logic change.
|
@SEZ9 the comment-only follow-up I mentioned is pushed as
|
|
Thanks for the update on the CI gate. On the cancelled run: agreed that fork run 41162604738 on Concrete asks:
Once 41568689622 reports, I'll take another look at the gate status. |
DanielLeens
left a comment
There was a problem hiding this comment.
Self re-review of head e3a5965c54d062f0cde739ec4267554ec9a359ef. Thanks again to @SEZ9 for verifying the asynchronous operation against the diff on the previous head. This is a short re-check: the only new commit since my full review of 38f1ca01d7 is the comment-only follow-up, so I am not repeating the full report.
What Problem Does This PR Solve?
Operators need a job-level view of slot usage (total, per pipeline, per worker) for running jobs, exposed through both the legacy Hazelcast REST route and the Jetty REST route, without holding a shared Hazelcast operation thread while a worker-forwarded request is aggregated on the master. The functional scope is unchanged from the previous head.
1. Code Change Review
1.1 Core Logic Analysis
What changed since 38f1ca01d7: one commit, e3a5965c54, touching only RunningJobSlotUsageBuilder.java (+62 / -0).
I verified it is comment-only: filtering the incremental patch for added/removed lines that are not Javadoc or // comment lines leaves only three blank lines. No statement, signature, field, or import changed. The CI result for this head therefore covers exactly the logic reviewed on 38f1ca01d7, which answers @SEZ9's item 2.
Comment accuracy, checked line by line against the code:
RunningJobSlotUsageBuilder.java:95-111(four-argumentbuild): states that owned-slot entries can outlive a release/reassignment and are counted only when the assigned-slot snapshot still has the same allocation, and that an uninitialized resource manager yieldsslotSourceAvailable=falsewith zero counts. Matches the code: an uninitialized source passes an empty list, soisAssignedToJobnever matches and the flag at:167-168is false.:134-142(aggregateSlotUsage): describes the ambiguous "initialized but empty" snapshot and why owned slots of a running job turn it into "unavailable". Matches:149-150and:167-168, including the genuine-zero case.:171-175,:197-199,:206-208,:216-218,:231-233: each helper's role and null handling match the implementation.:239-258(SlotKey): saysSlotProfile#equalsignores the owner job. I confirmed this inSlotProfile.java:102-113on dev (slotID,worker,sequenceonly), so the four-part key is the correct identity and the comment explains why.
Runtime path is unchanged:
GET legacy /hazelcast/rest/maps/running-jobs/slot-usage or Jetty /running-jobs/slot-usage
-> RunningJobSlotUsageService -> local master build OR forward GetRunningJobSlotUsageOperation (ID 18)
-> AsyncOperation.doRun returns PassiveCompletableFuture (no get/join on the operation thread)
-> builder reads running jobs / owned slot profiles / assigned slots -> JSON
-> completion callback sends response and deregisters the live operation -> HTTP JSON response
1.2 Compatibility Impact
Unchanged and additive: new routes, new serializer ID 18; no existing route, operation ID, option, default, or checkpoint/state format changes. A worker forwarding to a master that does not know ID 18 is not a supported mixed-version path for the new endpoint only.
1.3 Performance / Side-Effect Analysis
Unchanged. Read-only diagnostic; cost scales with running jobs and slot maps per request; no caching and no allocation/scheduling side effect.
1.4 Error Handling and Logging
Unchanged. AsyncOperation handles synchronous scheduling failure and unwraps CompletionException; no credentials or job config in the output.
Issue 1 (previous blocker): Document the new aggregation helpers and slot-identity state
- Location:
RunningJobSlotUsageBuilder.java:95-258 - Status: Fixed at this head. All helpers and
SlotKeyfields named in my previous review now carry accurate comments explaining the snapshot-availability and stale-slot rules. - Raised by another reviewer: No
Issue 2: Add focused boundary controls when extending the new API tests
- Location:
RunningJobSlotUsageBuilderTest,GetRunningJobSlotUsageOperationTest,RestApiIT.assertRunningJobSlotUsageEndpoint - Problem description: Still not added: a partial-lag cluster-wide flag case, a sequence-only slot reuse case, synchronous executor rejection, JSON content type, and an assertion that
jobIdis a JSON string. - Potential risk: These documented contracts could regress while the current value assertions still pass. No incorrect behavior is shown.
- Best improvement: Add them as small cases in the existing test classes when the suite is next touched.
- Severity: Low; non-blocking.
- Raised by another reviewer: No
2. Code Quality Assessment
2.1 Coding Standards
The comment gap is closed. Comments explain why (stale entries, ambiguous empty snapshot, SlotProfile#equals semantics) rather than restating code.
2.2 Test Coverage and Test Stability
Test stability: Stable for the added tests (deterministic in-memory builder cases; the operation test holds the runnable pending and asserts exactly one success/failure response; RestApiIT polls both transports until the fixture owns slots). No test changed in this commit. Source analysis only; no local compile or test run.
2.3 Documentation Updates
EN/ZH REST v1/v2 docs were already consistent with the schema and the cluster-wide availability semantics; unchanged here. A one-line mixed-version note about the new operation remains an optional improvement.
3. Architectural Soundness
Unchanged: one stateless builder shared by both REST transports, forwarding through the existing AsyncOperation contract. The minimal fix and the preferred design coincide.
4. Issue Summary
| Number | Issue | Location | Severity | Status |
|---|---|---|---|---|
| 1 | Document the new aggregation helpers and slot-identity state | RunningJobSlotUsageBuilder.java:95-258 |
Medium | Fixed |
| 2 | Add focused boundary controls when extending the new API tests | RunningJobSlotUsageBuilderTest, GetRunningJobSlotUsageOperationTest, RestApiIT |
Low | Open, non-blocking |
5. Merge Recommendation
Conclusion: Ready to merge after fixes
- Blockers - must be fixed
- No source blocker remains. The only remaining gate is CI: there is no executed result for this head yet. The fork Build run 41568689622 is
queued(attempt 1), and no Apache-side checks are reported. The previous head's run was cancelled and gives no evidence either way. I will post the final per-job result once it completes, as @SEZ9 asked.
- No source blocker remains. The only remaining gate is CI: there is no executed result for this head yet. The fork Build run 41568689622 is
- Recommended fixes - non-blocking
- Issue 2: boundary test controls.
Branch state: mergeable with no conflicts; compare against dev is diverged (ahead 14 / behind 14), recorded only, not a sync request. Merge state is BLOCKED pending an approval from a write-capable maintainer. As the author I cannot approve this PR; this is a COMMENT.
|
As promised, the exact-head CI run has now completed: fork Build 41568689622 is cancelled and Apache Build is TIMED_OUT. The collected per-job results contain 39 cancelled jobs and no failed assertion; they do not establish a source failure or complete runtime acceptance. Please check for an active retry, then rerun the required cancelled lanes and retain their stage durations if timeout recurs. No specific upstream code fix has been established, so sync alone is not a supported remedy. My existing source conclusion is clear; independent approval remains required. CI reference: Build 41568689622. This updates CI/merge facts on the already-reviewed head; it is not another full source review. No local runtime testing was performed. Daniel has READ permission; effective maintainer approval/dismissal remains separate. |
|
Maintenance follow-up on unchanged head Requested one job-level rerun through the retry guard for the cancelled run 41568689622 (job 125891088902). The final same-head inspection now shows attempt 2 completed/cancelled, superseding the earlier in-progress snapshot. Cancelled lanes still provide incomplete execution evidence, and the default one-rerun budget is exhausted. The Apache Build pointer has not yet reflected this terminal result. No source change or full-workflow rerun was added. This is an action/status update, not a new full source review or a maintainer approval. No local functional validation was run. |
Purpose
Add a read-only Zeta REST API that reports the current slot usage for each running job.
Changes
/running-jobs/slot-usagefor Jetty REST v2./hazelcast/rest/maps/running-jobs/slot-usagefor the existing Hazelcast REST path.Validation
./mvnw -pl seatunnel-engine/seatunnel-engine-server spotless:apply -nsu -Dmaven.gitcommitid.skip=true./mvnw -pl seatunnel-engine/seatunnel-engine-server spotless:check -nsu -Dmaven.gitcommitid.skip=truegit diff --checkgit diff --cached --checkNo local compile/package/E2E was run; this follows the current Apache SeaTunnel workflow preference to use GitHub CI as functional proof for PR validation.