Skip to content

storage: clear the oneshot-source decode arena per row#37135

Merged
frankmcsherry merged 1 commit into
MaterializeInc:mainfrom
frankmcsherry:rowarena-oneshot-source
Jun 18, 2026
Merged

storage: clear the oneshot-source decode arena per row#37135
frankmcsherry merged 1 commit into
MaterializeInc:mainfrom
frankmcsherry:rowarena-oneshot-source

Conversation

@frankmcsherry

Copy link
Copy Markdown
Contributor

What

render_decode_chunk (the oneshot/COPY decode operator) created one RowArena in the operator body and reused it across every chunk and every row without ever clearing it. The arena owns whatever is pushed into it for its lifetime, so the MFP-evaluation temporaries for the entire source accumulated until the COPY finished — an unbounded arena proportional to the data volume.

This scopes the arena to each decoded chunk and clears it per row, so it holds at most one row's worth of temporaries and is released when the chunk is processed.

Why

Found while auditing RowArena lifetimes (companion to the arena work in #37114 / #37134). This was the only arena in the audit that was both operator-lived and never cleared — i.e. a genuine unbounded accumulation rather than a bounded high-water. It brings the operator in line with the "arena per batch, cleared per row" idiom the other operators use.

Tests

No behavior change (the MFP output is identical; only the arena's lifetime changes). Covered by the existing oneshot-source / COPY FROM tests.

`render_decode_chunk` created a single `RowArena` in the operator body and reused
it across every chunk and row without ever clearing it, so the MFP-evaluation
temporaries for the entire source accumulated for the lifetime of the COPY — an
unbounded arena. Scope the arena to each decoded chunk and clear it per row, so
it holds at most one row's temporaries and is freed when the chunk is done.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@frankmcsherry frankmcsherry requested a review from a team as a code owner June 18, 2026 13:11

@martykulma martykulma left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🦈

@frankmcsherry frankmcsherry merged commit ec53bee into MaterializeInc:main Jun 18, 2026
118 checks passed
@frankmcsherry frankmcsherry deleted the rowarena-oneshot-source branch June 18, 2026 13:43
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