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

Return status of set_priority. Ability to broadcast priority changes if there's a leader #432

Merged
merged 5 commits into from
Jun 1, 2023

Conversation

myrrc
Copy link
Contributor

@myrrc myrrc commented May 25, 2023

set_priority is a bit inconsistent with add_srv and remove_srv.
If you invoke the latter two on a follower, the request will be
forwarded to leader. You can wait on the request and check whether it was accepted or not.
Unfortunately, there are no such guarantees for set_priority.
If you invoke it on a follower, and there is a live leader, function would quit.
I want to know the result of set_priority, so changes are proposed that change its return type.

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.

Hi @myrrc, thanks for submitting this PR.

I understand how it works, and the overall code looks good to me, but can you please elaborate on why (and in which case) broadcast_when_leader_exists option is needed? Enforcing priority even with a live leader will cause cluster config to diverge, which should be strictly avoided (it only affects priority but not data though).

Also, please break lines at 90 chars. There are a few places to fix.

include/libnuraft/raft_server.hxx Outdated Show resolved Hide resolved
tests/unit/asio_service_test.cxx Outdated Show resolved Hide resolved
@myrrc
Copy link
Contributor Author

myrrc commented May 30, 2023 via email

@myrrc myrrc requested a review from greensky00 May 30, 2023 10:40
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.

@greensky00 greensky00 merged commit c2f3128 into eBay:master Jun 1, 2023
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.

2 participants