groeneai's Description of Work
Related: https://github.com/ClickHouse/ClickHouse/pull/108772
Related: https://github.com/ClickHouse/ClickHouse/pull/124485
Changelog category (leave one):
- Experimental Feature
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Experimental transactions: a mutation that runs while a part's transaction metadata is being updated no longer copies the part's txn_version.txt.tmp, so it neither fails with FILE_DOESNT_EXIST on object storage nor produces a part that is dropped as rolled back on the next table load.
Description
A mutation that rewrites some columns of a Wide part hardlinks every other file of the source part. collectFilesToSkip excluded txn_version.txt only if it existed, and never excluded txn_version.txt.tmp, which VersionMetadataOnDisk::storeInfoToDataPartStorage writes and then renames over txn_version.txt when a commit stamps the part's CSN. A mutation that lists the part inside that window copies the temporary file:
- on a local disk the mutated part keeps a
.tmpwith the source part's version info, so it is loaded as an uncommitted transaction and dropped on the next load, and its rows are lost; - on object storage the hardlink runs at the disk transaction commit, after the rename, and the mutation fails with
Can't create hardlink for file .../txn_version.txt.tmp (FILE_DOESNT_EXIST).
The mutated part writes its own version metadata, so both files are now skipped by name. #108772 made the readers tolerate a stray .tmp; this stops the mutation from producing one.
This is the flaky 03752_attach_as_replicated_transaction_metadata, 6 times since June, twice on master: the FILE_DOESNT_EXIST variant (latest) and on master the lost-rows variant (report, count() 1271 instead of 0).
The new test uses two pauseable failpoints to stop COMMIT before the rename and the mutation before it adds its part. Without the fix it fails on every run on local and on encrypted S3 storage; with it, 50/50 randomized runs pass on each.
๐ค Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/127074]
<!-- CI automatic block end :ci_links: -->
Version info
- Merged into:
26.11.1.582-master(included in26.11and later)
<!-- ch-version-info:end -->