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

Don't start a learner node with no peers #7582

Merged
merged 2 commits into from
Mar 17, 2021

Conversation

ahsanbarkati
Copy link
Contributor

@ahsanbarkati ahsanbarkati commented Mar 16, 2021

When a learner node starts and there is no alpha peer then it promotes itself to a normal mode.
This PR makes it crash itself in this case.


This change is Reviewable

@@ -1742,6 +1743,10 @@ func (n *node) InitAndStartNode() {
}
}

if n.RaftContext.IsLearner && !hasPeer {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For the case of restart, should we check again after making connections to nodes in ConfState? I don't know why it is required.

Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest we keep this here for now.

@ahsanbarkati ahsanbarkati marked this pull request as ready for review March 16, 2021 15:47
@@ -1742,6 +1743,10 @@ func (n *node) InitAndStartNode() {
}
}

if n.RaftContext.IsLearner && !hasPeer {
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest we keep this here for now.

@ahsanbarkati ahsanbarkati merged commit e489fd2 into release/v21.03 Mar 17, 2021
@ahsanbarkati ahsanbarkati deleted the ahsan/learner-fix branch March 17, 2021 22:15
aman-bansal pushed a commit that referenced this pull request Mar 25, 2021
When a learner node starts and there is no alpha peer then it 
behaves like a normal mode. This change causes it to crash 
itself if it has no peer alpha nodes.
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