You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// deleteInvalidMigrationReplicas selects one replica for each path and delete the rests.
4150
+
//
4151
+
// Notice that the selected replica may not be valid.
4152
+
// Returning invalid replicas for some paths helps inform the caller that it should wait for the existing invalid replica disappears before creating a new one.
if!isChosenReplicaRunning&&r.Status.CurrentState==longhorn.InstanceStateRunning { // when both are valid, prefer a running replica
4176
+
chosenReplica=r
4177
+
isChosenReplicaValid=true
4178
+
isChosenReplicaRunning=true
4179
+
}
4180
+
}
4181
+
} else { // for invalid replicas, do cleanup immediately
4182
+
c.logger.Infof("Cleaning up the invalid migration replica %v (data engine %v) since it is state %s, or it is last failed at %s, or there is no matching old replica in path %v", r.Name, v.Spec.DataEngine, r.Status.CurrentState, r.Spec.LastFailedAt, path)
returnerrors.Wrapf(err, "failed to delete the new replica %v when there is no matching old replica in path %v", r.Name, path)
4188
+
4189
+
// Even if there are multiple valid or running migration replicas, we still need to clean up the extra ones.
4190
+
// Otherwise, those extra replicas for the same path would lead to the mismatching between migration replica list and the old replica list, then cause the migration engine restart.
4191
+
for_, r:=rangerList {
4192
+
ifr.Name!=chosenReplica.Name {
4193
+
c.logger.Infof("Cleaning up the extra migration replica %v (data engine %v) since another migration replica %v is chosen for path %v", r.Name, v.Spec.DataEngine, chosenReplica.Name, path)
0 commit comments