Skip to content

Fix data loss when a merge materializes a pending RENAME COLUMN - #115981

Merged
alexey-milovidov merged 15 commits into
masterfrom
groeneai/fix-111001-merge-materialized-rename-not-recorded
Sep 5, 2026
Merged

alexey-milovidov merged 15 commits into
masterfrom
groeneai/fix-111001-merge-materialized-rename-not-recorded

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Aug 23, 2026 •

Copy link
Copy Markdown
Member

Closes: #111001
Related: #109356
Related: #80648

A merge writes its result with the column names of the current metadata, so it materializes a pending ALTER TABLE ... RENAME COLUMN by itself. FutureMergedMutatedPart::assign takes the maximum data version of the source parts, so nothing records that it did: the rename mutation stays pending for the merged part. When it runs, AlterConversions resolves the new name back to the physical name the merge already replaced, the column reads as missing and is filled with defaults. A column with no default expression has nothing to refill from, so its values are lost for good.

This is a wrong-results bug in plain MergeTree, not flakiness. It surfaces as 03040_dynamic_type_alters_2_compact_merge_tree failing on master and on unrelated pull requests - 15 hits in the CI database over the last 30 days, two of them on master itself. Dynamic is not special; it just makes the loss unavoidable, since it cannot carry a default expression.

From the server log of the reported run (database test_u5o3o5i6h9c1):

23:27:56.861  Added mutation: mutation_6.txt              <- ALTER ... RENAME COLUMN d TO d1
23:27:56.870  Not enough idle threads to apply mutations  <- repeats for ~50 s
23:28:07.407  (MergerMutator): Merge #0 Regular, 5 parts all_1_1_0 .. all_5_5_0
23:28:10.362  Merged 5 parts -> all_1_5_1                 <- mutation version 0, so mutation 6 is still pending
23:28:47.243  tmp_mut_all_1_5_1_6 -> all_1_5_1_6          <- the rename is applied a second time, and the data is gone

It is not the mechanism fixed in #109356. That one dropped the column from the merged part through expired_columns; here the column is kept and the loss is in name binding on the second application.

The fix

Extend the merged part's mutation version through the contiguous run of pending mutations that consist only of metadata mutations, which are exactly the ones a merge materializes on its own. The merge above now produces all_1_5_1_6, and the rename mutation is no longer pending for it.

A part carries a single data version, so it cannot express a non-contiguous applied set. When a pending RENAME COLUMN sits past a mutation the merge leaves pending for the merged part, the merge is refused instead of losing the data, and it becomes possible again as soon as that earlier mutation has run.

Two ALTER queries do not reach that state: RENAME COLUMN is a barrier command, so alter waits out every already registered mutation before registering the rename, and a permanently failing earlier mutation does not open the window either, because checkMutationStatus then throws and the rename is never registered. What does reach it is a single ALTER that combines the rename with a metadata command the merge does not materialize, ALTER TABLE ... CLEAR COLUMN y, RENAME COLUMN d TO d1: both are metadata alters, so AlterCommands::getMutationCommands keeps them in one entry, and the barrier only makes alter wait for the mutations registered before it. A rename combined with an UPDATE does not - InterpreterAlterQuery splits those into two segments, and the rename segment still waits out the update - so for that shape only the race window between the wait and the registration remains.

The scope of a command is taken into account: a pending command scoped to another partition is never applied to the merged part - canSkipMutationCommandForPart skips it and the untouched part is cloned forward to the mutation version - so it does not refuse the merge, and the merged part records the whole entry. Only a command that has something left to do for that part does. Without this, an ALTER TABLE ... UPDATE ... IN PARTITION 1 pending behind a RENAME COLUMN would block every merge in the other partitions, including OPTIMIZE TABLE ... PARTITION 2 FINAL.

The scope of a command is read from both shapes the parser produces, IN PARTITION p and IN PARTITION p1, p2, ..., which are two different fields of the parsed command.

ReplicatedMergeTree is unaffected and unchanged: it records the table metadata version in each part, and ReplicatedMergeTreeQueue already excludes metadata mutations a part has already seen. This is the same model, applied to the engine that has no table-level metadata version.

