limit memory of tenant 500

This commit is contained in:
obdev
2024-02-06 17:26:16 +00:00
committed by ob-robot
parent 7e8d65c1c1
commit 85e87077a2
3 changed files with 7 additions and 14 deletions

View File

@ -405,18 +405,21 @@ int ObServerMemoryConfig::set_500_tenant_limit(const int64_t limit_mode)
int ret = OB_SUCCESS;
bool unlimited = false;
auto ma = ObMallocAllocator::get_instance();
int64_t tenant_limit = INT64_MAX;
ObMallocAllocator *ma = ObMallocAllocator::get_instance();
if (UNLIMIT_MODE == limit_mode) {
unlimited = true;
ObTenantMemoryMgr::error_log_when_tenant_500_oversize = false;
} else if (CTX_LIMIT_MODE == limit_mode) {
ObTenantMemoryMgr::error_log_when_tenant_500_oversize = false;
// do-nothing
} else if (TENANT_LIMIT_MODE == limit_mode) {
ObTenantMemoryMgr::error_log_when_tenant_500_oversize = true;
tenant_limit = system_memory_ - get_extra_memory();
} else {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("invalid limit mode", K(ret), K(limit_mode));
}
if (OB_SUCC(ret)) {
set_tenant_memory_limit(OB_SERVER_TENANT_ID, tenant_limit);
}
for (int ctx_id = 0; OB_SUCC(ret) && ctx_id < ObCtxIds::MAX_CTX_ID; ++ctx_id) {
if (ObCtxIds::SCHEMA_SERVICE == ctx_id ||
ObCtxIds::PKT_NIO == ctx_id ||