Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

raft learner support. #386

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

raft learner support. #386

wants to merge 1 commit into from

Conversation

liyichao
Copy link

@liyichao liyichao commented Feb 13, 2023

learner will neither participate in elections nor be inclued in quorum, and will not trigger election_timeout or vote.

This feature makes it easy to add a read-only replica to server, only making minimum influence to the raft group. It is also useful for replication between clusters at different data center.

Signed-off-by: Yichao Li <liyichao.good@gmail.com>
@@ -1609,7 +1625,7 @@ void NodeImpl::pre_vote(std::unique_lock<raft_mutex_t>* lck, bool triggered) {

for (std::set<PeerId>::const_iterator
iter = peers.begin(); iter != peers.end(); ++iter) {
if (*iter == _server_id) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

计算 last_leader_active_timestamp、check_dead_nodes、check_majority_nodes_readonly 的时候也应该过滤掉 learner 吧

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants