[CP] alter server_cpu_quota_max/server_cpu_quota_min dynamic_effective
This commit is contained in:
@ -880,10 +880,10 @@ int ObServer::start()
|
|||||||
FLOG_INFO("success to start log pool");
|
FLOG_INFO("success to start log pool");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FAILEDx(try_create_hidden_sys())) {
|
if (FAILEDx(try_update_hidden_sys())) {
|
||||||
LOG_ERROR("fail to create hidden sys tenant", KR(ret));
|
LOG_ERROR("fail to update hidden sys tenant", KR(ret));
|
||||||
} else {
|
} else {
|
||||||
FLOG_INFO("success to create hidden sys tenant");
|
FLOG_INFO("success to update hidden sys tenant");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FAILEDx(weak_read_service_.start())) {
|
if (FAILEDx(weak_read_service_.start())) {
|
||||||
@ -1088,12 +1088,24 @@ int ObServer::start()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// try create hidden sys tenant must after ObServerCheckpointSlogHandler start,
|
// try create hidden sys tenant must after ObServerCheckpointSlogHandler start,
|
||||||
// no need create if real sys has been replayed out from slog.
|
// update hidden sys tenant unit if it exists
|
||||||
int ObServer::try_create_hidden_sys()
|
int ObServer::try_update_hidden_sys()
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
if (OB_FAIL(multi_tenant_.create_hidden_sys_tenant())) {
|
const uint64_t tenant_id = OB_SYS_TENANT_ID;
|
||||||
LOG_ERROR("fail to create hidden sys tenant", KR(ret));
|
omt::ObTenant *tenant = nullptr;
|
||||||
|
if (OB_FAIL(multi_tenant_.get_tenant(tenant_id, tenant))) {
|
||||||
|
if (OB_TENANT_NOT_IN_SERVER == ret) { // only when adding a new server
|
||||||
|
ret = OB_SUCCESS;
|
||||||
|
if (OB_FAIL(multi_tenant_.create_hidden_sys_tenant())) {
|
||||||
|
LOG_ERROR("fail to create hidden sys tenant", KR(ret));
|
||||||
|
}
|
||||||
|
LOG_INFO("finish create hidden sys", KR(ret));
|
||||||
|
} else {
|
||||||
|
LOG_ERROR("fail to get tenant", KR(ret));
|
||||||
|
}
|
||||||
|
} else if (OB_FAIL(multi_tenant_.update_hidden_sys_tenant())) {
|
||||||
|
LOG_WARN("fail to update hidden sys tenant unit", KR(ret));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -297,7 +297,7 @@ private:
|
|||||||
int set_running_mode();
|
int set_running_mode();
|
||||||
void check_user_tenant_schema_refreshed(const common::ObIArray<uint64_t> &tenant_ids, const int64_t expire_time);
|
void check_user_tenant_schema_refreshed(const common::ObIArray<uint64_t> &tenant_ids, const int64_t expire_time);
|
||||||
void check_log_replay_over(const common::ObIArray<uint64_t> &tenant_ids, const int64_t expire_time);
|
void check_log_replay_over(const common::ObIArray<uint64_t> &tenant_ids, const int64_t expire_time);
|
||||||
int try_create_hidden_sys();
|
int try_update_hidden_sys();
|
||||||
int parse_mode();
|
int parse_mode();
|
||||||
|
|
||||||
// ------------------------------- arb server start ------------------------------------
|
// ------------------------------- arb server start ------------------------------------
|
||||||
|
|||||||
@ -683,24 +683,39 @@ int ObMultiTenant::create_hidden_sys_tenant()
|
|||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
const uint64_t tenant_id = OB_SYS_TENANT_ID;
|
const uint64_t tenant_id = OB_SYS_TENANT_ID;
|
||||||
omt::ObTenant *tenant;
|
omt::ObTenant *tenant = nullptr;
|
||||||
ObTenantMeta meta;
|
ObTenantMeta meta;
|
||||||
if (OB_FAIL(construct_meta_for_hidden_sys(meta))) {
|
if (OB_FAIL(construct_meta_for_hidden_sys(meta))) {
|
||||||
LOG_ERROR("fail to construct meta", K(ret));
|
LOG_ERROR("fail to construct meta", K(ret));
|
||||||
|
} else if (OB_FAIL(create_tenant(meta, true /* write_slog */))) {
|
||||||
|
LOG_ERROR("create hidden sys tenant failed", K(ret));
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ObMultiTenant::update_hidden_sys_tenant()
|
||||||
|
{
|
||||||
|
int ret = OB_SUCCESS;
|
||||||
|
const uint64_t tenant_id = OB_SYS_TENANT_ID;
|
||||||
|
omt::ObTenant *tenant = nullptr;
|
||||||
|
ObTenantMeta meta;
|
||||||
|
if (OB_FAIL(get_tenant(tenant_id, tenant))) { // sys tenant will not be deleted
|
||||||
|
LOG_WARN("failed to get sys tenant", K(ret));
|
||||||
|
} else if (OB_FAIL(construct_meta_for_hidden_sys(meta))) {
|
||||||
|
LOG_ERROR("fail to construct meta", K(ret));
|
||||||
} else {
|
} else {
|
||||||
if (OB_FAIL(get_tenant(tenant_id, tenant))) {
|
int64_t bucket_lock_idx = -1;
|
||||||
ret = OB_SUCCESS;
|
bool lock_succ = false;
|
||||||
if (OB_FAIL(create_tenant(meta, true/* write_slog */))) {
|
if (OB_FAIL(bucket_lock_.wrlock(bucket_lock_idx = get_tenant_lock_bucket_idx(tenant_id)))) {
|
||||||
LOG_ERROR("create hidden sys tenant failed", K(ret));
|
LOG_WARN("fail to try_wrlock for update tenant unit", K(ret), K(tenant_id), K(bucket_lock_idx));
|
||||||
}
|
} else if (FALSE_IT(lock_succ = true)) {
|
||||||
LOG_INFO("finish create hidden sys", KR(ret));
|
} else if (!tenant->is_hidden() || meta.unit_ == tenant->get_unit()) {
|
||||||
} else if(tenant->is_hidden()){
|
// do nothing
|
||||||
if (OB_SUCC(ret) && !(meta.unit_ == tenant->get_unit())) {
|
} else if (OB_FAIL(update_tenant_unit_no_lock(meta.unit_))) {
|
||||||
if (OB_FAIL(GCTX.omt_->update_tenant_unit_no_lock(meta.unit_))) {
|
LOG_WARN("fail to update tenant unit", K(ret), K(tenant_id));
|
||||||
LOG_WARN("fail to update tenant unit", K(ret), K(tenant_id));
|
}
|
||||||
}
|
if (lock_succ) {
|
||||||
}
|
bucket_lock_.unlock(bucket_lock_idx);
|
||||||
LOG_INFO("sys tenant has been created, no need create hidden sys");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
@ -90,6 +90,7 @@ public:
|
|||||||
void destroy();
|
void destroy();
|
||||||
|
|
||||||
int create_hidden_sys_tenant();
|
int create_hidden_sys_tenant();
|
||||||
|
int update_hidden_sys_tenant();
|
||||||
int convert_hidden_to_real_sys_tenant(const share::ObUnitInfoGetter::ObTenantConfig &unit, const int64_t abs_timeout_us = INT64_MAX);
|
int convert_hidden_to_real_sys_tenant(const share::ObUnitInfoGetter::ObTenantConfig &unit, const int64_t abs_timeout_us = INT64_MAX);
|
||||||
int create_tenant_without_unit(const uint64_t tenant_id, const double min_cpu, const double max_cpu);
|
int create_tenant_without_unit(const uint64_t tenant_id, const double min_cpu, const double max_cpu);
|
||||||
int create_tenant(const ObTenantMeta &meta, bool write_slog, const int64_t abs_timeout_us = INT64_MAX);
|
int create_tenant(const ObTenantMeta &meta, bool write_slog, const int64_t abs_timeout_us = INT64_MAX);
|
||||||
|
|||||||
@ -103,6 +103,8 @@ int ObConfigManager::reload_config()
|
|||||||
LOG_WARN("reload config for mysql login thread count failed", K(ret));
|
LOG_WARN("reload config for mysql login thread count failed", K(ret));
|
||||||
} else if (OB_FAIL(ObTdeEncryptEngineLoader::get_instance().reload_config())) {
|
} else if (OB_FAIL(ObTdeEncryptEngineLoader::get_instance().reload_config())) {
|
||||||
LOG_WARN("reload config for tde encrypt engine fail", K(ret));
|
LOG_WARN("reload config for tde encrypt engine fail", K(ret));
|
||||||
|
} else if (OB_FAIL(GCTX.omt_->update_hidden_sys_tenant())) {
|
||||||
|
LOG_WARN("update hidden sys tenant failed", K(ret));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -284,11 +284,11 @@ DEF_BOOL(enable_monotonic_weak_read, OB_TENANT_PARAMETER, "false",
|
|||||||
DEF_DBL(server_cpu_quota_min, OB_CLUSTER_PARAMETER, "0", "[0,16]",
|
DEF_DBL(server_cpu_quota_min, OB_CLUSTER_PARAMETER, "0", "[0,16]",
|
||||||
"the number of minimal vCPUs allocated to the server tenant"
|
"the number of minimal vCPUs allocated to the server tenant"
|
||||||
"(a special internal tenant that exists on every observer). 0 stands for adaptive. Range: [0, 16]",
|
"(a special internal tenant that exists on every observer). 0 stands for adaptive. Range: [0, 16]",
|
||||||
ObParameterAttr(Section::TENANT, Source::DEFAULT, EditLevel::STATIC_EFFECTIVE));
|
ObParameterAttr(Section::TENANT, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
|
||||||
DEF_DBL(server_cpu_quota_max, OB_CLUSTER_PARAMETER, "0", "[0,16]",
|
DEF_DBL(server_cpu_quota_max, OB_CLUSTER_PARAMETER, "0", "[0,16]",
|
||||||
"the number of maximal vCPUs allocated to the server tenant"
|
"the number of maximal vCPUs allocated to the server tenant"
|
||||||
"(a special internal tenant that exists on every observer). 0 stands for adaptive. Range: [0, 16]",
|
"(a special internal tenant that exists on every observer). 0 stands for adaptive. Range: [0, 16]",
|
||||||
ObParameterAttr(Section::TENANT, Source::DEFAULT, EditLevel::STATIC_EFFECTIVE));
|
ObParameterAttr(Section::TENANT, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
|
||||||
DEF_CAP_WITH_CHECKER(_hidden_sys_tenant_memory, OB_CLUSTER_PARAMETER, "0M",
|
DEF_CAP_WITH_CHECKER(_hidden_sys_tenant_memory, OB_CLUSTER_PARAMETER, "0M",
|
||||||
common::ObConfigTenantMemoryChecker, "[0M,)",
|
common::ObConfigTenantMemoryChecker, "[0M,)",
|
||||||
"the size of the memory reserved for hidden sys tenant, 0M means follow the adjusting value.",
|
"the size of the memory reserved for hidden sys tenant, 0M means follow the adjusting value.",
|
||||||
|
|||||||
Reference in New Issue
Block a user