[CP] add pre_check when set group_io_config && fix same io_timestamp in schedule_heap

This commit is contained in:
renju96
2023-11-22 05:45:02 +00:00
committed by ob-robot
parent 3648cbf52b
commit 54bf7798c8
10 changed files with 157 additions and 59 deletions

View File

@ -1619,26 +1619,22 @@ void ObTenantDagWorker::resume()
int ObTenantDagWorker::set_dag_resource(const uint64_t group_id)
{
int ret = OB_SUCCESS;
if (OB_ISNULL(GCTX.cgroup_ctrl_)) {
//cgroup not init, cannot bind thread and control resource
} else {
uint64_t consumer_group_id = 0;
if (group_id != 0) {
//user level
consumer_group_id = group_id;
} else if (OB_FAIL(G_RES_MGR.get_mapping_rule_mgr().get_group_id_by_function_type(MTL_ID(), function_type_, consumer_group_id))) {
//function level
LOG_WARN("fail to get group id by function", K(ret), K(MTL_ID()), K(function_type_), K(consumer_group_id));
}
if (OB_SUCC(ret) && consumer_group_id != group_id_) {
// for CPU isolation, depend on cgroup
if (GCTX.cgroup_ctrl_->is_valid() && OB_FAIL(GCTX.cgroup_ctrl_->add_self_to_group(MTL_ID(), consumer_group_id))) {
LOG_WARN("bind back thread to group failed", K(ret), K(GETTID()), K(MTL_ID()), K(group_id));
} else {
// for IOPS isolation, only depend on consumer_group_id
ATOMIC_SET(&group_id_, consumer_group_id);
THIS_WORKER.set_group_id(static_cast<int32_t>(consumer_group_id));
}
uint64_t consumer_group_id = 0;
if (group_id != 0) {
//user level
consumer_group_id = group_id;
} else if (OB_FAIL(G_RES_MGR.get_mapping_rule_mgr().get_group_id_by_function_type(MTL_ID(), function_type_, consumer_group_id))) {
//function level
LOG_WARN("fail to get group id by function", K(ret), K(MTL_ID()), K(function_type_), K(consumer_group_id));
}
if (OB_SUCC(ret) && consumer_group_id != group_id_) {
// for CPU isolation, depend on cgroup
if (OB_NOT_NULL(GCTX.cgroup_ctrl_) && GCTX.cgroup_ctrl_->is_valid() && OB_FAIL(GCTX.cgroup_ctrl_->add_self_to_group(MTL_ID(), consumer_group_id))) {
LOG_WARN("bind back thread to group failed", K(ret), K(GETTID()), K(MTL_ID()), K(group_id));
} else {
// for IOPS isolation, only depend on consumer_group_id
ATOMIC_SET(&group_id_, consumer_group_id);
THIS_WORKER.set_group_id(static_cast<int32_t>(consumer_group_id));
}
}
return ret;