Skip to content

Commit

Permalink
Updated chitchat to include a liveness predicate. (#4618)
Browse files Browse the repository at this point in the history
* Updated chitchat to include a liveness predicate.

This guards us from attempting to build ClusterMember / Node
when the critical Key Values have not been transmitted yet.

* Fix fmt

---------

Co-authored-by: Adrien Guillo <[email protected]>
  • Loading branch information
fulmicoton and guilload authored Feb 23, 2024
1 parent c2b84a3 commit 6337ac0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion quickwit/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion quickwit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ base64 = "0.21"
bytes = { version = "1", features = ["serde"] }
bytesize = { version = "1.3.0", features = ["serde"] }
bytestring = "1.3.0"
chitchat = { git = "https://github.com/quickwit-oss/chitchat.git", rev = "31f8d02" }
chitchat = { git = "https://github.com/quickwit-oss/chitchat.git", rev = "fa59b4c" }
chrono = { version = "0.4", default-features = false, features = [
"clock",
"std",
Expand Down
10 changes: 7 additions & 3 deletions quickwit/quickwit-cluster/src/cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ use crate::member::{
use crate::metrics::spawn_metrics_task;
use crate::{ClusterChangeStream, ClusterNode};

const MARKED_FOR_DELETION_GRACE_PERIOD: usize = if cfg!(any(test, feature = "testsuite")) {
100 // ~ HEARTBEAT * 100 = 2.5 seconds.
const MARKED_FOR_DELETION_GRACE_PERIOD: Duration = if cfg!(any(test, feature = "testsuite")) {
Duration::from_millis(2_500) // 2.5 secs
} else {
5_000 // ~ HEARTBEAT * 5_000 ~ 4 hours.
Duration::from_secs(3_600 * 2) // 2 hours.
};

// An indexing task key is formatted as
Expand Down Expand Up @@ -133,6 +133,10 @@ impl Cluster {
failure_detector_config,
gossip_interval,
marked_for_deletion_grace_period: MARKED_FOR_DELETION_GRACE_PERIOD,
extra_liveness_predicate: Some(Box::new(|node_state: &NodeState| {
node_state.contains_key(ENABLED_SERVICES_KEY)
&& node_state.contains_key(GRPC_ADVERTISE_ADDR_KEY)
})),
};
let chitchat_handle = spawn_chitchat(
chitchat_config,
Expand Down

0 comments on commit 6337ac0

Please sign in to comment.