diff --git a/src/logservice/palf/election/algorithm/election_impl.cpp b/src/logservice/palf/election/algorithm/election_impl.cpp index 953290f054..808d8f3b1b 100644 --- a/src/logservice/palf/election/algorithm/election_impl.cpp +++ b/src/logservice/palf/election/algorithm/election_impl.cpp @@ -112,6 +112,9 @@ int ElectionImpl::init_and_start(const int64_t id, } else if (CLICK_FAIL(acceptor_.start())) { LOG_INIT(ERROR, "start acceptor failed"); } else { + if (inner_priority_seed_ & static_cast(PRIORITY_SEED_BIT::SEED_NOT_NORMOL_REPLICA_BIT)) { + event_recorder_.set_need_report(false); + } is_inited_ = true; is_running_ = true; LOG_INIT(INFO, "election init and start"); @@ -309,7 +312,9 @@ void ElectionImpl::refresh_priority_() { ELECT_TIME_GUARD(500_ms); int ret = OB_SUCCESS; - if (OB_ISNULL(priority_)) { + if (inner_priority_seed_ & static_cast(PRIORITY_SEED_BIT::SEED_NOT_NORMOL_REPLICA_BIT)) { + // do nothing + } else if (OB_ISNULL(priority_)) { ELECT_LOG(INFO, "priority is null", K(*this)); } else if (CLICK_FAIL(priority_->refresh())) { ELECT_LOG(WARN, "refresh priority failed", KR(ret), K(*this)); diff --git a/src/logservice/palf/election/algorithm/election_impl.h b/src/logservice/palf/election/algorithm/election_impl.h index 6efacae1c8..4683c07d81 100644 --- a/src/logservice/palf/election/algorithm/election_impl.h +++ b/src/logservice/palf/election/algorithm/election_impl.h @@ -274,7 +274,6 @@ private: bool is_inited_; bool is_running_; uint64_t inner_priority_seed_; - common::ObOccamThreadPool *thread_pool_; common::ObOccamTimer *timer_; EventRecorder event_recorder_; mutable ElectionMsgCounter msg_counter_; diff --git a/src/logservice/palf/election/utils/election_event_recorder.cpp b/src/logservice/palf/election/utils/election_event_recorder.cpp index 4da88cd933..08d680f2d2 100644 --- a/src/logservice/palf/election/utils/election_event_recorder.cpp +++ b/src/logservice/palf/election/utils/election_event_recorder.cpp @@ -63,6 +63,8 @@ int EventRecorder::report_event_(ElectionEventType type, const common::ObString LOG_EVENT(WARN, "fail to create unique ownership of string"); #undef PRINT_WRAPPER #define PRINT_WRAPPER KR(ret), K(retry_times), K(report_ts), K(self_addr), K(mtl_id), K(obj_to_string(type)), K(ls_id), KPC(uniq_holder.get_ptr()) + } else if (!need_report_) { + LOG_EVENT(INFO, "event happened, but no need do report"); } else if (CLICK_FAIL(GLOBAL_REPORT_TIMER.schedule_task_ignore_handle_repeat_and_immediately(15_s, [retry_times, report_ts, self_addr, mtl_id, type, ls_id, uniq_holder]() mutable -> bool { ELECT_TIME_GUARD(500_ms); int ret = OB_SUCCESS; diff --git a/src/logservice/palf/election/utils/election_event_recorder.h b/src/logservice/palf/election/utils/election_event_recorder.h index 221b7b929c..de8cbbe211 100644 --- a/src/logservice/palf/election/utils/election_event_recorder.h +++ b/src/logservice/palf/election/utils/election_event_recorder.h @@ -77,7 +77,8 @@ class EventRecorder { public: EventRecorder(const int64_t &ls_id, const ObAddr &self_addr, ObOccamTimer *&timer) : - ls_id_(ls_id), self_addr_(self_addr), timer_(timer) {} + ls_id_(ls_id), self_addr_(self_addr), timer_(timer), need_report_(true) {} + void set_need_report(const bool need_report) { need_report_ = need_report; } // proposer event int report_decentralized_to_be_leader_event(const MemberListWithStates &member_list_with_states);// 当选Leader int report_leader_lease_expired_event(const MemberListWithStates &member_list_with_states);// Leader续约失败卸任 @@ -96,6 +97,7 @@ private: const int64_t &ls_id_; const ObAddr &self_addr_; ObOccamTimer *&timer_; + bool need_report_; }; }