Skip to content

Add totalMemAllocatedBytes to multi-stage query responses - #19816

Open
yashmayya wants to merge 1 commit into
apache:masterfrom
yashmayya:mse-total-mem-allocated
Open

yashmayya wants to merge 1 commit into
apache:masterfrom
yashmayya:mse-total-mem-allocated

Conversation

@yashmayya

Copy link
Copy Markdown
Contributor

Multi-stage (MSE) queries report heap allocation only per operator, inside stageStats. The top-level *MemAllocatedBytes fields are always 0 for MSE, so users have no single number to find the queries that allocate the most memory.

This PR adds totalMemAllocatedBytes to the MSE broker response. The broker computes it from stats that already exist:

  • The allocatedMemoryBytes of each stage root. A root's value already includes the other operators of its op chain (since Account a mailbox send's current block before it reports its stats #19365).
  • The threadMemAllocatedBytes of each leaf. The single-stage threads of the leaf are not part of the stage root's value.
  • The allocatedMemoryBytes of each pipeline breaker, which runs in its own op chain.

Notes:

  • A sum of allocatedMemoryBytes over all operators gives a number that is too large, because each value includes the children in the same stage.
  • Like the per-operator stats, the value is 0 unless pinot.server.instance.enableThreadAllocatedBytesMeasurement and pinot.broker.instance.enableThreadAllocatedBytesMeasurement are enabled.
  • The value is the bytes allocated, which includes short-lived objects. It is not the peak heap that the query used.

@yashmayya yashmayya added enhancement Improvement to existing functionality multi-stage Related to the multi-stage query engine labels Oct 9, 2026
@yashmayya
yashmayya requested a review from gortiz October 9, 2026 18:59
@codecov-commenter

codecov-commenter commented Oct 9, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.56%. Comparing base (910f9d5) to head (8940d73).

Files with missing lines Patch % Lines
...requesthandler/MultiStageBrokerRequestHandler.java 0.00% 3 Missing ⚠️
...not/query/runtime/operator/MultiStageOperator.java 50.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #19816      +/-   ##
============================================
- Coverage     68.63%   68.56%   -0.08%     
  Complexity     1486     1486              
============================================
  Files          3526     3526              
  Lines        230143   230151       +8     
  Branches      36562    36563       +1     
============================================
- Hits         157963   157807     -156     
- Misses        59837    60011     +174     
+ Partials      12343    12333      -10     
Flag Coverage Δ
integration 100.00% <ø> (ø)
integration1 100.00% <ø> (ø)
integration2 0.00% <ø> (ø)
java-25 68.56% <50.00%> (-0.08%) ⬇️
lane-a 100.00% <ø> (ø)
lane-b 0.00% <ø> (ø)
temurin 68.56% <50.00%> (-0.08%) ⬇️
unittests 68.56% <50.00%> (-0.08%) ⬇️
unittests1 58.30% <80.00%> (-0.04%) ⬇️
unittests2 40.17% <0.00%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improvement to existing functionality multi-stage Related to the multi-stage query engine

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants