Skip to content

raft: Set the RecentActive flag for newly added nodes#7830

Merged
xiang90 merged 2 commits intoetcd-io:masterfrom
aaronlehmann:new-nodes-start-active
May 5, 2017
Merged

raft: Set the RecentActive flag for newly added nodes#7830
xiang90 merged 2 commits intoetcd-io:masterfrom
aaronlehmann:new-nodes-start-active

Conversation

@aaronlehmann
Copy link
Copy Markdown

I found that enabling the CheckQuorum flag led to spurious leader elections when new nodes joined. It looks like in the time between a new node joining the cluster, and that node first communicating with the leader, the quorum check could fail because the new node looks inactive. To solve this, set the RecentActive flag when nodes are first added. This gives a grace period for the node to communicate before it causes the quorum check to fail.

This seems like a decent way to solve the problem, but please feel free to suggest other approaches instead.

I found that enabling the CheckQuorum flag led to spurious leader
elections when new nodes joined. It looks like in the time between a new
node joining the cluster, and that node first communicating with the
leader, the quorum check could fail because the new node looks inactive.
To solve this, set the RecentActive flag when nodes are first added.
This gives a grace period for the node to communicate before it causes
the quorum check to fail.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
@aaronlehmann
Copy link
Copy Markdown
Author

Any thoughts on this propsed change? The extra leader elections when CheckQuorum is enabled are a bit of a pain point for me.

@xiang90
Copy link
Copy Markdown
Contributor

xiang90 commented May 4, 2017

can you write a test for this?

@xiang90
Copy link
Copy Markdown
Contributor

xiang90 commented May 4, 2017

this change looks reasonable.

This test verifies that adding a node does not cause the leader to step
down until at least one full ElectionTick cycle elapses.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
@aaronlehmann
Copy link
Copy Markdown
Author

Thanks. I've added a test.

@xiang90
Copy link
Copy Markdown
Contributor

xiang90 commented May 4, 2017

LGTM.

@xiang90 xiang90 merged commit db6f45e into etcd-io:master May 5, 2017
@xiang90
Copy link
Copy Markdown
Contributor

xiang90 commented May 5, 2017

@aaronlehmann Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants