wangbo commented on code in PR #19526: URL: https://github.com/apache/doris/pull/19526#discussion_r1192950326
########## be/src/runtime/task_group/task_group_manager.cpp: ########## @@ -35,20 +36,31 @@ TaskGroupManager* TaskGroupManager::instance() { TaskGroupPtr TaskGroupManager::get_or_create_task_group(const TaskGroupInfo& task_group_info) { { std::shared_lock<std::shared_mutex> r_lock(_group_mutex); - if (_task_groups.count(task_group_info._id)) { - return _task_groups[task_group_info._id]; + if (LIKELY(_task_groups.count(task_group_info.id))) { + auto task_group = _task_groups[task_group_info.id]; + task_group->check_and_update(task_group_info); + return task_group; } } - auto new_task_group = - std::make_shared<TaskGroup>(task_group_info._id, task_group_info._name, - task_group_info._cpu_share, task_group_info._version); + auto new_task_group = std::make_shared<TaskGroup>(task_group_info); std::lock_guard<std::shared_mutex> w_lock(_group_mutex); - if (_task_groups.count(task_group_info._id)) { - return _task_groups[task_group_info._id]; + if (_task_groups.count(task_group_info.id)) { + auto task_group = _task_groups[task_group_info.id]; + task_group->check_and_update(task_group_info); + return task_group; } - _task_groups[task_group_info._id] = new_task_group; + _task_groups[task_group_info.id] = new_task_group; return new_task_group; } +int64_t TaskGroupManager::memory_limit_gc() { + int64_t total_free_memory = 0; + std::shared_lock<std::shared_mutex> r_lock(_group_mutex); Review Comment: It seems that we can't create ResourceGroup when exec GC; So how about use a copy-on-write. Get a copy list of current RS under RLock, then GC current RS. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org