diff --git a/src/logservice/applyservice/ob_log_apply_service.cpp b/src/logservice/applyservice/ob_log_apply_service.cpp index a0728b6e32..15c6fa87a7 100644 --- a/src/logservice/applyservice/ob_log_apply_service.cpp +++ b/src/logservice/applyservice/ob_log_apply_service.cpp @@ -782,11 +782,13 @@ void ObApplyStatus::reset_proposal_id() 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_); last_check_scn_.reset(); max_applied_cb_scn_.reset(); + palf_committed_end_lsn_.val_ = 0; } int ObApplyStatus::submit_task_to_apply_service_(ObApplyServiceTask &task) diff --git a/src/logservice/applyservice/ob_log_apply_service.h b/src/logservice/applyservice/ob_log_apply_service.h index a1f139ff9b..75e2843263 100644 --- a/src/logservice/applyservice/ob_log_apply_service.h +++ b/src/logservice/applyservice/ob_log_apply_service.h @@ -203,7 +203,8 @@ public: // // NB: this interface only can be used in 'ObLogHandler::offline'. 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_), K(role_), K(proposal_id_), diff --git a/src/logservice/ob_log_handler.cpp b/src/logservice/ob_log_handler.cpp index 7af10c229f..ddba3d8248 100755 --- a/src/logservice/ob_log_handler.cpp +++ b/src/logservice/ob_log_handler.cpp @@ -1645,9 +1645,6 @@ 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)); @@ -1686,6 +1683,10 @@ int ObLogHandler::online(const LSN &lsn, const SCN &scn) } else { WLockGuard guard(lock_); 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; // NB: before notify role change service, we need set role to FOLLOWER, // otherwise, role change service may need switch leader to leader.