Skip to content

Backport #111378 to 25.8: Fsync restored part files on RESTORE to survive power loss - #115088

Merged
PedroTadim merged 3 commits into
25.8from
backport/25.8/111378
Aug 18, 2026
Merged

PedroTadim merged 3 commits into
25.8from
backport/25.8/111378

Conversation

@robot-ch-test-poll2

@robot-ch-test-poll2 robot-ch-test-poll2 commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Original pull-request #111378

This pull-request is a last step of an automated backporting.
Treat it as a standard pull-request: look at the checks and resolve conflicts.
Merge it only if you intend to backport changes to the target branch, otherwise just close it.

The PR source

The PR is created in the CI job

Version info

  • Merged into: 25.8.31.7

@robot-ch-test-poll2 robot-ch-test-poll2 added pr-backport Changes, backported to release branch. Do not use manually - automated use only! pr-critical-bugfix labels Aug 17, 2026
@clickhouse-gh

clickhouse-gh Bot commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [BackportPR], commit [7aa8d32]

@groeneai

Copy link
Copy Markdown
Collaborator

The Stateless tests (amd_asan, distributed plan, parallel, 1/2) failure here is mine, and it is
not flaky. 04550_restore_fsync_after_insert.sh, which #111378 added, reads the files column of
system.parts. That column landed in 476e9fc in January, after 25.8 forked, so the test
throws UNKNOWN_IDENTIFIER and the empty shell variable then fails the {files:UInt64} binding.
The cherry-pick itself is fine: the script is byte-identical to master and the source fix works on
25.8 (this job printed encrypted incremental count: 1000). Only that one line is at fault, and
only the 25.8 backport is affected; #115089-#115092 are green.

I fixed it on master in #115117: the count now comes from the physical part-file measurement the
test already performs, which needs no version-specific column. I verified on the official 25.8
binary that the old test reproduces both errors and the new one runs to completion.

Regenerating this PR will not pick that up, since the backport tree is built from #111378's merge
commit. So the two options are to cherry-pick #115117's commit onto backport/25.8/111378, which
turns this PR green, or to merge as-is and let #115117 reach 25.8 later via v25.8-must-backport.
I do not push to release or robot branches, so this needs someone with write access.

@alexey-milovidov you merged #111378 and set its backport labels, so flagging it to you.

…e_fsync_after_insert

The test read the `files` column of `system.parts` to size the
encrypted-incremental-restore fsync assertion. That column was added by
476e9fc in January, after 25.8 forked, so the automated 25.8
backport of #111378 (#115088) fails at runtime with UNKNOWN_IDENTIFIER
even though the cherry-pick applied cleanly and the script is
byte-identical to master. The empty shell variable then also fails the
`{files:UInt64}` parameter binding.

The count the assertion wants is how many files RESTORE copies and must
therefore fsync. The test already measures exactly that for its first
table via `SELECT path FROM system.parts` plus `find`, so feed the
encrypted arm the same count and drop the column read. The two tables
have identical schema, data and part-layout settings, so their parts hold
the same file set; the physical count is also larger than the checksums
map (18 vs 14 on master), since it covers checksums.txt, columns.txt and
the zero-byte arr.bin, so the assertion gets stronger rather than weaker.

Validated on the official 25.8 binary: the old test reproduces both
errors, the new one runs to completion. On master the encrypted restore
performs 20 FileSync events against a required 18, the two arms' part
file lists are identical on both branches (18 files on master, 15 on
25.8), disabling fsync_after_insert still fails the test, and 50/50 runs
pass with randomized settings.

Related: #111378
Related: #115088

Co-Authored-By: Claude Fable 5 <[email protected]>
(cherry picked from commit fd8fc0c)
@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 Cherry-picked #115117 as dd18559. This removes the unavailable system.parts.files read from the 25.8 test and reuses its measured physical part-file count. The update is pushed; the new CI run will validate the affected stateless test.

pull Bot pushed a commit to SINHASantos/ClickHouse that referenced this pull request Aug 18, 2026
…e_fsync_after_insert

The test read the `files` column of `system.parts` to size the
encrypted-incremental-restore fsync assertion. That column was added by
476e9fc in January, after 25.8 forked, so the automated 25.8
backport of ClickHouse#111378 (ClickHouse#115088) fails at runtime with UNKNOWN_IDENTIFIER
even though the cherry-pick applied cleanly and the script is
byte-identical to master. The empty shell variable then also fails the
`{files:UInt64}` parameter binding.

The count the assertion wants is how many files RESTORE copies and must
therefore fsync. The test already measures exactly that for its first
table via `SELECT path FROM system.parts` plus `find`, so feed the
encrypted arm the same count and drop the column read. The two tables
have identical schema, data and part-layout settings, so their parts hold
the same file set; the physical count is also larger than the checksums
map (18 vs 14 on master), since it covers checksums.txt, columns.txt and
the zero-byte arr.bin, so the assertion gets stronger rather than weaker.

Validated on the official 25.8 binary: the old test reproduces both
errors, the new one runs to completion. On master the encrypted restore
performs 20 FileSync events against a required 18, the two arms' part
file lists are identical on both branches (18 files on master, 15 on
25.8), disabling fsync_after_insert still fails the test, and 50/50 runs
pass with randomized settings.

Related: ClickHouse#111378
Related: ClickHouse#115088

Co-Authored-By: Claude Fable 5 <[email protected]>
@PedroTadim
PedroTadim merged commit 3251360 into 25.8 Aug 18, 2026
33 checks passed
@PedroTadim
PedroTadim deleted the backport/25.8/111378 branch August 18, 2026 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-backport Changes, backported to release branch. Do not use manually - automated use only! pr-critical-bugfix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants