[store]: refactor: upgrade raft to 0.6.2-alpha.10#1526
Merged
Conversation
Introduce common_tracing::init_tracing() to create a logger that will be released when being dropped. Every test need to hold a `guard` to ensure the log subscriber working. Elaborate some tracing span arguments.
change-membership should be log driven but not channel driven databendlabs/openraft@v0.6.2-alpha.9...datafuse-extras:v0.6.2-alpha.10 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.
Member
|
Thanks for the contribution! Please review the labels and make any necessary changes. |
3 similar comments
Member
|
Thanks for the contribution! Please review the labels and make any necessary changes. |
Member
|
Thanks for the contribution! Please review the labels and make any necessary changes. |
Member
|
Thanks for the contribution! Please review the labels and make any necessary changes. |
drmingdrmer
marked this pull request as ready for review
August 19, 2021 18:10
drmingdrmer
marked this pull request as draft
August 19, 2021 18:26
drmingdrmer
marked this pull request as ready for review
August 19, 2021 18:45
Member
|
CI Passed |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I hereby agree to the terms of the CLA available at: https://datafuse.rs/policies/cla/
Summary
[store]: refactor: upgrade raft to 0.6.2-alpha.10
change-membership should be log driven but not channel driven
databendlabs/openraft@v0.6.2-alpha.9...datafuse-extras:v0.6.2-alpha.10
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:
change-membership request.
This simplifies the workflow and makes it more reliable and intuitive to
understand.
Related changes:
When
change_membershipis 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 responseerror type:
ResponseError.Internal response channel is now an
Option<ResponseTx>, since thefirst 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.
[store] refactor: add per-case logging
Introduce common_tracing::init_tracing() to create a logger that will be
released when being dropped.
Every test need to hold a
guardto ensure the log subscriberworking.
Elaborate some tracing span arguments.
Changelog
Related Issues