Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use mariadb for primary check and fallback to mysql if binary path is not defined in cluster config. #867

Merged
merged 3 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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