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

Refactor: sharing state between CurpServer and CurpClient #299

Closed
Phoenix500526 opened this issue Jun 1, 2023 · 1 comment · Fixed by #302
Closed

Refactor: sharing state between CurpServer and CurpClient #299

Phoenix500526 opened this issue Jun 1, 2023 · 1 comment · Fixed by #302
Assignees
Labels
bug Something isn't working enhancement New feature or request
Milestone

Comments

@Phoenix500526
Copy link
Collaborator

Currently, we use Client::get_leader_id to get the current leader id from a curp cluster. The client maintains its own state. The leader_id returned by get_leader_id may be outdated, because it will read from the client's state first.

Read pr #276 and issue #251 for more detail. I'll file a new pr to resolve this issue.

@Phoenix500526 Phoenix500526 added bug Something isn't working enhancement New feature or request labels Jun 1, 2023
@Phoenix500526 Phoenix500526 added this to the Release v0.4.1 milestone Jun 1, 2023
@Phoenix500526 Phoenix500526 self-assigned this Jun 1, 2023
Phoenix500526 added a commit to Phoenix500526/Xline that referenced this issue Jun 2, 2023
Phoenix500526 added a commit to Phoenix500526/Xline that referenced this issue Jun 2, 2023
@Phoenix500526 Phoenix500526 linked a pull request Jun 2, 2023 that will close this issue
@Phoenix500526
Copy link
Collaborator Author

Finally, in that sharing the State structure between RawCurp and Client will break our present encapsulation, we've decided to add another method named get_leader_info_from_curp to solve this issue. The get_leader_info_from_curp will fetch the current leader and term from the curp server which is on the same node as the client. Therefore, from the curp server perspective, the leader_id won't be outdated.

Phoenix500526 added a commit to Phoenix500526/Xline that referenced this issue Jun 2, 2023
Phoenix500526 added a commit to Phoenix500526/Xline that referenced this issue Jun 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant