Skip to content

fix(metadata): validate snapshot integers and allocation bounds - #1169

Open
manuzhang wants to merge 1 commit into
apache:mainfrom
manuzhang:fix/json-snapshot-sequence-and-row-id
Open

manuzhang wants to merge 1 commit into
apache:mainfrom
manuzhang:fix/json-snapshot-sequence-and-row-id

Conversation

@manuzhang

@manuzhang manuzhang commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Why

JSON conversion could truncate or wrap integer-valued snapshot fields, last-sequence-number, and next-row-id. A table could also carry bounds below values in its retained snapshots, so a later commit could allocate sequence numbers or row IDs from a stale starting point.

What

  • Decode snapshot integer fields and the table's sequence and row ID bounds exactly.
  • Compare last-sequence-number with retained snapshot sequence numbers and V3 next-row-id with retained first-row-id values. Allow bounds above retained values after expiration and accept conservative V3 added-rows estimates.
  • Share TableMetadata::ValidateSequenceAndRowIdBounds across metadata reads, writes, and builds. It is an instance method because the checks depend on the table's format version, bounds, and retained snapshots.

Validation

Local validation passed for table, JSON, catalog, REST, C++20, and 33 expiration tests, plus pre-commit. REST had one existing skip. The combined patch passed the table and JSON suites.

Parse snapshot integer fields and table sequence and row ID bounds exactly. Check the bounds against retained snapshots on read, write, and build, including V3 snapshots with conservative added-rows bounds.

Co-authored-by: Codex <codex@openai.com>

This branch has not been deployed

No deployments
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