Skip to content

Write manifests to the transaction's metadata location - #4523

Merged
Fokko merged 1 commit into
apache:mainfrom
smaheshwar-pltr:sm/transaction-manifest-location
Nov 30, 2026
Merged

Fokko merged 1 commit into
apache:mainfrom
smaheshwar-pltr:sm/transaction-manifest-location

Conversation

@smaheshwar-pltr

Copy link
Copy Markdown
Contributor

Rationale for this change

A transaction can set write.metadata.path and then write data. The new metadata file and the data files go to the new locations, but the manifests and manifest list still go under the old metadata directory, because they're placed using the table's metadata from when the transaction started. For example, after setting write.data.path and write.metadata.path to /data and /metadata and appending in one transaction:

metadata file: /metadata/00001-....metadata.json
data file:     /data/00000-0-....parquet
manifest list: /default/t/metadata/snap-...-0-....avro
manifest:      /default/t/metadata/...-m0.avro

This PR places them using the transaction's metadata, as data files already are. Iceberg Java does the same through the transaction's table operations.

Are these changes tested?

Yes. A catalog test sets write.metadata.path and appends in the same transaction, then checks where the manifest list and manifests were written. It fails without the fix.

Are there any user-facing changes?

Manifests and manifest lists written in a transaction go to a write.metadata.path set earlier in that transaction.

AI Disclosure: This PR was authored by Claude Code (Opus 5.5) but directed and overseen by me.

Snapshot producers wrote manifests and manifest lists using the location
provider of the table the transaction started from, while data files use
the transaction's metadata. A transaction that changes the location or
write.metadata.path before writing would split its files between the old
and new paths. Use the transaction's metadata for both, as Java does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
def _location_provider(self) -> LocationProvider:
# Use the metadata of the transaction, as for data files, in case it changed the location or properties
table_metadata = self._transaction.table_metadata
return load_location_provider(table_location=table_metadata.location, table_properties=table_metadata.properties)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

(Note that self._transaction._table.location_provider() which we had previously in new_manifest_output calls load_location_provider, so this isn't a new load per-manifest)

@smaheshwar-pltr
smaheshwar-pltr marked this pull request as ready for review November 29, 2026 23:32

@Fokko Fokko 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, thanks @smaheshwar-pltr for the fix and the clear write-up! This matches Java, where TransactionTableOperations resolves metadata locations through ops.temp(current).

@Fokko
Fokko added this pull request to the merge queue Nov 30, 2026
Merged via the queue into apache:main with commit d90e205 Nov 30, 2026
20 checks passed
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