aboutsummaryrefslogtreecommitdiff
path: root/src/rpc
diff options
context:
space:
mode:
authorAlex <alex@adnab.me>2022-12-11 17:41:53 +0000
committerAlex <alex@adnab.me>2022-12-11 17:41:53 +0000
commit6e44369cbc810b8912ca0f7f5fd293e87f10c851 (patch)
treec3daca5df86a17139f25a718779dfadf26d78af8 /src/rpc
parent2c2e65ad8b37128612ba47a777eacbae5e43f3ab (diff)
parent9d83364ad911b414e6e8eb56f75bf4bfb2d36239 (diff)
downloadgarage-6e44369cbc810b8912ca0f7f5fd293e87f10c851.tar.gz
garage-6e44369cbc810b8912ca0f7f5fd293e87f10c851.zip
Merge pull request 'Optimal layout assignation algorithm' (#296) from optimal-layout into next
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/296
Diffstat (limited to 'src/rpc')
-rw-r--r--src/rpc/layout.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/rpc/layout.rs b/src/rpc/layout.rs
index 133e33c8..1cef44d1 100644
--- a/src/rpc/layout.rs
+++ b/src/rpc/layout.rs
@@ -353,20 +353,18 @@ To know the correct value of the new layout version, invoke `garage layout show`
// Check that every partition is associated to distinct nodes
let rf = self.replication_factor;
for p in 0..(1 << PARTITION_BITS) {
- let mut nodes_of_p = self.ring_assignation_data[rf * p..rf * (p + 1)].to_vec();
- nodes_of_p.sort();
+ let nodes_of_p = self.ring_assignation_data[rf * p..rf * (p + 1)].to_vec();
if nodes_of_p.iter().unique().count() != rf {
return Err(format!("partition does not contain {} unique node ids", rf));
}
// Check that every partition is spread over at least zone_redundancy zones.
- let mut zones_of_p = nodes_of_p
+ let zones_of_p = nodes_of_p
.iter()
.map(|n| {
self.get_node_zone(&self.node_id_vec[*n as usize])
.expect("Zone not found.")
})
.collect::<Vec<_>>();
- zones_of_p.sort();
let redundancy = self.parameters.zone_redundancy;
if zones_of_p.iter().unique().count() < redundancy {
return Err(format!(