Repository navigation
Tolerate a broken txn_version.txt.tmp when loading a part - #110519
Merged
alexey-milovidov merged 2 commits intoJul 17, 2026
Merged
Conversation
A leftover `txn_version.txt.tmp` on a part is an artifact of an interrupted
write, so not only its content but even the disk-level metadata describing it
can be broken. On an object storage disk with local metadata, a raw or
partially written metadata file for it made `getFileSize` throw
`CANNOT_PARSE_INPUT_ASSERTION_FAILED` from
`DiskObjectStorageMetadata::deserialize` inside
`VersionMetadataOnDisk::removeTmpMetadataFile`, failing the part load, the
table load, and with it the server startup ("Cannot start clickhouse-server").
The read there is purely diagnostic (the content is dumped to the log before
the file is removed), so make it best-effort: on failure, log the exception
and proceed with the removal, which is already tolerant to such files
(`UnlinkFileOperation` reads the disk-level metadata with
`tryReadMetadataFile`).
Seen in stress tests when the harness kills the server inside the window in
which `04492_attach_as_replicated_clears_tmp_txn_version` keeps a raw
`txn_version.txt.tmp` on a part, e.g.
https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=106189&sha=73e731bf28d09bb59fa7e7921f58be9d812cf201&name_0=PR&name_1=Stress%20test%20%28arm_debug%29
on #106189, and the same
signature on at least three other PRs within the last 30 days.
Add `test_broken_tmp_txn_version_startup`: a transactional insert on a local
object storage disk, a raw overwrite of the `txn_version.txt.tmp` metadata
file, and a hard restart. Without the fix the server fails to load the table
with the exact `Cannot parse input` error from the report; with the fix it
starts, the committed part survives, and the leftover file is cleaned up.
Contributor
|
Workflow [PR], commit [a518f99] Summary: ✅
AI ReviewSummaryThis PR makes the diagnostic read of a leftover Final Verdict
|
…-tmp-txn-version-diagnostic
Contributor
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 18/22 (81.82%) · Uncovered code |
alexey-milovidov
deleted the
fix/tolerate-broken-tmp-txn-version-diagnostic
branch
July 17, 2026 22:18
This was referenced Jul 19, 2026
zeekay
pushed a commit
to hanzoai/datastore
that referenced
this pull request
Sep 11, 2026
…ken-tmp-txn-version-diagnostic Tolerate a broken txn_version.txt.tmp when loading a part
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A leftover
txn_version.txt.tmpon a part is an artifact of an interrupted write, so not only its content but even the disk-level metadata describing it can be broken. On an object storage disk with local metadata, a raw or partially written metadata file for it madegetFileSizethrowCANNOT_PARSE_INPUT_ASSERTION_FAILEDfromDiskObjectStorageMetadata::deserializeinsideVersionMetadataOnDisk::removeTmpMetadataFile, failing the part load, the table load, and with it the server startup (Cannot start clickhouse-server).The read there is purely diagnostic — the content is dumped to the log right before the file is removed, and
VersionMetadataOnDisk::loadMetadataalready documents the content as expendable ("Content of *.tmp file may be broken"). Make it best-effort: on failure, log the exception and proceed with the removal, which is already tolerant to such files (UnlinkFileOperationreads the disk-level metadata withtryReadMetadataFile).Seen in stress tests when the harness kills the server inside the window in which
04492_attach_as_replicated_clears_tmp_txn_versionkeeps a rawtxn_version.txt.tmpon a part: Stress test (arm_debug) report. The same signature hit at least three other PRs within the last 30 days (#107363, #86353, #108773 in addition to #106189). This is not CI-only: any server restart that encounters this on a real deployment hits the same startup failure, so this is a genuine bug fix rather than a CI-only change.Added
test_broken_tmp_txn_version_startup: a transactional insert on a local object storage disk, a raw overwrite of thetxn_version.txt.tmpmetadata file, and a hard restart. Without the fix the server fails to load the table with the exactCannot parse inputerror from the report; with the fix it starts, the committed part survives, and the leftover file is cleaned up.Related: #106189
Related: #108772
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed server startup failure for
MergeTreetables on object storage disks when a leftovertxn_version.txt.tmpfile has broken disk-level metadata.Documentation entry for user-facing changes
Version info
26.7.1.1120(included in26.7and later)