fix cgroup log display
This commit is contained in:
parent
4395407af0
commit
4ad457ced3
@ -1183,7 +1183,7 @@ void ObTenant::set_unit_max_cpu(double cpu)
|
||||
if (!cgroup_ctrl_.is_valid() || is_meta_tenant(id_)) {
|
||||
// do nothing
|
||||
} else if (OB_TMP_FAIL(cgroup_ctrl_.set_cpu_cfs_quota(id_, is_sys_tenant(id_) ? -1 : cpu))) {
|
||||
LOG_WARN_RET(tmp_ret, "set tenant cpu cfs quota failed", K(tmp_ret), K_(id));
|
||||
_LOG_WARN_RET(tmp_ret, "set tenant cpu cfs quota failed, tenant_id=%lu, cpu=%.2f", id_, cpu);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1194,7 +1194,7 @@ void ObTenant::set_unit_min_cpu(double cpu)
|
||||
if (!cgroup_ctrl_.is_valid()) {
|
||||
// do nothing
|
||||
} else if (OB_TMP_FAIL(cgroup_ctrl_.set_cpu_shares(id_, cpu))) {
|
||||
LOG_WARN_RET(tmp_ret, "set tenant cpu shares failed", K(tmp_ret), K_(id), K(cpu));
|
||||
_LOG_WARN_RET(tmp_ret, "set tenant cpu shares failed, tenant_id=%lu, cpu=%.2f", id_, cpu);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -515,6 +515,7 @@ void ObTenantNodeBalancer::periodically_check_tenant()
|
||||
}
|
||||
omt_->unlock_tenant_list();
|
||||
|
||||
G_RES_MGR.get_plan_mgr().refresh_global_background_cpu();
|
||||
int i = 0;
|
||||
for (auto it = pairs.begin();
|
||||
it != pairs.end();
|
||||
|
@ -596,7 +596,11 @@ int ObCgroupCtrl::set_cpu_shares_(
|
||||
} else if (OB_FAIL(set_cgroup_config_(group_path, CPU_SHARES_FILE, cpu_shares_value))) {
|
||||
LOG_WARN("set cpu shares failed", K(ret), K(group_path), K(tenant_id));
|
||||
} else {
|
||||
LOG_INFO("set cpu shares success", K(group_path), K(cpu), K(cpu_shares_value), K(tenant_id));
|
||||
_LOG_INFO("set cpu shares success, "
|
||||
"group_path=%s, cpu=%.2f, "
|
||||
"cpu_shares_value=%s, tenant_id=%lu",
|
||||
group_path, cpu,
|
||||
cpu_shares_value, tenant_id);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -707,17 +711,21 @@ int ObCgroupCtrl::set_cpu_cfs_quota_(
|
||||
ret = set_cpu_cfs_quota_by_path_(group_path, target_cpu);
|
||||
}
|
||||
if (OB_FAIL(ret)) {
|
||||
LOG_WARN("set cpu cfs quota failed",
|
||||
K(ret),
|
||||
K(tenant_id),
|
||||
K(group_id),
|
||||
K(cpu),
|
||||
K(target_cpu),
|
||||
K(current_cpu),
|
||||
K(group_path));
|
||||
_LOG_WARN("set cpu cfs quota failed, "
|
||||
"tenant_id=%lu, group_id=%lu, "
|
||||
"cpu=%.2f, target_cpu=%.2f, "
|
||||
"current_cpu=%.2f, group_path=%s",
|
||||
tenant_id, group_id,
|
||||
cpu, target_cpu,
|
||||
current_cpu, group_path);
|
||||
} else {
|
||||
LOG_INFO(
|
||||
"set cpu cfs quota success", K(tenant_id), K(group_id), K(cpu), K(target_cpu), K(current_cpu), K(group_path));
|
||||
_LOG_INFO("set cpu cfs quota success, "
|
||||
"tenant_id=%lu, group_id=%lu, "
|
||||
"cpu=%.2f, target_cpu=%.2f, "
|
||||
"current_cpu=%.2f, group_path=%s",
|
||||
tenant_id, group_id,
|
||||
cpu, target_cpu,
|
||||
current_cpu, group_path);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
@ -797,7 +805,11 @@ int ObCgroupCtrl::set_cpu_cfs_quota_by_path_(const char *group_path, const doubl
|
||||
loop_times++;
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
LOG_INFO("set cpu quota success", K(group_path), K(cpu), K(cfs_quota_us), K(cfs_period_us));
|
||||
_LOG_INFO("set cpu quota success, "
|
||||
"group_path=%s, cpu=%.2f, "
|
||||
"cfs_quota_us=%d, cfs_period_us=%d",
|
||||
group_path, cpu,
|
||||
cfs_quota_us, cfs_period_us);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
@ -167,8 +167,6 @@ int ObResourcePlanManager::refresh_resource_plan(const uint64_t tenant_id, ObStr
|
||||
// step1: 以 100 为总值做归一化
|
||||
// step2: 将值转化成 cgroup 值 (utilization=>cfs_cpu_quota 的值和 cpu 核数等有关)
|
||||
// - 如果 utilization = 100,那么 cfs_cpu_quota = -1
|
||||
} else if (OB_FAIL(refresh_global_background_cpu())) {
|
||||
LOG_WARN("fail refresh background cpu quota", K(ret));
|
||||
} else if (OB_FAIL(flush_directive_to_cgroup_fs(directives))) { // for CPU
|
||||
LOG_WARN("fail flush directive to cgroup fs", K(ret));
|
||||
}
|
||||
@ -458,7 +456,6 @@ int ObResourcePlanManager::clear_deleted_directives(const uint64_t tenant_id,
|
||||
}
|
||||
if (!is_group_id_found) {
|
||||
const uint64_t deleted_group_id = group_id_keys.at(i).group_id_;
|
||||
LOG_INFO("directive need to be cleared", K(tenant_id), K(deleted_group_id));
|
||||
if (OB_FAIL(tenant_holder.get_ptr()->reset_consumer_group_config(deleted_group_id))) {
|
||||
LOG_WARN("reset consumer group config failed", K(ret), K(deleted_group_id));
|
||||
} else if (!GCTX.cgroup_ctrl_->is_valid()) {
|
||||
@ -467,6 +464,8 @@ int ObResourcePlanManager::clear_deleted_directives(const uint64_t tenant_id,
|
||||
LOG_WARN("fail to set cpu share", K(ret), K(tenant_id), K(deleted_group_id));
|
||||
} else if (OB_FAIL(GCTX.cgroup_ctrl_->set_cpu_cfs_quota(tenant_id, -1, deleted_group_id))) {
|
||||
LOG_WARN("fail to set cpu quota", K(ret), K(tenant_id), K(deleted_group_id));
|
||||
} else {
|
||||
LOG_INFO("directive cleared", K(tenant_id), K(deleted_group_id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user