Use memory tracker on query level.

This commit is contained in:
Ivan Lezhankin 2020-01-28 15:31:10 +03:00
parent 09b39b78e4
commit eb5e577f14

View File

@ -187,8 +187,6 @@ ProcessList::EntryPtr ProcessList::insert(const String & query_, const IAST * as
/// Track memory usage for all simultaneously running queries from single user.
user_process_list.user_memory_tracker.setParent(&total_memory_tracker);
user_process_list.user_memory_tracker.setOrRaiseHardLimit(settings.max_memory_usage_for_user);
user_process_list.user_memory_tracker.setOrRaiseProfilerLimit(settings.memory_profiler_step);
user_process_list.user_memory_tracker.setProfilerStep(settings.memory_profiler_step);
user_process_list.user_memory_tracker.setDescription("(for user)");
/// Actualize thread group info
@ -201,6 +199,8 @@ ProcessList::EntryPtr ProcessList::insert(const String & query_, const IAST * as
/// Set query-level memory trackers
thread_group->memory_tracker.setOrRaiseHardLimit(process_it->max_memory_usage);
thread_group->memory_tracker.setOrRaiseProfilerLimit(settings.memory_profiler_step);
thread_group->memory_tracker.setProfilerStep(settings.memory_profiler_step);
thread_group->memory_tracker.setDescription("(for query)");
if (process_it->memory_tracker_fault_probability)
thread_group->memory_tracker.setFaultProbability(process_it->memory_tracker_fault_probability);