mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 18:12:02 +00:00
Remove parts from mutations on replica start
This commit is contained in:
parent
1f4b42a99f
commit
f4b2be7b32
@ -205,9 +205,6 @@ void ReplicatedMergeTreeQueue::updateStateOnQueueEntryRemoval(
|
||||
for (const String & virtual_part_name : entry->getVirtualPartNames())
|
||||
{
|
||||
Strings replaced_parts;
|
||||
/// In most cases we will replace only current parts, but sometimes
|
||||
/// we can even replace virtual parts. For example when we failed to
|
||||
/// GET source part and dowloaded merged/mutated part instead.
|
||||
current_parts.add(virtual_part_name, &replaced_parts);
|
||||
|
||||
/// Each part from `replaced_parts` should become Obsolete as a result of executing the entry.
|
||||
@ -1896,4 +1893,10 @@ String padIndex(Int64 index)
|
||||
return std::string(10 - index_str.size(), '0') + index_str;
|
||||
}
|
||||
|
||||
void ReplicatedMergeTreeQueue::removeCurrentPartsFromMutations()
|
||||
{
|
||||
std::lock_guard state_lock(state_mutex);
|
||||
for (const auto & part_name : current_parts.getParts())
|
||||
removePartFromMutations(part_name);
|
||||
}
|
||||
}
|
||||
|
@ -383,6 +383,7 @@ public:
|
||||
|
||||
std::vector<MergeTreeMutationStatus> getMutationsStatus() const;
|
||||
|
||||
void removeCurrentPartsFromMutations();
|
||||
};
|
||||
|
||||
class ReplicatedMergeTreeMergePredicate
|
||||
|
@ -180,6 +180,7 @@ bool ReplicatedMergeTreeRestartingThread::tryStartup()
|
||||
/// pullLogsToQueue() after we mark replica 'is_active' (and after we repair if it was lost);
|
||||
/// because cleanup_thread doesn't delete log_pointer of active replicas.
|
||||
storage.queue.pullLogsToQueue(zookeeper);
|
||||
storage.queue.removeCurrentPartsFromMutations();
|
||||
storage.last_queue_update_finish_time.store(time(nullptr));
|
||||
|
||||
updateQuorumIfWeHavePart();
|
||||
|
Loading…
Reference in New Issue
Block a user