You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "yashmayya (via GitHub)" <gi...@apache.org> on 2026/09/01 17:12:31 UTC
[PR] Skip block copies for spool stages whose workers are all remote [pinot]
yashmayya opened a new pull request, #19428:
URL: https://github.com/apache/pinot/pull/19428
Fixes #19427. Follow-up to #19353.
## Problem
#19353 made `BroadcastExchange` copy blocks that carry aggregation intermediate results, because a destination can hand an on-heap block to a receiver by reference. It skips the copy for destinations that are not local, because those serialize the block within `send`.
That skip never applied to spools, which are the case #19353 was written for. A multi-send (spool) node wraps each receiver stage's inner exchange as a `BlockExchange.BlockExchangeSendingMailbox`, and `isLocal()` on that wrapper returns `true` unconditionally. Every outer destination of a spool is such a wrapper, so a receiver stage with no worker on the sending server still got a copy. The inner exchange then serialized that copy immediately, on the same thread, and no receiver ever mutated it. Each wasted copy costs one serialization plus one deserialization of every non-null `OBJECT` cell.
The cause is that `isLocal()` answered two different questions:
- `BlockExchange#sendBlock` asks "can I pass the block whole, without splitting it?"
- `BroadcastExchange#route` asks "can a receiver keep a reference to this block?"
The two answers differ for `BlockExchangeSendingMailbox`. Only the conservative direction kept the code correct.
## Fix
Add `SendingMailbox#deliversByReference()`, and use it in `BroadcastExchange#route`:
- `InMemorySendingMailbox` returns `true`.
- `GrpcSendingMailbox` returns `false`.
- `BlockExchangeSendingMailbox` returns `true` if any mailbox of its inner exchange returns `true`.
The answer of a mailbox never changes, so each exchange computes it once, when it is created.
The delegation is an OR over the inner mailboxes. An inner `HashExchange` builds a new block for each destination, but those blocks hold the same cell objects, so one by-reference worker in a receiver stage is enough to require a copy.
`isLocal()` now only means what `sendBlock` needs. This PR also moves the contract that `route` depends on — a mailbox that does not deliver by reference must finish reading the block before `send` returns — from `GrpcSendingMailbox` to `SendingMailbox#send`, where implementers can see it.
## Testing
`BroadcastExchangeTest` gets two spool cases: receiver stages whose workers are all remote (no copies), and a receiver stage with one worker on this server next to one on another server (one copy, shared within that stage). The first fails without this change. `BlockExchangeTest` covers the delegation directly. `WindowFunnelTest` and `SpoolIntegrationTest` still pass.
## Out of scope
The same wrapper also reports `isLocal() == true` to `BlockExchange#sendBlock`, while the inner exchanges get `BlockSplitter.NO_OP`, so multi-send blocks to remote receivers are never split against `MAX_MAILBOX_CONTENT_SIZE_BYTES`. That defect is tracked separately in #19427.
--
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: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] Skip block copies for spool stages whose workers are all remote [pinot]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #19428:
URL: https://github.com/apache/pinot/pull/19428#issuecomment-5498262607
## [Codecov](https://app.codecov.io/gh/apache/pinot/pull/19428?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 57.69%. Comparing base ([`88ea694`](https://app.codecov.io/gh/apache/pinot/commit/88ea694bae5f98760fb8c61f737fe6d3bc713427?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`6ca1b2f`](https://app.codecov.io/gh/apache/pinot/commit/6ca1b2fece58b1319f78d565c9c2be363f4e380f?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 5 commits behind head on master.
> :exclamation: There is a different number of reports uploaded between BASE (88ea694) and HEAD (6ca1b2f). Click for more details.
>
> <details><summary>HEAD has 24 uploads less than BASE</summary>
>
>| Flag | BASE (88ea694) | HEAD (6ca1b2f) |
>|------|------|------|
>|unittests2|1|0|
>|unittests|2|1|
>|java-25|6|1|
>|temurin|6|1|
>|lane-a|2|0|
>|integration|4|0|
>|integration1|2|0|
>|lane-b|2|0|
>|integration2|2|0|
></details>
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #19428 +/- ##
============================================
- Coverage 67.57% 57.69% -9.88%
+ Complexity 1430 1 -1429
============================================
Files 3487 2684 -803
Lines 224228 164062 -60166
Branches 35394 26643 -8751
============================================
- Hits 151511 94651 -56860
- Misses 60691 61403 +712
+ Partials 12026 8008 -4018
```
| [Flag](https://app.codecov.io/gh/apache/pinot/pull/19428/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [integration](https://app.codecov.io/gh/apache/pinot/pull/19428/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [integration1](https://app.codecov.io/gh/apache/pinot/pull/19428/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [integration2](https://app.codecov.io/gh/apache/pinot/pull/19428/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [java-25](https://app.codecov.io/gh/apache/pinot/pull/19428/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `57.69% <100.00%> (-9.88%)` | :arrow_down: |
| [lane-a](https://app.codecov.io/gh/apache/pinot/pull/19428/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [lane-b](https://app.codecov.io/gh/apache/pinot/pull/19428/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [temurin](https://app.codecov.io/gh/apache/pinot/pull/19428/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `57.69% <100.00%> (-9.88%)` | :arrow_down: |
| [unittests](https://app.codecov.io/gh/apache/pinot/pull/19428/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `57.69% <100.00%> (-9.88%)` | :arrow_down: |
| [unittests1](https://app.codecov.io/gh/apache/pinot/pull/19428/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `57.69% <100.00%> (-0.01%)` | :arrow_down: |
| [unittests2](https://app.codecov.io/gh/apache/pinot/pull/19428/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/pinot/pull/19428?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
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: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] Skip block copies for spool stages whose workers are all remote [pinot]
Posted by "yashmayya (via GitHub)" <gi...@apache.org>.
yashmayya merged PR #19428:
URL: https://github.com/apache/pinot/pull/19428
--
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: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org