Repository navigation
Conversation
3e5880a to
a41c259
Compare
a41c259 to
afae5a7
Compare
|
@rienath thanks for the feedback. I've moved the full context into #116235 (measurements, repro, landing order). This PR is the parsed-state / derived-metadata reuse, third in that order. One safety property to note: time-travel reads bypass both caches, so historical queries can't poison the current-state entry. I'll rebase all six onto master and update here once fork validation is green. |
Keep the parsed-state reuse current with master.
| void backgroundMetadataPrefetcherThread(); | ||
|
|
||
| /// Parsed-state cache: while the metadata version is unchanged, reuse the | ||
| /// last parsed {data snapshot, table state} instead of re-parsing the |
There was a problem hiding this comment.
I think iceberg metadata cache does the same?
There was a problem hiding this comment.
🕵 Both the parsed state and derived StorageInMemoryMetadata now use IcebergMetadataFilesCache, with its existing eviction and clear lifecycle; there is no separate derived-metadata cache. The remaining benefit is avoiding repeated parsing and metadata construction, not caching the file bytes again.
I also fixed the disabled-cache path and initialization of a fresh storage’s schema processor on a shared-cache hit, and added a focused lifecycle fixture. The fixture/reference was checked separately; validation of the patched binary is still pending. Keeping this draft behind #115877.
Addresses the review question about the files cache doing the same
thing: the parsed {data snapshot, table state} now lives in the same
cache as the metadata JSON, keyed by metadata path, version, and
snapshot selector. One cache, one eviction domain, one SYSTEM CLEAR;
time-travel queries get their own entry instead of bypassing/poisoning
a singleton. The derived StorageInMemoryMetadata cache is unchanged.
getRelevantState returns IcebergDataSnapshotPtr (non-const); the cached entry must be the same type as the original single-entry cache held.
|
@scanhex12 fair point — the files cache covers the metadata bytes, but the parse and the |
Replace debug-only `chassert` guards in `ManifestFilesPruner::partitionFilterHash` with real `LOGICAL_ERROR` checks on the `KeyCondition` `RPN` (`AND`/`OR`/`NOT`), so a malformed stack throws an exception in release builds instead of causing undefined behavior. Document only, no behavior change: stateless `ManifestFileIterator::create` `table_snapshot_id` placeholder, `ParquetV3BlockInputFormat` row-group key unambiguity via `path.size()`, partition-only candidate sharing between data and delete iterators, derived `StorageInMemoryMetadata` `TableStateSnapshot` equality safety under `SYSTEM CLEAR ICEBERG METADATA CACHE`, and `DatabaseDataLake::tryGetTableImpl` global-context credentials, TTL race, and `ALTER DATABASE` over-invalidation. Related: ClickHouse#116235 Related: ClickHouse#115873 Related: ClickHouse#115874 Related: ClickHouse#115876 Related: ClickHouse#115877 Related: ClickHouse#115878
…into files cache Replace the hand-rolled `OrderedRowGroupIndexCache` (`mutex` + `unordered_map` + `list`) with `CacheBase` in the new `ParquetOrderedRowGroupIndexCache.h`: bounded eviction, `ParquetOrderedRowGroupIndexCacheBytes/Files` gauges and `ParquetOrderedRowGroupIndexCacheWeightLost` events. `SYSTEM CLEAR PARQUET METADATA CACHE` now resets the fence index too (same file-identity keying), covered by a clear-and-miss round-trip in `05024_parquet_sorted_row_group_point_lookup`. Move the single-entry derived `StorageInMemoryMetadata` cache out of `IcebergMetadata` into `IcebergMetadataFilesCache` as `DerivedStorageMetadata`, keyed by the exact `TableStateSnapshot::operator==` fields. This bounds its memory, shares entries across storages of one table, and couples its lifetime to `SYSTEM CLEAR ICEBERG METADATA CACHE`. Time-travel queries still bypass it, and with `use_iceberg_metadata_files_cache=0` the metadata is built directly with no caching. Related: ClickHouse#116235 Related: ClickHouse#115874 Related: ClickHouse#115878
Replace the per-object single-entry derived `StorageInMemoryMetadata` cache with a `DerivedStorageMetadata` entry in `IcebergMetadataFilesCache`, keyed by the exact `TableStateSnapshot::operator==` fields. This bounds its memory, shares entries across storages of one table, and couples its lifetime to `SYSTEM CLEAR ICEBERG METADATA CACHE`. Time-travel queries still bypass it, and with `use_iceberg_metadata_files_cache=0` the metadata is built directly with no caching. Related: ClickHouse#115874
Do not dereference a disabled `IcebergMetadataFilesCache`. A shared parsed-state hit must initialize a fresh storage schema processor before use. Validate mutually exclusive time-travel settings before the cache lookup. Add a lifecycle fixture covering disabled caching, a second storage, and an external metadata update; fixture output was checked on the baseline binary, patched build validation remains pending.
ATTACH TABLE with a full definition emits a server-side warning that clickhouse-test treats as stderr failure. Set send_logs_level to fatal on those two statements only.
Per-query SETTINGS cannot lower log delivery below the session level, so the full-definition ATTACH warning still reached stderr. Use a quiet client with --allow_repeated_settings --send_logs_level=fatal for those two statements only, following 01600_quota_by_prefix_forwarded_ip.sh. Verified locally: exit 0, empty stderr, exact reference match.
|
Closing this draft to keep the review queue clear, per @rienath's request in #116235 to not have the whole series open at once. The parsed-state question @scanhex12 raised was answered by folding both the parsed state and derived metadata into |
Related: #116235
Reuse parsed Iceberg table state and derived
StorageInMemoryMetadatawithinIcebergMetadataFilesCache, rather than introducing another cache lifecycle. The benefit is avoiding repeated parsing and metadata construction, not caching already-cached file bytes again.The current revision handles a disabled cache, initializes a fresh storage's schema processor on a shared-state hit, and checks mutually exclusive time-travel selectors before lookup. A new lifecycle fixture covers disabled caching, a second storage over the same table, and a metadata update. Its reference was checked on a baseline binary; validation of the patched head is queued: https://github.com/adonm/ClickHouse/actions/runs/33950831698.
Broader schema/time-travel and cache-identity coverage remains necessary. Kept draft in the agreed landing order; historical combined measurements are not proof of this standalone revision.
Changelog category (leave one):
Changelog entry:
Reuse parsed Iceberg table state and derived storage metadata through the existing metadata-files cache when the requested state is unchanged.
Original implementation assisted by DeepSeek V4 Pro; follow-up revisions also used AI assistance.