Skip to content

compute: spill correction chunks at their merge depth - #39460

Merged
antiguru merged 1 commit into
moritz/column-body-splitfrom
moritz/correction-chunk-depth
Oct 1, 2026
Merged

antiguru merged 1 commit into
moritz/column-body-splitfrom
moritz/correction-chunk-depth

Conversation

@antiguru

@antiguru antiguru commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

The correction buffer spilled every chunk at depth 0, which put all of them in the buffer pool's hottest eviction band and kept them out of compression. The merge batcher instead tags chunks with a generational depth that grows with each merge they survive, and the pool evicts deeper chunks first and compresses them past column_chunk_compress_min_depth. This change gives correction chunks the same depth.

A bucket's chain merge writes its output one generation deeper than its deepest input. The bucket's geometric chain invariant is the same structure the merge batcher's depth describes: a merged chain waits about chain_proportionality times longer for its next merge. Chunks that a read writes into emitted stay at depth 0, because the caller iterates them next and the next consolidation merges them with the feedback retractions. Chunks built from staged updates also start at depth 0, and a split keeps the depth of the chunk it copies.

On a CPU-bound M.1-nano, compressing every spilled correction chunk was about 12% slower than not compressing (CPU-279). With the default floor of 1, this change compresses the chain-merge generations of a hydration snapshot, so it trades CPU for memory on such replicas. The floor stays tunable per replica.

On top of #39159. Part of CPU-279.

🤖 Generated with Claude Code

@antiguru
antiguru requested a review from a team as a code owner October 1, 2026 16:37
@linear-code

linear-code Bot commented Oct 1, 2026

Copy link
Copy Markdown

CPU-279

@antiguru
antiguru requested a review from DAlperin October 1, 2026 16:42
@antiguru
antiguru added this pull request to stack #38898 October 1, 2026 16:42

@DAlperin DAlperin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great!

The correction buffer spilled every chunk at depth 0, so the buffer pool kept all of them in its hottest eviction band and never compressed them. Chunks now carry a generational depth like the merge batcher's: a bucket's chain merge writes its output one generation deeper than its deepest input, and the pool evicts deeper chunks first and compresses them past `column_chunk_compress_min_depth`.

Chunks built from staged updates and chunks a read writes into `emitted` stay at depth 0, because the next write and the feedback retractions read them right away. Splits keep the depth of the chunk they copy.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@antiguru
antiguru force-pushed the moritz/correction-chunk-depth branch from 8ae3dae to 90af05a Compare October 1, 2026 17:07
@antiguru
antiguru merged commit beb7f6c into main Oct 1, 2026
82 checks passed
@antiguru
antiguru deleted the moritz/correction-chunk-depth branch October 1, 2026 17:55
@antiguru

antiguru commented Oct 1, 2026

Copy link
Copy Markdown
Member Author

Thanks for the reviews!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants