-
Notifications
You must be signed in to change notification settings - Fork 881
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
有没有可能出现两次选举成功的间隔小于election_timeout导致lease read失效? #405
Comments
Prevote为什么不失败呢?
|
B向C请求preVote,C会返回成功啊 |
在JRaft的stepdown中有更新updateLastLeaderTimestamp,保证了之后的handleElectionTimeout在尝试选举前检查lastLeaderTimestamp间隔小于选举间隔。 在Braft中起到类似作用的应该是FollowerLease,但是在step_down函数中,并没有调用_follower_lease.renew()。 是有其他机制来避免我上面说的问题吗 |
从目前实现来看,当 但是在实际情况中,该问题不会导致严重的后果。因为当 leader 当选成功后,并不会立即调用 fsm->on_leader_start, 而是会先将当前最新的 configuration 复制到大多数节点(commit)后才会正式对外提供服务。 所以,即使发生上述情况,老term的 leader 会无法完成第一个日志的复制,并且发现已经有新的leader产生,从而转为follwer。 综上上述现象会发生,但是仅发生在老 term 的 leader 当选以及第一次日志复制过程中,而该过程并不会对外提供服务,所以是安全的。
所以从更严格的角度来说,是应该在投票后(收到了candidate的请求)进行重新计时。 |
万分感谢! |
如下case:
三节点{A, B, C}
follower在handleRequestVoteRequest中vote成功时,并没有renew follower_lease。这种情况下follower(B)在vote成功后会立即开始新的一轮选举,导致AB两个node在很短时间内先后当选为Leader
会有这种情况发生吗?
The text was updated successfully, but these errors were encountered: