Closed cheniujh closed 2 months ago
The recent changes primarily revolve around enhancing the master election process in the Codis and Pika systems. A new field IsEligibleForMasterElection
has been introduced to various structs and methods to ensure that only eligible servers participate in the master election. Additionally, new methods and configurations handle unfinished full sync operations, ensuring consistency and reliability during master-slave switchovers.
File(s) | Change Summary |
---|---|
codis/pkg/models/group.go , codis/pkg/topom/topom_group.go , codis/pkg/topom/topom_sentinel.go , codis/pkg/utils/redis/sentinel.go |
Added IsEligibleForMasterElection field to relevant structs and methods. Updated master election logic to consider this field. |
conf/pika.conf , include/pika_conf.h , src/pika_conf.cc , src/pika_admin.cc , src/pika_repl_client_conn.cc |
Introduced handling of internal-used-unfinished-full-sync configuration parameter. Added methods to manage unfinished full sync operations. |
src/pika_db.cc |
Added logic to remove unfinished full sync count after setting replication state to kTryConnect . |
Objective (Issue #2436) | Addressed | Explanation |
---|---|---|
Introduce a new field to track eligibility for master election | ✅ | |
Ensure servers with unfinished full sync are not eligible for master election | ✅ | |
Provide a mechanism to handle unfinished full sync operations | ✅ |
In Codis realms where data streams, A new rule now reigns supreme. Masters chosen with utmost care, Only when syncs are all fair. If full sync's not yet complete, Master role they can't compete. 🐇✨
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
这个PR修复了 fix #2436
1 具体地,通过对外提供指标‘is_eligible_for_master_election’(通过info replication/info命令),告知本实例是否有资格在fail over是成为新master的候选者。
2 在codis-sentinel中加入了使用该指标的逻辑:
This PR fixes issue #2436:
Specifically, it introduces the metric 'is_eligible_for_master_election' (accessible via the info replication/info command) to indicate whether this instance is eligible to be a candidate for the new master during a failover.
Summary by CodeRabbit
New Features
IsEligibleForMasterElection
to enhance master election criteria, ensuring more reliable and optimized master selection in cluster scenarios.Improvements