Skip to content

API, Core, Spark: add Snapshot.rootManifestLocation() - #17523

Open
stevenzwu wants to merge 2 commits into
apache:mainfrom
stevenzwu:snapshot_file_extract
Open

stevenzwu wants to merge 2 commits into
apache:mainfrom
stevenzwu:snapshot_file_extract

Conversation

@stevenzwu

@stevenzwu stevenzwu commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #17545 (FileWithEncryptedKey).

v4 snapshots store a root-manifest instead of a manifest-list, and v4 has no format-version field, so each snapshot records which file it has. This adds Snapshot.rootManifestLocation() (default null) next to manifestListLocation(), which is unchanged for v1–v3. A snapshot sets at most one of the two. SnapshotParser reads and writes whichever is present, and the snapshots table adds a root_manifest column (field ID 9).

V4 commits still write a manifest list, and readers that open the file as a manifest list stay on manifestListLocation() until a v4 root-manifest write path is ready.

@stevenzwu
stevenzwu force-pushed the snapshot_file_extract branch 3 times, most recently from 51e06e3 to ee6b97b Compare August 5, 2026 04:12
@stevenzwu
stevenzwu force-pushed the snapshot_file_extract branch from ee6b97b to 0073109 Compare August 6, 2026 05:44
@stevenzwu
stevenzwu force-pushed the snapshot_file_extract branch from 0073109 to 63c4057 Compare August 6, 2026 06:00

@gaborkaszab gaborkaszab 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 keeping this rolling, @stevenzwu !
I have 2 comments in general:

  1. I think I'd not include metadata tables to this PR. That seems an orthogonal question and can be a follow-up and a different discussion how to visualize this abstraction
  2. For me the abstraction layer we introduce here is too specific. I describe this in multiple of my comments, but basically we could simplify encryption APIs if we introduced a more general abstraction here that goes for every file that keeps it's encrypted encryption keys in TableMetadata.encryptionKeys, including TableStataistics and PartitionStatistics (see this for the former)

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@iceberg.apache.org list. Thank you for your contributions.

@github-actions github-actions Bot added the stale label Sep 7, 2026
@stevenzwu
stevenzwu force-pushed the snapshot_file_extract branch 4 times, most recently from 81159ce to c9b805a Compare September 10, 2026 23:10
@stevenzwu stevenzwu changed the title API, Core, Spark, Flink: extract SnapshotFile abstraction API, Core, Spark, Flink: add version-agnostic Snapshot.rootLocation() Sep 10, 2026
@stevenzwu
stevenzwu force-pushed the snapshot_file_extract branch 3 times, most recently from 89ffa8e to 9b1909b Compare September 11, 2026 04:24
@github-actions github-actions Bot removed the stale label Sep 12, 2026
@github-actions

Copy link
Copy Markdown

This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@iceberg.apache.org list. Thank you for your contributions.

@github-actions github-actions Bot added the stale label Oct 12, 2026
@github-actions

Copy link
Copy Markdown

This pull request has been closed due to lack of activity. This is not a judgement on the merit of the PR in any way. It is just a way of keeping the PR queue manageable. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time.

@github-actions github-actions Bot closed this Oct 20, 2026
@stevenzwu stevenzwu reopened this Oct 31, 2026
@stevenzwu stevenzwu added not-stale and removed stale labels Oct 31, 2026
…ManifestListFile

ManifestListFile and its implementation contains nothing that is specific
to manifest lists. It is more generally related to files that use
TableMetadata.encryptionKeys to store encrypted encryption key metadata
that are referred to by a key ID.
This PR introduces a more general functionality that can be used accross
multiple file types like manifest lists, V4 root manifests, table
statistics and partition statistics. The less general functionality
specific to manifest lists is deprecated or removed where possible.
@stevenzwu
stevenzwu force-pushed the snapshot_file_extract branch from 9b1909b to 92275f9 Compare October 31, 2026 04:47
@stevenzwu
stevenzwu force-pushed the snapshot_file_extract branch 3 times, most recently from 68e2be0 to 0b626a8 Compare November 2, 2026 05:35
@stevenzwu
stevenzwu force-pushed the snapshot_file_extract branch from 0b626a8 to 803b4f6 Compare November 2, 2026 22:21
@stevenzwu stevenzwu changed the title API, Core, Spark, Flink: add version-agnostic Snapshot.rootLocation() API, Core, Spark, Flink: add Snapshot.rootManifestLocation() Nov 2, 2026
@stevenzwu
stevenzwu force-pushed the snapshot_file_extract branch from 803b4f6 to 015f87b Compare November 2, 2026 23:30
@github-actions github-actions Bot removed the NESSIE label Nov 2, 2026
@stevenzwu
stevenzwu force-pushed the snapshot_file_extract branch from 015f87b to 1284eb0 Compare November 2, 2026 23:39
@stevenzwu stevenzwu changed the title API, Core, Spark, Flink: add Snapshot.rootManifestLocation() API, Core, Spark: add Snapshot.rootManifestLocation() Nov 2, 2026
@stevenzwu
stevenzwu force-pushed the snapshot_file_extract branch from 1284eb0 to d1c11ad Compare November 2, 2026 23:52
…oot manifests

v4 snapshot metadata has no format-version field and stores the snapshot's
root file in root-manifest instead of manifest-list. Add
Snapshot.rootManifestLocation() and keep manifestListLocation() for v1-v3
snapshots. Each snapshot sets exactly one of the two. SnapshotUtil.rootLocation()
returns whichever is set, so callers that need the snapshot's root file do not
branch on the field.

Commits still write a manifest list. Readers that open the snapshot file as a
manifest list stay on manifestListLocation() until a root manifest is written.

The snapshots metadata table adds root_manifest (field ID 9), set only when
the snapshot has a root manifest.

Generated-by: Cursor Grok 4.7
Co-authored-by: Cursor <cursoragent@cursor.com>
for (Snapshot snapshot : metadata.snapshots()) {
String newManifestListLocation =
newPath(snapshot.manifestListLocation(), sourcePrefix, targetPrefix);
String manifestList = snapshot.manifestListLocation();

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.

do we also need to handle ReachableFileCleanup and IncrementalFileCleanup?

TableMetadata metadata, String sourcePrefix, String targetPrefix) {
List<Snapshot> newSnapshots = Lists.newArrayListWithCapacity(metadata.snapshots().size());
for (Snapshot snapshot : metadata.snapshots()) {
String newManifestListLocation =

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.

there are a few more places in this class that reference snapshot.manifestListLocation() directly, should we update those as well?

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

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

5 participants