Skip to content

Commit 1f667ff

Browse files
author
Matt Spilchen
committed
Sync from server repo (50213c66e4)
1 parent 5288b7b commit 1f667ff

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

rfc7807/errors.go

+4
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ var (
6565
"https://integrators.vertica.com/vcluster/errors/internal-load-remote-catalog-failure",
6666
"Internal error while loading remote catalog",
6767
)
68+
GenericSpreadSecurityPersistenceFailure = newProblemID(
69+
"https://integrators.vertica.com/vcluster/errors/spread-security-persistence-failure",
70+
"Internal error while persisting spread encryption key",
71+
)
6872
SubclusterNotFound = newProblemID(
6973
"https://integrators.vertica.com/vcluster/errors/subcluster-not-found",
7074
"Subcluster is not found",

vclusterops/https_spread_remove_node_op.go

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ type HTTPSSpreadRemoveNodeOp struct {
2828
RequestParams map[string]string
2929
}
3030

31-
//lint:ignore U1000 Ignore unused function temporarily
3231
func makeHTTPSSpreadRemoveNodeOp(hostsToRemove []string, initiatorHost []string, useHTTPPassword bool,
3332
userName string, httpsPassword *string, hostNodeMap vHostNodeMap) (HTTPSSpreadRemoveNodeOp, error) {
3433
op := HTTPSSpreadRemoveNodeOp{}

vclusterops/remove_node.go

+13-9
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ func (o *VRemoveNodeOptions) completeVDBSetting(vdb *VCoordinationDatabase) erro
236236
// - Update ksafety if needed
237237
// - Mark nodes to remove as ephemeral
238238
// - Rebalance cluster for Enterprise mode, rebalance shards for Eon mode
239+
// - Remove secondary nodes from spread
239240
// - Drop Nodes
240241
// - Reload spread
241242
// - Delete catalog and data directories
@@ -285,7 +286,13 @@ func produceRemoveNodeInstructions(vdb *VCoordinationDatabase, options *VRemoveN
285286
instructions = append(instructions, &httpsRebalanceClusterOp)
286287
}
287288

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+
}
289296

290297
err = produceDropNodeOps(&instructions, options.HostsToRemove, initiatorHost,
291298
usePassword, username, password, vdb.HostNodeMap, vdb.IsEon)
@@ -367,27 +374,24 @@ func produceDropNodeOps(instructions *[]ClusterOp, targetHosts, hosts []string,
367374

368375
// produceSpreadRemoveNodeOp calls HTTPSSpreadRemoveNodeOp
369376
// when there is at least one secondary node to remove
370-
//
371-
//lint:ignore U1000 Ignore unused function temporarily
372377
func produceSpreadRemoveNodeOp(instructions *[]ClusterOp, hostsToRemove []string,
373378
useHTTPPassword bool, userName string, httpsPassword *string,
374379
initiatorHost []string, hostNodeMap vHostNodeMap) error {
375380
// find secondary nodes from HostsToRemove
376-
hasSecondaryNodesToRemove := false
381+
var secondaryHostsToRemove []string
377382
for _, h := range hostsToRemove {
378383
vnode, ok := hostNodeMap[h]
379384
if !ok {
380385
return fmt.Errorf("cannot find host %s from vdb.HostNodeMap", h)
381386
}
382387
if !vnode.IsPrimary {
383-
hasSecondaryNodesToRemove = true
384-
break
388+
secondaryHostsToRemove = append(secondaryHostsToRemove, h)
385389
}
386390
}
387391

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,
391395
useHTTPPassword, userName, httpsPassword, hostNodeMap)
392396
if err != nil {
393397
return err

0 commit comments

Comments
 (0)