Skip to content

Commit

Permalink
Sync from server repo (50213c66e4)
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Spilchen committed Oct 4, 2023
1 parent 5288b7b commit 1f667ff
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
4 changes: 4 additions & 0 deletions rfc7807/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ var (
"https://integrators.vertica.com/vcluster/errors/internal-load-remote-catalog-failure",
"Internal error while loading remote catalog",
)
GenericSpreadSecurityPersistenceFailure = newProblemID(
"https://integrators.vertica.com/vcluster/errors/spread-security-persistence-failure",
"Internal error while persisting spread encryption key",
)
SubclusterNotFound = newProblemID(
"https://integrators.vertica.com/vcluster/errors/subcluster-not-found",
"Subcluster is not found",
Expand Down
1 change: 0 additions & 1 deletion vclusterops/https_spread_remove_node_op.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ type HTTPSSpreadRemoveNodeOp struct {
RequestParams map[string]string
}

//lint:ignore U1000 Ignore unused function temporarily
func makeHTTPSSpreadRemoveNodeOp(hostsToRemove []string, initiatorHost []string, useHTTPPassword bool,
userName string, httpsPassword *string, hostNodeMap vHostNodeMap) (HTTPSSpreadRemoveNodeOp, error) {
op := HTTPSSpreadRemoveNodeOp{}
Expand Down
22 changes: 13 additions & 9 deletions vclusterops/remove_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ func (o *VRemoveNodeOptions) completeVDBSetting(vdb *VCoordinationDatabase) erro
// - Update ksafety if needed
// - Mark nodes to remove as ephemeral
// - Rebalance cluster for Enterprise mode, rebalance shards for Eon mode
// - Remove secondary nodes from spread
// - Drop Nodes
// - Reload spread
// - Delete catalog and data directories
Expand Down Expand Up @@ -285,7 +286,13 @@ func produceRemoveNodeInstructions(vdb *VCoordinationDatabase, options *VRemoveN
instructions = append(instructions, &httpsRebalanceClusterOp)
}

// VER-89478: only remove secondary nodes from spread
// only remove secondary nodes from spread
err = produceSpreadRemoveNodeOp(&instructions, options.HostsToRemove,
usePassword, username, password,
initiatorHost, vdb.HostNodeMap)
if err != nil {
return instructions, err
}

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

// produceSpreadRemoveNodeOp calls HTTPSSpreadRemoveNodeOp
// when there is at least one secondary node to remove
//
//lint:ignore U1000 Ignore unused function temporarily
func produceSpreadRemoveNodeOp(instructions *[]ClusterOp, hostsToRemove []string,
useHTTPPassword bool, userName string, httpsPassword *string,
initiatorHost []string, hostNodeMap vHostNodeMap) error {
// find secondary nodes from HostsToRemove
hasSecondaryNodesToRemove := false
var secondaryHostsToRemove []string
for _, h := range hostsToRemove {
vnode, ok := hostNodeMap[h]
if !ok {
return fmt.Errorf("cannot find host %s from vdb.HostNodeMap", h)
}
if !vnode.IsPrimary {
hasSecondaryNodesToRemove = true
break
secondaryHostsToRemove = append(secondaryHostsToRemove, h)
}
}

// only call HTTPSSpreadRemoveNodeOp when there are secondary nodes to remove
if hasSecondaryNodesToRemove {
httpsSpreadRemoveNodeOp, err := makeHTTPSSpreadRemoveNodeOp(hostsToRemove, initiatorHost,
// only call HTTPSSpreadRemoveNodeOp for secondary nodes to remove
if len(secondaryHostsToRemove) > 0 {
httpsSpreadRemoveNodeOp, err := makeHTTPSSpreadRemoveNodeOp(secondaryHostsToRemove, initiatorHost,
useHTTPPassword, userName, httpsPassword, hostNodeMap)
if err != nil {
return err
Expand Down

0 comments on commit 1f667ff

Please sign in to comment.