mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-15 12:14:18 +00:00
Optimize the lock contentions for ThreadGroupStatus::mutex
The release of ThreadGroupStatus::finished_threads_counters_memory via the getProfileEventsCountersAndMemoryForThreads method brings lots of lock contentions for ThreadGroupStatus::mutex and lowers the overall performance. This commit optimizes this performance issue by replacing the method call with an equivalent but more lightweight code block.
This commit is contained in:
parent
445446c700
commit
223c1230b6
@ -350,7 +350,10 @@ void ThreadStatus::detachQuery(bool exit_if_already_detached, bool thread_exits)
|
||||
|
||||
/// Avoid leaking of ThreadGroupStatus::finished_threads_counters_memory
|
||||
/// (this is in case someone uses system thread but did not call getProfileEventsCountersAndMemoryForThreads())
|
||||
thread_group->getProfileEventsCountersAndMemoryForThreads();
|
||||
{
|
||||
std::lock_guard guard(thread_group->mutex);
|
||||
auto stats = std::move(thread_group->finished_threads_counters_memory);
|
||||
}
|
||||
|
||||
thread_group.reset();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user