Skip to content

fix(manifest): preserve 64-bit list metadata ids#1334

Open
fallintoplace wants to merge 2 commits into
apache:mainfrom
fallintoplace:fix/manifest-list-int64-metadata
Open

fix(manifest): preserve 64-bit list metadata ids#1334
fallintoplace wants to merge 2 commits into
apache:mainfrom
fallintoplace:fix/manifest-list-int64-metadata

Conversation

@fallintoplace

Copy link
Copy Markdown
Contributor

Summary

format manifest-list header snapshot ids, sequence numbers, parent snapshot ids, and first-row ids directly from int64
remove the intermediate int conversion in V1/V2/V3 manifest list writers
add regression coverage that reads the OCF header metadata back for large 64-bit values

Why

The manifest-list writers were serializing several 64-bit metadata fields by converting them to int and then calling strconv.Itoa. That is conceptually wrong for Iceberg's 64-bit ids and unsafe on 32-bit builds.

Using strconv.FormatInt(..., 10) keeps the full value intact for snapshot ids, sequence numbers, parent snapshot ids, and v3 first-row ids.

Testing

go test . -run 'TestManifests/TestManifestListWriterMetadataPreservesInt64Values$' -count=1
go test . -count=1
go test ./table -count=1
go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.11.4 run --timeout=10m . ./table/...
git diff --check

@fallintoplace fallintoplace requested a review from zeroshade as a code owner June 27, 2026 15:05

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

LGTM, correct 64-bit fix across all three writer versions. One optional test idea inline.

Comment thread manifest.go
}

return m, m.init(map[string][]byte{
"format-version": []byte(strconv.Itoa(m.version)),

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.

Nice that you caught first-row-id here too, not just the fields shared with v1/v2, FormatInt is the right call for all of these since they're all 64-bit per the spec.

Comment thread manifest_test.go
m.EqualValues(5022, *writer.NextRowID())
}

func (m *ManifestTestSuite) TestManifestListWriterMetadataPreservesInt64Values() {

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.

1<<40 already proves the >2^32 case well. Might be worth also asserting a value up near math.MaxInt64 (a realistic snapshot id like 9223372036854775807), since that's the boundary a future regression to a
32-bit path would corrupt first.

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