Skip to content

Fix LOGICAL_ERROR in TemporaryParts::add during mutation checksum mismatch fallback#96376

Merged
alexey-milovidov merged 1 commit intomasterfrom
fix-mutate-task-temporary-parts-crash
Feb 8, 2026
Merged

Fix LOGICAL_ERROR in TemporaryParts::add during mutation checksum mismatch fallback#96376
alexey-milovidov merged 1 commit intomasterfrom
fix-mutate-task-temporary-parts-crash

Conversation

@alexey-milovidov
Copy link
Copy Markdown
Member

@alexey-milovidov alexey-milovidov commented Feb 8, 2026

When a mutation produces a part that is not byte-identical to another replica, MutateFromLogEntryTask::finalize falls back to fetching the part. If the mutation did not touch any rows, MutateTask clones the source part using cloneAndLoadDataPart with the tmp_clone_ prefix, which registers the temporary part name in TemporaryParts. The fallback fetch in fetchPart also tries to clone with the same tmp_clone_ prefix, hitting TemporaryParts::add with a duplicate name and causing a LOGICAL_ERROR exception that aborts the server.

The fix resets mutate_task before checkPartChecksumsAndCommit, releasing the RAII guard for the temporary directory. This mirrors the existing pattern in MergeFromLogEntryTask::finalize, which already resets merge_task at the same point for the same reason.

https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=96319&sha=6758cc8debe3136c3c71c9cc044d00daa0042a43&name_0=PR&name_1=Stateless%20tests%20%28amd_binary%2C%20old%20analyzer%2C%20s3%20storage%2C%20DatabaseReplicated%2C%20sequential%29

Closes #86050.

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

…ismatch fallback

When a mutation produces a part that is not byte-identical to another
replica, `MutateFromLogEntryTask::finalize` falls back to fetching the
part. If the mutation did not touch any rows, `MutateTask` clones the
source part using `cloneAndLoadDataPart` with the `tmp_clone_` prefix,
which registers the temporary part name in `TemporaryParts`. The fallback
fetch in `fetchPart` also tries to clone with the same `tmp_clone_`
prefix, hitting `TemporaryParts::add` with a duplicate name and causing
a `LOGICAL_ERROR` exception that aborts the server.

The fix resets `mutate_task` before `checkPartChecksumsAndCommit`, releasing
the RAII guard for the temporary directory. This mirrors the existing
pattern in `MergeFromLogEntryTask::finalize`, which already resets
`merge_task` at the same point for the same reason.

https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=96319&sha=6758cc8debe3136c3c71c9cc044d00daa0042a43&name_0=PR&name_1=Stateless%20tests%20%28amd_binary%2C%20old%20analyzer%2C%20s3%20storage%2C%20DatabaseReplicated%2C%20sequential%29

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@clickhouse-gh
Copy link
Copy Markdown
Contributor

clickhouse-gh bot commented Feb 8, 2026

Workflow [PR], commit [0b782cb]

Summary:

@clickhouse-gh clickhouse-gh bot added the pr-ci label Feb 8, 2026
@alexey-milovidov alexey-milovidov self-assigned this Feb 8, 2026
@alexey-milovidov alexey-milovidov merged commit a404f1b into master Feb 8, 2026
133 of 134 checks passed
@alexey-milovidov alexey-milovidov deleted the fix-mutate-task-temporary-parts-crash branch February 8, 2026 10:33
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label Feb 8, 2026
@alesapin
Copy link
Copy Markdown
Member

Fix is correct, but need followup #99613.

@alesapin alesapin added the post-approved Approved, but after the PR is merged. label Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

post-approved Approved, but after the PR is merged. pr-ci pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Logical error: 'Temporary part tmp_clone_all_64_64_0_70 already added'

3 participants