-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
change: change-membership should be log driven but not channel driven
A membership change involves two steps: the joint config phase and the final config phase. Each phase has a corresponding log invovled. Previously the raft setup several channel to organize this workflow, which makes the logic hard to understand and introduces complexity when restarting or leadership transfered: it needs to re-establish the channels and tasks. According to the gist of raft, all workflow should be log driven. Thus the new approach: - Write two log(the joint and the final) at once it recevies a change-membership request. - All following job is done according to just what log is committed. This simplifies the workflow and makes it more reliable and intuitive to understand. Related changes: - When `change_membership` is called, append 2 logs at once. - Introduce universal response channel type to send back a message when some internal task is done: `ResponseTx`, and a universal response error type: `ResponseError`. - Internal response channel is now an `Option<ResponseTx>`, since the first step of membership change does not need to respond to the caller. - When a new leaser established, if the **last** log is a joint config log, append a final config log to let the partial change-membership be able to complete. And the test is added. - Removed membership related channels. - Refactor: convert several func from async to sync.
- Loading branch information
1 parent
beb0302
commit 6350514
Showing
8 changed files
with
351 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.