Repository navigation
Conversation
A `UNIQUE KEY` insert opens an internal `MergeTreeTransaction` and commits its part under it, but `MergeTreeDataWriter` stamps the transaction on the part only when the table supports transactions (`StorageMergeTree::support_transaction`, false when a disk of the policy cannot append, e.g. `plain`/`plain_rewritable` metadata). The part then carries `NonTransactionalTID` and `IMergeTreeDataPart::assertHasVersionMetadata` throws `LOGICAL_ERROR` "CreationTID of part ... is set to unexpected value". Refuse such tables with `SUPPORT_IS_DISABLED`, keyed on `support_transaction` itself: at `CREATE` in the `StorageMergeTree` constructor (attach and server startup still load existing tables), and in `StorageMergeTree::write` for tables that exist without passing that check (created by an older version, full `ATTACH ... UUID`). Object storage with local metadata (e.g. `s3_disk`) keeps working. The same refusal applies to an `ALTER ... MODIFY SETTING storage_policy` that adds such a disk to a `UNIQUE KEY` table (`MergeTreeData::checkAlterEligibility`). `supportWritingWithAppend` now unwraps every delegate layer, so stacked `encrypted` disks are classified like single ones. `write` checks the table's current disks, so a storage-configuration reload that adds such a disk does not bypass the refusal. Found by `La Casa Del Dolor (amd_debug)` on master: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?REF=master&sha=d8d24e15f18c1584567da000d2c2f75b4df33fca&name_0=MasterCI&name_1=La%20Casa%20Del%20Dolor%20%28amd_debug%29 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal review (3 rounds)
|
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-5:20261103-053600 |
|
cc @murphy-4o @CheSema, could you review this and add the |
|
Workflow [PR], commit [56702ba] Summary: ✅
AI ReviewSummaryThe PR rejects Findings
Tests
Final Verdict |
Disks know nothing about transactions: what the check tests is `supportWritingWithAppend`, and a table supports transactions only when all its disks do (`supportTransaction` in `StorageMergeTree.cpp`). Rename the helper to `checkDisksSupportWritingWithAppend`, and say "does not support writing with append" in its comment, in the `ALTER` check's comment and in both error messages. The test is renamed to match. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… UNIQUE KEY Unwrapping every delegate layer in `supportWritingWithAppend` also turned off `supportsTransactions` for existing tables without `UNIQUE KEY` on a stacked `encrypted` disk. A transactional part written there by the previous version then fails to load: `VersionMetadataOnDisk` gets `can_write_metadata = false`, and `loadAndUpdateMetadata` throws `LOGICAL_ERROR` "was involved in transaction but cannot write metadata" (measured: master writes one part with `implicit_transaction`, restart into the previous head aborts at startup 3/3, master and this commit load it and `TRUNCATE` 3/3 and 4/4). Restore the function as on master, so tables without `UNIQUE KEY` are not affected, and make the two `UNIQUE KEY` checks test the innermost disk. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units8 translation units recompiled, 65 s compile time in total, 8 of them have a recent master baseline. |
…licy Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
CI finish ledger - 56702baEvery failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
CIDB has no other Session id: cron:our-pr-ci-monitor:20261104-083003 |
b02fbee
Changelog category (leave one):
Description
A
UNIQUE KEYinsert commits its part under a transaction, butStorageMergeTreesupports transactions only if every disk supports writing with append (plain,plain_rewritabledo not). On such a disk the part is not stamped with the transaction and the commit throwsLOGICAL_ERROR(CreationTID ... is set to unexpected value), seen in La Casa Del Dolor.UNIQUE KEYtables now requiresupportsTransactions, elseSUPPORT_IS_DISABLED:CREATE;INSERT, for tables attached without theCREATEcheck;ALTERthat switches to a storage policy with such a disk.The insert layer (#123003) is not in any release, hence not for changelog.
Workflow [PR]
Sync PR [sync-upstream/pr/128898]
Version info
26.11.1.1407-master(included in26.11and later)