Skip to content

Fix server crash when dropping a patch part after schema change#99036

Merged
CurtizJ merged 2 commits into
ClickHouse:masterfrom
fastio:bugfix-98484
Mar 17, 2026
Merged

Fix server crash when dropping a patch part after schema change#99036
CurtizJ merged 2 commits into
ClickHouse:masterfrom
fastio:bugfix-98484

Conversation

@fastio
Copy link
Copy Markdown
Contributor

@fastio fastio commented Mar 9, 2026

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Fix server crash (std::terminate) when executing ALTER TABLE ... DROP PART on a patch part after a schema change (e.g. ADD COLUMN). The crash was caused by missing system columns (_part) in the empty
coverage part metadata, leading to an uncaught exception inside a NOEXCEPT_SCOPE.

Fixes #98484

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

No documentation changes needed. This is a bug fix for server crash when dropping patch parts.


Note

Medium Risk
Touches MergeTree patch-part metadata/key construction, which can affect part partitioning and operations if the injected columns list is incorrect; change is small and covered by a regression test.

Overview
Fixes a crash when dropping patch parts after a schema change by making getPatchPartMetadata(ColumnsDescription, ...) always inject required patch-part system columns (e.g. _part) before building the partition/sorting keys.

Adds a stateless regression test that creates patch parts via lightweight delete, alters the table schema, then DROP PART on a patch part and verifies the server stays alive.

Written by Cursor Bugbot for commit 8826d16. This will update automatically on new commits. Configure here.

@alesapin alesapin added can be tested Allows running workflows for external contributors labels Mar 9, 2026
@clickhouse-gh
Copy link
Copy Markdown
Contributor

clickhouse-gh Bot commented Mar 9, 2026

Workflow [PR], commit [8826d16]

Summary:

job_name test_name status info comment
Stateless tests (arm_asan, targeted) error IGNORED

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Mar 9, 2026
@CurtizJ CurtizJ self-assigned this Mar 9, 2026
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Comment thread tests/queries/0_stateless/04023_issue_98484_drop_patch_part.sh
@clickhouse-gh
Copy link
Copy Markdown
Contributor

clickhouse-gh Bot commented Mar 11, 2026

LLVM Coverage Report

Metric Baseline Current Δ
Lines 83.80% 83.80% +0.00%
Functions 23.80% 23.80% +0.00%
Branches 76.40% 76.40% +0.00%

PR changed lines: PR changed-lines coverage: 100.00% (7/7)
Diff coverage report
Uncovered code

@CurtizJ CurtizJ added this pull request to the merge queue Mar 17, 2026
@CurtizJ CurtizJ added pr-must-backport Pull request should be backported intentionally. Use this label with great care! v25.12-must-backport labels Mar 17, 2026
Merged via the queue into ClickHouse:master with commit 08bd681 Mar 17, 2026
161 of 163 checks passed
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR label Mar 17, 2026
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Mar 17, 2026
robot-clickhouse added a commit that referenced this pull request Mar 17, 2026
robot-clickhouse added a commit that referenced this pull request Mar 17, 2026
robot-clickhouse added a commit that referenced this pull request Mar 17, 2026
robot-clickhouse added a commit that referenced this pull request Mar 17, 2026
@robot-clickhouse robot-clickhouse added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Mar 17, 2026
clickhouse-gh Bot added a commit that referenced this pull request Mar 18, 2026
Backport #99036 to 25.8:  Fix server crash when dropping a patch part after schema change
clickhouse-gh Bot added a commit that referenced this pull request Mar 18, 2026
Backport #99036 to 25.12:  Fix server crash when dropping a patch part after schema change
clickhouse-gh Bot added a commit that referenced this pull request Mar 18, 2026
Backport #99036 to 26.1:  Fix server crash when dropping a patch part after schema change
clickhouse-gh Bot added a commit that referenced this pull request Mar 18, 2026
Backport #99036 to 26.2:  Fix server crash when dropping a patch part after schema change
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-bugfix Pull request with bugfix, not backported by default pr-must-backport Pull request should be backported intentionally. Use this label with great care! pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR pr-synced-to-cloud The PR is synced to the cloud repo v25.12-must-backport

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fatal error: Unknown identifier while committing part

6 participants