Skip to content

Commit

Permalink
chore(bors): merge pull request #397
Browse files Browse the repository at this point in the history
397: fix(upgrade-job): avoid infinite loop when no unhealthy vols have a target r=niladrih a=niladrih

Fixes a bug where if, during data-plane upgrade, `rebuild_result` function finds unhealthy volumes, but none of the volumes have a target, then, the function continues to try to list unhealthy volumes constantly.

<!

Co-authored-by: Niladri Halder <[email protected]>
  • Loading branch information
mayastor-bors and niladrih committed Dec 27, 2023
2 parents 2a93380 + c0096f6 commit b86947c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions k8s/upgrade/src/bin/upgrade-job/upgrade/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,13 @@ pub(crate) async fn rebuild_result(
break;
}

let mut volume_over_nodes = HashSet::new();
for volume in unhealthy_volumes.iter() {
let target = if let Some(target) = volume.state.target.as_ref() {
target
} else {
continue;
let target = match volume.state.target.as_ref() {
Some(t) => t,
None => continue,
};

let mut volume_over_nodes = HashSet::new();
volume_over_nodes.insert(target.node.as_str());

for (_, topology) in volume.state.replica_topology.iter() {
Expand Down Expand Up @@ -74,6 +73,9 @@ pub(crate) async fn rebuild_result(
}
}
}
if volume_over_nodes.is_empty() {
break;
}
}
Ok(RebuildResult {
rebuilding: false,
Expand Down

0 comments on commit b86947c

Please sign in to comment.