[FIX] updating throttle config when unit memory is changed
This commit is contained in:
@ -1169,6 +1169,8 @@ int ObMultiTenant::update_tenant_memory(const ObUnitInfoGetter::ObTenantConfig &
|
||||
LOG_WARN("fail to update tenant memory", K(ret), K(tenant_id));
|
||||
} else if (OB_FAIL(update_tenant_freezer_mem_limit(tenant_id, memory_size, allowed_mem_limit))) {
|
||||
LOG_WARN("fail to update_tenant_freezer_mem_limit", K(ret), K(tenant_id));
|
||||
} else if (OB_FAIL(update_throttle_config_(tenant_id))) {
|
||||
LOG_WARN("update throttle config failed", K(ret), K(tenant_id));
|
||||
} else if (FALSE_IT(tenant->set_unit_memory_size(allowed_mem_limit))) {
|
||||
// unreachable
|
||||
}
|
||||
@ -1309,8 +1311,8 @@ int ObMultiTenant::update_tenant_config(uint64_t tenant_id)
|
||||
if (OB_TMP_FAIL(update_tenant_freezer_config_())) {
|
||||
LOG_WARN("failed to update tenant tenant freezer config", K(tmp_ret), K(tenant_id));
|
||||
}
|
||||
if (OB_TMP_FAIL(update_throttle_config_())) {
|
||||
|
||||
if (OB_TMP_FAIL(update_throttle_config_(tenant_id))) {
|
||||
LOG_WARN("update throttle config failed", K(ret), K(tenant_id));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1376,16 +1378,19 @@ int ObMultiTenant::update_tenant_freezer_config_()
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObMultiTenant::update_throttle_config_()
|
||||
int ObMultiTenant::update_throttle_config_(const uint64_t tenant_id)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObSharedMemAllocMgr *share_mem_alloc_mgr = MTL(ObSharedMemAllocMgr *);
|
||||
|
||||
if (OB_ISNULL(share_mem_alloc_mgr)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_ERROR("share mem alloc mgr should not be null", K(ret));
|
||||
} else {
|
||||
(void)share_mem_alloc_mgr->update_throttle_config();
|
||||
MTL_SWITCH(tenant_id) {
|
||||
ObSharedMemAllocMgr *share_mem_alloc_mgr = MTL(ObSharedMemAllocMgr *);
|
||||
|
||||
if (OB_ISNULL(share_mem_alloc_mgr)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_ERROR("share mem alloc mgr should not be null", K(ret));
|
||||
} else {
|
||||
(void)share_mem_alloc_mgr->update_throttle_config();
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ protected:
|
||||
|
||||
private:
|
||||
int update_tenant_freezer_config_();
|
||||
int update_throttle_config_();
|
||||
int update_throttle_config_(const uint64_t tenant_id);
|
||||
protected:
|
||||
static const int DEL_TRY_TIMES = 30;
|
||||
enum class ObTenantCreateStep {
|
||||
|
@ -51,41 +51,60 @@ void ObSharedMemAllocMgr::update_throttle_config()
|
||||
int64_t tx_data_limit = total_memory * tx_data_limit_percentage / 100LL;
|
||||
int64_t mds_limit = total_memory * mds_limit_percentage / 100LL;
|
||||
|
||||
bool share_config_changed = false;
|
||||
(void)share_resource_throttle_tool_.update_throttle_config<FakeAllocatorForTxShare>(
|
||||
share_mem_limit, trigger_percentage, max_duration);
|
||||
(void)share_resource_throttle_tool_.update_throttle_config<ObMemstoreAllocator>(
|
||||
memstore_limit, trigger_percentage, max_duration);
|
||||
(void)share_resource_throttle_tool_.update_throttle_config<ObTenantTxDataAllocator>(
|
||||
tx_data_limit, trigger_percentage, max_duration);
|
||||
(void)share_resource_throttle_tool_.update_throttle_config<ObTenantMdsAllocator>(
|
||||
mds_limit, trigger_percentage, max_duration);
|
||||
share_mem_limit, trigger_percentage, max_duration, share_config_changed);
|
||||
|
||||
SHARE_LOG(INFO,
|
||||
"[Throttle] Update Config",
|
||||
K(share_mem_limit_percentage),
|
||||
K(memstore_limit_percentage),
|
||||
K(tx_data_limit_percentage),
|
||||
K(mds_limit_percentage),
|
||||
K(trigger_percentage),
|
||||
K(max_duration));
|
||||
SHARE_LOG(INFO,
|
||||
"[Throttle] Update Config",
|
||||
THROTTLE_CONFIG_LOG(FakeAllocatorForTxShare, share_mem_limit, trigger_percentage, max_duration));
|
||||
SHARE_LOG(INFO,
|
||||
"[Throttle] Update Config",
|
||||
THROTTLE_CONFIG_LOG(ObMemstoreAllocator, memstore_limit, trigger_percentage, max_duration));
|
||||
SHARE_LOG(INFO,
|
||||
"[Throttle] Update Config",
|
||||
THROTTLE_CONFIG_LOG(ObTenantTxDataAllocator, tx_data_limit, trigger_percentage, max_duration));
|
||||
SHARE_LOG(INFO,
|
||||
"[Throttle] Update Config",
|
||||
THROTTLE_CONFIG_LOG(ObTenantMdsAllocator, mds_limit, trigger_percentage, max_duration));
|
||||
bool memstore_config_changed = false;
|
||||
(void)share_resource_throttle_tool_.update_throttle_config<ObMemstoreAllocator>(
|
||||
memstore_limit, trigger_percentage, max_duration, memstore_config_changed);
|
||||
|
||||
bool tx_data_config_changed = false;
|
||||
(void)share_resource_throttle_tool_.update_throttle_config<ObTenantTxDataAllocator>(
|
||||
tx_data_limit, trigger_percentage, max_duration, tx_data_config_changed);
|
||||
|
||||
bool mds_config_changed = false;
|
||||
(void)share_resource_throttle_tool_.update_throttle_config<ObTenantMdsAllocator>(
|
||||
mds_limit, trigger_percentage, max_duration, mds_config_changed);
|
||||
|
||||
if (share_config_changed || memstore_config_changed || tx_data_config_changed || mds_config_changed) {
|
||||
SHARE_LOG(INFO,
|
||||
"[Throttle] Update Config",
|
||||
K(share_mem_limit_percentage),
|
||||
K(memstore_limit_percentage),
|
||||
K(tx_data_limit_percentage),
|
||||
K(mds_limit_percentage),
|
||||
K(trigger_percentage),
|
||||
K(max_duration));
|
||||
|
||||
if (share_config_changed) {
|
||||
SHARE_LOG(INFO,
|
||||
"[Throttle] Update Config",
|
||||
THROTTLE_CONFIG_LOG(FakeAllocatorForTxShare, share_mem_limit, trigger_percentage, max_duration));
|
||||
}
|
||||
|
||||
if (memstore_config_changed) {
|
||||
SHARE_LOG(INFO,
|
||||
"[Throttle] Update Config",
|
||||
THROTTLE_CONFIG_LOG(ObMemstoreAllocator, memstore_limit, trigger_percentage, max_duration));
|
||||
}
|
||||
|
||||
if (tx_data_config_changed) {
|
||||
SHARE_LOG(INFO,
|
||||
"[Throttle] Update Config",
|
||||
THROTTLE_CONFIG_LOG(ObTenantTxDataAllocator, tx_data_limit, trigger_percentage, max_duration));
|
||||
}
|
||||
|
||||
if (mds_config_changed) {
|
||||
SHARE_LOG(INFO,
|
||||
"[Throttle] Update Config",
|
||||
THROTTLE_CONFIG_LOG(ObTenantMdsAllocator, mds_limit, trigger_percentage, max_duration));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
SHARE_LOG_RET(WARN, OB_INVALID_CONFIG, "invalid tenant config", K(tenant_id), K(total_memory));
|
||||
}
|
||||
}
|
||||
|
||||
#undef UPDATE_BY_CONFIG_NAME
|
||||
|
||||
} // namespace share
|
||||
} // namespace oceanbase
|
||||
|
@ -109,7 +109,8 @@ public:
|
||||
template <typename ALLOCATOR>
|
||||
void update_throttle_config(const int64_t resource_limit,
|
||||
const int64_t trigger_percentage,
|
||||
const int64_t max_duration);
|
||||
const int64_t max_duration,
|
||||
bool &config_changed);
|
||||
|
||||
template <typename ALLOCATOR>
|
||||
void enable_adaptive_limit();
|
||||
|
@ -305,10 +305,11 @@ template <typename FakeAllocator, typename... Args>
|
||||
template <typename ALLOCATOR>
|
||||
void ObShareResourceThrottleTool<FakeAllocator, Args...>::update_throttle_config(const int64_t resource_limit,
|
||||
const int64_t trigger_percentage,
|
||||
const int64_t max_duration)
|
||||
const int64_t max_duration,
|
||||
bool &config_changed)
|
||||
{
|
||||
ACQUIRE_THROTTLE_UNIT(ALLOCATOR, throttle_unit);
|
||||
(void)throttle_unit.update_throttle_config(resource_limit, trigger_percentage, max_duration);
|
||||
(void)throttle_unit.update_throttle_config(resource_limit, trigger_percentage, max_duration, config_changed);
|
||||
}
|
||||
|
||||
#undef ACQUIRE_THROTTLE_UNIT
|
||||
|
@ -153,7 +153,8 @@ public: // throttle configs setter
|
||||
void set_resource_limit(const int64_t resource_limit);
|
||||
void update_throttle_config(const int64_t resource_limit,
|
||||
const int64_t throttle_trigger_percentage,
|
||||
const int64_t throttle_max_duration);
|
||||
const int64_t throttle_max_duration,
|
||||
bool &config_changed);
|
||||
|
||||
private:
|
||||
int get_throttle_info_(const ThrottleID &throttle_id, share::ObThrottleInfoGuard &ti_guard);
|
||||
|
@ -474,8 +474,10 @@ void ObThrottleUnit<ALLOCATOR>::set_throttle_max_duration(const int64_t value)
|
||||
template <typename ALLOCATOR>
|
||||
void ObThrottleUnit<ALLOCATOR>::update_throttle_config(const int64_t resource_limit,
|
||||
const int64_t throttle_trigger_percentage,
|
||||
const int64_t throttle_max_duration)
|
||||
const int64_t throttle_max_duration,
|
||||
bool &config_changed)
|
||||
{
|
||||
config_changed = false;
|
||||
if (resource_limit < 0 || throttle_trigger_percentage <= 0 || throttle_trigger_percentage > 100 ||
|
||||
throttle_max_duration <= 0) {
|
||||
int ret = OB_INVALID_ARGUMENT;
|
||||
@ -484,7 +486,10 @@ void ObThrottleUnit<ALLOCATOR>::update_throttle_config(const int64_t resource_li
|
||||
K(resource_limit),
|
||||
K(throttle_trigger_percentage),
|
||||
K(throttle_max_duration));
|
||||
} else {
|
||||
} else if (config_specify_resource_limit_ != resource_limit ||
|
||||
throttle_trigger_percentage_ != throttle_trigger_percentage ||
|
||||
throttle_max_duration_ != throttle_max_duration) {
|
||||
config_changed = true;
|
||||
throttle_trigger_percentage_ = throttle_trigger_percentage;
|
||||
throttle_max_duration_ = throttle_max_duration;
|
||||
(void)inner_set_resource_limit_(resource_limit);
|
||||
|
Reference in New Issue
Block a user