Skip to content

Fix MutateTask nullptr deref on column dropped by concurrent ALTER - #105917

Merged
PedroTadim merged 8 commits into
ClickHouse:masterfrom
groeneai:groeneai/fix-105912-mutate-task-statistics-nullptr
Jun 9, 2026
Merged

PedroTadim merged 8 commits into
ClickHouse:masterfrom
groeneai:groeneai/fix-105912-mutate-task-statistics-nullptr

Conversation

@groeneai

@groeneai groeneai commented May 27, 2026 •

Copy link
Copy Markdown
Collaborator

Fix the SIGSEGV in MutateTask.cpp::canSkipConversionToNullable that PedroTadim reported in #105912.

Root cause

metadata_snapshot->getColumns().tryGet(command.column_name) can return nullptr when the column was concurrently removed from the metadata snapshot the mutation task ended up using. The next line column_desc->statistics.empty() then dereferences nullptr at offset 0x90 (the statistics field in ColumnDescription), matching the observed SIGSEGV signature on Stress test (amd_tsan) (CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=105550&sha=5db5c66a4c135950ddd8ac21fe895a693ae75bec&name_0=PR&name_1=Stress%20test%20%28amd_tsan%29).

The race window: selectPartsToMutate picks a READ_COLUMN mutation (e.g. MODIFY y Nullable(...)) for execution, the currently_processing_in_background_mutex is released, an ALTER DROP COLUMN y slips through with parts_to_do == 0 (the prior mutation is invisible to checkDropOrRenameCommandDoesntAffectInProgressMutations), and then MutatePlainMergeTreeTask takes a fresh getInMemoryMetadataPtr() at StorageMergeTree.cpp:1808 that no longer contains y. The queued command still references y, so canSkipConversionToNullable hits the unguarded tryGet.

Fix

Guard the dereference with the same !column_desc || pattern already used at the sibling READ_COLUMN site at MutateTask.cpp:1173-1174. When column_desc is nullptr we return false so the optimization is skipped and the normal mutation path surfaces the error cleanly.

Audit

Audited all metadata_snapshot->getColumns().tryGet( callsites in MutateTask.cpp:

  • Line 1173 (READ_COLUMN stats-rename in collectColumnsForMutation) — already guarded.
  • Line 2599 (canSkipConversionToNullable) — NOW guarded by this fix.

The sibling canSkipConversionToVariant uses part->tryGetColumn (not metadata) and is already guarded at the early-return. The remaining getColumn call at line 430 uses the throwing overload, so it cannot null-deref.

Test

tests/queries/0_stateless/04295_105912_modify_column_to_nullable_with_statistics.sql covers the non-race path through canSkipConversionToNullable with STATISTICS(tdigest) and ALTER MODIFY COLUMN y Nullable(UInt8). Verified 10/10 with --test-runs 10 and no regression in the surrounding 02864_statistics_* suite (22/22). The race itself is not deterministically reproducible from a stateless test because checkDropOrRenameCommandDoesntAffectInProgressMutations blocks the normal sequential path; it surfaces under the concurrent stress (TSan + ZK fault injection) PedroTadim observed.

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 a SIGSEGV in ALTER TABLE ... MODIFY COLUMN ... Nullable(...) on MergeTree tables when a column with STATISTICS is concurrently dropped by another ALTER. Closes #105912.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Version info

  • Merged into: 26.6.1.542

`canSkipConversionToNullable` in `src/Storages/MergeTree/MutateTask.cpp`
calls `metadata_snapshot->getColumns().tryGet(command.column_name)` and
then dereferences the result without a null check. `tryGet` returns
`nullptr` when the column is missing from the metadata snapshot used by
the mutation task, which can happen under concurrent `ALTER DROP COLUMN`
in stress tests (see Issue ClickHouse#105912 from PedroTadim). The deref hits
address `0x90` (the offset of the `statistics` field in
`ColumnDescription`), matching the observed SIGSEGV signature.

Guard with the same `!column_desc || ...` pattern already used at the
sibling `READ_COLUMN` site (line 1173-1174) of the same file. When
`column_desc` is null, return `false` so this optimization is skipped
and the normal mutation path surfaces the error.

The new stateless regression test exercises the path through
`canSkipConversionToNullable` with `STATISTICS(tdigest)` and an
`ALTER MODIFY COLUMN ... Nullable(T)`, ensuring the function works in
the common case where statistics are present. The race itself was
observed in `Stress test (amd_tsan)` on PR ClickHouse#105550 and is not directly
reproducible from a stateless test because the in-tree safety check
`checkDropOrRenameCommandDoesntAffectInProgressMutations` blocks the
non-concurrent path.

Closes ClickHouse#105912
@groeneai

Copy link
Copy Markdown
Collaborator Author

Pre-PR validation gate (session cron:clickhouse-ci-task-worker:20260527-091500):

a) Deterministic repro? Partial. The root cause is fully understood from @PedroTadim's analysis on #105912 (the deref at offset 0x90 matches the ColumnDescription::statistics field exactly, and tryGet is documented to return nullptr for missing columns). The exact concurrent race is not deterministically reproducible from a stateless test because checkDropOrRenameCommandDoesntAffectInProgressMutations (MergeTreeData.cpp:10089) blocks the normal sequential path; it surfaces under stress (TSan + ZK fault injection) when the window between selectPartsToMutate releasing currently_processing_in_background_mutex and MutatePlainMergeTreeTask taking a fresh getInMemoryMetadataPtr() is widened, plus parts_to_do == 0 makes the prior mutation invisible to the safety check.

b) Root cause explained? Yes. selectPartsToMutate picks a READ_COLUMN mutation, releases the mutex, an ALTER DROP COLUMN slips through, MutatePlainMergeTreeTask takes a fresh metadata snapshot that no longer contains the column, the queued command still targets it, tryGet returns nullptr, the next ->statistics dereference hits 0x90.

c) Fix matches root cause? Yes. The guard !column_desc || ... matches the established defensive pattern at MutateTask.cpp:1173-1174 (the sibling READ_COLUMN site in the same file). Returning false skips the optimization and lets the normal mutation path surface the error.

d) Test intent preserved? / New tests added? New 04295_105912_modify_column_to_nullable_with_statistics.sql exercises the path through canSkipConversionToNullable with STATISTICS(tdigest) + ALTER MODIFY COLUMN ... Nullable(...) in the non-race common case. No existing test was modified or weakened.

e) Both directions demonstrated? With fix: 10/10 with --test-runs 10, plus 22/22 with the full 02864_statistics_* suite. Without fix: not deterministically reproducible from this test (the safety check blocks the race) — but the bug is provably real: senior maintainer observed it in CI stress, the deref offset matches ColumnDescription::statistics, and the sibling site already has the same defensive guard.

f) Fix is general, not narrow patch? Audited all metadata_snapshot->getColumns().tryGet( call sites in MutateTask.cpp:

  • L1173 (READ_COLUMN stats-rename in collectColumnsForMutation): already guarded.
  • L2599 (canSkipConversionToNullable): NOW guarded by this PR.

Sibling canSkipConversionToVariant uses part->tryGetColumn (not metadata) and is already guarded by its early-return. The other getColumn call at L430 uses the throwing overload, so it cannot null-deref.

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @CurtizJ @alesapin could you review this? Null-guard for canSkipConversionToNullable in MutateTask.cpp (same defensive pattern as the sibling site at L1173). Closes #105912 per PedroTadim's analysis there.

@Algunenano Algunenano added the can be tested Allows running workflows for external contributors label May 27, 2026
@clickhouse-gh

clickhouse-gh Bot commented May 27, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [edce32c]

Summary: ✅


AI Review

Summary

This PR adds a focused null guard in canSkipConversionToNullable so a stale READ_COLUMN mutation command cannot dereference a missing ColumnDescription after a concurrent ALTER drops the column, and it adds a failpoint-backed stateless regression test for that path. I did not find a code correctness issue that needs an inline review comment.

PR Metadata
  • 💡 The selected category is probably too weak for the described failure. Since the PR fixes a null dereference/server-start failure, use Critical Bug Fix (crash, data loss, RBAC) rather than Bug Fix (user-visible misbehavior in an official stable release).
  • 💡 Move the issue reference out of the changelog entry and add it as a standalone relationship line: Closes: https://github.com/ClickHouse/ClickHouse/issues/105912.
  • Suggested changelog entry:

    Fixes a server startup failure in ALTER TABLE ... MODIFY COLUMN ... Nullable(...) on MergeTree tables when a column with STATISTICS is concurrently dropped by another ALTER.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label May 27, 2026
Adds 04296_105912_modify_column_to_nullable_concurrent_inserts.sh as a
companion to 04295. The .sql test exercises the deterministic
non-race path through `canSkipConversionToNullable`; this new .sh
test runs the same `MODIFY COLUMN ... Nullable(...)` with several
parallel client INSERTs while the mutation is in flight. The fix
in `MutateTask.cpp` guards `tryGet` against returning a `nullptr`
when metadata drifts under concurrent ALTERs; this test stresses the
realistic concurrent workload the maintainer asked about on the PR.

Test passes 30/30 locally; ~5s per run on debug build.

Follow-up to @PedroTadim review on PR ClickHouse#105917.
@PedroTadim

Copy link
Copy Markdown
Member

@groeneai check the comment and the CI failures

The first version of the concurrent-inserts companion test in commit
d54985b swallowed background `INSERT` errors via `2>/dev/null` and
asserted only `count() >= 1000`. That meant the seed `INSERT` alone would
satisfy the assertion even if every background `INSERT` failed, making
the concurrent coverage vacuous.

Drop the stderr redirection so any unexpected `INSERT` failure surfaces
and require strictly `count() > 1000` so the test passes only when at
least one background `INSERT` actually completed against the table
during/after the `ALTER MODIFY COLUMN`.

Verified locally with 30/30 runs against a debug build on the existing
fix branch.

For ClickHouse#105917
@PedroTadim

Copy link
Copy Markdown
Member

@groeneai the test 04296_105912_modify_column_to_nullable_concurrent_inserts failed, fix it

The background INSERTs in this test ran with both columns of
t_105912_conc explicit:

    INSERT INTO t_105912_conc SELECT x_value, y_value FROM ...

While the ALTER MODIFY COLUMN y Nullable(UInt8) is mid-flight, the
table's metadata snapshot can swap from UInt8 to Nullable(UInt8)
between when the SELECT block is built and when InsertDependenciesBuilder
::createPreSink calls StorageInMemoryMetadata::check. The check at
StorageInMemoryMetadata.cpp:856 does strict equals on each block column,
so an INSERT block carrying y: UInt8 against post-swap metadata
Nullable(UInt8) is rejected with TYPE_MISMATCH:

    Code: 53. DB::Exception: Type mismatch for column y. Column has
    type Nullable(UInt8), got type UInt8.

This was surfacing after c5cc758 (the fail-closed change that
removed 2>/dev/null on the background loop). The crash itself is a
test artifact, not the MutateTask code path the PR is exercising.

Drop y from the background INSERT column list. Only x (UInt32,
unchanged by the ALTER) goes on the wire, so the strict check has
no racing column to compare. Background INSERTs still create parts
concurrently with the in-flight mutation, which is the stress the
test is designed to apply.
@groeneai

groeneai commented Jun 1, 2026

Copy link
Copy Markdown
Collaborator Author

@PedroTadim addressed in caf79078ad0f.

Root cause: the background loop sent both columns explicitly. While ALTER MODIFY COLUMN y Nullable(UInt8) is in flight, the metadata snapshot swaps between when the INSERT block is built (column y typed UInt8) and when InsertDependenciesBuilder::createPreSink calls StorageInMemoryMetadata::check (line 856 does strict equals per block column, post-swap metadata is Nullable(UInt8)). Mismatched types throw TYPE_MISMATCH and the run reports a stderr failure. CIDB sightings on c5cc758 show that exact stack: amd_debug flaky, amd_asan_ubsan flaky, amd_msan flaky, amd_msan WasmEdge.

Fix: drop y from the background INSERT column list. Block now contains only x (UInt32, untouched by the ALTER), so the strict check has no racing column to compare. The concurrent-mutation stress is unchanged: 4 background loops keep creating new parts while mutations_sync = 2 walks the moving part set.

Verified on 26.6.1.1 debug build, 30 runs with randomization and 30 without, all pass. The fail-closed safeguards from c5cc758 are kept (no 2>/dev/null, count() > 1000 lower bound).

@PedroTadim

Copy link
Copy Markdown
Member

@groeneai tests failed again, check

@groeneai

groeneai commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator Author

@PedroTadim checked caf79078. The test that motivated the previous fix (04296) is now stable: 50/50 in amd_debug flaky, 50/50 in amd_asan_ubsan flaky, 50/50 in amd_msan flaky, 50/50 in amd_tsan flaky, plus 50/50 in arm_asan_ubsan targeted = 250/250 on this commit.

The three failed checks are unrelated to the MutateTask fix in this PR. Classification:

Check STID / signature Tracked PR-related?
AST fuzzer (arm_asan_ubsan) 3067-370b, UBSan signed-int overflow at src/Common/levenshteinDistance.h:105, 3 + 9223372036854775806 from fuzzed arrayLevenshtein arg P0 task open since 2026-04-28 (stid-3067) No. Trace is fully inside FunctionArrayLevenshtein. This PR only touches MutateTask.cpp.
Stress test (amd_msan) 3685-4830, Assertion 'px != 0' in QueryPlanResourceHolder::~QueryPlanResourceHolder via QueryPipelineBuilder::addResources from SELECT ... SETTINGS extremes=1, max_memory_usage='4Mi' P1 chronic, 39 hits across 32 PRs in 30d, 6 master hits (last 2026-05-30) No. Pure pipeline-builder / extremes-transform path.
Bugfix validation (functional tests) 04295 + 04296 marked FAIL since the first commit a5de734d983f on 2026-05-27 n/a, inherent to race fix The bug is gated by checkDropOrRenameCommandDoesntAffectInProgressMutations and the CI signature only fired when ZK fault injection let a prior mutation finish with parts_to_do == 0 past the guard. Neither regression test can deterministically reproduce that without stress + ZK fault injection, so the validation harness consistently reports FAIL for these two on every commit of this PR. The underlying fix in a5de734d983f is independently verified by the flaky checks above.

Nothing in caf79078 should be reverted or amended for these three failures. Happy to investigate the levenshtein or extremes paths under a separate PR if you would prefer that.

@PedroTadim PedroTadim self-assigned this Jun 3, 2026

@PedroTadim PedroTadim left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

@PedroTadim

Copy link
Copy Markdown
Member

@groeneai check the failed tests, a merge with master is needed.

@groeneai

groeneai commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator Author

@PedroTadim merged master in ec795ff83426 and triaged the three failing checks. None are caused by the MutateTask diff:

Check Failure Status
Stateless tests (amd_tsan, parallel, 1/2) 00096_obfuscator_save_load, 00175_obfuscator_schema_inference (Aborted under TSan) Chronic flaky on master and across 20+ unrelated PRs in the last 30 days (3 / 5 master hits respectively). Not introduced by this PR.
Unit tests (asan_ubsan) UBSan null-deref in boost::intrusive::list_node via DB::UntrackedMemoryRegistry::remove -> ~UntrackedMemoryCounter -> ~ThreadStatus Trunk-wide regression from PR #104690 (Add UntrackedMemory async metric, merged 2026-06-02 21:16Z). Reverted on master in PR #106365 (merged 2026-06-03 06:28Z). Our branch was forked at 06:50Z from a master snapshot that did NOT yet include the revert — hence the UBSan in this CI run. The master merge ec795ff83426 pulls in #106365 and removes src/Common/UntrackedMemoryRegistry.cpp entirely, so the UBSan should clear on the next run.
Bugfix validation (functional tests) 04295 / 04296 do not reproduce the race on fresh master Inherent to this PR. The race is gated by checkDropOrRenameCommandDoesntAffectInProgressMutations and ZK fault injection in stress; the regression tests cover the workload but the deterministic crash path lives in stress + TSan. The fix itself is independently validated by 250/250 passes in the flaky-check matrix on the prior commit.

CI re-running on ec795ff83426.

… hide

Per ClickHouse#105917 (comment),
bare `wait` reaps all children but returns 0 even when one of those subshells
exited non-zero, so a failed background `clickhouse-client` could pass through
without affecting the test outcome.

Capture each subshell PID and `wait $pid` per-PID so any non-zero exit
propagates and fails the script. Also add `|| exit 1` to the loop body so a
failing INSERT does not let the subshell silently complete after.

Verified locally on `groeneai/fix-105912-mutate-task-statistics-nullptr` debug
build:

- 15/15 normal-case runs pass.
- Inject-fail variant (force the first INSERT in subshell `i=1` to be a
  parse-error query): with the per-PID `wait` the script exits 1 with
  `background INSERT subshell failed` on stderr; with the prior bare `wait`
  the same inject-fail variant exits 0 and stdout still matches the
  reference, exactly the false-pass shape the bot warned about.
@groeneai

groeneai commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator Author

CI ledger for HEAD b19ce478bf5 (bot per-PID wait fix):

check test classification disposition
Bugfix validation (functional tests) 04295_105912_modify_column_to_nullable_with_statistics inherent framework-limit; the fix's race only repros under stress + ZK fault injection, regression test passes on master HEAD too. Same as prior runs and consistent with the LGTM.
Bugfix validation (functional tests) 04296_105912_modify_column_to_nullable_concurrent_inserts inherent same as above. Independent stress validation: 250/250 flaky-check pass on caf7907 / b19ce47.

CH Inc sync, Mergeable Check, PR are red only as mirrors of the Bugfix-validation row.

Bot per-PID-wait concern from discussion_r3359548595 addressed in b19ce478bf5. Both directions verified (inject-fail subshell now exits 1 on bare wait-only baseline, exits 0 on the per-PID variant).

@PedroTadim

Copy link
Copy Markdown
Member

@groeneai the broken Bugfix validation tests are related to this PR. They need to get fixed.

@PedroTadim

Copy link
Copy Markdown
Member

@groeneai can you fix the tests?

…ous 04296

The Bugfix-validation framework reported that 04295 and 04296 do not
reproduce the SIGSEGV in `canSkipConversionToNullable` against master:
the natural race needs ZooKeeper fault injection plus aggressive concurrent
ALTER chaos that no stateless test can stage.

Add a dedicated `mt_mutate_task_can_skip_conversion_to_nullable_force_null_column_desc`
failpoint that forces `metadata_snapshot->getColumns().tryGet(...)` to return
null inside `canSkipConversionToNullable`. Pre-fix, the next line dereferences
the null `ColumnDescription*` at offset 0x90 (the `statistics` field), exactly
the address pattern from the original CI sighting on PR ClickHouse#105550. With the
existing `!column_desc ||` guard the optimization is simply skipped and the
mutation falls through to the normal rewrite path.

Rewrite 04295 as a deterministic regression test that toggles the failpoint
around an `ALTER MODIFY COLUMN y Nullable(UInt8)` on a table with
`STATISTICS(tdigest)`. On master without the guard the mutation worker
crashes the server with SIGSEGV at address 0x90 and the test diffs against
the reference. On the PR with the guard the optimization returns false, the
mutation completes through the normal path, the column type becomes
`Nullable(UInt8)` and data is preserved.

Drop 04296 (concurrent inserts shape) which never reproduced the bug
deterministically and was the second source of Bugfix-validation false
positives. The deterministic 04295 covers the regression strictly better.

Verified locally: 10/10 passes with the fix; the broken version (null guard
removed) raises SIGSEGV with `Address: 0x90. Access: read. Address not
mapped to object.` exactly matching the original signature from
https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=105550&sha=5db5c66a4c135950ddd8ac21fe895a693ae75bec&name_0=PR&name_1=Stress%20test%20%28amd_tsan%29

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@groeneai

groeneai commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator Author

@PedroTadim addressed in edce32c9a65. Short version: the previous 04295/04296 could not actually fail on master pre-fix (the natural race needs ZK fault injection + concurrent ALTER chaos that a stateless test cannot stage), which is why Bugfix-validation kept reporting Failed to reproduce the bug.

The new commit adds a dedicated failpoint mt_mutate_task_can_skip_conversion_to_nullable_force_null_column_desc that forces metadata_snapshot->getColumns().tryGet(...) to return null inside canSkipConversionToNullable. Pre-fix, the next line dereferences the null ColumnDescription* at offset 0x90 (the statistics field). That is the exact address pattern from the original sighting on PR #105550. With the existing !column_desc || guard the optimization is skipped and the mutation falls through to the normal rewrite path.

04295 is rewritten to toggle the failpoint around an ALTER MODIFY COLUMN y Nullable(UInt8) on a table with STATISTICS(tdigest). 04296 is dropped because the concurrent-inserts shape never reproduced the bug deterministically.

Verified locally: 10/10 passes with the fix; the broken version (null guard removed) raises SIGSEGV with Address: 0x90. Access: read. Address not mapped to object. matching the original signature.

# Question Answer
a Deterministic repro? Yes. SYSTEM ENABLE FAILPOINT mt_mutate_task_can_skip_conversion_to_nullable_force_null_column_desc then ALTER TABLE t MODIFY COLUMN y Nullable(UInt8) reliably crashes the server pre-fix at offset 0x90.
b Root cause explained? canSkipConversionToNullable calls metadata_snapshot->getColumns().tryGet(command.column_name) which returns nullptr when the column has been concurrently dropped from the metadata snapshot the MutateTask ended up using. The next line dereferences the null pointer to read column_desc->statistics.
c Fix matches root cause? Yes. The `!column_desc
d Test intent preserved / new tests added? 04295 rewritten to use the failpoint and now actually fails on master pre-fix; 04296 dropped (vacuous coverage).
e Both directions demonstrated? Yes. 10/10 passes with the fix; broken-version run (null guard removed) crashes the server with Address: 0x90. Access: read. Address not mapped to object. exactly matching the original CI signature.
f Fix is general, not a narrow patch? Yes. The audit at line 1173 sibling site (READ_COLUMN stats-rename) already had the same `!column_desc

Session id: cron:clickhouse-ci-task-worker:20260608-090600

@clickhouse-gh

clickhouse-gh Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 84.60% 84.60% +0.00%
Functions 92.30% 92.30% +0.00%
Branches 77.20% 77.20% +0.00%

Changed lines: Changed C/C++ lines covered by tests: 12/12 (100.00%) | Lost baseline coverage: none · Uncovered code

Full report · Diff report

@groeneai

groeneai commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator Author

CI fully finished and GREEN on HEAD edce32c9a65.

CI Ledger — covered SHA: edce32c

  • All 147 checks pass; 19 skipped (build matrix variants not relevant to this PR).
  • Finish Workflow: pass. Mergeable Check: pass. PR: pass.
  • Bugfix validation (functional tests): PASS — the new failpoint-based regression test (mt_mutate_task_can_skip_conversion_to_nullable_force_null_column_desc) now deterministically reproduces the bug on master pre-fix and passes post-fix, satisfying the Bugfix-validation contract that PedroTadim flagged in the 5th and 6th rounds.
  • AST fuzzer (5 variants), BuzzHouse (4 variants), Stateless tests (full matrix), Integration tests (full matrix), Stress test, Upgrade check, Performance Comparison, ClickBench, SQLLogic, Compatibility, Install: all pass.
  • CIDB scan over the full HEAD: zero FAIL/ERROR rows.

Awaiting merge.

Session: cron:our-pr-ci-monitor:20260608-143000

@PedroTadim
PedroTadim added this pull request to the merge queue Jun 9, 2026
Merged via the queue into ClickHouse:master with commit 0a32eb5 Jun 9, 2026
166 checks passed
@robot-ch-test-poll1 robot-ch-test-poll1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jun 9, 2026
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Jul 12, 2026
When ALTER MODIFY COLUMN ... Nullable(T) reaches canSkipConversionToNullable
and the target column is present in the mutation commands but missing from the
metadata snapshot (metadata and commands drifted apart under concurrent
ALTERs), the metadata-only optimization is skipped and the part is fully
rewritten. Since ClickHouse#105917 this fail-open path is silent, so a real drift only
shows up as an unexplained full rewrite.

Add a MutateTaskMetadataDriftDetected profile event and a LOG_WARNING on that
branch so the drift is observable. No behavior change. Extend the existing
ClickHouse#105912 failpoint regression test to assert the event fires.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Jul 12, 2026
When ALTER MODIFY COLUMN ... Nullable(T) reaches canSkipConversionToNullable
and the target column is present in the mutation commands but missing from the
metadata snapshot (metadata and commands drifted apart under concurrent
ALTERs), the metadata-only optimization is skipped and the part is fully
rewritten. Since ClickHouse#105917 this fail-open path is silent, so a real drift only
shows up as an unexplained full rewrite.

Add a MutateTaskMetadataDriftDetected profile event and a LOG_WARNING on that
branch so the drift is observable. No behavior change. Extend the existing
ClickHouse#105912 failpoint regression test to assert the event fires.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
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-bugfix Pull request with bugfix, not backported by default 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.

Cannot start clickhouse-server

5 participants