Skip to content

fix(metadata): decode snapshot and table JSON integers exactly - #1169

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

manuzhang wants to merge 8 commits 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

Generic JSON number conversion can truncate or wrap integer-valued snapshot and table metadata fields. A stricter decoder can also reject a REST commit response after the server has already accepted the update.

What

  • Decode snapshot integers and table metadata integer fields with type and range checks. A missing or null current-snapshot-id still represents a table without a current snapshot.
  • Log a decode error after a successful REST commit POST and return CommitStateUnknown, avoiding a replay or staged-file cleanup.

Validation

Pre-commit and git diff --check passed. Added coverage for non-integers, overflow, valid signed values, and two unreadable HTTP 200 commit responses. Runtime checks pending.

Comment thread src/iceberg/table_metadata.cc Resolved
Comment thread src/iceberg/table_metadata.h Resolved
Comment thread src/iceberg/table_metadata.cc Resolved
Comment thread src/iceberg/json_serde.cc Resolved
Comment thread src/iceberg/json_serde.cc Resolved

@timothyw553 timothyw553 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.

thanks for the PR, overall the validation changes look good. i left two comments: one on stale parentless snapshots failing instead of retrying, and one on test coverage.

Comment thread src/iceberg/table_metadata.cc Resolved
Comment thread src/iceberg/test/metadata_serde_test.cc Resolved
Comment thread src/iceberg/json_serde.cc Resolved
Comment thread src/iceberg/json_serde.cc Resolved
@manuzhang manuzhang changed the title fix(metadata): validate snapshot integers and allocation bounds fix(metadata): decode snapshot and table JSON integers exactly Dec 2, 2026
manuzhang and others added 3 commits December 3, 2026 10:20
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>
@manuzhang
manuzhang force-pushed the fix/json-snapshot-sequence-and-row-id branch from 082f9d0 to fb5b891 Compare December 3, 2026 02:21
@manuzhang
manuzhang requested review from wgtmac and xndai December 3, 2026 06:28

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.

6 participants