Skip to content

Backport #117034 to 26.7: Keep Distributed spool files after transient split errors - #118140

Merged
clickhouse-gh[bot] merged 5 commits into
26.7from
backport/26.7/117034
Sep 5, 2026
Merged

clickhouse-gh[bot] merged 5 commits into
26.7from
backport/26.7/117034

Conversation

@robot-clickhouse

@robot-clickhouse robot-clickhouse commented Sep 4, 2026 •

Copy link
Copy Markdown
Member

Original pull-request #117034

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: 26.7.7.31

@robot-clickhouse robot-clickhouse added pr-backport Changes, backported to release branch. Do not use manually - automated use only! pr-critical-bugfix labels Sep 4, 2026
@clickhouse-gh

clickhouse-gh Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [BackportPR], commit [51abcf0]

Summary: ✅

alexey-milovidov and others added 2 commits September 5, 2026 01:47
On 26.7 the materialized view inner query is analyzed by the old analyzer,
which rejects a non-trivial `ARRAY JOIN` value without an alias with
`ALIAS_REQUIRED` ("No alias for non-trivial value in ARRAY JOIN"). The test
therefore never reached the intended `ARGUMENT_OUT_OF_BOUND` transient error
and failed on both integration shards. Adding `AS r` keeps the query valid
under both analyzers and restores the scenario the test exercises. Same fix
as on the 26.3 backport (#118138).

CI: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=118140&sha=fb2738e337fba925152ab28603a23fbb26c034a5&name_0=BackportPR&name_1=Integration%20tests%20%28amd_tsan%2C%201%2F6%29

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@zlareb1

zlareb1 commented Sep 5, 2026

Copy link
Copy Markdown
Member

Heads-up before merging: this backport also carries the regression tracked in #118153 — after #117034, DistributedAsyncInsertBatch::recoverBatch treats every file listed in current_batch.txt before a broken/ twin as already sent and deletes it, so a batch file that was never acknowledged by the remote shard is silently removed on recovery (repro matrix and pre-fix/post-fix comparison in #118153). The same combination already went out in #118141 to 26.8.

Suggest either waiting for the #118153 fix and backporting both together, or noting the known regression in the release notes for this branch.

`DistributedAsyncInsertBatch::recoverBatch` treated a twin in the `broken/`
directory as proof that every file listed before it in `current_batch.txt`
had been acknowledged, and finalized them with `markAsSend`. That inference
only holds for servers with ordered split retries. The previous
`sendSeparateFiles` skipped a file after a transient error and continued with
the next one, so a server being upgraded can leave an unsent file in front of
a quarantined one. Recovery then deleted rows that never reached any shard.

Keep such files and let the normal queue resend them: the missing quarantined
member already makes `recoverBatch` return `false`, and the surviving files
are processed from `pending_files`. Duplicates are possible, data loss is not.

The recovery test now models the pre-upgrade state and asserts that the
unsent predecessor is delivered.

Closes: #118153
(cherry picked from commit b4f8ebf)
@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 Confirmed, and thank you for the heads-up. The 26.7 base still has the old sendSeparateFiles, which skips a file after a transient error and continues with the next one, so {1.bin unsent, broken/2.bin, current_batch.txt = 1 2} is a reachable pre-upgrade state, and the backported recoverBatch would have deleted 1.bin.

Following the "backport both together" suggestion, this PR now carries the fix as an extra commit (6c07cae, the same change as on the 26.3 backport #118138): the broken-twin inference is removed from recoverBatch, a still existing predecessor is never finalized and is resent through the normal queue, and the recovery test now models the pre-upgrade state and asserts that the unsent file is delivered. Duplicates are possible in that edge case, data loss is not. The same change is proposed for master in #118211 (labelled pr-must-backport, so 26.8 and 26.6 get it too).

@clickhouse-gh
clickhouse-gh Bot merged commit 5ec22ff into 26.7 Sep 5, 2026
38 of 39 checks passed
@clickhouse-gh
clickhouse-gh Bot deleted the backport/26.7/117034 branch September 5, 2026 16:50
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.

3 participants