Repository navigation
Remove the stale format_version assertion from IcebergMetadata::getHistory - #126801
Conversation
…story `PersistentTableComponents::format_version` is captured when the table is opened and is documented as allowed to go stale after an external upgrade. `getHistory` re-reads the latest metadata file and asserted that its `format-version` still equals the cached value, so a debug or sanitizer server aborted when another engine upgraded an attached table and then `system.iceberg_history` or `OPTIMIZE` (which calls `getHistory`) ran. Seen in Stress test (amd_msan) on PR ClickHouse#125542 (STID 2508-400e), where the AST fuzzer turned a `system.iceberg_history` query into an unfiltered scan that reached the table 05394 had just upgraded to format version 3. ClickHouse#100407 removed this comparison from both `getState` and `getHistory`; the ClickHouse#108080 sync brought both back and 6520200 removed only the `getState` one. `getHistory` computes everything from the freshly read metadata, and release builds compile `chassert` out, so there is no release-build behavior change. Extend the ClickHouse#86776 regression case to compare `system.iceberg_history` before and after the v1 -> v2 upgrade; it aborts node1 on master. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 0 findings) plus my own cold review (1 finding).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-8:20261019-204900 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-41:20261019-200200 |
|
Workflow [PR], commit [00ed4b3] Summary: ✅
AI ReviewSummaryPR #126801 removes the stale Missing context / blind spots
Final VerdictStatus: ✅ Approve. No code changes requested. |
|
cc @scanhex12 @SmitaRKulkarni, could you review this and add the |
1010688
Related: #86776
Related: #100407
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Description
A debug or sanitizer server aborts on
Logical error: 'persistent_components.format_version == metadata_object->getValue<int>(f_format_version)'when it reads the history of an Iceberg table whose format version another engine upgraded while the table stayed attached:system.iceberg_history, orOPTIMIZEwithallow_experimental_iceberg_compaction, which callsgetHistoryfirst. Seen in Stress test (amd_msan), where the AST fuzzer rewrote the filter of asystem.iceberg_historyquery so that it no longer pruned databases, and the scan reached the table05394_iceberg_v3_upgrade_insert_assigns_row_idshad just upgraded to v3.Cause.
PersistentTableComponents::format_versionis the value seen when the table was opened, andPersistentTableComponents.hdocuments that it may go stale after an external upgrade.getHistoryre-reads the latest metadata file and asserted that itsformat-versionstill equals the cached value. #100407 removed this comparison fromgetStateandgetHistory; the #108080 sync brought both back, and only thegetStateone was removed again.Change. Delete the assertion.
getHistorycomputes its result from the freshly read metadata and uses the cached value nowhere else. Release builds compilechassertout, so they are unaffected. With the fix,OPTIMIZEon a table upgraded to v3 fails withCompaction is supported only for format_version 2instead of aborting.Test.
test_format_version_upgrade_v1_to_v2(#86776) now also comparessystem.iceberg_historybefore and after the v1 -> v2 upgrade. On master node1 aborts on the post-upgrade read; with the fix it passes. #99981 also deletes this line as one hunk of a larger change.Workflow [PR]
Sync PR [sync-upstream/pr/126801]
Version info
26.11.1.514-master(included in26.11and later)