Skip to content

Commit

Permalink
Sync from server repo (c51565346e9)
Browse files Browse the repository at this point in the history
  • Loading branch information
releng committed Nov 8, 2024
1 parent ad0175c commit 5d9d716
Show file tree
Hide file tree
Showing 14 changed files with 528 additions and 262 deletions.
11 changes: 10 additions & 1 deletion commands/cmd_create_db.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,17 @@ func (c *CmdCreateDB) Run(vcc vclusterops.ClusterCommands) error {
// write db info to vcluster config file
err := writeConfig(&vdb, c.createDBOptions.ForceOverwriteFile)
if err != nil {
vcc.DisplayWarning("Failed to write the configuration file: %s\n", err)
vcc.DisplayWarning("Failed to write the configuration file: %s", err)
if dbOptions.ConfigPath != defaultConfigFilePath {
vcc.DisplayWarning("Attempting writing to default config file path: %s", defaultConfigFilePath)
dbOptions.ConfigPath = defaultConfigFilePath
err = writeConfig(&vdb, c.createDBOptions.ForceOverwriteFile)
if err != nil {
vcc.DisplayWarning("Failed to write the configuration file to default path: %s", err)
}
}
}

// write config parameters to vcluster config param file
err = c.writeConfigParam(c.createDBOptions.ConfigurationParameters, c.createDBOptions.ForceOverwriteFile)
if err != nil {
Expand Down
4 changes: 3 additions & 1 deletion commands/vcluster_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const (
currentConfigFileVersion = "1.0"
configFilePerm = 0644
rpmConfDir = "/opt/vertica/config"
defaultConfigFilePath = rpmConfDir + "/" + defConfigFileName
)

// Config is the struct of vertica_cluster.yaml
Expand Down Expand Up @@ -124,7 +125,7 @@ func initConfigImpl(vclusterExePath string, ensureOptVerticaConfigExists, ensure
}
cobra.CheckErr(err)
} else {
dbOptions.ConfigPath = fmt.Sprintf("%s/%s", rpmConfDir, defConfigFileName)
dbOptions.ConfigPath = defaultConfigFilePath
return
}
}
Expand Down Expand Up @@ -360,6 +361,7 @@ func (c *DatabaseConfig) write(configFilePath string, forceOverwrite bool) error
if err != nil {
return fmt.Errorf("fail to marshal configuration data, details: %w", err)
}

err = os.WriteFile(configFilePath, configBytes, configFilePerm)
if err != nil {
return fmt.Errorf("fail to write configuration file, details: %w", err)
Expand Down
5 changes: 4 additions & 1 deletion vclusterops/https_get_up_nodes_op.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,10 @@ func isCompleteScanRequired(cmdType CmdType) bool {
cmdType == ManageConnectionDrainingCmd ||
cmdType == SetConfigurationParameterCmd ||
cmdType == GetConfigurationParameterCmd ||
cmdType == GetDrainingStatusCmd
cmdType == GetDrainingStatusCmd ||
// need to find an up node from the sandbox if we're starting sandbox
// nodes, to handle identifying compute nodes in the sandbox
cmdType == StartNodeCmd
}

func (op *httpsGetUpNodesOp) finalize(_ *opEngineExecContext) error {
Expand Down
9 changes: 9 additions & 0 deletions vclusterops/https_mark_nodes_ephemeral_op.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package vclusterops

import (
"errors"
"strings"

"github.com/vertica/vcluster/vclusterops/util"
)
Expand Down Expand Up @@ -76,11 +77,19 @@ func (op *httpsMarkEphemeralNodeOp) execute(execContext *opEngineExecContext) er

func (op *httpsMarkEphemeralNodeOp) processResult(_ *opEngineExecContext) error {
var allErrs error
const errComputeNodeMsg = "cannot change node type from compute to ephemeral"

for host, result := range op.clusterHTTPRequest.ResultCollection {
op.logResponse(host, result)

if !result.isSuccess() {
if result.isInternalError() {
errLower := strings.ToLower(result.err.Error())
if strings.Contains(errLower, errComputeNodeMsg) {
// down compute nodes can be skipped
continue
}
}
allErrs = errors.Join(allErrs, result.err)
continue
}
Expand Down
227 changes: 0 additions & 227 deletions vclusterops/https_poll_compute_node_state_op.go

This file was deleted.

Loading

0 comments on commit 5d9d716

Please sign in to comment.