Repository navigation
Improve updating mutations - #87206
Merged
alexey-milovidov merged 2 commits intoOct 18, 2025
Merged
Conversation
k-morozov
marked this pull request as ready for review
September 25, 2025 10:27
alexey-milovidov
approved these changes
Oct 17, 2025
alexey-milovidov
left a comment
Member
There was a problem hiding this comment.
This is a good change.
Contributor
|
Workflow [PR], commit [167311d] Summary: ❌
|
This was referenced Aug 15, 2026
pull Bot
pushed a commit
to SINHASantos/ClickHouse
that referenced
this pull request
Aug 21, 2026
…ecated syntax
A table created with the deprecated positional syntax
(ENGINE = ReplicatedMergeTree(date, key, granularity) under
allow_deprecated_syntax_for_merge_tree) uses date-based V0 part names.
MergeTreePartInfo::getPartNameAndCheckFormat cannot produce such a name,
because getPartNameV0 needs the min/max DayNum that MergeTreePartInfo does
not carry, so it throws BAD_DATA_PART_NAME unconditionally.
Two ActiveDataPartSet entry points accept only a MergeTreePartInfo and must
therefore synthesize a name that way: tryAddPart and add(info, Strings *).
Each had exactly one production caller, and both callers already held the
part name and discarded it:
* ReplicatedMergeTreeQueue::getPartNamesToMutate builds mutation.parts_to_do.
The throw aborted mutationsUpdatingTask and left parts_to_do empty, so the
mutation was reported as done on a replica that had not applied it. With
mutations_sync = 2 the ALTER returned success while that replica still
served pre-mutation values. Regressed by ClickHouse#87206, which changed
QueueEntryRepresentation::produced_parts from a vector of names to a vector
of infos.
* StorageReplicatedMergeTree::checkPartsImpl builds the set of empty
unexpected parts on disk. The throw aborted ReplicatedMergeTreeAttachThread
and left the table readonly. Regressed by ClickHouse#103537, which replaced
tryAdd(name, &reason) with add(info, name, ...).
Both failures appear in a single Upgrade check report on ClickHouse#112457. Pass the
name that is already in hand at both call sites instead. V0 name formatting is
untouched, and behaviour on current-format tables is provably unchanged
because the name-taking overload re-parses the name into the identical info
and runs the same addImpl. This is the remedy alexey-milovidov used in
536b611 for the ATTACH PARTITION instance of
the same defect, which added ActiveDataPartSet::tryAdd(const String &).
dropped_parts is deliberately left holding infos only:
removePartAndCoveredParts(info) is getPartsCoveredBy + remove, neither of
which regenerates a name.
The V0 gap in MergeTreeData::restorePartFromBackup that the comment at the
throw site describes is a different code path, absent from both stacks here,
and is not addressed.
Testing: 04907_mutation_parts_to_do_deprecated_syntax asserts parts_to_do on
the frozen replica and fails on master with "parts to do 0". checkPartsImpl's
state requires fabricating parts on disk, which is not allowed in a stateless
test, so that half is covered by three V0 cases in gtest_active_data_part_set,
all of which fail with this change reverted.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Slightly improve the code around updating mutations.
Documentation entry for user-facing changes
MergeTreePartInfo::fromPartName.QueueRepresentationdata structure to minimize queue traversal.