4G mysqltest

This commit is contained in:
tushicheng
2023-09-27 09:14:01 +00:00
committed by ob-robot
parent c6f228ce59
commit ba2ac56c8e
12 changed files with 103 additions and 65 deletions

View File

@ -411,43 +411,6 @@ int ObMallocAllocator::with_resource_handle_invoke(uint64_t tenant_id, InvokeFun
}
return ret;
}
#ifdef ENABLE_500_MEMORY_LIMIT
int ObMallocAllocator::set_500_tenant_limit(const bool unlimited)
{
int ret = OB_SUCCESS;
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 ||
ObCtxIds::CO_STACK == ctx_id ||
ObCtxIds::LIBEASY == ctx_id ||
ObCtxIds::GLIBC == ctx_id ||
ObCtxIds::LOGGER_CTX_ID== ctx_id ||
ObCtxIds::RPC_CTX_ID == ctx_id ||
ObCtxIds::UNEXPECTED_IN_500 == ctx_id) {
continue;
}
auto ta = get_tenant_ctx_allocator(OB_SERVER_TENANT_ID, ctx_id);
if (OB_NOT_NULL(ta)) {
int64_t ctx_limit = ObCtxIds::DEFAULT_CTX_ID == ctx_id ? (4LL<<30) : (50LL<<20);
if (unlimited) {
ctx_limit = INT64_MAX;
}
if (OB_FAIL(ta->set_limit(ctx_limit))) {
LIB_LOG(WARN, "set limit of 500 tenant failed", K(ret), K(ctx_limit),
"ctx_name", get_global_ctx_info().get_ctx_name(ctx_id));
} else {
LIB_LOG(INFO, "set limit of 500 tenant succeed", K(ret), K(ctx_limit),
"ctx_name", get_global_ctx_info().get_ctx_name(ctx_id));
}
} else {
ret = OB_INVALID_ARGUMENT;
LIB_LOG(WARN, "tenant ctx allocator is not exist", K(ret),
"ctx_name", get_global_ctx_info().get_ctx_name(ctx_id));
}
}
return ret;
}
#endif
int ObMallocAllocator::set_tenant_limit(uint64_t tenant_id, int64_t bytes)
{

View File

@ -122,9 +122,6 @@ public:
int64_t get_urgent() const;
void set_reserved(int64_t bytes);
int64_t get_reserved() const;
#ifdef ENABLE_500_MEMORY_LIMIT
int set_500_tenant_limit(const bool unlimited);
#endif
int set_tenant_limit(uint64_t tenant_id, int64_t bytes);
int64_t get_tenant_limit(uint64_t tenant_id);
int64_t get_tenant_hold(uint64_t tenant_id);

View File

@ -27,6 +27,8 @@ 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),
@ -265,6 +267,12 @@ 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,6 +31,7 @@ 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);