Testing

New test 05037_rename_column_materialized_by_merge, which uses the mt_select_parts_to_mutate_no_free_threads failpoint to hold the rename mutation unselected while the merge runs. Without the fix it reproduces the CI signature exactly - the type census collapses to 9 None and every concrete value reads back as \N; with the fix it passes.

05044_clear_column_materialized_by_merge pins the complementary case: a pending CLEAR COLUMN must stay pending for the merged part. 05055_merge_past_multi_partition_update pins the partition scoping: a pending UPDATE ... IN PARTITION 1, 2 must not stop the scan for a merge in partition 3, so the merged part still records the DROP COLUMN behind it.

05076_merge_refused_before_pending_rename_column pins the refusal itself, which the three tests above never drive: a single ALTER TABLE ... CLEAR COLUMN y, RENAME COLUMN d TO d1 held unselected by the failpoint, and OPTIMIZE ... FINAL then has to fail with CANNOT_ASSIGN_OPTIMIZE and leave both source parts active. Once the entry has run, the same OPTIMIZE merges them and the values of the renamed Dynamic column are all there.

The three tests that assert a part name create their table with max_bytes_to_merge_at_max_space_in_pool = 1, so the name is the result of their own OPTIMIZE ... FINAL - which ignores that limit - and not of a background merge that wins the race and then gets rewritten by the OPTIMIZE, one level higher.

The test uses Compact parts on purpose: there the rename mutation rewrites the whole part through the reader, so a rename applied twice reads the column as missing. In a Wide part it only renames files, which is a no-op once the merge has already written the new name - which is why only the _2_compact variant has ever failed in CI.

CI report the fix was derived from: https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=9f19372141ea123d170d0afd41cf99d6d6631a15&name_0=MasterCI&name_1=Stateless%20tests%20%28amd_tsan%2C%20parallel%29

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

Fixed data loss in MergeTree when a merge runs while an ALTER TABLE ... RENAME COLUMN is still pending. The merge applied the rename but did not record it, so the mutation applied it a second time and read the renamed column as missing, filling it with defaults. Columns without a default expression, such as Dynamic, lost their values.


Workflow [PR]
Sync PR [sync-upstream/pr/115981]

Version info

  • Merged into: 26.9.1.749 (included in 26.9 and later)

…sion

A merge writes its result with the column names of the current metadata, so it
materializes a pending `ALTER TABLE ... RENAME COLUMN` by itself.
`FutureMergedMutatedPart::assign` takes the maximum data version of the source
parts, so nothing records that it did: the rename mutation stays pending for the
merged part. When it runs, `AlterConversions` resolves the new name back to the
physical name the merge already replaced, the column reads as missing and is
filled with defaults. A column with no default expression has nothing to refill
from, so its values are lost for good - reads return `NULL`, and for `Dynamic`
the type census collapses to `None`.

Extend the merged part's mutation version through the contiguous run of pending
mutations that consist only of metadata mutations, which are exactly the ones a
merge materializes on its own. A part carries a single data version, so it cannot
express a non-contiguous applied set; when a pending `RENAME COLUMN` sits past a
mutation the merge does not materialize, refuse the merge instead of losing the
data. That state is unreachable in practice, because `RENAME COLUMN` is a barrier
command and `alter` waits out every earlier mutation before registering it, and
`DROP COLUMN` - the other metadata mutation - is a no-op when re-applied to a part
that no longer has the column.

`ReplicatedMergeTree` is unaffected: it records the table metadata version in each
part, and `ReplicatedMergeTreeQueue` already excludes metadata mutations a part has
already seen.

The failure only shows on Compact parts, where the rename mutation rewrites the
whole part through the reader. In a Wide part it only renames files, which is a
no-op once the merge has already written the new name.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=9f19372141ea123d170d0afd41cf99d6d6631a15&name_0=MasterCI&name_1=Stateless%20tests%20%28amd_tsan%2C%20parallel%29

Co-Authored-By: Claude Fable 5 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [75a2b4c]

Summary: ✅


AI Review

Summary

