nielifeng opened a new pull request, #11498: URL: https://github.com/apache/seatunnel/pull/11498
### Purpose of this pull request Closes #11497. `IntermediateBlockingQueue` publishes a record before the producer can update `IntermediateQueueSize`. A concurrent consumer can therefore dequeue the record and decrement the shared total first, temporarily exposing a negative value through the REST metrics API. This patch shares queue metric ordering state across all wrappers for the same blocking queue. If a dequeue metric notification arrives before its enqueue notification, the tracker pairs the two events without decrementing the total below zero. Queue occupancy is also updated immediately after polling, so records dropped by `prepareClose` or followed by a collector failure do not leave stale counts. ### Does this PR introduce _any_ user-facing change? Yes. Zeta REST job metrics no longer report a negative `IntermediateQueueSize` during concurrent enqueue and dequeue. There are no configuration or API changes. ### How was this patch tested? Added deterministic unit coverage that pauses a producer after `put()` publishes a record, drains it through a separate consumer wrapper, and verifies the shared total never becomes negative. Added coverage for dequeued records dropped during `prepareClose`. ```shell ./mvnw -pl seatunnel-engine/seatunnel-engine-server -Dtest=IntermediateBlockingQueueSignalTest test ``` Result: 7 tests passed. The repository-level `./mvnw -q -DskipTests verify` completed the Zeta modules and later failed in the unrelated `connector-jdbc` module on existing source compilation errors. ### Check list * [x] No new Jar binary package is added. * [x] No documentation update is required for this metrics correctness fix. * [x] No incompatible change is introduced. * [x] This PR does not change connector code. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
