Repository navigation
Conversation
…g `table-uuid` `IcebergMetadata::initializePersistentTableComponents` always read and parsed the metadata file from object storage, because the metadata files cache is keyed on `(table_uuid, path)` and the uuid is only known after parsing that file. The cache was filled afterwards, but never used by this read, so opening a table through a catalog cost one metadata read and parse per query even when the file was cached. A REST catalog already returns the Iceberg `table-uuid` in its `LoadTable` response, together with the metadata location. Pass it from the catalog to the storage configuration (`TableMetadata::getIcebergTableUUID`, `StorageObjectStorageConfiguration::catalog_iceberg_table_uuid`) and use it for the first read through `getMetadataJSONObject`. The uuid in the file is checked against it. The catalog uuid is not forwarded through `iceberg_metadata_table_uuid`, because that setting also changes how the metadata file is resolved. The generic `TableMetadata::getTableUUID` is not used either, because Unity catalogs return their own table id there. Ported from the catalog part of #2181 Related: #2181 Co-authored-by: Cursor <cursoragent@cursor.com>
ianton-ru
marked this pull request as draft
November 23, 2026 15:03
6 of 28 tasks
… has no `table-uuid` `table-uuid` is optional in a format version 1 metadata file. Such a table used to open with an empty `table_uuid` even when a catalog reported one, but the check added for the first read treated the missing field as a mismatch and threw `ICEBERG_SPECIFICATION_VIOLATION`. Compare the uuids only when the file has one. Related: #2947 Co-authored-by: Cursor <cursoragent@cursor.com>
…d is stored in the cache The first read keyed the metadata files cache on the uuid reported by the catalog and compared it with the uuid in the file only afterwards, so a file whose uuid differs from the catalog's was already cached under the catalog's key when the exception was thrown. Do the comparison inside the cache load function, so that only a file whose uuid agrees with the key is stored. Related: #2947 Co-authored-by: Cursor <cursoragent@cursor.com>
The keys of the Iceberg metadata files cache were the table uuid followed by the file path. Both come from a catalog or from a query, so a table on a storage of its own could fill the entry that a table of the same uuid and path on another storage later hits. The first metadata read of a catalog table now takes such an entry without reading the file, which made this easier to reach. Add the storage description, the objects namespace and the common key prefix to every key of the cache (metadata files, manifest lists, manifest files and the latest metadata version), and join the parts with a separator that none of them contains. Related: #2947 Co-authored-by: Cursor <cursoragent@cursor.com>
…che keys Carry the catalog `table-uuid` in `DataLakeSpecificProperties` next to the metadata location it belongs to, instead of a separate `TableMetadata` field and a check of the `iceberg_metadata_file_path` setting. Scoping the cache key by the object storage already guarantees that an entry keyed on the catalog uuid holds the file of that storage and path, so the uuid is compared only after the read, as before, and a separate check inside the cache load function is not needed. The storage in the key is its description and namespace; the key prefix is redundant with the path. The latest metadata version entries are left as they were: they hold a path, which is then read from the table's own storage through the scoped keys. Related: #2947 Co-authored-by: Cursor <cursoragent@cursor.com>
…ult initializer Related: #2947 Co-authored-by: Cursor <cursoragent@cursor.com>
This was referenced Nov 25, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Use the Iceberg
table-uuidthat a REST catalog returns for the first metadata read of a table. This is one independent feature split out of #2181, ported ontoantalya-26.8.The Iceberg metadata files cache is keyed on
(table-uuid, metadata file path), but the uuid used to be known only after the metadata file was parsed. SoIcebergMetadata::initializePersistentTableComponents, which runs every time a table is opened (once per query for aDataLakeCatalogtable), always read and parsed the metadata file from object storage. It filled the cache afterwards, and the later reads in the same query hit it, but this first read never did.A REST catalog already returns the
table-uuidand the metadata location in itsLoadTableresponse. With this change:RestCatalogstores it inTableMetadata(setIcebergTableUUID). It is a separate field fromgetTableUUID, because Unity catalogs put their own table id there, which is not the uuid inside the metadata file.DatabaseDataLakepasses it toStorageObjectStorageConfiguration::catalog_iceberg_table_uuid, only together with the explicit metadata location.getMetadataJSONObjectwith this uuid, so a cached metadata file is not read or parsed again. If the uuid in the file differs from the one from the catalog, the read fails withICEBERG_SPECIFICATION_VIOLATION.Changes compared with the pull request above: the uuid is not forwarded through the
iceberg_metadata_table_uuidsetting. That setting also switches the resolution of the latest metadata file to the listing of all metadata files, which the maintenance commands (remove_orphan_files, compaction, which ignore the explicit path) would then run for every catalog table. The second part of the original change, seeding the cache after the uuid-less read, is already inantalya-26.8.Tests: integration test
test_database_iceberg/test.py::test_first_metadata_read_uses_catalog_table_uuidchecksIcebergJsonFileParsinginsystem.query_log: zero for the second query with the cache, non-zero without it. It fails without the change (assert 1 == 0) and passes with it. The othertest_database_icebergtests that read, insert, optimize, drop and run on a cluster (test_select,test_insert,test_timestamps,test_optimize_manifest_with_catalog,test_cluster_select,test_used_storages_in_query_log,test_create_table_as,test_drop_table) pass with the change. All of this was run in the Praktika integration job on a local aarch64 build.Related: #2181
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Opening an Iceberg table through a REST catalog no longer reads and parses its metadata file again when the file is in the Iceberg metadata files cache.
Documentation entry for user-facing changes
No user-facing setting is added.
CI/CD Options
Exclude tests:
Regression jobs to run: