Merge pull request 'fix crash in layout computation when changing all nodes of a zone to gateway mode' (#937) from baptiste/garage:fix_layout_crash into main
All checks were successful
ci/woodpecker/push/debug Pipeline was successful
All checks were successful
ci/woodpecker/push/debug Pipeline was successful
Reviewed-on: #937 Reviewed-by: Alex <lx@deuxfleurs.fr>
This commit is contained in:
commit
1cb0ae10a8
1 changed files with 10 additions and 4 deletions
|
@ -650,8 +650,11 @@ impl LayoutVersion {
|
|||
let mut cost = CostFunction::new();
|
||||
for (p, assoc_p) in prev_assign.iter().enumerate() {
|
||||
for n in assoc_p.iter() {
|
||||
let node_zone = zone_to_id[self.expect_get_node_zone(&self.node_id_vec[*n])];
|
||||
cost.insert((Vertex::PZ(p, node_zone), Vertex::N(*n)), -1);
|
||||
if let Some(&node_zone) =
|
||||
zone_to_id.get(self.expect_get_node_zone(&self.node_id_vec[*n]))
|
||||
{
|
||||
cost.insert((Vertex::PZ(p, node_zone), Vertex::N(*n)), -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -751,8 +754,11 @@ impl LayoutVersion {
|
|||
if let Some(prev_assign) = prev_assign_opt {
|
||||
let mut old_zones_of_p = Vec::<usize>::new();
|
||||
for n in prev_assign[p].iter() {
|
||||
old_zones_of_p
|
||||
.push(zone_to_id[self.expect_get_node_zone(&self.node_id_vec[*n])]);
|
||||
if let Some(&zone_id) =
|
||||
zone_to_id.get(self.expect_get_node_zone(&self.node_id_vec[*n]))
|
||||
{
|
||||
old_zones_of_p.push(zone_id);
|
||||
}
|
||||
}
|
||||
if !old_zones_of_p.contains(&z) {
|
||||
new_partitions_zone[z] += 1;
|
||||
|
|
Loading…
Add table
Reference in a new issue