This pull request's diff hasn't been prepared yet. Log in with GitHub to have us prepare it for review.

This pull request's diff hasn't been prepared yet. Log in with GitHub to have us prepare it for review.

Do not copy the source part's txn_version files into a mutated part #127074

Closed
groeneai opened 10:24pm on October 20, 2026 wanted to merge 6 ฮ” into clickhouse/clickhouse master from
mutation-skip-source-txn-version-files

Pull Request Overview

  • Opened on October 21, 2026
  • Status Closed
  • Commit count 3 with first commit October 20, 2026

Total Delta

6 Total Diff Delta

Open Days

Open 25 weekdays

Test Delta

3 Diff Delta in Test Files
Breakdown by Phase

How long has this pull request spent in each phase of its lifecycle?

Fraction of total time Business days Phase
 
1 day Authoring 2 commits before pull request opened for review
 
1 day Awaiting first review

Total time for pull request 2 business days from first commit to closed PR

Author avatar

Do not copy the source part's txn_version files into a mutated part

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 .tmp with 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 in 26.11 and later)
    <!-- ch-version-info:end -->

Comments Threads Pending Resolution

alexey-milovidov reviewed and approved this work on October 22, 2026
alexey-milovidov left a comment

Reasonable.

Resolved Comment Threads

No resolved comments have been left on this PR.