-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Switch consensus to a runtime configuration #565
Conversation
0b20e9d
to
5b07a9a
Compare
5b07a9a
to
1fb720c
Compare
@@ -51,7 +51,7 @@ jobs: | |||
run: .github/scripts/protoc.sh | |||
shell: bash | |||
- name: Build | |||
run: cargo build --features consensus |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that the binaries are now equivalent, we could also just move ./tests/integration-tests.sh distributed
as an additional step to the previous job to not compile twice.
src/main.rs
Outdated
runtime_handle.block_on(async { | ||
for collection in toc.all_collections().await { | ||
log::info!("Loaded collection: {}", collection); | ||
} | ||
}); | ||
|
||
#[cfg(feature = "consensus")] | ||
let (propose_sender, propose_receiver) = std::sync::mpsc::channel(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the channel
and the propose_sender
are always initialized regardless of the configuration,
@@ -355,21 +337,17 @@ impl TableOfContent { | |||
operation: CollectionMetaOperations, | |||
wait_timeout: Option<Duration>, | |||
) -> Result<bool, StorageError> { | |||
#[cfg(feature = "consensus")] | |||
{ | |||
if self.distributed_mode { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is where the rubber meets the road
@@ -30,25 +30,6 @@ jobs: | |||
- name: Run tests | |||
run: cargo test --all | |||
|
|||
test-consensus: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed because the consensus
unit tests are now executed by default
@@ -129,7 +116,7 @@ impl TableOfContent { | |||
Wal::open(collections_meta_wal_path).unwrap(), | |||
)) | |||
}; | |||
#[cfg(feature = "consensus")] | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the raft state is now always initialized, not sure if it could be problematic TBH
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a small file, shouldn't really matter to user I think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks nice
This PR switch the consensus from a conditional compilation cargo feature to a runtime configuration #511
This means:
cluster.enabled
configuration field (false by default)toc
is aware of the distribution mode