@@ -236,6 +236,7 @@ func (o *VRemoveNodeOptions) completeVDBSetting(vdb *VCoordinationDatabase) erro
236
236
// - Update ksafety if needed
237
237
// - Mark nodes to remove as ephemeral
238
238
// - Rebalance cluster for Enterprise mode, rebalance shards for Eon mode
239
+ // - Remove secondary nodes from spread
239
240
// - Drop Nodes
240
241
// - Reload spread
241
242
// - Delete catalog and data directories
@@ -285,7 +286,13 @@ func produceRemoveNodeInstructions(vdb *VCoordinationDatabase, options *VRemoveN
285
286
instructions = append (instructions , & httpsRebalanceClusterOp )
286
287
}
287
288
288
- // VER-89478: only remove secondary nodes from spread
289
+ // only remove secondary nodes from spread
290
+ err = produceSpreadRemoveNodeOp (& instructions , options .HostsToRemove ,
291
+ usePassword , username , password ,
292
+ initiatorHost , vdb .HostNodeMap )
293
+ if err != nil {
294
+ return instructions , err
295
+ }
289
296
290
297
err = produceDropNodeOps (& instructions , options .HostsToRemove , initiatorHost ,
291
298
usePassword , username , password , vdb .HostNodeMap , vdb .IsEon )
@@ -367,27 +374,24 @@ func produceDropNodeOps(instructions *[]ClusterOp, targetHosts, hosts []string,
367
374
368
375
// produceSpreadRemoveNodeOp calls HTTPSSpreadRemoveNodeOp
369
376
// when there is at least one secondary node to remove
370
- //
371
- //lint:ignore U1000 Ignore unused function temporarily
372
377
func produceSpreadRemoveNodeOp (instructions * []ClusterOp , hostsToRemove []string ,
373
378
useHTTPPassword bool , userName string , httpsPassword * string ,
374
379
initiatorHost []string , hostNodeMap vHostNodeMap ) error {
375
380
// find secondary nodes from HostsToRemove
376
- hasSecondaryNodesToRemove := false
381
+ var secondaryHostsToRemove [] string
377
382
for _ , h := range hostsToRemove {
378
383
vnode , ok := hostNodeMap [h ]
379
384
if ! ok {
380
385
return fmt .Errorf ("cannot find host %s from vdb.HostNodeMap" , h )
381
386
}
382
387
if ! vnode .IsPrimary {
383
- hasSecondaryNodesToRemove = true
384
- break
388
+ secondaryHostsToRemove = append (secondaryHostsToRemove , h )
385
389
}
386
390
}
387
391
388
- // only call HTTPSSpreadRemoveNodeOp when there are secondary nodes to remove
389
- if hasSecondaryNodesToRemove {
390
- httpsSpreadRemoveNodeOp , err := makeHTTPSSpreadRemoveNodeOp (hostsToRemove , initiatorHost ,
392
+ // only call HTTPSSpreadRemoveNodeOp for secondary nodes to remove
393
+ if len ( secondaryHostsToRemove ) > 0 {
394
+ httpsSpreadRemoveNodeOp , err := makeHTTPSSpreadRemoveNodeOp (secondaryHostsToRemove , initiatorHost ,
391
395
useHTTPPassword , userName , httpsPassword , hostNodeMap )
392
396
if err != nil {
393
397
return err
0 commit comments