Skip to content

feat(metadata): add format v4 table metadata foundations - #1070

Draft
manuzhang wants to merge 1 commit into
apache:mainfrom
manuzhang:feat/v4-metadata-foundation
Draft

manuzhang wants to merge 1 commit into
apache:mainfrom
manuzhang:feat/v4-metadata-foundation

Conversation

@manuzhang

@manuzhang manuzhang commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Depends on #1169 and #1172; merge those fixes first, then rebase onto main.

Adds format-version: 4 metadata creation, upgrades, and JSON round trips with absolute locations. The default remains 2. Supports root references and legacy snapshots, validates root snapshots, and protects expiration/pruning while root traversal is unavailable. REST schema/spec pruning remains deferred pending a server guarantee.

Deferred: root-manifest I/O and writes, constraints migration, and relative paths. Separate PRs: #1160 manifest types; #1163 omitted locations.

Validation: table/JSON/catalog/REST/C++20/update suites, pre-commit, and clang-tidy.

Copilot AI balanced review requested due to automatic review settings October 29, 2026 07:55

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

Copilot AI balanced review requested due to automatic review settings October 29, 2026 08:43
@manuzhang manuzhang changed the title feat(manifest): add foundational v4 metadata types feat(metadata): add format v4 table metadata foundations Oct 29, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

Copilot AI balanced review requested due to automatic review settings October 30, 2026 09:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

Copilot AI balanced review requested due to automatic review settings November 1, 2026 15:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Version inputs are narrowed to int8_t before validation, allowing invalid values such as 260 and -252 to silently upgrade tables to v4, where snapshot writes are unsupported.

1 open issue

Review effort: Balanced

Comment thread src/iceberg/table_metadata.cc Resolved
Copilot AI balanced review requested due to automatic review settings November 2, 2026 14:30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

5 open issues

Review effort: Lite

Comment thread src/iceberg/snapshot.cc Resolved
Comment thread src/iceberg/inspect/snapshots_table.cc Resolved
Comment thread src/iceberg/json_serde.cc Resolved
Comment thread src/iceberg/location_provider.cc Resolved
@manuzhang
manuzhang force-pushed the feat/v4-metadata-foundation branch from ce26c99 to 60ecac1 Compare November 2, 2026 15:23
Copilot AI balanced review requested due to automatic review settings November 2, 2026 15:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Comment thread src/iceberg/json_serde.cc Resolved
Comment thread src/iceberg/update/expire_snapshots.cc Resolved
Comment thread src/iceberg/json_serde.cc Resolved
Comment thread src/iceberg/manifest/v4_types.cc Resolved
Copilot AI balanced review requested due to automatic review settings November 2, 2026 15:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Comment thread src/iceberg/json_serde.cc Resolved
Comment thread src/iceberg/table_metadata.cc Resolved
Copilot AI balanced review requested due to automatic review settings November 2, 2026 16:27

Copilot AI left a comment

Copy link
Copy Markdown

Copilot AI balanced review requested due to automatic review settings November 3, 2026 00:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Human assessment is needed because concurrent v4 root commits can invalidate planned metadata pruning, potentially removing a required spec despite the finalization guard.

2 open issues
1 resolved since last review

Review effort: Balanced

@manuzhang
manuzhang marked this pull request as ready for review November 3, 2026 02:02
Copilot AI balanced review requested due to automatic review settings November 3, 2026 02:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Human assessment is needed because the change introduces staged-v1 commit failures and process-dependent metadata destinations for locationless v4 tables.

1 open issue
1 resolved since last review

Review effort: Balanced

@manuzhang
manuzhang force-pushed the feat/v4-metadata-foundation branch from ca04e74 to 188c66a Compare November 23, 2026 14:42
@manuzhang
manuzhang force-pushed the feat/v4-metadata-foundation branch 7 times, most recently from 6bdbc21 to 09c7a36 Compare November 24, 2026 05:21
@manuzhang
manuzhang marked this pull request as draft November 24, 2026 05:21
@manuzhang
manuzhang force-pushed the feat/v4-metadata-foundation branch 12 times, most recently from f490368 to fa4aea8 Compare November 24, 2026 08:51
@manuzhang
manuzhang force-pushed the feat/v4-metadata-foundation branch from fa4aea8 to 7237413 Compare November 24, 2026 10:52
Support v4 table metadata creation, loading, upgrades, and JSON round trips
with root-manifest snapshot references. Keep the default table version at 2
and preserve legacy snapshots. Require a provided absolute v4 table location.

