aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/membership.rs
diff options
context:
space:
mode:
authorTrinity Pointard <trinity.pointard@gmail.com>2021-04-06 05:25:28 +0200
committerAlex Auvolat <alex@adnab.me>2021-04-27 16:47:08 +0200
commit74373aebcfdfcf5c03e4fb6510d8dd664a0b9b88 (patch)
treed33d89915de29eb69e1b527c686f26358fcd2b45 /src/rpc/membership.rs
parent16300bbd89235dfb5852413cd451535559664594 (diff)
downloadgarage-74373aebcfdfcf5c03e4fb6510d8dd664a0b9b88.tar.gz
garage-74373aebcfdfcf5c03e4fb6510d8dd664a0b9b88.zip
make most requested changes
Diffstat (limited to 'src/rpc/membership.rs')
-rw-r--r--src/rpc/membership.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/rpc/membership.rs b/src/rpc/membership.rs
index c465ce68..4fce1a7b 100644
--- a/src/rpc/membership.rs
+++ b/src/rpc/membership.rs
@@ -1,4 +1,4 @@
-/// Module containing structs related to membership management
+//! Module containing structs related to membership management
use std::collections::HashMap;
use std::fmt::Write as FmtWrite;
use std::io::{Read, Write};
@@ -96,7 +96,7 @@ pub struct System {
rpc_client: Arc<RpcClient<Message>>,
pub(crate) status: watch::Receiver<Arc<Status>>,
- /// The ring, viewed by this node
+ /// The ring
pub ring: watch::Receiver<Arc<Ring>>,
update_lock: Mutex<Updaters>,
@@ -114,9 +114,8 @@ struct Updaters {
#[derive(Debug, Clone)]
pub struct Status {
/// Mapping of each node id to its known status
- // considering its sorted regularly, maybe it should be a btreeset?
pub nodes: HashMap<UUID, Arc<StatusEntry>>,
- /// Hash of this entry
+ /// Hash of `nodes`, used to detect when nodes have different views of the cluster
pub hash: Hash,
}
@@ -380,7 +379,7 @@ impl System {
id_option,
addr,
sys.rpc_client
- .get_addr()
+ .by_addr()
.call(&addr, ping_msg_ref, PING_TIMEOUT)
.await,
)
@@ -418,6 +417,8 @@ impl System {
}
} else if let Some(id) = id_option {
if let Some(st) = status.nodes.get_mut(id) {
+ // TODO this might double-increment the value as the counter is already
+ // incremented for any kind of failure in rpc_client
st.num_failures.fetch_add(1, Ordering::SeqCst);
if !st.is_up() {
warn!("Node {:?} seems to be down.", id);