Skip to content

Commit

Permalink
modify scale out sqlClient
Browse files Browse the repository at this point in the history
  • Loading branch information
catpineapple committed Dec 10, 2024
1 parent 2d6d9de commit ffbc771
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,13 @@ func (dcgs *DisaggregatedComputeGroupsController) ClearResources(ctx context.Con
NoNeedAppend:
}

sqlClient, err := dcgs.getMasterSqlClient(ctx, dcgs.K8sclient, ddc)
if err != nil {
klog.Errorf("computeGroupSync ClearResources dropCGBySQLClient getMasterSqlClient failed: %s", err.Error())
dcgs.K8srecorder.Event(ddc, string(sc.EventWarning), string(sc.CGSqlExecFailed), "computeGroupSync dropCGBySQLClient failed: "+err.Error())
}
defer sqlClient.Close()

for i := range clearCGs {
cgs := clearCGs[i]
cleared := true
Expand All @@ -295,12 +302,6 @@ func (dcgs *DisaggregatedComputeGroupsController) ClearResources(ctx context.Con
// drop compute group
cgName := strings.ReplaceAll(cgs.UniqueId, "_", "-")
cgKeepAmount := int32(0)
sqlClient, err := dcgs.getMasterSqlClient(ctx, dcgs.K8sclient, ddc)
if err != nil {
klog.Errorf("computeGroupSync ClearResources dropCGBySQLClient getMasterSqlClient failed: %s", err.Error())
dcgs.K8srecorder.Event(ddc, string(sc.EventWarning), string(sc.CGSqlExecFailed), "computeGroupSync dropCGBySQLClient failed: "+err.Error())
}
defer sqlClient.Close()
err = dcgs.scaledOutBENodesByDrop(sqlClient, cgName, cgKeepAmount)
if err != nil {
klog.Errorf("computeGroupSync ClearResources dropCGBySQLClient failed: %s", err.Error())
Expand Down

0 comments on commit ffbc771

Please sign in to comment.