From 5d5f94f456b83e27f11f2e3080a95679fa0edeb8 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Sat, 25 Sep 2021 20:41:40 +0300 Subject: [PATCH 1/8] Mark 01200_mutations_memory_consumption as long and allow run in fasttest --- tests/queries/bugs/01200_mutations_memory_consumption.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/queries/bugs/01200_mutations_memory_consumption.sql b/tests/queries/bugs/01200_mutations_memory_consumption.sql index d3eb5dd165c..de9c2df7f08 100644 --- a/tests/queries/bugs/01200_mutations_memory_consumption.sql +++ b/tests/queries/bugs/01200_mutations_memory_consumption.sql @@ -1,4 +1,4 @@ --- Tags: no-debug, no-parallel, no-fasttest +-- Tags: no-debug, no-parallel, long DROP TABLE IF EXISTS table_with_single_pk; From ae980fcd622e50e6f85c8d6c69954a76dd2b2c9b Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Sat, 2 Oct 2021 16:49:44 +0300 Subject: [PATCH 2/8] Move 01200_mutations_memory_consumption out from bugs --- .../01200_mutations_memory_consumption.reference | 0 .../{bugs => 0_stateless}/01200_mutations_memory_consumption.sql | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename tests/queries/{bugs => 0_stateless}/01200_mutations_memory_consumption.reference (100%) rename tests/queries/{bugs => 0_stateless}/01200_mutations_memory_consumption.sql (100%) diff --git a/tests/queries/bugs/01200_mutations_memory_consumption.reference b/tests/queries/0_stateless/01200_mutations_memory_consumption.reference similarity index 100% rename from tests/queries/bugs/01200_mutations_memory_consumption.reference rename to tests/queries/0_stateless/01200_mutations_memory_consumption.reference diff --git a/tests/queries/bugs/01200_mutations_memory_consumption.sql b/tests/queries/0_stateless/01200_mutations_memory_consumption.sql similarity index 100% rename from tests/queries/bugs/01200_mutations_memory_consumption.sql rename to tests/queries/0_stateless/01200_mutations_memory_consumption.sql From e4b39ca99cc16ce2f27faf5c2f30bf79cec43c84 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Wed, 6 Oct 2021 00:10:12 +0300 Subject: [PATCH 3/8] Remove unused Block member from MutateTask v0: Fix excessive memory usage in MutateTask This is relevant only for 01200_mutations_memory_consumption test, since this is just a block. v2: just remove unused Block member, since other part had been fixed in #29768 --- src/Storages/MergeTree/MutateTask.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Storages/MergeTree/MutateTask.cpp b/src/Storages/MergeTree/MutateTask.cpp index 66d0f5f7e49..dbf05e1c6cc 100644 --- a/src/Storages/MergeTree/MutateTask.cpp +++ b/src/Storages/MergeTree/MutateTask.cpp @@ -766,7 +766,6 @@ private: State state{State::NEED_PREPARE}; MutationContextPtr ctx; - Block block; size_t block_num = 0; using ProjectionNameToItsBlocks = std::map; From fd38cbb0dfb10fc1211dba1404cd78dce29bd0f9 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Mon, 4 Oct 2021 01:41:35 +0300 Subject: [PATCH 4/8] Fix memory tracking for merges and mutations (by destroying earlier) It fixes only some tiny allocations, and so it should not affect any huge mutations/merges. And plus, this should not be a real fix, since peak_memory_usage is obtained before even destrying this objects, and destroing objects will unlikely update peak memory usage (although it is possible). v0: do this in dtors v2: do this earlier --- src/Storages/MergeTree/MergePlainMergeTreeTask.cpp | 1 + src/Storages/MergeTree/MutatePlainMergeTreeTask.cpp | 1 + src/Storages/MergeTree/MutateTask.cpp | 1 + 3 files changed, 3 insertions(+) diff --git a/src/Storages/MergeTree/MergePlainMergeTreeTask.cpp b/src/Storages/MergeTree/MergePlainMergeTreeTask.cpp index 3129ae9aa35..af54bf113d6 100644 --- a/src/Storages/MergeTree/MergePlainMergeTreeTask.cpp +++ b/src/Storages/MergeTree/MergePlainMergeTreeTask.cpp @@ -87,6 +87,7 @@ void MergePlainMergeTreeTask::prepare() write_part_log = [this] (const ExecutionStatus & execution_status) { + merge_task.reset(); storage.writePartLog( PartLogElement::MERGE_PARTS, execution_status, diff --git a/src/Storages/MergeTree/MutatePlainMergeTreeTask.cpp b/src/Storages/MergeTree/MutatePlainMergeTreeTask.cpp index 1f4b387a3a3..39a057d68ca 100644 --- a/src/Storages/MergeTree/MutatePlainMergeTreeTask.cpp +++ b/src/Storages/MergeTree/MutatePlainMergeTreeTask.cpp @@ -40,6 +40,7 @@ void MutatePlainMergeTreeTask::prepare() write_part_log = [this] (const ExecutionStatus & execution_status) { + mutate_task.reset(); storage.writePartLog( PartLogElement::MUTATE_PART, execution_status, diff --git a/src/Storages/MergeTree/MutateTask.cpp b/src/Storages/MergeTree/MutateTask.cpp index dbf05e1c6cc..40037c38779 100644 --- a/src/Storages/MergeTree/MutateTask.cpp +++ b/src/Storages/MergeTree/MutateTask.cpp @@ -985,6 +985,7 @@ private: ctx->mutating_pipeline.reset(); static_pointer_cast(ctx->out)->writeSuffixAndFinalizePart(ctx->new_data_part, ctx->need_sync); + ctx->out.reset(); } enum class State From 8cc45bea7b8586e0d2e5133051169c96152ee5f0 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Wed, 13 Oct 2021 23:47:28 +0300 Subject: [PATCH 5/8] Avoid accounting memory from another mutation/merge Before this path it was possible that one merge/mutation may account memory from another, due to ThreadStatus::untracked_memory. And this cause flakiness of 01200_mutations_memory_consumption. --- src/Storages/MergeTree/MergeList.cpp | 6 ++++++ src/Storages/MergeTree/MergeList.h | 1 + 2 files changed, 7 insertions(+) diff --git a/src/Storages/MergeTree/MergeList.cpp b/src/Storages/MergeTree/MergeList.cpp index 07aabf64dfd..8e85bcb986f 100644 --- a/src/Storages/MergeTree/MergeList.cpp +++ b/src/Storages/MergeTree/MergeList.cpp @@ -34,6 +34,11 @@ MemoryTrackerThreadSwitcher::MemoryTrackerThreadSwitcher(MemoryTracker * memory_ prev_untracked_memory_limit = current_thread->untracked_memory_limit; current_thread->untracked_memory_limit = untracked_memory_limit; + + /// Avoid accounting memory from another mutation/merge + /// (NOTE: consider moving such code to ThreadFromGlobalPool and related places) + prev_untracked_memory = current_thread->untracked_memory; + current_thread->untracked_memory = 0; } @@ -45,6 +50,7 @@ MemoryTrackerThreadSwitcher::~MemoryTrackerThreadSwitcher() background_thread_memory_tracker->setParent(background_thread_memory_tracker_prev_parent); current_thread->untracked_memory_limit = prev_untracked_memory_limit; + current_thread->untracked_memory = prev_untracked_memory; } MergeListElement::MergeListElement( diff --git a/src/Storages/MergeTree/MergeList.h b/src/Storages/MergeTree/MergeList.h index 95e96b5a73e..0389736a7f9 100644 --- a/src/Storages/MergeTree/MergeList.h +++ b/src/Storages/MergeTree/MergeList.h @@ -68,6 +68,7 @@ private: MemoryTracker * background_thread_memory_tracker; MemoryTracker * background_thread_memory_tracker_prev_parent = nullptr; UInt64 prev_untracked_memory_limit; + UInt64 prev_untracked_memory; }; using MemoryTrackerThreadSwitcherPtr = std::unique_ptr; From 3477ab52a75202879f912176c2e03f58f595a9fa Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Wed, 13 Oct 2021 23:47:28 +0300 Subject: [PATCH 6/8] Add StorageID::getShortName() --- src/Interpreters/StorageID.cpp | 2 +- src/Interpreters/StorageID.h | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Interpreters/StorageID.cpp b/src/Interpreters/StorageID.cpp index bfb969cab25..2e76618e4c0 100644 --- a/src/Interpreters/StorageID.cpp +++ b/src/Interpreters/StorageID.cpp @@ -110,7 +110,7 @@ StorageID StorageID::fromDictionaryConfig(const Poco::Util::AbstractConfiguratio return res; } -String StorageID::getInternalDictionaryName() const +String StorageID::getShortName() const { assertNotEmpty(); if (hasUUID()) diff --git a/src/Interpreters/StorageID.h b/src/Interpreters/StorageID.h index 623f481fbc5..f1fcfde25c0 100644 --- a/src/Interpreters/StorageID.h +++ b/src/Interpreters/StorageID.h @@ -91,7 +91,9 @@ struct StorageID /// If dictionary has UUID, then use it as dictionary name in ExternalLoader to allow dictionary renaming. /// ExternalDictnariesLoader::resolveDictionaryName(...) should be used to access such dictionaries by name. - String getInternalDictionaryName() const; + String getInternalDictionaryName() const { return getShortName(); } + /// Get short, but unique, name. + String getShortName() const; private: StorageID() = default; From 8a209a78d78aae63ffb1089bc8b442132c293064 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Wed, 13 Oct 2021 23:47:28 +0300 Subject: [PATCH 7/8] Set query_id for mutations/merges This will allow to distinguish allocations in trace_log. --- src/Common/ThreadStatus.h | 8 ++++++++ src/Storages/MergeTree/MergeList.cpp | 7 ++++++- src/Storages/MergeTree/MergeList.h | 4 +++- src/Storages/MergeTree/MergePlainMergeTreeTask.cpp | 5 ++++- src/Storages/MergeTree/MutatePlainMergeTreeTask.cpp | 5 ++++- src/Storages/MergeTree/ReplicatedMergeMutateTaskBase.cpp | 5 ++++- 6 files changed, 29 insertions(+), 5 deletions(-) diff --git a/src/Common/ThreadStatus.h b/src/Common/ThreadStatus.h index 16a47a21184..d22f6e1574b 100644 --- a/src/Common/ThreadStatus.h +++ b/src/Common/ThreadStatus.h @@ -41,6 +41,7 @@ class TaskStatsInfoGetter; class InternalTextLogsQueue; struct ViewRuntimeData; class QueryViewsLog; +class MemoryTrackerThreadSwitcher; using InternalTextLogsQueuePtr = std::shared_ptr; using InternalTextLogsQueueWeakPtr = std::weak_ptr; @@ -166,6 +167,13 @@ protected: /// It is used to avoid enabling the query profiler when you have multiple ThreadStatus in the same thread bool query_profiled_enabled = true; + /// Requires access to query_id. + friend class MemoryTrackerThreadSwitcher; + void setQueryId(const String & query_id_) + { + query_id = query_id_; + } + public: ThreadStatus(); ~ThreadStatus(); diff --git a/src/Storages/MergeTree/MergeList.cpp b/src/Storages/MergeTree/MergeList.cpp index 8e85bcb986f..7ef61bbc382 100644 --- a/src/Storages/MergeTree/MergeList.cpp +++ b/src/Storages/MergeTree/MergeList.cpp @@ -10,7 +10,7 @@ namespace DB { -MemoryTrackerThreadSwitcher::MemoryTrackerThreadSwitcher(MemoryTracker * memory_tracker_ptr, UInt64 untracked_memory_limit) +MemoryTrackerThreadSwitcher::MemoryTrackerThreadSwitcher(MemoryTracker * memory_tracker_ptr, UInt64 untracked_memory_limit, const std::string & query_id) { // Each merge is executed into separate background processing pool thread background_thread_memory_tracker = CurrentThread::getMemoryTracker(); @@ -39,6 +39,9 @@ MemoryTrackerThreadSwitcher::MemoryTrackerThreadSwitcher(MemoryTracker * memory_ /// (NOTE: consider moving such code to ThreadFromGlobalPool and related places) prev_untracked_memory = current_thread->untracked_memory; current_thread->untracked_memory = 0; + + prev_query_id = current_thread->getQueryId().toString(); + current_thread->setQueryId(query_id); } @@ -51,6 +54,7 @@ MemoryTrackerThreadSwitcher::~MemoryTrackerThreadSwitcher() current_thread->untracked_memory_limit = prev_untracked_memory_limit; current_thread->untracked_memory = prev_untracked_memory; + current_thread->setQueryId(prev_query_id); } MergeListElement::MergeListElement( @@ -66,6 +70,7 @@ MergeListElement::MergeListElement( , result_part_info{future_part->part_info} , num_parts{future_part->parts.size()} , max_untracked_memory(max_untracked_memory_) + , query_id(table_id.getShortName() + "::" + result_part_name) , thread_id{getThreadId()} , merge_type{future_part->merge_type} , merge_algorithm{MergeAlgorithm::Undecided} diff --git a/src/Storages/MergeTree/MergeList.h b/src/Storages/MergeTree/MergeList.h index 0389736a7f9..236837e3768 100644 --- a/src/Storages/MergeTree/MergeList.h +++ b/src/Storages/MergeTree/MergeList.h @@ -62,13 +62,14 @@ using FutureMergedMutatedPartPtr = std::shared_ptr; class MemoryTrackerThreadSwitcher : boost::noncopyable { public: - explicit MemoryTrackerThreadSwitcher(MemoryTracker * memory_tracker_ptr, UInt64 untracked_memory_limit); + explicit MemoryTrackerThreadSwitcher(MemoryTracker * memory_tracker_ptr, UInt64 untracked_memory_limit, const std::string & query_id); ~MemoryTrackerThreadSwitcher(); private: MemoryTracker * background_thread_memory_tracker; MemoryTracker * background_thread_memory_tracker_prev_parent = nullptr; UInt64 prev_untracked_memory_limit; UInt64 prev_untracked_memory; + String prev_query_id; }; using MemoryTrackerThreadSwitcherPtr = std::unique_ptr; @@ -107,6 +108,7 @@ struct MergeListElement : boost::noncopyable MemoryTracker memory_tracker{VariableContext::Process}; UInt64 max_untracked_memory; + std::string query_id; UInt64 thread_id; MergeType merge_type; diff --git a/src/Storages/MergeTree/MergePlainMergeTreeTask.cpp b/src/Storages/MergeTree/MergePlainMergeTreeTask.cpp index af54bf113d6..5d5b22bdcd9 100644 --- a/src/Storages/MergeTree/MergePlainMergeTreeTask.cpp +++ b/src/Storages/MergeTree/MergePlainMergeTreeTask.cpp @@ -30,7 +30,10 @@ bool MergePlainMergeTreeTask::executeStep() /// Make out memory tracker a parent of current thread memory tracker MemoryTrackerThreadSwitcherPtr switcher; if (merge_list_entry) - switcher = std::make_unique(&(*merge_list_entry)->memory_tracker, (*merge_list_entry)->max_untracked_memory); + switcher = std::make_unique( + &(*merge_list_entry)->memory_tracker, + (*merge_list_entry)->max_untracked_memory, + (*merge_list_entry)->query_id); switch (state) { diff --git a/src/Storages/MergeTree/MutatePlainMergeTreeTask.cpp b/src/Storages/MergeTree/MutatePlainMergeTreeTask.cpp index 39a057d68ca..a8faf8e7899 100644 --- a/src/Storages/MergeTree/MutatePlainMergeTreeTask.cpp +++ b/src/Storages/MergeTree/MutatePlainMergeTreeTask.cpp @@ -62,7 +62,10 @@ bool MutatePlainMergeTreeTask::executeStep() /// Make out memory tracker a parent of current thread memory tracker MemoryTrackerThreadSwitcherPtr switcher; if (merge_list_entry) - switcher = std::make_unique(&(*merge_list_entry)->memory_tracker, (*merge_list_entry)->max_untracked_memory); + switcher = std::make_unique( + &(*merge_list_entry)->memory_tracker, + (*merge_list_entry)->max_untracked_memory, + (*merge_list_entry)->query_id); switch (state) { diff --git a/src/Storages/MergeTree/ReplicatedMergeMutateTaskBase.cpp b/src/Storages/MergeTree/ReplicatedMergeMutateTaskBase.cpp index 32071566bbe..a60fd42eec6 100644 --- a/src/Storages/MergeTree/ReplicatedMergeMutateTaskBase.cpp +++ b/src/Storages/MergeTree/ReplicatedMergeMutateTaskBase.cpp @@ -122,7 +122,10 @@ bool ReplicatedMergeMutateTaskBase::executeImpl() { MemoryTrackerThreadSwitcherPtr switcher; if (merge_mutate_entry) - switcher = std::make_unique(&(*merge_mutate_entry)->memory_tracker, (*merge_mutate_entry)->max_untracked_memory); + switcher = std::make_unique( + &(*merge_mutate_entry)->memory_tracker, + (*merge_mutate_entry)->max_untracked_memory, + (*merge_mutate_entry)->query_id); auto remove_processed_entry = [&] () -> bool { From 2a7a1d8df59da9e02ca27e5193a477b1209d697d Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Wed, 13 Oct 2021 23:47:28 +0300 Subject: [PATCH 8/8] Avoid losing any allocations context from merges/mutations --- src/Storages/MergeTree/MergeList.cpp | 14 +++++++++----- src/Storages/MergeTree/MergeList.h | 13 ++++++++++--- src/Storages/MergeTree/MergePlainMergeTreeTask.cpp | 5 +---- .../MergeTree/MutatePlainMergeTreeTask.cpp | 5 +---- .../MergeTree/ReplicatedMergeMutateTaskBase.cpp | 5 +---- 5 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/Storages/MergeTree/MergeList.cpp b/src/Storages/MergeTree/MergeList.cpp index 7ef61bbc382..366834b8f09 100644 --- a/src/Storages/MergeTree/MergeList.cpp +++ b/src/Storages/MergeTree/MergeList.cpp @@ -10,7 +10,8 @@ namespace DB { -MemoryTrackerThreadSwitcher::MemoryTrackerThreadSwitcher(MemoryTracker * memory_tracker_ptr, UInt64 untracked_memory_limit, const std::string & query_id) +MemoryTrackerThreadSwitcher::MemoryTrackerThreadSwitcher(MergeListEntry & merge_list_entry_) + : merge_list_entry(merge_list_entry_) { // Each merge is executed into separate background processing pool thread background_thread_memory_tracker = CurrentThread::getMemoryTracker(); @@ -29,19 +30,19 @@ MemoryTrackerThreadSwitcher::MemoryTrackerThreadSwitcher(MemoryTracker * memory_ } background_thread_memory_tracker_prev_parent = background_thread_memory_tracker->getParent(); - background_thread_memory_tracker->setParent(memory_tracker_ptr); + background_thread_memory_tracker->setParent(&merge_list_entry->memory_tracker); } prev_untracked_memory_limit = current_thread->untracked_memory_limit; - current_thread->untracked_memory_limit = untracked_memory_limit; + current_thread->untracked_memory_limit = merge_list_entry->max_untracked_memory; /// Avoid accounting memory from another mutation/merge /// (NOTE: consider moving such code to ThreadFromGlobalPool and related places) prev_untracked_memory = current_thread->untracked_memory; - current_thread->untracked_memory = 0; + current_thread->untracked_memory = merge_list_entry->untracked_memory; prev_query_id = current_thread->getQueryId().toString(); - current_thread->setQueryId(query_id); + current_thread->setQueryId(merge_list_entry->query_id); } @@ -53,7 +54,10 @@ MemoryTrackerThreadSwitcher::~MemoryTrackerThreadSwitcher() background_thread_memory_tracker->setParent(background_thread_memory_tracker_prev_parent); current_thread->untracked_memory_limit = prev_untracked_memory_limit; + + merge_list_entry->untracked_memory = current_thread->untracked_memory; current_thread->untracked_memory = prev_untracked_memory; + current_thread->setQueryId(prev_query_id); } diff --git a/src/Storages/MergeTree/MergeList.h b/src/Storages/MergeTree/MergeList.h index 236837e3768..4139e9599aa 100644 --- a/src/Storages/MergeTree/MergeList.h +++ b/src/Storages/MergeTree/MergeList.h @@ -55,6 +55,10 @@ struct MergeInfo struct FutureMergedMutatedPart; using FutureMergedMutatedPartPtr = std::shared_ptr; +struct MergeListElement; +using MergeListEntry = BackgroundProcessListEntry; + + /** * Since merge is executed with multiple threads, this class * switches the parent MemoryTracker to account all the memory used. @@ -62,9 +66,10 @@ using FutureMergedMutatedPartPtr = std::shared_ptr; class MemoryTrackerThreadSwitcher : boost::noncopyable { public: - explicit MemoryTrackerThreadSwitcher(MemoryTracker * memory_tracker_ptr, UInt64 untracked_memory_limit, const std::string & query_id); + explicit MemoryTrackerThreadSwitcher(MergeListEntry & merge_list_entry_); ~MemoryTrackerThreadSwitcher(); private: + MergeListEntry & merge_list_entry; MemoryTracker * background_thread_memory_tracker; MemoryTracker * background_thread_memory_tracker_prev_parent = nullptr; UInt64 prev_untracked_memory_limit; @@ -107,7 +112,11 @@ struct MergeListElement : boost::noncopyable std::atomic columns_written{}; MemoryTracker memory_tracker{VariableContext::Process}; + /// Used to adjust ThreadStatus::untracked_memory_limit UInt64 max_untracked_memory; + /// Used to avoid losing any allocation context + UInt64 untracked_memory = 0; + /// Used for identifying mutations/merges in trace_log std::string query_id; UInt64 thread_id; @@ -129,8 +138,6 @@ struct MergeListElement : boost::noncopyable ~MergeListElement(); }; -using MergeListEntry = BackgroundProcessListEntry; - /** Maintains a list of currently running merges. * For implementation of system.merges table. */ diff --git a/src/Storages/MergeTree/MergePlainMergeTreeTask.cpp b/src/Storages/MergeTree/MergePlainMergeTreeTask.cpp index 5d5b22bdcd9..1cbf928047c 100644 --- a/src/Storages/MergeTree/MergePlainMergeTreeTask.cpp +++ b/src/Storages/MergeTree/MergePlainMergeTreeTask.cpp @@ -30,10 +30,7 @@ bool MergePlainMergeTreeTask::executeStep() /// Make out memory tracker a parent of current thread memory tracker MemoryTrackerThreadSwitcherPtr switcher; if (merge_list_entry) - switcher = std::make_unique( - &(*merge_list_entry)->memory_tracker, - (*merge_list_entry)->max_untracked_memory, - (*merge_list_entry)->query_id); + switcher = std::make_unique(*merge_list_entry); switch (state) { diff --git a/src/Storages/MergeTree/MutatePlainMergeTreeTask.cpp b/src/Storages/MergeTree/MutatePlainMergeTreeTask.cpp index a8faf8e7899..3359693fa22 100644 --- a/src/Storages/MergeTree/MutatePlainMergeTreeTask.cpp +++ b/src/Storages/MergeTree/MutatePlainMergeTreeTask.cpp @@ -62,10 +62,7 @@ bool MutatePlainMergeTreeTask::executeStep() /// Make out memory tracker a parent of current thread memory tracker MemoryTrackerThreadSwitcherPtr switcher; if (merge_list_entry) - switcher = std::make_unique( - &(*merge_list_entry)->memory_tracker, - (*merge_list_entry)->max_untracked_memory, - (*merge_list_entry)->query_id); + switcher = std::make_unique(*merge_list_entry); switch (state) { diff --git a/src/Storages/MergeTree/ReplicatedMergeMutateTaskBase.cpp b/src/Storages/MergeTree/ReplicatedMergeMutateTaskBase.cpp index a60fd42eec6..5fe7de70a20 100644 --- a/src/Storages/MergeTree/ReplicatedMergeMutateTaskBase.cpp +++ b/src/Storages/MergeTree/ReplicatedMergeMutateTaskBase.cpp @@ -122,10 +122,7 @@ bool ReplicatedMergeMutateTaskBase::executeImpl() { MemoryTrackerThreadSwitcherPtr switcher; if (merge_mutate_entry) - switcher = std::make_unique( - &(*merge_mutate_entry)->memory_tracker, - (*merge_mutate_entry)->max_untracked_memory, - (*merge_mutate_entry)->query_id); + switcher = std::make_unique(*merge_mutate_entry); auto remove_processed_entry = [&] () -> bool {