Repository navigation
Conversation
Internal second-model review (click to expand)Two review rounds by an independent reviewer that never edits the code, plus two cold Round 1: 1 blocker, 2 majors, all AGREED and fixed ❌ Do not recommend
Re-review of the fix - no findings. Both diff scopes were checked against the intended change 💡 Noted, not blocking: the rewritten header of Also verified in this round, by reading the code rather than trusting the change description: One open question for the owners, deliberately not decided here: PR #110069 (also mine, open) Session id: cron:clickhouse-review-self-slot-58:20260812-074400 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-self-slot-57:20260812-070002 |
|
Workflow [PR], commit [c255e8c] Summary: ✅
AI ReviewSummaryThis PR makes open-source Missing context / blind spots
Final Verdict
LLVM Coverage ReportMeasured on commit c255e8c.
Changed lines: Changed C/C++ lines covered: 85/85 (100.00%) · Uncovered code |
|
cc @divanik @arsenmuk, could you review this? Iceberg data compaction deletes a raw listing of metadata/ and data/ with no reachability filter, so it removes files that retained snapshots still reference, including version-hint.text and every vN.metadata.json, and its own rewrite is never published because getPlan never calls setVersion. This refuses the path in the open-source build rather than repairing publication, which needs the current-snapshot replacement model and catalog plumbing. |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units9 translation units recompiled, 53 s compile time in total, 9 of them have a recent master baseline. |
|
Confirmed, and it applies to the other half of the same sentence too.
Took the second option and dropped the reclaim guidance from the message. Scoping it in place Also corrected a claim of my own that the re-review caught: the message and docs said no The refusal itself, its placement, the setting gate and both tokens the stateless test greps |
CI finish ledger - 36d141fCI is fully finished on this head and there are no failures to own. 177 check runs, 164 success, 13 skipped, 0 failed. The praktika report for this head is top-level
The only
Session id: cron:our-pr-ci-monitor:20260813-113000 |
|
📊 Cloud Performance Report ✅ AI verdict: no significant changes detected. K_source=6 K_base=30 flagged=0/65 clickbench🟢 No significant changes tpch_adapted_1_official🟢 No significant changes Debug info
|
CI finish ledger - 7d0b9e4Every failure below has an owner: a fixing PR (ours or external), or a full-effort fix task
Not caused by this PR: the abort is at This is a new sub-signature within STID 2508-3775 rather than the already-tracked one: the other 8 Session id: cron:our-pr-ci-monitor:20260825-020000 |
Fixing PR for the
|
| build | result |
|---|---|
| master | SIGABRT, stack identical to this job's fatal.log |
| master + #113242 | 21 (correct), no abort |
EXPLAIN PLAN shows the mechanism: on master the step above ReadFromMerge is Sorting (Merge sorted streams for ORDER BY, ...), so an order-bearing stage was delegated to children whose cast had already destroyed the order; with #113242 the children are read at FetchColumns and the initiator does a real sort. The guard sits in StorageMerge::getQueryProcessingStage, upstream of the sort-property claim, so it covers this consumer as well as DistinctSortedStreamTransform. Control: an unfuzzed String parent does not abort on master, so the mistyped cast is required.
Separately, #115839 pins ast_fuzzer_runs = 0 on 04870 and stops this wave in the stress lane without waiting on #113242.
Nothing here is caused by this PR's diff.
|
While investigating a separate report I reproduced, on unmodified master, the failure mode this PR's refusal message describes ("no version increment ... so which generation a reader resolves is undefined"). Posting it here because it turns that sentence into a measured data-loss reproduction with no non-default settings. Master CREATE TABLE t (id Int64, v String) ENGINE = IcebergLocal('user_files/t/', 'Parquet');
INSERT INTO t SELECT number, char(number + ascii('a')) FROM numbers(6)
SETTINGS iceberg_insert_max_rows_in_data_file = 2, min_insert_block_size_rows = 2,
max_insert_block_size = 2, max_block_size = 2, max_insert_threads = 1;
ALTER TABLE t DELETE WHERE id = 2 SETTINGS mutations_sync = 2;
INSERT INTO t SELECT number + 100, char(number + ascii('p')) FROM numbers(2);
OPTIMIZE TABLE t SETTINGS allow_experimental_iceberg_compaction = 1; -- succeeds, result correct
ALTER TABLE t DELETE WHERE id = 4 SETTINGS mutations_sync = 2; -- succeeds, no error
SELECT count(), sum(id) FROM t; -- 0 / 0, expected 6 / 210What
The version counter restarts at 0 ( Three probes pin that as the carrier: It stops being merely a wrong answer as soon as anything writes on top of the stale view. Continuing with Two bounds worth recording: a pre-existing position delete is required, since I am not opening a competing PR. The only reachable carrier is |
|
@scanhex12 @SmitaRKulkarni can one of you review this? |
|
@scanhex12 @SmitaRKulkarni looks like the data compaction does not work as expected ? |
|
Understood, I will repair the publish path instead of refusing the command. One measurement first, because it decides the shape of the repair: on master, with nothing pinned and the correct metadata root, a successful The repair, all in
I will rework this PR into that. If you would rather keep the refusal on master as an interim guard while the repair is reviewed, say so and I will split it into two PRs. This is the non-cloud path only: in the |
On Cloud, data compaction is allowed by the table-level allow_experimental_iceberg_compaction setting (stored in the table definition, or taken from the context that initializes the table metadata), and IcebergMetadata::optimize never reads the setting sent with OPTIMIZE. The test creates its table without that setting, so on a Cloud build the success assertion for the first OPTIMIZE failed whenever that gate was closed, and the setting-gate assertion for the second OPTIMIZE failed whenever it was open: no Cloud configuration could pass both. On Cloud, accept either outcome of that gate: OPTIMIZE succeeds, or its error names the setting. Any other error, including the open-source refusal, still fails there. The open-source assertions are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The combined `UPDATE` / `MERGE` row said neither is supported, but `ALTER TABLE ... UPDATE` is implemented for Iceberg tables: `IcebergMetadata::checkMutationIsPossible` accepts it, it goes through the same `IcebergMetadata::mutate` path as `DELETE` (gated by `allow_insert_into_iceberg`), and test_writes_mutate_update.py covers it. Measured on master 026dca3: without the setting it fails with SUPPORT_IS_DISABLED ("Iceberg mutations is experimental"), with it the row is updated. `MERGE` has no statement in ClickHouse (SYNTAX_ERROR). The `UPDATE` row now mirrors the `DELETE` row; `MERGE` stays unsupported. Co-Authored-By: Claude Opus 5.5 <[email protected]>
`allow_experimental_iceberg_compaction` enables only `OPTIMIZE TABLE ... MANIFEST` in open-source builds, because data compaction reports `NOT_IMPLEMENTED` there. The support matrix and the Iceberg table function docs already say so; the settings reference page, which is generated from this description, did not. Co-Authored-By: Claude Opus 5.5 <[email protected]>
| started_cluster_iceberg_with_spark, instance, storage_type, table_name | ||
| ) | ||
| removed = sorted(set(files_before) - set(files_after)) | ||
| assert not removed, f"OPTIMIZE deleted pre-existing files: {removed}" | ||
|
|
||
| if hint_state == "stale": | ||
| # Point the hint back at the version it named before it went stale. Reading through a | ||
| # stale hint legitimately returns the older version, so the hint has to name the newest | ||
| # one for the row assertion below to be about `OPTIMIZE` rather than about the hint. | ||
| _write_version_hint( | ||
| started_cluster_iceberg_with_spark, | ||
| instance, | ||
| storage_type, | ||
| table_name, | ||
| newest_before, | ||
| ) | ||
|
|
||
| # The acked third insert must still be there, and the table must still be readable | ||
| # through the version it was committed at. | ||
| assert instance.query(f"SELECT x FROM {table_name} ORDER BY x") == "1\n99\n" | ||
| assert int(instance.query(f"SELECT count() FROM {table_name}")) == 2 | ||
|
|
||
| instance.query(f"DROP TABLE {table_name} SYNC;") |
There was a problem hiding this comment.
@groeneai Checking filenames and current rows does not prove a retained snapshot remains readable, and cached metadata can mask an overwrite. Please capture a pre-delete snapshot ID and verify its rows and current rows after clearing the Iceberg metadata cache.
There was a problem hiding this comment.
Done in c5de71d: the test takes the snapshot before the DELETE from system.iceberg_history, checks that it reads [1,2] before OPTIMIZE, and after SYSTEM DROP ICEBERG METADATA CACHE checks it again together with the current rows. On a master binary with the removed-files check disabled, the absent-hint arms fail only on that snapshot read.
| if grep -qF 'Logical error' <<< "$out"; then | ||
| echo "FAIL: logical error: $out" | ||
| elif [ "$is_cloud" = 1 ]; then | ||
| if grep -qF 'Code:' <<< "$out" && ! grep -qF allow_experimental_iceberg_compaction <<< "$out"; then | ||
| echo "FAIL: expected OPTIMIZE to succeed or to name the setting: $out" | ||
| else | ||
| echo "ok" | ||
| fi | ||
| elif grep -qF NOT_IMPLEMENTED <<< "$out" \ | ||
| && grep -qF 'not yet supported for Iceberg data compaction' <<< "$out"; then | ||
| echo "ok" | ||
| else | ||
| echo "FAIL: expected a NOT_IMPLEMENTED refusal on the open-source build: $out" | ||
| fi |
There was a problem hiding this comment.
@groeneai The Cloud arm accepts a disabled-table setting error as ok, so it never proves Cloud compaction works. Please use a separately initialized table with per-table compaction enabled and require its OPTIMIZE to succeed.
There was a problem hiding this comment.
Done in 1463ab1: a second table created with SETTINGS allow_experimental_iceberg_compaction = 1 must compact successfully on Cloud, and the open-source build must still refuse it. I cannot build Cloud here, so I ran the test body against a stub client: a Cloud build where every OPTIMIZE names the setting passed before this change and fails now. On a real open-source server, forcing is_cloud=1 fails on the refusal.
|
@groeneai please update to the latest master while addressing my latests comments on this PR |
…blishable-data-compaction
…NIFEST The table function docs listed only the format-version requirement, while manifest compaction also rejects encrypted tables whose data files carry per-file key_metadata with NOT_IMPLEMENTED. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The iceberg_data_file_size_*_threshold_compaction, iceberg_compaction_*, iceberg_max_number_datafiles_to_compact and allow_experimental_cleanup_old_data_files_compaction settings have no reader in the open-source build, so their docs pages presented data compaction as available there. Their descriptions now carry the in-file marker "Only has an effect in ClickHouse Cloud", which also adds the Cloud-only badge to the generated settings pages. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…st_optimize The stale-hint arm now points the hint at the newest metadata version after OPTIMIZE instead of the pre-OPTIMIZE one, so a published result is what gets read. The test also captures the snapshot before the delete and, after dropping the Iceberg metadata cache, checks that it still reads [1, 2] next to the current rows. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ed in 04880 The Cloud arm accepted the table-level setting error, so it never proved that compaction works there. A second table created with the table-level allow_experimental_iceberg_compaction now has to compact successfully on Cloud, and the open-source build must still refuse it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Merged master (3eda573) without conflicts and pushed 1463ab1 with the five review changes on top. Locally |
The test pins issue ClickHouse#89037, which was reported through OPTIMIZE TABLE, but the probe was dropped when data compaction started being refused. It is back, with the open-source refusal added to the tolerated outcomes, so the test still fails on the conversion error once compaction runs on this fixture again. A build that calls getHistory before the refusal and reads the two metrics unguarded now fails at the probe with the reported message. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…able in 04880 With `--allow_experimental_iceberg_compaction=1` on the query, the Cloud arm would also pass if the gate fell back to the query-level setting and the table-level one stopped mattering. The Cloud call now relies on the table-level setting alone. The open-source call keeps both settings, so it still proves the refusal holds when every gate is open. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Edited by the nightly changelog CI job following .claude/skills/edit-changelog/SKILL.md. Changelog-revert: 123508 114437 Revert "Refuse Iceberg data compaction until it can publish its result" Changelog-revert: 123789 122853 Revert "Make LLVM coverage opt-in in pull requests, run the same configurations on arm_binary" Changelog-deleted-entry: 114437 [Improvement] [section] * In the open-source build, `Iceberg` data compaction (`OPTIMIZE TABLE` with `allow_experimental_iceberg_compaction = 1`) now reports `NOT_IMPLEMENTED` instead of running, because it deleted files that retained snapshots still referenced, including `version-hint.text` and every `vN.metadata.json`, which left the table unreadable and could permanently lose an acknowledged snapshot's rows. `OPTIMIZE TABLE ... MANIFEST`, `expire_snapshots`, and `remove_orphan_files` are unaffected. [#114437](#114437) ([Groene AI](https://github.com/groeneai)). Changelog-deleted-entry: 122853 [NOT FOR CHANGELOG / INSIGNIFICANT] [raw] * Make LLVM coverage opt-in in pull requests, run the same configurations on arm_binary. [#122853](#122853) ([Nikita Fomichev](https://github.com/fm4v)).
|
@groeneai I reverted this change via #123508 I want you to:
|
|
Acknowledged. I'm re-assessing the Iceberg OPTIMIZE compaction data loss on current master; I'll open an issue with a clean repro (if none exists yet) and a new PR that implements the missing publication wiring so compaction and OPTIMIZE work, with you as reviewer, and link both here. |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
In the open-source build, Iceberg data compaction (
OPTIMIZE TABLEwithallow_experimental_iceberg_compaction = 1) now reportsNOT_IMPLEMENTEDinstead of running, because it deleted files that retained snapshots still referenced, includingversion-hint.textand everyvN.metadata.json, which left the table unreadable and could permanently lose an acknowledged snapshot's rows.OPTIMIZE TABLE ... MANIFEST,expire_snapshotsandremove_orphan_filesare unaffected.Description
Related: #114194 (the same stale-hint root reaching
remove_orphan_files).Measured on master (
26.8.1.1), v2 table with position deletes:OPTIMIZE TABLEreturns success silently, drops the object count 18 to 10, and deletesmetadata/version-hint.textwithv1..v5.metadata.json; every later read failsCode: 107 FILE_DOESNT_EXIST. No stale hint is needed. When the hint is behind the newest metadata, the rewrite is rooted at the older version, so an acknowledged snapshot's data files are not carried forward yet are still deleted:groupArray(x)returns[1]where[1,99]was committed.Root cause:
getOldFilestakes a raw listing ofmetadata/anddata/with no reachability filter and no age gate, andclearOldFilesdeletes all of it. Those files are reachable by the engine's own definition -collectSnapshotReferencedFileswalks every entry of thesnapshotsarray - so deleting them is wrong at any age, under any guard.The rewrite is also never published atomically:
getPlannever callssetVersion, so it always writesv0.metadata.json, andwriteMetadataFilescommits with a bareWriteMode::Rewrite, no hint and no catalog commit. Since the old files are listed before it runs, cleanup deletes the previousvNand leavesv0, so a reader resolves whichever generation survived - in the measured run, the truncated one. Publishing correctly needs the current-snapshot replacement model and catalog plumbing that do not exist here, so this refuses the path rather than repairing it, following the existing format-version 3 refusal forOPTIMIZE ... MANIFEST.The data-compaction success contracts in the tests were deleted rather than inverted into "the feature is absent" assertions, which would have to be deleted again once publication lands. The new integration test asserts the property that holds either way: no pre-existing file is removed and the committed rows survive. A stateless test pins the refusal.
OPTIMIZE ... MANIFESTcoverage is untouched.Workflow [PR]
Sync PR [sync-upstream/pr/114437]
Version info
26.10.1.1205-master(included in26.10and later)