Repository navigation
Commit 5009f42
authored
Account for TopK common-prefix converter memory (#26286)
## Which issue does this PR close?
- Part of #23393
## Rationale for this change
`TopK` underreports retained memory when a common sort prefix is present
because its memory accounting omits the optional
`common_sort_prefix_converter`. This can cause memory reservations to
underestimate TopK's retained memory, weakening memory-limit
enforcement.
## What changes are included in this PR?
- Include `common_sort_prefix_converter.size()` exactly once in
`TopK::size()` when the converter is present.
- Preserve the existing size calculation when the converter is absent.
- Add a regression test covering both construction paths and checking
that the memory reservation matches the reported size after batch
insertion.
## Are these changes tested?
Added `test_topk_size_common_sort_prefix_converter`, which verifies:
- A common-prefix converter is created and reports a nonzero size.
- Without a common prefix, `TopK::size()` retains its existing formula.
- With a common prefix, the reported size increases by the converter's
size.
- After `insert_batch()`, the memory reservation matches `TopK::size()`.
The test does not rely on global allocator measurements.
## Are there any user-facing changes?
No changes to query results or public APIs. The change corrects internal
memory accounting for TopK with a common sort prefix, potentially
improving memory-limit enforcement.
## LLM-generated code disclosure
This PR includes LLM-generated code and comments. All LLM-generated
content has been manually reviewed.1 parent cdc2fc0 commit 5009f42
1 file changed
Lines changed: 45 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
882 | 882 | | |
883 | 883 | | |
884 | 884 | | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
885 | 889 | | |
886 | 890 | | |
887 | 891 | | |
| |||
3306 | 3310 | | |
3307 | 3311 | | |
3308 | 3312 | | |
| 3313 | + | |
| 3314 | + | |
| 3315 | + | |
| 3316 | + | |
| 3317 | + | |
| 3318 | + | |
| 3319 | + | |
| 3320 | + | |
| 3321 | + | |
| 3322 | + | |
| 3323 | + | |
| 3324 | + | |
| 3325 | + | |
| 3326 | + | |
| 3327 | + | |
| 3328 | + | |
| 3329 | + | |
| 3330 | + | |
| 3331 | + | |
| 3332 | + | |
| 3333 | + | |
| 3334 | + | |
| 3335 | + | |
| 3336 | + | |
| 3337 | + | |
| 3338 | + | |
| 3339 | + | |
| 3340 | + | |
| 3341 | + | |
| 3342 | + | |
| 3343 | + | |
| 3344 | + | |
| 3345 | + | |
| 3346 | + | |
| 3347 | + | |
| 3348 | + | |
| 3349 | + | |
| 3350 | + | |
| 3351 | + | |
| 3352 | + | |
| 3353 | + | |
3309 | 3354 | | |
3310 | 3355 | | |
3311 | 3356 | | |
| |||
0 commit comments