This PR teaches plain MergeTree merges to record merge-materialized metadata mutations in the result part's data version and to refuse merges that would materialize a pending RENAME COLUMN non-contiguously. I reviewed the current code, the added stateless tests, and the full prior thread history; the earlier issues are addressed, and I did not find a remaining correctness bug in the current implementation.

Missing context / blind spots
  • ⚠️ The full CI build matrix was still pending at review time, so I could only use the completed Fast test and Style check results as supporting evidence.
Final Verdict

✅ No new findings from this review.

LLVM Coverage Report

Measured on commit 75a2b4c.

Metric Baseline Current Δ
Lines 88.70% 88.70% +0.00%
Functions 92.10% 92.10% +0.00%
Branches 81.10% 81.10% +0.00%

Changed lines: Changed C/C++ lines covered: 62/73 (84.93%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Aug 23, 2026
Comment thread src/Storages/StorageMergeTree.cpp Resolved
@clickhouse-gh

clickhouse-gh Bot commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 75a2b4c7a with master bb1a20e15 (stripped binary size, per-symbol sizes and ThinLTO time; object sizes against the warmup build of da918ab89; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Compile time of recompiled translation units

61 translation units recompiled, 674 s compile time in total, 61 of them have a recent master baseline.

Job report

alexey-milovidov and others added 2 commits August 25, 2026 22:16
…ding for a merged part

`isMaterializedByMerge` looked only at `MutationCommand::type`, so `CLEAR COLUMN` -
a `DROP_COLUMN` command with `clear` - and a command scoped to a single partition
counted as materialized by the merge, and the merged part's data version was extended
past them.

Neither is lost in practice: a pending `DROP_COLUMN` is reported by `AlterConversions`
as a dropped column regardless of `clear`, so the merge reads the column as missing and
writes defaults - it does materialize a clear, and the mutation re-applied later is a
no-op. Verified by holding the clear mutation unselected with the
`mt_select_parts_to_mutate_no_free_threads` failpoint: the merged part comes out as
`all_1_2_1_3` with the version extended and the values are cleared either way.

Still, a merged part should record only what the merge provably materialized for it,
and the equivalence above is too subtle to rely on - a partition-scoped command is not
even applied to the parts of the other partitions, while the data version is per part.
Exclude both, so the merge leaves those mutations pending.

New test `05044_clear_column_materialized_by_merge`, for a merge that runs while a
`CLEAR COLUMN` is still pending: the merged part keeps the mutation pending
(`all_1_2_1`), reads return the cleared values, and they stay cleared once the mutation
runs.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=115981&sha=24d02c6d25c3b4427eab9471277f27d84d47f51c&name_0=PR&name_1=Integration%20tests%20%28amd_tsan%2C%202%2F6%29 (test_refreshable_mv/test.py::test_refreshable_mv_in_replicated_db) and provide a fix in a separate PR. If the fix is already in progress, link it here.

It is unrelated to this pull request: the failure is DATABASE_REPLICATION_FAILED while enqueueing drop table if exists re.g through DatabaseReplicatedDDLWorker::tryEnqueueAndExecuteEntry under TSan, while this change only affects the mutation version a plain MergeTree merge records. The test has been flaky before (#92642, #92862, #79121, all closed), but this is its only hit in the CI database over the last 30 days, so there is no open issue to point at.

@groeneai

Copy link
Copy Markdown
Collaborator

Root cause: the Keeper cluster lost quorum for about 20 seconds, node1's Keeper session expired one second before the failing statement, and the test does not retry an error that is explicitly documented as retryable.

Timeline from the job's logs.tar.gz:

  • 09:07:11 to 09:07:13 Raft leader election, term 1 to term 2 (zoo1 starts a pre-vote, zoo3 wins).
  • zoo2 then stalls on node1's session: Receiving request for session 5 took 28927 ms.
  • 09:07:38.179 zoo2: Session #5 expired because server shutting down or quorum is not alive. node1 re-registers as session 9 at 09:07:34 and session 10 at 09:07:43, so it is thrashing through reconnects across the whole window.
  • 09:07:39 the test runs drop table if exists re.g on node1 (172.16.3.11). The wait predicate in DatabaseReplicatedDDLWorker::tryEnqueueAndExecuteEntry sees zookeeper->expired() and throws Code 571 (src/Databases/DatabaseReplicatedWorker.cpp:486-489).

node1's own log for that minute is already rotated out of the artifact (oldest surviving line is 09:09:15), but node2 hit the identical throw at 09:07:25 with its log intact, and that occurrence is the informative one:

09:07:25.017996 DDLWorker(re): Not enqueueing query: ZooKeeper session expired
09:07:25.018269 EphemeralNodeHolder: Cannot remove /test/re_0/log/query-0000000228/try since session has been expired
09:07:25.019011 DDLWorker(re): Will not execute task query-0000000228: Entry query-0000000228 hasn't been committed

Two things follow. The uncommitted entry is cleanly skipped by the other replica, so a retry cannot double-execute. And the refresh machinery that hit the same error did retry: the next attempt is logged as comment: refresh of re.g (attempt 2/3) and it succeeded. So Code 571 with "try again" behaves as designed, and the gap is only on the caller side.

The test calls nodes[randint(0, 1)].query("drop table if exists re.g") bare at test_refreshable_mv/test.py:238 (and again at :242), inside a loop whose stated purpose is to race the drop against a refresh. The same file already uses query_with_retry or assert_eq_with_retry in 21 places.

I agree it is unrelated to your change. Confirming your CIDB reading: 1 hit in 30 days. Over 90 days the test failed 39 times across 8 pull requests and 0 times on master, but at other statements and mostly with TIMEOUT_EXCEEDED; this Code 571 at :238 is the only occurrence of this shape.

No fix is in progress. I will open a separate PR making the drops in that stress loop tolerate the retryable Code 571, and link it here. If you would rather have tryEnqueueAndExecuteEntry re-acquire a session and retry internally instead of pushing the retry to the caller, tell me and I will do that instead.

@groeneai

Copy link
Copy Markdown
Collaborator

Following up on my analysis above. I have a root cause, but I am not opening a PR yet, because every fix I can build lands in a place only you can choose between. Details below, then three options and my recommendation.

The window is narrower than I first described. tryEnqueueAndExecuteEntry captures the Keeper handle at DatabaseReplicatedWorker.cpp:456 via getZooKeeperFromContext, and Context::getZooKeeper replaces an already-expired session before that (Context.cpp:5936-5947, startNewSession). So the session must be live at capture and expire while the thread waits on wait_current_task_change at :481; the predicate at :486-489 then throws. A session that is already dead when the statement starts does not reach it.

The failure is not specific to the drop I pointed at. The predicate is if (zookeeper->expired() || stop_flag), with no refresh term, so it does not depend on the stress loop at all. test_refreshable_mv_in_replicated_db issues 36 statements against the Replicated database, and the cleanup fixture adds drop database if exists re sync at :69. All are equally exposed, so patching the two inside the loop would be arbitrary. Fleet-wide the same throw hit 25 distinct tests in 180 days.

Code 571 is overloaded, which rules out the obvious retry predicate. Three sites throw DATABASE_REPLICATION_FAILED, and two are reachable from the same drop table:

site message retryable
DatabaseReplicatedWorker.cpp:489 ZooKeeper session expired or replication stopped, try again yes
DatabaseReplicated.cpp:1471 Database is not initialized or is being dropped no
DatabaseReplicated.cpp:1664 Too many tables to recreate no

Anything keyed on the error code would also retry "Database is not initialized or is being dropped", masking a real teardown bug. Today the only sound discriminator is the message substring try again, unique to :489 in src/Databases.

The options, and why I am not picking:

  1. Client-side. ClientBase::processOrdinaryQuery already has int retries_left = 10 (ClientBase.cpp:1764) whose catch block is commented "Retry when the server said 'Client should retry'" (:1827); it fires only on DEADLOCK_AVOIDED. Every test shells out to clickhouse-client, so this fixes all 25 tests at once, including 04077_database_replicated_alias_alter.sql, where a .sql file cannot express a retry. It needs a retryable/non-retryable marker for 571, which does not exist yet.
  2. Server-side. Retry inside tryEnqueueAndExecuteEntry. Not a local guard: entry_path and try_node were created against the dead session (:465-466), so it must re-acquire a session and re-enqueue a new entry, and the wait runs under std::unique_lock lock{mutex}. I also note DatabaseReplicatedDDLWorker::enqueueQuery takes const ZooKeeperRetriesInfo & unnamed and ignores it (:338-342) while DDLWorker::enqueueQuery honours it (DDLWorker.cpp:1151-1173); if that asymmetry is deliberate, option 2 is off the table.
  3. Nothing. 38 occurrences in 180 days across 25 tests, 0 on master, 97 percent inside 2026-04-04 to 04-16, one since June (this one).

Retrying is safe in all cases: the entry is created with an ephemeral /try child and a peer refuses an uncommitted entry (Will not execute task ...: Entry ... hasn't been committed), which I saw on node2 in this same run.

My recommendation is option 1 if you want it fixed, since it is the only one that covers the stateless tests, and option 3 otherwise. I would rather not add a per-test Python retry: it re-implements the client loop one test at a time, and a blanket query_with_retry would swallow the DROP-versus-refresh races that loop exists to catch. Tell me which you prefer and I will open that PR.

The test passed even if the merge wrongly recorded the pending `CLEAR COLUMN`
as materialized, because the merge zeroes the column either way. Pin the active
part name and data version before releasing the failpoint: with the fix the
merged part is `all_1_2_1` with data version 1, while the broken classification
produces `all_1_2_1_3` (measured on a counterfactual build).

Co-Authored-By: Claude Fable 5 <[email protected]>
Comment thread src/Storages/StorageMergeTree.cpp Resolved
…use a merge

`isMaterializedByMerge` rejected every command it did not recognise as a
metadata mutation, whatever partition the command was scoped to. A pending
`ALTER TABLE ... UPDATE ... IN PARTITION 1` leaves nothing pending for a part of
partition 2 - `MutateTask` skips it through `canSkipMutationCommandForPart` and
clones the untouched part forward to the mutation version - but it stopped the
scan all the same, so `getMutationVersionForMergedPart` refused every merge in
the other partitions as soon as a `RENAME COLUMN` was pending behind it,
including `OPTIMIZE TABLE ... PARTITION 2 FINAL`.

Compare the partition of the command against the partition of the result part
before looking at the kind of the command, and treat a command scoped elsewhere
as irrelevant for that part. A command scoped to the partition being merged is
still left pending.

The `alter->partition` check this replaces was in fact unreachable: only
`RENAME_COLUMN` and `DROP_COLUMN` get past `AlterConversions::isSupportedMetadataMutation`,
`RENAME COLUMN` has no `IN PARTITION` form, and the only partition-scoped
`DROP_COLUMN` is `CLEAR COLUMN`, which the `clear` check above already rejects.
An `UPDATE` never reached it.

The scan now reparses the AST of every command and evaluates partition
expressions, so `getMutationVersionForMergedPart` first checks that a metadata
mutation is pending at all - the case the whole function exists for - and returns
immediately otherwise. That is the path every merge of every table takes.

Also corrected the claim that the refusal is unreachable: two `ALTER` queries
cannot reach it, because `RENAME COLUMN` is a barrier command and `alter` waits
out every earlier mutation before registering the rename, but a single `ALTER`
that combines a rename with an `UPDATE` puts both commands into one entry, and a
merge does not materialize that entry.
Comment thread src/Storages/StorageMergeTree.cpp Resolved
…adata mutation past a pending one

A merge materializes every pending `RENAME COLUMN` and `DROP COLUMN` (including its
`CLEAR COLUMN` form) by itself, through `AlterConversions`. The merged part carries a single
data version, so once an earlier mutation is left pending the merge cannot record them - and
that earlier mutation reads the column the merge already renamed or cleared. Refuse such a
merge for `DROP COLUMN` as well, not only for `RENAME COLUMN`.
Verified on a running server: the reported loss around `CLEAR COLUMN` is not caused by the
merge. `ALTER TABLE t UPDATE z = y + 100 WHERE 1, CLEAR COLUMN y` is rejected outright by
`checkDropOrRenameCommandDoesntAffectInProgressMutations`, and in the variants that are
accepted (`MATERIALIZE COLUMN z` with `z` defaulting to `y + 100`, followed by
`CLEAR COLUMN y`) the earlier mutation reads the cleared values through `AlterConversions`
even when no merge happens at all. Refusing the merge does not prevent it, so keep the barrier
narrow: `DROP COLUMN` is idempotent, and re-applying it to the merged part is a no-op.
…mutation scan

A mutation command can carry its partition scope in either `ASTAlterCommand::partition`
(`IN PARTITION p`) or `ASTAlterCommand::partitions` (`IN PARTITION p1, p2, ...`).
`canSkipMutationCommandForPart` honours both, so both leave nothing pending for a part
outside the scope, but `isMaterializedByMerge` only looked at the first one. A pending
`UPDATE ... IN PARTITION 1, 2` therefore stopped the scan for a merge in partition 3,
so the merged part did not record the metadata mutations behind it - and a pending
`RENAME COLUMN` behind it refused the merge outright.

Extracted the scope test into `getPartitionScope` covering both shapes.
Comment thread src/Storages/StorageMergeTree.cpp Resolved

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

LGTM

@alexey-milovidov alexey-milovidov self-assigned this Sep 3, 2026
…-merge-materialized-rename-not-recorded

# Conflicts:
#	src/Storages/StorageMergeTree.h
@clickhouse-gh clickhouse-gh Bot added the comp-mutations ALTER UPDATE/DELETE and mutation execution over parts (including lightweight updates/deletes). label Sep 4, 2026
…COLUMN`

The refusal in `getMutationVersionForMergedPart` had no test of its own. None of
`05037`, `05044` or `05055` produces a pending mutation entry that a merge does
not materialize with a `RENAME COLUMN` behind it, so a regression there would
let a merge materialize the rename without recording it, and no test would fail.

The reachable shape is a single `ALTER TABLE ... CLEAR COLUMN y, RENAME COLUMN d
TO d1`: both are metadata alters, so `AlterCommands::getMutationCommands` keeps
them in one entry, and `RENAME COLUMN` being a barrier command only makes
`alter` wait for the mutations registered before it. New test
`05076_merge_refused_before_pending_rename_column` holds that entry unselected
with the `mt_select_parts_to_mutate_no_free_threads` failpoint, asserts the
entry shape - one `mutation_id`, one `CLEAR COLUMN` and one `RENAME COLUMN` -
and then that `OPTIMIZE ... FINAL` fails with `CANNOT_ASSIGN_OPTIMIZE` while
both source parts stay active. Once the entry has run, the same `OPTIMIZE`
merges them and the values of the renamed `Dynamic` column are all there.

The other shape suggested in review, `MATERIALIZE COLUMN x, RENAME COLUMN d TO
d1`, does not reach it: `MATERIALIZE COLUMN` is not an `AlterCommand`, only
`MutationCommand::parse` accepts it, so `InterpreterAlterQuery` puts it in a
segment of its own that registers first and the barrier rename then waits for
it. Verified on a running server: with mutation selection blocked, only
`(MATERIALIZE COLUMN m)` is registered and the `ALTER` never returns.
`05044` and `05055` assert the name of the part that their `OPTIMIZE ... FINAL`
produces, which is what distinguishes a recorded mutation version from a
pending one. A background merge that wins the race produces the same name, but
then `OPTIMIZE ... FINAL` rewrites the single result part and its level goes up
by one, so the assertion would read `all_1_2_2` or `3_3_4_2_6` instead. Create
those tables with `max_bytes_to_merge_at_max_space_in_pool = 1`, which stops
background merges while `OPTIMIZE ... FINAL` ignores the limit, as the new
`05076` does. The references are unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-mutations ALTER UPDATE/DELETE and mutation execution over parts (including lightweight updates/deletes). 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.

Flaky test 03040_dynamic_type_alters_2: values read back as NULL after ALTER

3 participants