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

@ -27,8 +27,6 @@ namespace oceanbase
using namespace common;
namespace lib
{
bool ObTenantMemoryMgr::error_log_when_tenant_500_oversize = false;
ObTenantMemoryMgr::ObTenantMemoryMgr()
: cache_washer_(NULL), tenant_id_(common::OB_INVALID_ID),
limit_(INT64_MAX), sum_hold_(0), rpc_hold_(0), cache_hold_(0),
@ -267,12 +265,6 @@ bool ObTenantMemoryMgr::update_hold(const int64_t size, const uint64_t ctx_id,
updated = true;
}
}
if (OB_UNLIKELY(error_log_when_tenant_500_oversize &&
OB_SERVER_TENANT_ID == tenant_id_ &&
sum_hold_ > (1LL<<30))) {
LOG_ERROR_RET(OB_ERROR, "the hold memory of tenant_500 is over the reserved memory",
K_(sum_hold));
}
}
if (!updated) {
auto &afc = g_alloc_failed_ctx();

View File

@ -31,8 +31,6 @@ class ObTenantMemoryMgr
public:
static const int64_t LARGE_REQUEST_EXTRA_MB_COUNT = 2;
static const int64_t ALIGN_SIZE = static_cast<int64_t>(INTACT_ACHUNK_SIZE);
static bool error_log_when_tenant_500_oversize;
ObTenantMemoryMgr();
ObTenantMemoryMgr(const uint64_t tenant_id);

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 ||