-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Storage Execution
-
Storage Execution 2026-11-23
-
None
-
None
-
None
-
None
-
None
-
None
-
None
This replaces the at-crossing burst with pacing: each added key accrues its serialized size as debt, and when the debt covers one batch's bytes (Spiller::spillBatchBytes()) the sorter calls spillIncremental() once, repaying the debt with the consumed elements' own sizes.
Debt and repayment are in the same units, so the sorted buffer finishes its spill as the filling buffer refills, whatever the keys' sizes; a document held past the check by SorterBatchGuard leaves a tail bounded by one document's keys, spilled after the guard releases. spillAllRemaining() completes the in-progress spill and spills the remaining buffer for done()/persistDataForShutdown().
With a range now in progress between crossings, onSpillBegin captures the scan position at the spill's start and onSpill persists that captured value; the live scan position advances past the sorted buffer's unspilled keys while the spill is written, and without the capture, resume's loc <= lastSpilledRecordId skip would drop them. finalizeSpills() and done() handle a sorted buffer whose range has not completed, and pause() trips instead of silently dropping one.
- related to
-
SERVER-139272 Sort the filling buffer and begin its spill when it exceeds half the budget
-
- In Progress
-
- split from
-
SERVER-138779 Give NoLimitSorter two swapping buffers for incremental spilling
-
- In Code Review
-