aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2021-03-05 17:08:03 +0100
committerAlex Auvolat <alex@adnab.me>2021-03-05 17:08:03 +0100
commit7cda917b6b91a1533afb3b066e4a90269c61c871 (patch)
treeb861db9508ae2e4e7b4f0e53ba1c5857f41bbfa6
parent5e33c3cfc9e80ad64778ec49e346d51ba787c9ce (diff)
downloadgarage-7cda917b6b91a1533afb3b066e4a90269c61c871.tar.gz
garage-7cda917b6b91a1533afb3b066e4a90269c61c871.zip
update condition
-rw-r--r--src/rpc/ring.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/rpc/ring.rs b/src/rpc/ring.rs
index 906ab9f8..ee0b52ef 100644
--- a/src/rpc/ring.rs
+++ b/src/rpc/ring.rs
@@ -122,9 +122,8 @@ impl Ring {
.iter()
.map(|(_id, info)| info.datacenter.as_str())
.collect::<HashSet<&str>>();
- if !partitions[qv]
- .iter()
- .any(|(_id, i)| *i.datacenter == node_info.datacenter)
+ if (p_dcs.len() < n_datacenters
+ && !p_dcs.contains(&node_info.datacenter.as_str()))
|| (p_dcs.len() == n_datacenters
&& !partitions[qv].iter().any(|(id, _i)| id == node_id))
{