[bugfix] reset max_applied_cb_scn when offline lsn

This commit is contained in:
yyy-hust
2023-07-12 03:48:25 +00:00
committed by ob-robot
parent e85d959eae
commit 6bf3970f39
3 changed files with 14 additions and 0 deletions

View File

@ -782,6 +782,13 @@ void ObApplyStatus::reset_proposal_id()
CLOG_LOG(INFO, "reset_proposal_id success");
}
void ObApplyStatus::reset_max_applied_scn_meta()
{
lib::ObMutexGuard guard(mutex_);
last_check_scn_.reset();
max_applied_cb_scn_.reset();
}
int ObApplyStatus::submit_task_to_apply_service_(ObApplyServiceTask &task)
{
int ret = OB_SUCCESS;

View File

@ -203,6 +203,7 @@ public:
//
// NB: this interface only can be used in 'ObLogHandler::offline'.
void reset_proposal_id();
void reset_max_applied_scn_meta();
TO_STRING_KV(K(ls_id_),
K(role_),
K(proposal_id_),

View File

@ -1265,6 +1265,9 @@ int ObLogHandler::get_max_decided_scn(SCN &scn)
} else if (is_in_stop_state_) {
//和replay service统一返回4109
ret = OB_STATE_NOT_MATCH;
} else if (is_offline()) {
ret = OB_STATE_NOT_MATCH;
CLOG_LOG(WARN, "log handle is offline", K(id_));
} else if (FALSE_IT(id = id_)) {
} else if (OB_FAIL(apply_service_->get_max_applied_scn(id, max_applied_scn))) {
CLOG_LOG(WARN, "failed to get_max_applied_scn", K(ret), K(id));
@ -1411,6 +1414,9 @@ int ObLogHandler::offline()
//
MEM_BARRIER();
is_offline_ = true;
//4.Due to the order of ObLogHandle:offline() and ObLSWRSHandler::offline() in ObLS::offline(), we must keep reset_max_applied_scn_meta() after set is_offline_ to true, otherwise ls_wrs_service may
//print error log.
apply_status_->reset_max_applied_scn_meta();
// NB: must ensure on_role_change not fail.
if (OB_FAIL(rc_service_->on_role_change(id_))) {
CLOG_LOG(WARN, "on_role_change failed", K(ret), KPC(this));