Skip to content

关于raft协议voteFor元数据的用途 #950

Discussion options

You must be logged in to vote

考虑了很多场景,大于等于改成大于,应该是不影响正确性。

但是加上等于号,有一种情况可以加快选举进程

A term=2, index=201
B term=2, index=203
C term=2, index=203

A发起选举,term3,线程暂停,还未投票给A
B发起选举,term3,
A收到B的选举消息:

  • 如果没有等于号,A不会投票给B,而A线程恢复过来,投票给自己,A也是不能晋升的,因为index小。
  • 如果有等于的存在,A会投票给B,加快B的选举

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
6 replies
@shihuili1218
Comment options

@FantasyChen-DH
Comment options

@FantasyChen-DH
Comment options

@shihuili1218
Comment options

Answer selected by FantasyChen-DH
@FantasyChen-DH
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants