-
Notifications
You must be signed in to change notification settings - Fork 276
Support learner change #571
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
Conversation
include/libnuraft/msg_type.hxx
Outdated
| learner_change_request = 30, | ||
| learner_change_response = 31, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New message types are not needed.
Same as priority change (raft_server::set_priority), we can just create a new config log with updated server config, and replicate it. There is no need for its handler.
https://github.com/eBay/NuRaft/blob/master/src/handle_priority.cxx#L79-L106
There is a special message type priority_change_request, in order to broadcast (temporary) priority change in case when the leader is dead, for the sake of troubleshooting. This shouldn't be the case for learner flag, as changing learner role without leader is not safe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw there is an auto_forwarding_ parameter, and when enabled, add_srv/remove_srv can be forwarded to leader. Not sure in this scenario if we should allow forwarding for learner change.
|
Remove |
Previously, learner is a static srv config, provide a cmd for use to flip the learner flag.
xiaoxichen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
greensky00
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, fixed some indent.
Previously, learner is a static srv config, provide a cmd for use to flip the learner flag.