We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
看了下代码。 Node 如果是follower, 当判断是否要选举的时候, 首先判断了一下自己是否是leader, 如果不是就继续判断是否过了选举时间, 过了就开始选举。 我猜测应该是heartbeat的时候应该延长这个要选择leader的时间, 但是没有看到代码里有判断。 当然这样运行也不会错, 但是多了很多无效的选举。 不知道说的对不?
The text was updated successfully, but these errors were encountered:
我觉得你说的对
解决办法是:在收到心跳或者投票给别人后,都将 preElectionTime 设为当前时间,达到延长的效果
Sorry, something went wrong.
心跳请求也是追加日志rpc一种,作者在追加日志处理中重置了上一次选举的时间。见defaultConsensus#appendEntries
哪位大佬能教教我这里面Leader选举的时候,防止分裂选举是怎么实现的
No branches or pull requests
看了下代码。 Node 如果是follower, 当判断是否要选举的时候, 首先判断了一下自己是否是leader, 如果不是就继续判断是否过了选举时间, 过了就开始选举。
我猜测应该是heartbeat的时候应该延长这个要选择leader的时间, 但是没有看到代码里有判断。
当然这样运行也不会错, 但是多了很多无效的选举。 不知道说的对不?
The text was updated successfully, but these errors were encountered: