Skip to content

Commit

Permalink
Sync from server repo (1bb3e064f04)
Browse files Browse the repository at this point in the history
  • Loading branch information
releng committed Jan 10, 2025
1 parent 3d877cd commit 118920e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
13 changes: 11 additions & 2 deletions commands/cmd_start_replication.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package commands

import (
"fmt"
"strings"

"github.com/spf13/cobra"
"github.com/spf13/viper"
Expand Down Expand Up @@ -262,8 +263,16 @@ func (c *CmdStartReplication) Run(vcc vclusterops.ClusterCommands) error {

transactionID, err := vcc.VReplicateDatabase(options)
if err != nil {
vcc.LogError(err, "failed to replicate to database", "targetDB", options.TargetDB.DBName)
return err
errMsg := err.Error()
// when no table matches include pattern, errMsg contains "ERROR 4089: [22023] No objects specified"
// when no table matches table-or-schema-name, errMsg contains "ERROR 11781: [22023] Unknown or unsupported table name"
if !strings.Contains(errMsg, "22023") {
vcc.LogError(err, "failed to replicate to database", "targetDB", options.TargetDB.DBName)
return err
}
vcc.DisplayWarning("No data is replicated to database %s: %s",
options.TargetDB.DBName, errMsg)
return nil
}

if options.Async {
Expand Down
10 changes: 5 additions & 5 deletions commands/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,17 @@ func converErrorMessage(err error, logger vlog.Printer) string {
errMsg := err.Error()
logger.Error(err, "error to be converted into err msg")
if strings.Contains(errMsg, "down database") {
return "failed to vertify connection parameters. please check your db name and host list"
return "Failed to verify connection parameters. Please check your db name and host list"
} else if strings.Contains(errMsg, "Wrong password") {
return "failed to vertify connection parameters. please check your db username and password"
return "Failed to verify connection parameters. Please check your db username and password"
} else if strings.Contains(errMsg, "rather than database") {
return "failed to vertify connection parameters. please check your db name"
return "Failed to verify connection parameters. Please check your db name"
} else if strings.Contains(errMsg, "no such host") || strings.Contains(errMsg, "network is unreachable") ||
strings.Contains(errMsg, "fail to send request") || strings.Contains(errMsg, "server misbehaving") ||
strings.Contains(errMsg, "i/o timeout") {
return "failed to vertify connection parameters. please check your host list"
return "Failed to verify connection parameters. Please check your host list"
}
return "failed to vertify connection parameters: " + errMsg
return "Failed to verify connection parameters: " + errMsg
}

// this function calls ClusterCommand.FetchNodesDetails() for each input hosts and return both valid and invalid hosts
Expand Down

0 comments on commit 118920e

Please sign in to comment.