Skip to content

Commit

Permalink
Merge pull request #867 from signal18/version
Browse files Browse the repository at this point in the history
use mariadb for primary check and fallback to mysql if binary path is not defined in cluster config.
  • Loading branch information
caffeinated92 authored Sep 18, 2024
2 parents 23f9306 + ef33f10 commit 3f1124c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
20 changes: 18 additions & 2 deletions cluster/cluster_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,17 @@ func (cluster *Cluster) GetShareDir() string {
// This will use installed mysqldump first
func (cluster *Cluster) GetMysqlDumpPath() string {
if cluster.Conf.BackupMysqldumpPath == "" {
// Return installed mysql client on repman host instead of embedded if exists
if out, err := exec.Command("which", "mariadb-dump").Output(); err == nil {
path := strings.Trim(string(out), "\r\n")
return path
}

//if mysqldump installed
if path, err := exec.Command("which", "mysqldump").Output(); err == nil {
strpath := strings.TrimRight(string(path), "\r\n")
cluster.LogModulePrintf(cluster.Conf.Verbose, config.ConstLogModConfigLoad, config.LvlDbg, "Using from os package: %s\n", strpath)
return strpath
}
cluster.LogModulePrintf(cluster.Conf.Verbose, config.ConstLogModConfigLoad, config.LvlWarn, "Installed mysqldump not found, using from repman embed.")
return cluster.GetShareDir() + "/" + cluster.Conf.GoArch + "/" + cluster.Conf.GoOS + "/mysqldump"
}
return cluster.Conf.BackupMysqldumpPath
Expand Down Expand Up @@ -101,6 +105,12 @@ func (cluster *Cluster) GetMyLoaderPath() string {

func (cluster *Cluster) GetMysqlBinlogPath() string {
if cluster.Conf.BackupMysqlbinlogPath == "" {
// Return installed mysql client on repman host instead of embedded if exists
if out, err := exec.Command("which", "mariadb-binlog").Output(); err == nil {
path := strings.Trim(string(out), "\r\n")
return path
}

// Return installed mysqlbinlog on repman host instead of embedded if exists
if out, err := exec.Command("which", "mysqlbinlog").Output(); err == nil {
path := strings.Trim(string(out), "\r\n")
Expand All @@ -113,6 +123,12 @@ func (cluster *Cluster) GetMysqlBinlogPath() string {

func (cluster *Cluster) GetMysqlclientPath() string {
if cluster.Conf.BackupMysqlclientPath == "" {
// Return installed mysql client on repman host instead of embedded if exists
if out, err := exec.Command("which", "mariadb").Output(); err == nil {
path := strings.Trim(string(out), "\r\n")
return path
}

// Return installed mysql client on repman host instead of embedded if exists
if out, err := exec.Command("which", "mysql").Output(); err == nil {
path := strings.Trim(string(out), "\r\n")
Expand Down
1 change: 1 addition & 0 deletions utils/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type Version struct {
Minor int `json:"minor"`
Release int `json:"release"`
Suffix string `json:"suffix"`
Path string `json:"path"`
DistVersion *Version `json:"dist"`
}

Expand Down

0 comments on commit 3f1124c

Please sign in to comment.