Skip to content

storage: group a pinned snapshot's updates into one batch - #38935

Draft
martykulma wants to merge 1 commit into
maz-sink-multi-ts-batchfrom
maz-sink-group-snapshot
Draft

martykulma wants to merge 1 commit into
maz-sink-multi-ts-batchfrom
maz-sink-group-snapshot

Conversation

@martykulma

@martykulma martykulma commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

While an export snapshots its frontier is pinned, so no description gets minted
and every update writes a batch of its own timestamp.

The minter now commits a ceiling a fixed lookahead past the newest data and
broadcasts it on a second output. write_batches puts everything below it into
one builder, whatever the timestamp.

A ceiling isn't a description. It carries the lower of the description that'll
retire it, since a builder declares its lower when it opens, and it binds the
minter to mint nothing below it. So the snapshot plus its catch-up is one
description, one append. The cost is the tail, the shard upper waits for the
frontier to reach the ceiling, about one lookahead however long the snapshot ran.

Rows that outrun the ceiling write their own batch, same as everything does with
the flag off. Both kinds get finished under whatever description covers them.

max_seen_timestamps reports each worker's largest timestamp to the minter,
since the collection is pre-sharded and the minter would otherwise pace on its
own share.

Only for exports snapshotting in this incarnation, and only while the frontier
sits at the snapshot's time. CdcV2 is excluded, its MZ times come from the data
so a wall-clock lookahead means nothing there.

storage_persist_sink_description_lookahead defaults to 0, off in production,
5s in mzcompose.

Tests: write_batches_routes_updates_below_the_ceiling_into_one_builder, plus
unit tests for next_mint and description_lookahead.

🤖 Generated with Claude Code

@martykulma
martykulma added this pull request to stack #38937 September 19, 2026 00:30
@martykulma martykulma changed the title maz sink group snapshot storage: group a pinned snapshot's updates into one batch Sep 19, 2026
While an export snapshots, its frontier is pinned at the single time the
snapshot occupies, so the minter derives no description and every update
reaches write_batches with no bounds to group under, writing a batch of its own
timestamp. The minter now commits a ceiling a fixed lookahead past the largest
timestamp the data has reached and broadcasts it on a second output, and
write_batches takes every update below it into one open builder whatever its
timestamp.

A ceiling is not a description. It carries the lower of the description that
will retire it, since a builder declares its lower when it opens, and it binds
the minter to mint nothing below it. So the whole snapshot and the catch-up
behind it become one description, appended once rather than once per boundary.
The cost is the tail: the shard upper waits for the frontier to reach the
ceiling, which is about one lookahead however long the snapshot ran.

An update that outruns the ceiling has no bound to group under and writes a
batch of its own timestamp, which is also what every update does when nothing
is committed ahead of the frontier. Both kinds are finished under the
description that comes to cover them, on its arrival or at its readiness.

max_seen_timestamps reports each worker's largest timestamp to the minting
worker, since the collection is pre-sharded and the minter would otherwise pace
on its own share alone.

Committing is confined to an export that snapshots in this incarnation, and
only while the frontier sits at the time its snapshot occupies. A collection
that is keeping up lags the data by about one timestamp and has nothing to
group, so it would pay the tail for nothing. CdcV2 exports are excluded, since
their MZ times come from the data rather than from reclocking and no wall-clock
lookahead relates to them.

Defaults off in production and on in the mzcompose test configuration so the
path is exercised.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@martykulma
martykulma force-pushed the maz-sink-group-snapshot branch from fc77c10 to 05deedd Compare September 19, 2026 01:00
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.

1 participant