[LOG]fix fallback of max_decided_scn

This commit is contained in:
yyy-hust
2023-08-15 09:48:46 +00:00
committed by ob-robot
parent 58ba7c5e34
commit fcde1af1cd
3 changed files with 9 additions and 5 deletions

View File

@ -782,11 +782,13 @@ void ObApplyStatus::reset_proposal_id()
CLOG_LOG(INFO, "reset_proposal_id success"); CLOG_LOG(INFO, "reset_proposal_id success");
} }
void ObApplyStatus::reset_max_applied_scn_meta() void ObApplyStatus::reset_meta()
{ {
RLockGuard rlock(lock_);
lib::ObMutexGuard guard(mutex_); lib::ObMutexGuard guard(mutex_);
last_check_scn_.reset(); last_check_scn_.reset();
max_applied_cb_scn_.reset(); max_applied_cb_scn_.reset();
palf_committed_end_lsn_.val_ = 0;
} }
int ObApplyStatus::submit_task_to_apply_service_(ObApplyServiceTask &task) int ObApplyStatus::submit_task_to_apply_service_(ObApplyServiceTask &task)

View File

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

View File

@ -1645,9 +1645,6 @@ int ObLogHandler::offline()
// //
MEM_BARRIER(); MEM_BARRIER();
is_offline_ = true; 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. // NB: must ensure on_role_change not fail.
if (OB_FAIL(rc_service_->on_role_change(id_))) { if (OB_FAIL(rc_service_->on_role_change(id_))) {
CLOG_LOG(WARN, "on_role_change failed", K(ret), KPC(this)); CLOG_LOG(WARN, "on_role_change failed", K(ret), KPC(this));
@ -1686,6 +1683,10 @@ int ObLogHandler::online(const LSN &lsn, const SCN &scn)
} else { } else {
WLockGuard guard(lock_); WLockGuard guard(lock_);
proposal_id_ = INVALID_PROPOSAL_ID; proposal_id_ = INVALID_PROPOSAL_ID;
//reset_meta to avoid contributing excessively large max_decided_scn
//reset_meta is placed here rather than offline() because after offline, callbacks will be
//handled after offline which may refer to palf_committed_end_lsn_
apply_status_->reset_meta();
is_offline_ = false; is_offline_ = false;
// NB: before notify role change service, we need set role to FOLLOWER, // NB: before notify role change service, we need set role to FOLLOWER,
// otherwise, role change service may need switch leader to leader. // otherwise, role change service may need switch leader to leader.