[FIX] use getClock insteat of getCurrentTime

This commit is contained in:
ZenoWang 2024-02-07 20:13:18 +00:00 committed by ob-robot
parent f3e0f2fa6b
commit 5050a64f7c
7 changed files with 12 additions and 12 deletions

View File

@ -218,7 +218,7 @@ void ObShareResourceThrottleTool<FakeAllocator, Args...>::do_throttle(const int6
{
int ret = OB_SUCCESS;
int64_t left_interval = (0 == abs_expire_time ? ObThrottleUnit<ALLOCATOR>::DEFAULT_MAX_THROTTLE_TIME
: abs_expire_time - ObClockGenerator::getCurrentTime());
: abs_expire_time - ObClockGenerator::getClock());
int64_t sleep_time = 0;
ObThrottleInfoGuard share_ti_guard;
ObThrottleInfoGuard module_ti_guard;

View File

@ -69,11 +69,11 @@ void FakeAllocatorForTxShare::adaptive_update_limit(const int64_t holding_size,
int64_t &last_update_limit_ts,
bool &is_updated)
{
static const int64_t UPDATE_LIMIT_INTERVAL = 50LL * 1000LL; // 50 ms
static const int64_t UPDATE_LIMIT_INTERVAL = 100LL * 1000LL; // 100 ms
static const int64_t USABLE_REMAIN_MEMORY_PERCETAGE = 60;
static const int64_t MAX_UNUSABLE_MEMORY = 2LL * 1024LL * 1024LL * 1024LL; // 2 GB
int64_t cur_ts = ObClockGenerator::getCurrentTime();
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)) {
int64_t remain_memory = lib::get_tenant_memory_remain(MTL_ID());

View File

@ -152,7 +152,7 @@ void ObThrottleUnit<ALLOCATOR>::print_throttle_info_(const int64_t holding_size,
const int64_t PRINT_THROTTLE_INFO_INTERVAL = 1L * 1000L * 1000L; // one second
int64_t last_print_ts = last_print_throttle_info_ts_;
int64_t current_ts = ObClockGenerator::getCurrentTime();
int64_t current_ts = ObClockGenerator::getClock();
if (current_ts - last_print_ts > PRINT_THROTTLE_INFO_INTERVAL &&
ATOMIC_BCAS(&last_print_throttle_info_ts_, last_print_ts, current_ts)) {
// release_speed means the allocated resource size per second
@ -190,14 +190,14 @@ int ObThrottleUnit<ALLOCATOR>::inner_get_throttle_info_(share::ObThrottleInfo *&
if (OB_ENTRY_NOT_EXIST == ret) {
ret = OB_SUCCESS;
if (0 == abs_expire_time) {
abs_expire_time = DEFAULT_MAX_THROTTLE_TIME + ObClockGenerator::getCurrentTime();
abs_expire_time = DEFAULT_MAX_THROTTLE_TIME + ObClockGenerator::getClock();
}
if (OB_FAIL(throttle_info_map_.alloc_value(throttle_info))) {
if (OB_ALLOCATE_MEMORY_FAILED == ret) {
if (REACH_TIME_INTERVAL(10L * 1000L * 1000L)) {
SHARE_LOG(WARN, "allocate throttle info failed", KR(ret), K(tid));
}
if (ObClockGenerator::getCurrentTime() > abs_expire_time) {
if (ObClockGenerator::getClock() > abs_expire_time) {
SHARE_LOG(WARN, "allocate throttle info failed", KR(ret), K(tid));
} else {
// sleep 10 ms and retry
@ -267,7 +267,7 @@ void ObThrottleUnit<ALLOCATOR>::update_decay_factor_(const bool is_adaptive_upda
template <typename ALLOCATOR>
void ObThrottleUnit<ALLOCATOR>::advance_clock(const int64_t holding_size)
{
int64_t cur_ts = ObClockGenerator::getCurrentTime();
int64_t cur_ts = ObClockGenerator::getClock();
int64_t old_ts = last_advance_clock_ts_us_;
const int64_t advance_us = cur_ts - old_ts;
if ((advance_us > ADVANCE_CLOCK_INTERVAL) && ATOMIC_BCAS(&last_advance_clock_ts_us_, old_ts, cur_ts)) {

View File

@ -123,7 +123,7 @@ void ObStorageTableGuard::do_throttle_(TxShareThrottleTool &throttle_tool,
int64_t left_interval = INT64_MAX;
if (!for_replay_) {
left_interval = min(left_interval, store_ctx_.timeout_ - ObClockGenerator::getCurrentTime());
left_interval = min(left_interval, store_ctx_.timeout_ - ObClockGenerator::getClock());
}
while (throttle_tool.still_throttling<ObMemstoreAllocator>(share_ti_guard, module_ti_guard) && (left_interval > 0)) {

View File

@ -329,7 +329,7 @@ int ObTxDataMemtable::pre_process_commit_version_row_(ObTxData *fake_tx_data)
ObCommitVersionsArray past_commit_versions;
ObCommitVersionsArray merged_commit_versions;
int64_t current_time = ObClockGenerator::getCurrentTime();
int64_t current_time = ObClockGenerator::getClock();
int64_t prev_recycle_time = memtable_mgr_->get_mini_merge_recycle_commit_versions_ts();
if (current_time - prev_recycle_time < MINI_RECYCLE_COMMIT_VERSIONS_INTERVAL_US) {
// tx data mini merge do not recycle commit versions array every time

View File

@ -138,7 +138,7 @@ int ObTxDataMemtableMgr::release_head_memtable_(memtable::ObIMemtable *imemtable
memtable->set_state(ObTxDataMemtable::State::RELEASED);
memtable->set_release_time();
if (true == memtable->do_recycled()) {
mini_merge_recycle_commit_versions_ts_ = ObClockGenerator::getCurrentTime();
mini_merge_recycle_commit_versions_ts_ = ObClockGenerator::getClock();
}
STORAGE_LOG(INFO, "[TX DATA MERGE]tx data memtable mgr release head memtable", K(ls_id_), KP(memtable), KPC(memtable));
release_head_memtable();

View File

@ -910,7 +910,7 @@ int ObTxTable::get_recycle_scn(SCN &real_recycle_scn)
int ret = OB_SUCCESS;
real_recycle_scn = SCN::min_scn();
int64_t current_time_us = ObClockGenerator::getCurrentTime();
int64_t current_time_us = ObClockGenerator::getClock();
int64_t tx_result_retention = DEFAULT_TX_RESULT_RETENTION_S;
omt::ObTenantConfigGuard tenant_config(TENANT_CONF(MTL_ID()));
if (tenant_config.is_valid()) {
@ -956,7 +956,7 @@ int ObTxTable::get_recycle_scn(SCN &real_recycle_scn)
// update cache
recycle_scn_cache_.val_ = real_recycle_scn;
recycle_scn_cache_.update_ts_ = ObClockGenerator::getCurrentTime();
recycle_scn_cache_.update_ts_ = ObClockGenerator::getClock();
}
return ret;