Skip to content

Conversation

@yuwmao
Copy link
Contributor

@yuwmao yuwmao commented Mar 10, 2025

Previously, learner is a static srv config, provide a cmd for use to flip the learner flag.

Comment on lines 63 to 64
learner_change_request = 30,
learner_change_response = 31,
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@yuwmao
Copy link
Contributor Author

yuwmao commented Mar 11, 2025

Remove learner_change_request.
Use cmd_result as return value to reuse error code.

Previously, learner is a static srv config, provide a cmd for use to flip the learner flag.
Copy link

@xiaoxichen xiaoxichen left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Contributor

@greensky00 greensky00 left a 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.

@greensky00 greensky00 merged commit 9f52bb8 into eBay:master Mar 11, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants