fix defensive detection bug for replaying log task

This commit is contained in:
obdev
2023-01-04 13:41:55 +00:00
committed by ob-robot
parent 4ca6b270f0
commit 30b78e5855
4 changed files with 16 additions and 12 deletions

View File

@ -79,11 +79,18 @@ int ObLSAdapter::replay(ObLogReplayTask *replay_task)
if (common::OB_INVALID_TIMESTAMP == replay_task->first_handle_ts_) {
replay_task->first_handle_ts_ = start_ts;
replay_task->print_error_ts_ = start_ts;
} else if ((start_ts - replay_task->print_error_ts_) > MAX_SINGLE_RETRY_WARNING_TIME_THRESOLD) {
} else {
replay_task->retry_cost_ = start_ts - replay_task->first_handle_ts_;
CLOG_LOG(WARN, "single replay task retry cost too much time. replay may be delayed",
KPC(replay_task));
replay_task->print_error_ts_ = start_ts;
if ((start_ts - replay_task->print_error_ts_) > MAX_SINGLE_RETRY_WARNING_TIME_THRESOLD) {
if (replay_task->retry_cost_ > 100 * 1000 *1000 && REACH_TIME_INTERVAL(1 * 1000 * 1000)) {
CLOG_LOG(ERROR, "single replay task retry cost too much time. replay may be delayed",
K(ret), KPC(replay_task));
} else {
CLOG_LOG(WARN, "single replay task retry cost too much time. replay may be delayed",
K(ret), KPC(replay_task));
}
replay_task->print_error_ts_ = start_ts;
}
}
}
replay_task->replay_cost_ = ObTimeUtility::fast_current_time() - start_ts;

View File

@ -820,12 +820,7 @@ int ObLogReplayService::do_replay_task_(ObLogReplayTask *replay_task,
replay_status->dec_pending_task(replay_task->log_size_);
}
} else if (OB_FAIL(ls_adapter_->replay(replay_task))) {
if (replay_task->retry_cost_ > 60 * 1000 *1000 &&
REACH_TIME_INTERVAL(1 * 1000 * 1000)) {
CLOG_LOG(ERROR, "ls do replay retry failed last for long time", K(ret), KPC(replay_task));
} else {
CLOG_LOG(WARN, "ls do replay failed", K(ret), KPC(replay_task));
}
CLOG_LOG(WARN, "ls do replay failed", K(ret), KPC(replay_task));
}
if (OB_SUCC(ret) && need_replay) {
if (replay_task->is_post_barrier_) {

View File

@ -506,6 +506,8 @@ void ObLogReplayTask::reset()
is_raw_write_ = false;
first_handle_ts_ = common::OB_INVALID_TIMESTAMP;
print_error_ts_ = common::OB_INVALID_TIMESTAMP;
replay_cost_ = common::OB_INVALID_TIMESTAMP;
retry_cost_ = common::OB_INVALID_TIMESTAMP;
log_buf_ = NULL;
}

View File

@ -141,8 +141,8 @@ public:
bool is_raw_write_;
int64_t first_handle_ts_;
int64_t print_error_ts_;
int64_t replay_cost_; //此任务重试的总耗时时间
int64_t retry_cost_; //此任务回放成功时的当次处理时间
int64_t replay_cost_; //此任务回放成功时的当次处理时间
int64_t retry_cost_; //此任务重试的总耗时时间
void *log_buf_;
TO_STRING_KV(K(ls_id_),