diff --git a/dbms/src/Flash/Pipeline/Schedule/TaskQueues/ResourceControlQueue.cpp b/dbms/src/Flash/Pipeline/Schedule/TaskQueues/ResourceControlQueue.cpp index 26b3c47bbab..515155aee6d 100644 --- a/dbms/src/Flash/Pipeline/Schedule/TaskQueues/ResourceControlQueue.cpp +++ b/dbms/src/Flash/Pipeline/Schedule/TaskQueues/ResourceControlQueue.cpp @@ -150,13 +150,28 @@ bool ResourceControlQueue::take(TaskPtr & task) } template -void ResourceControlQueue::updateStatistics(const TaskPtr & task, ExecTaskStatus, UInt64 inc_value) +void ResourceControlQueue::updateStatistics( + const TaskPtr & task, + ExecTaskStatus exec_task_status, + UInt64 inc_value) { assert(task); auto ru = cpuTimeToRU(inc_value); - const String & name = task->getResourceGroupName(); - LOG_TRACE(logger, "resource group {} will consume {} RU(or {} cpu time in ns)", name, ru, inc_value); - LocalAdmissionController::global_instance->consumeCPUResource(name, ru, inc_value); + const String & resource_group_name = task->getResourceGroupName(); + LOG_TRACE(logger, "resource group {} will consume {} RU(or {} cpu time in ns)", resource_group_name, ru, inc_value); + LocalAdmissionController::global_instance->consumeCPUResource(resource_group_name, ru, inc_value); + + NestedTaskQueuePtr group_queue = nullptr; + { + std::lock_guard lock(mu); + auto iter = resource_group_task_queues.find(resource_group_name); + if (likely(iter != resource_group_task_queues.end())) + group_queue = iter->second; + else + return; + } + assert(group_queue); + group_queue->updateStatistics(task, exec_task_status, inc_value); } template diff --git a/dbms/src/Flash/Pipeline/Schedule/TaskQueues/ResourceControlQueue.h b/dbms/src/Flash/Pipeline/Schedule/TaskQueues/ResourceControlQueue.h index 9cd7cbab3ba..6e63076d01e 100644 --- a/dbms/src/Flash/Pipeline/Schedule/TaskQueues/ResourceControlQueue.h +++ b/dbms/src/Flash/Pipeline/Schedule/TaskQueues/ResourceControlQueue.h @@ -45,7 +45,7 @@ class ResourceControlQueue bool take(TaskPtr & task) override; - void updateStatistics(const TaskPtr & task, ExecTaskStatus, UInt64 inc_value) override; + void updateStatistics(const TaskPtr & task, ExecTaskStatus exec_task_status, UInt64 inc_value) override; bool empty() const override;