BUGFIX: change memstore_limit to tenant level
This commit is contained in:
@ -9965,6 +9965,8 @@ int ObRootService::set_config_pre_hook(obrpc::ObAdminSetConfigArg &arg)
|
||||
ret = check_tx_share_memory_limit_(*item);
|
||||
} else if (0 == STRCMP(item->name_.ptr(), MEMSTORE_LIMIT_PERCENTAGE)) {
|
||||
ret = check_memstore_limit_(*item);
|
||||
} else if (0 == STRCMP(item->name_.ptr(), TENANT_MEMSTORE_LIMIT_PERCENTAGE)) {
|
||||
ret = check_tenant_memstore_limit_(*item);
|
||||
} else if (0 == STRCMP(item->name_.ptr(), _TX_DATA_MEMORY_LIMIT_PERCENTAGE)) {
|
||||
ret = check_tx_data_memory_limit_(*item);
|
||||
} else if (0 == STRCMP(item->name_.ptr(), _MDS_MEMORY_LIMIT_PERCENTAGE)) {
|
||||
@ -10066,6 +10068,19 @@ int ObRootService::set_config_pre_hook(obrpc::ObAdminSetConfigArg &arg)
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define CHECK_CLUSTER_CONFIG_WITH_FUNC(FUNCTOR, LOG_INFO) \
|
||||
do { \
|
||||
bool valid = true; \
|
||||
for (int i = 0; i < tenant_ids.count() && valid; i++) { \
|
||||
valid = valid && FUNCTOR::check(tenant_ids.at(i), item); \
|
||||
if (!valid) { \
|
||||
ret = OB_INVALID_ARGUMENT; \
|
||||
LOG_USER_ERROR(OB_INVALID_ARGUMENT, LOG_INFO); \
|
||||
LOG_WARN("config invalid", "item", item, K(ret), K(i), K(tenant_ids.at(i))); \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
int ObRootService::check_tx_share_memory_limit_(obrpc::ObAdminSetConfigItem &item)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
@ -10079,9 +10094,32 @@ int ObRootService::check_tx_share_memory_limit_(obrpc::ObAdminSetConfigItem &ite
|
||||
int ObRootService::check_memstore_limit_(obrpc::ObAdminSetConfigItem &item)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
const char *warn_log = "tenant config memstore_limit_percentage. "
|
||||
"It should less than or equal with _tx_share_memory_limit_percentage";
|
||||
CHECK_TENANTS_CONFIG_WITH_FUNC(ObConfigTxDataLimitChecker, warn_log);
|
||||
const char *warn_log = "cluster config memstore_limit_percentage. "
|
||||
"It should less than or equal with all tenant's _tx_share_memory_limit_percentage";
|
||||
ObArray<uint64_t> tenant_ids;
|
||||
ObSchemaGetterGuard schema_guard;
|
||||
if (OB_UNLIKELY(!inited_)) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("not inited", KR(ret));
|
||||
} else if (OB_ISNULL(schema_service_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("schema service is null", KR(ret));
|
||||
} else if (OB_FAIL(schema_service_->get_tenant_schema_guard(OB_SYS_TENANT_ID, schema_guard))) {
|
||||
LOG_WARN("get schema guard failed", KR(ret));
|
||||
} else if (OB_FAIL(schema_guard.get_tenant_ids(tenant_ids))) {
|
||||
LOG_WARN("failed to get all tenant ids", KR(ret), K(tenant_ids));
|
||||
} else {
|
||||
CHECK_CLUSTER_CONFIG_WITH_FUNC(ObConfigMemstoreLimitChecker, warn_log);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObRootService::check_tenant_memstore_limit_(obrpc::ObAdminSetConfigItem &item)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
const char *warn_log = "tenant config _memstore_limit_percentage. "
|
||||
"It should less than or equal with _tx_share_memory_limit_percentage";
|
||||
CHECK_TENANTS_CONFIG_WITH_FUNC(ObConfigMemstoreLimitChecker, warn_log);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -10122,6 +10160,7 @@ int ObRootService::check_write_throttle_trigger_percentage(obrpc::ObAdminSetConf
|
||||
}
|
||||
|
||||
#undef CHECK_TENANTS_CONFIG_WITH_FUNC
|
||||
#undef CHECK_CLUSTER_CONFIG_WITH_FUNC
|
||||
|
||||
int ObRootService::set_config_post_hook(const obrpc::ObAdminSetConfigArg &arg)
|
||||
{
|
||||
|
||||
@ -905,6 +905,7 @@ private:
|
||||
|
||||
int check_tx_share_memory_limit_(obrpc::ObAdminSetConfigItem &item);
|
||||
int check_memstore_limit_(obrpc::ObAdminSetConfigItem &item);
|
||||
int check_tenant_memstore_limit_(obrpc::ObAdminSetConfigItem &item);
|
||||
int check_tx_data_memory_limit_(obrpc::ObAdminSetConfigItem &item);
|
||||
int check_mds_memory_limit_(obrpc::ObAdminSetConfigItem &item);
|
||||
int check_freeze_trigger_percentage_(obrpc::ObAdminSetConfigItem &item);
|
||||
|
||||
Reference in New Issue
Block a user