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

fix(raft): Only leader should check the quorum #6323

Merged
merged 2 commits into from
Sep 9, 2020

Conversation

jarifibrahim
Copy link
Contributor

@jarifibrahim jarifibrahim commented Aug 31, 2020

The Checkquorum() function is used by the leader to determine if it is
still a leader and not behind a network partition (split-head situation).

The current code would checkquorum even for followers which isn't necessary.
This PR removes the quorum check for followers.


This change is Reviewable

The Checkquorum() function is used by the leader to determine if it is
still a leader and not behind a network partition (split-head
situation).
Copy link
Contributor

@manishrjain manishrjain left a comment

Choose a reason for hiding this comment

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

Run this with blockade.

Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @jarifibrahim, @manishrjain, and @vvbalaji-dgraph)


dgraph/cmd/zero/raft.go, line 64 at r1 (raw file):

func (n *node) AmLeader() bool {
	// Return false if the node is not the leader. Otherwise, check the lastQuorum as well.
	return n.amLeader() && func() bool {

This is unusual way of writing an if statement.

Copy link
Contributor

@manishrjain manishrjain left a comment

Choose a reason for hiding this comment

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

If it works with Blockade, then good to go.

Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @jarifibrahim, @manishrjain, and @vvbalaji-dgraph)

@jarifibrahim jarifibrahim merged commit 7a8e6de into master Sep 9, 2020
@jarifibrahim jarifibrahim deleted the ibrahim/checkquorum-leader-fix branch September 9, 2020 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants