[4.2][Standby] Optimize error refresh in standby
This commit is contained in:
@ -513,8 +513,12 @@ void ObLogRestoreHandler::mark_error(share::ObTaskId &trace_id,
|
||||
context_.error_context_.ret_code_ = ret_code;
|
||||
context_.error_context_.trace_id_.set(trace_id);
|
||||
context_.error_context_.err_lsn_ = lsn;
|
||||
if (OB_TIMEOUT == ret_code && ObLogRestoreErrorContext::ErrorType::FETCH_LOG == error_type) {
|
||||
CLOG_LOG(WARN, "fetch log timeout in restore", KPC(parent_), KPC(this));
|
||||
} else if(OB_SUCCESS != ret_code) {
|
||||
CLOG_LOG(ERROR, "fatal error occur in restore", KPC(parent_), KPC(this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int ObLogRestoreHandler::get_restore_error(share::ObTaskId &trace_id, int &ret_code, bool &error_exist)
|
||||
|
||||
@ -201,10 +201,8 @@ int ObLogRestoreNetDriver::scan_ls(const share::ObLogRestoreSourceType &type)
|
||||
}
|
||||
} else if (OB_FAIL(check_ls_stale_(id, proposal_id, is_stale))) {
|
||||
LOG_WARN("check_ls_stale_ failed", K(id));
|
||||
} else if (! is_stale) {
|
||||
if (OB_FAIL(refresh_error_context_(id))) {
|
||||
LOG_WARN("refresh error context failed", K(id));
|
||||
}
|
||||
} else if (!is_stale) {
|
||||
// do nothing
|
||||
} else if (OB_FAIL(fetcher_->remove_ls(id)) && OB_ENTRY_NOT_EXIST != ret) {
|
||||
LOG_WARN("remove ls failed", K(id), K(is_stale));
|
||||
} else {
|
||||
@ -573,18 +571,6 @@ int ObLogRestoreNetDriver::get_ls_count_in_fetcher_(int64_t &count)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObLogRestoreNetDriver::refresh_error_context_(const share::ObLSID &ls_id)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObRemoteFetchContext context;
|
||||
GET_RESTORE_HANDLER_CTX(ls_id) {
|
||||
if (OB_FAIL(restore_handler->refresh_error_context())) {
|
||||
LOG_WARN("refresh error failed");
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObLogRestoreNetDriver::set_restore_log_upper_limit()
|
||||
{
|
||||
RLockGuard guard(lock_);
|
||||
|
||||
@ -116,7 +116,6 @@ private:
|
||||
|
||||
int check_ls_stale_(const share::ObLSID &id, const int64_t proposal_id, bool &is_stale);
|
||||
int get_ls_count_in_fetcher_(int64_t &count);
|
||||
int refresh_error_context_(const share::ObLSID &ls_id);
|
||||
|
||||
private:
|
||||
class LogErrHandler : public logfetcher::IObLogErrHandler
|
||||
|
||||
@ -201,7 +201,7 @@ void ObLogRestoreService::do_thread_task_()
|
||||
last_normal_work_ts_ = common::ObTimeUtility::fast_current_time();
|
||||
}
|
||||
update_restore_upper_limit_();
|
||||
|
||||
refresh_error_context_();
|
||||
set_compressor_type_();
|
||||
}
|
||||
}
|
||||
@ -266,6 +266,40 @@ void ObLogRestoreService::set_compressor_type_()
|
||||
}
|
||||
}
|
||||
|
||||
void ObLogRestoreService::refresh_error_context_()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObLS *ls = NULL;
|
||||
ObLSIterator *iter = NULL;
|
||||
common::ObSharedGuard<ObLSIterator> guard;
|
||||
ObLogRestoreHandler *restore_handler = NULL;
|
||||
if (OB_FAIL(ls_svr_->get_ls_iter(guard, ObLSGetMod::LOG_MOD))) {
|
||||
LOG_WARN("get ls iter failed", K(ret));
|
||||
} else if (OB_ISNULL(iter = guard.get_ptr())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_ERROR("iter is NULL", K(ret), K(iter));
|
||||
} else {
|
||||
while (OB_SUCC(ret)) {
|
||||
ls = NULL;
|
||||
if (OB_FAIL(iter->get_next(ls))) {
|
||||
if (OB_ITER_END != ret) {
|
||||
LOG_WARN("iter ls get next failed", K(ret));
|
||||
} else {
|
||||
LOG_TRACE("iter to end", K(ret));
|
||||
}
|
||||
} else if (OB_ISNULL(ls)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_ERROR("ls is NULL", K(ret), K(ls));
|
||||
} else if (OB_ISNULL(restore_handler = ls->get_log_restore_handler())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_INFO("restore_handler is NULL", K(ret), K(ls->get_ls_id()));
|
||||
} else if (OB_FAIL(restore_handler->refresh_error_context())) {
|
||||
LOG_WARN("refresh error failed", K(ls->get_ls_id()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool ObLogRestoreService::need_schedule_() const
|
||||
{
|
||||
return common::ObTimeUtility::fast_current_time() - last_normal_work_ts_ > SCHEDULE_INTERVAL;
|
||||
|
||||
@ -81,6 +81,7 @@ private:
|
||||
void report_error_();
|
||||
void update_restore_upper_limit_();
|
||||
void set_compressor_type_();
|
||||
void refresh_error_context_();
|
||||
bool need_schedule_() const;
|
||||
|
||||
private:
|
||||
|
||||
@ -66,6 +66,10 @@ ERRSIM_POINT_DEF(ERRSIM_END_TRANS_ERROR);
|
||||
ret_code = OB_PASSWORD_WRONG; \
|
||||
case -ER_CONNECT_FAILED: \
|
||||
ret_code = OB_CONNECT_ERROR; \
|
||||
case OB_IN_STOP_STATE: \
|
||||
ret_code = OB_IN_STOP_STATE; \
|
||||
default: \
|
||||
ret_code = ret; \
|
||||
} \
|
||||
ROOTSERVICE_EVENT_ADD("root_service", "update_primary_ip_list", \
|
||||
"tenant_id", tenant_id_, K(ret), \
|
||||
|
||||
Reference in New Issue
Block a user