Sql audit use memory larger than expected during observer reboot period

This commit is contained in:
obdev
2023-05-06 09:42:04 +00:00
committed by ob-robot
parent 527f1b1cbb
commit 7fb78a8bcf
2 changed files with 14 additions and 2 deletions

View File

@ -40,6 +40,13 @@ int ObEliminateTask::init(const ObMySQLRequestManager *request_manager)
// can't call ObMySQLRequestManager::get_mem_limit for now, tenant not inited
// set config_mem_limit_ to 64M
config_mem_limit_ = 64 * 1024 * 1024; // 64M
common::ObConcurrentFIFOAllocator *allocator = request_manager_->get_allocator();
if (OB_ISNULL(allocator)) {
ret = OB_NOT_INIT;
LOG_WARN("request manager allocator not init", K(ret));
} else {
allocator->set_total_limit(config_mem_limit_);
}
disable_timeout_check();
}
return ret;
@ -145,7 +152,11 @@ void ObEliminateTask::runTimerTask()
LOG_WARN("fail to get sql audit evict memory level", K(ret));
} else {
int64_t queue_size = request_manager_->get_capacity();
release_cnt = queue_size * ObMySQLRequestManager::BATCH_RELEASE_PERCENTAGE;
bool use_mini_queue = lib::is_mini_mode() || MTL_IS_MINI_MODE()
|| is_meta_tenant(request_manager_->get_tenant_id());
release_cnt = use_mini_queue
? ObMySQLRequestManager::MINI_MODE_BATCH_RELEASE_SIZE
: ObMySQLRequestManager::BATCH_RELEASE_SIZE;
evict_high_size_level = queue_size * ObMySQLRequestManager::HIGH_LEVEL_EVICT_PERCENTAGE;
evict_low_size_level = queue_size * ObMySQLRequestManager::LOW_LEVEL_EVICT_PERCENTAGE;
allocator = request_manager_->get_allocator();

View File

@ -82,7 +82,8 @@ public:
static constexpr float HIGH_LEVEL_EVICT_PERCENTAGE = 0.9; // 90%
static constexpr float LOW_LEVEL_EVICT_PERCENTAGE = 0.8; // 80%
//每进行一次release_old操作删除的sql_audit百分比
static constexpr float BATCH_RELEASE_PERCENTAGE = 0.005; //0.005
static const int64_t BATCH_RELEASE_SIZE = 50000; //5w
static const int64_t MINI_MODE_BATCH_RELEASE_SIZE = 5000; //5k
//启动淘汰检查的时间间隔
static const int64_t EVICT_INTERVAL = 1000000; //1s
typedef common::ObRaQueue::Ref Ref;