test: bound merge fan-in in ordered aggregate spill tests - #25252
Conversation
|
@kosiew Please take a look when you get the time if this makes sense |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #25252 +/- ##
==========================================
+ Coverage 81.88% 81.92% +0.04%
==========================================
Files 1133 1134 +1
Lines 424522 426074 +1552
Branches 424522 426074 +1552
==========================================
+ Hits 347623 349066 +1443
- Misses 56285 56312 +27
- Partials 20614 20696 +82 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
@kumarUjjawal, thanks for working on this. The shared-pool regression coverage looks good overall. I just have one non-blocking suggestion to make the drop-during-merge test less dependent on polling behavior.
additional test that passed:
set -euo pipefail
runs="${RUNS:-100}"
test_threads="${SLT_TEST_THREADS:-$(getconf _NPROCESSORS_ONLN)}"
if ! [[ "$runs" =~ ^[1-9][0-9]*$ ]]; then
echo "RUNS must be a positive integer; got: $runs" >&2
exit 2
fi
if ! [[ "$test_threads" =~ ^[1-9][0-9]*$ ]]; then
echo "SLT_TEST_THREADS must be a positive integer; got: $test_threads" >&2
exit 2
fi
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$repo_root"
for ((iteration = 1; iteration <= runs; iteration++)); do
echo "=== ordered_aggregate_spill.slt: iteration $iteration/$runs (test threads: $test_threads) ==="
if ! cargo test -p datafusion-sqllogictest --test sqllogictests -- \
ordered_aggregate_spill.slt --test-threads "$test_threads"; then
echo "ordered_aggregate_spill.slt failed on iteration $iteration/$runs" >&2
exit 1
fi
done
echo "ordered_aggregate_spill.slt passed $runs consecutive runs"
| } | ||
| Finish::DropDuringMerge => { | ||
| senders[0].close_channel(); | ||
| let result = first.next().now_or_never(); |
There was a problem hiding this comment.
I don't think we need to require the first replay poll to return Pending here. A buffered spill read could be immediately ready and return a batch while the stream is still correctly in MergingSpills, which would make this assertion unnecessarily sensitive to polling behavior.
Could we remove this assertion and keep the MergingSpills state assertion plus the subsequent drop and reservation check? Those directly cover the cleanup invariant we're interested in, without needing a test-only controlled merge input.
kosiew
left a comment
There was a problem hiding this comment.
@kumarUjjawal, thanks for the follow-up. The change addresses the concern about requiring the first replay poll to return Pending. An immediately-ready buffered spill read is now accepted, while the MergingSpills state assertion and the subsequent drop and reservation cleanup checks still cover the intended lifecycle behavior.
I don't see any further issues with this change. Looks good to me.
|
Thank you @kosiew for your time |
Which issue does this PR close?
Closes #25047.
Rationale for this change
ordered_aggregate_spill.sltcan fail when spill-merge buffers leave too little memory for aggregate replay while another partition retains aggregate state in the shared greedy pool. Limit merge fan-in to two to reduce this contention while preserving the 600 KiB memory limit, two partitions, and existing query results.What changes are included in this PR?
What is the testing strategy for this PR?
Local validation:
Are there any user-facing changes?
No. This changes tests only; production execution and defaults are unchanged.