Skip to content

Commit f810d61

Browse files
wangyeleiapecloud-bot
authored andcommitted
fix: cancel vscale ops failed when the component is a sharding (#9970)
(cherry picked from commit 0fa7766)
1 parent 4230c7f commit f810d61

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

pkg/operations/ops_progress_util.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,18 @@ func handleComponentStatusProgress(
201201
completedCount = handleProgressForPodsRollingUpdate(opsRes, pods, pgRes, compStatus, minReadySeconds, podApplyOps)
202202
}
203203
if opsRes.OpsRequest.Status.Phase == opsv1alpha1.OpsCancellingPhase {
204-
// only rollback the actual re-created pod during cancelling.
205-
expectReplicas = int32(len(compStatus.ProgressDetails))
204+
// only rollback the actual re-created pod during cancelling and which belongs to this component.
205+
progressDetailMap := map[string]any{}
206+
var updatedPodCount int32
207+
for _, v := range compStatus.ProgressDetails {
208+
progressDetailMap[v.ObjectKey] = nil
209+
}
210+
for _, v := range pods {
211+
if _, ok := progressDetailMap[getProgressObjectKey(constant.PodKind, v.Name)]; ok {
212+
updatedPodCount += 1
213+
}
214+
}
215+
expectReplicas = updatedPodCount
206216
}
207217
return expectReplicas, completedCount, err
208218
}

0 commit comments

Comments
 (0)