Validate v4 schemas and snapshots, expose roots in snapshot inspection,
and guard expiration cleanup until root reachability checks are supported.

Co-authored-by: Codex <[email protected]>
@xndai

xndai commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Depends on #1169 and #1172; merge those fixes first, then rebase onto main.

I don't understand why this PR would depend on 1169 and 1172. Can you pls elaborate?

const std::vector<std::unique_ptr<TableUpdate>>& updates,
auth::AuthSession& session) {
ICEBERG_ENDPOINT_CHECK(supported_endpoints_, Endpoint::UpdateTable());
// The server may have roots absent from the client, including after an upgrade.

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.

What is this block of code? How does this relate to v4 support?

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.

Looks like you are going to fail all versions including v1 to v3.

summary.erase(SnapshotSummaryFields::kOperation);
return AppendStringMap(column, summary);
}},
{.field_id = 9, .append = [](ArrowArray* column, const Snapshot& row) {

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.

Why is this field_id 9 instead of 7?

Comment thread src/iceberg/json_serde.cc
GetJsonValueOptional<std::string>(json, kManifestList));
ICEBERG_ASSIGN_OR_RAISE(auto root_manifest,
GetJsonValueOptional<std::string>(json, kRootManifest));
if (manifest_list.has_value() == root_manifest.has_value()) {

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.

rewrite it into two error condition -
if (..has_value() && .. has_value()) and
if (!has_value() && !has_value())
and report separate errors. This way it's much easier to trouble shoot malformed json file.

Comment thread src/iceberg/json_serde.cc
ICEBERG_ASSIGN_OR_RAISE(auto manifest_list,
GetJsonValue<std::string>(json, kManifestList));
GetJsonValueOptional<std::string>(json, kManifestList));
ICEBERG_ASSIGN_OR_RAISE(auto root_manifest,

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.

should we only try to parse root_manifest when version is 4?

Comment thread src/iceberg/snapshot.cc
Status Snapshot::ValidateForFormatVersion(int8_t format_version,
bool is_new_snapshot) const {
if (is_new_snapshot && format_version >= TableMetadata::kMinFormatVersionRootManifest) {
ICEBERG_CHECK(root_manifest.has_value(),

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.

and check the manifest list doesn't set?

Comment thread src/iceberg/snapshot.cc
ICEBERG_CHECK(format_version >= TableMetadata::kMinFormatVersionRootManifest,
"root-manifest requires format version {}",
TableMetadata::kMinFormatVersionRootManifest);
ICEBERG_CHECK(manifest_list.empty(),

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.

Can we wrap these checks into a version awared validate function similar to #1169 ?

});
}

Status TableMetadata::ValidateLocation() const {

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.

All these location validation need to account for relative path. Refer to #1124. Ok to resolve as a follow up but pls log an issue.

}

// A create transaction may upgrade before selecting the current schema.
// Build() checks identifier-field compatibility across all schemas.

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.

Build() checks identifier-field compatibility across all schemas.
but why the check below only checks against current schema? is it still going to fail at Build()?

if (current_schema != schemas_by_id_.end() &&
!current_schema->second->IdentifierFieldIds().empty()) {
return NotSupported(
"Cannot upgrade a table with identifier fields to format 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.

Can you add a link to v4 proposal/spec regarding this limitation? I am not aware and am curious why.


Status TableMetadata::ValidateIdentifierFields() const {
if (format_version >= kMinFormatVersionConstraints &&
std::ranges::any_of(schemas, [](const auto& schema) {

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.

You check all schemas here instead of just current schema. This is inconsistent with UpgradeFormatVersion. So the upgrade could succeed but then Build() would fail. Need to fix this.

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.

3 participants