[FIX] set last_update_limit_ts to 0 when construct throttle unit
This commit is contained in:
@ -77,13 +77,16 @@ void FakeAllocatorForTxShare::adaptive_update_limit(const int64_t tenant_id,
|
||||
|
||||
int64_t cur_ts = ObClockGenerator::getClock();
|
||||
int64_t old_ts = last_update_limit_ts;
|
||||
if ((cur_ts - old_ts > UPDATE_LIMIT_INTERVAL) && ATOMIC_BCAS(&last_update_limit_ts, old_ts, cur_ts)) {
|
||||
if (OB_UNLIKELY(old_ts - cur_ts > UPDATE_LIMIT_INTERVAL)) {
|
||||
SHARE_LOG_RET(ERROR, OB_ERR_UNEXPECTED, "invalid timestamp", K(cur_ts), K(old_ts));
|
||||
} else if ((cur_ts - old_ts > UPDATE_LIMIT_INTERVAL) && ATOMIC_BCAS(&last_update_limit_ts, old_ts, cur_ts)) {
|
||||
int64_t remain_memory = lib::get_tenant_memory_remain(tenant_id);
|
||||
int64_t usable_remain_memory = remain_memory / 100 * USABLE_REMAIN_MEMORY_PERCETAGE;
|
||||
if (remain_memory > MAX_UNUSABLE_MEMORY) {
|
||||
usable_remain_memory = std::max(usable_remain_memory, remain_memory - MAX_UNUSABLE_MEMORY);
|
||||
}
|
||||
|
||||
|
||||
is_updated = false;
|
||||
if (holding_size + usable_remain_memory < config_specify_resource_limit) {
|
||||
resource_limit = holding_size + usable_remain_memory;
|
||||
|
@ -73,6 +73,8 @@ public:
|
||||
throttle_max_duration_(0),
|
||||
last_advance_clock_ts_us_(0),
|
||||
last_print_throttle_info_ts_(0),
|
||||
last_update_limit_ts_(0),
|
||||
tenant_id_(0),
|
||||
decay_factor_(0),
|
||||
throttle_info_map_() {}
|
||||
~ObThrottleUnit() {}
|
||||
@ -138,6 +140,9 @@ public:
|
||||
int64_t expected_wait_time(share::ObThrottleInfoGuard &ti_guard, const int64_t holding_size);
|
||||
|
||||
TO_STRING_KV(K(unit_name_),
|
||||
K(is_inited_),
|
||||
K(enable_adaptive_limit_),
|
||||
K(config_specify_resource_limit_),
|
||||
K(resource_limit_),
|
||||
K(sequence_num_),
|
||||
K(clock_),
|
||||
@ -145,7 +150,10 @@ public:
|
||||
K(throttle_trigger_percentage_),
|
||||
K(throttle_max_duration_),
|
||||
K(last_advance_clock_ts_us_),
|
||||
K(last_print_throttle_info_ts_),
|
||||
K(last_update_limit_ts_),
|
||||
K(decay_factor_));
|
||||
|
||||
public: // throttle configs setter
|
||||
void enable_adaptive_limit();
|
||||
void set_throttle_trigger_percentage(const int64_t throttle_trigger_percentage);
|
||||
|
Reference in New Issue
Block a user