Garage v0.9 #473
1 changed files with 2 additions and 4 deletions
|
@ -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
|
// Check that every partition is associated to distinct nodes
|
||||||
let rf = self.replication_factor;
|
let rf = self.replication_factor;
|
||||||
for p in 0..(1 << PARTITION_BITS) {
|
for p in 0..(1 << PARTITION_BITS) {
|
||||||
let mut nodes_of_p = self.ring_assignation_data[rf * p..rf * (p + 1)].to_vec();
|
let nodes_of_p = self.ring_assignation_data[rf * p..rf * (p + 1)].to_vec();
|
||||||
nodes_of_p.sort();
|
|
||||||
if nodes_of_p.iter().unique().count() != rf {
|
if nodes_of_p.iter().unique().count() != rf {
|
||||||
return Err(format!("partition does not contain {} unique node ids", rf));
|
return Err(format!("partition does not contain {} unique node ids", rf));
|
||||||
}
|
}
|
||||||
// Check that every partition is spread over at least zone_redundancy zones.
|
// 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()
|
.iter()
|
||||||
.map(|n| {
|
.map(|n| {
|
||||||
self.get_node_zone(&self.node_id_vec[*n as usize])
|
self.get_node_zone(&self.node_id_vec[*n as usize])
|
||||||
.expect("Zone not found.")
|
.expect("Zone not found.")
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
zones_of_p.sort();
|
|
||||||
let redundancy = self.parameters.zone_redundancy;
|
let redundancy = self.parameters.zone_redundancy;
|
||||||
if zones_of_p.iter().unique().count() < redundancy {
|
if zones_of_p.iter().unique().count() < redundancy {
|
||||||
return Err(format!(
|
return Err(format!(
|
||||||
|
|
Loading…
Reference in a new issue