Skip to content
Open
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
13 changes: 13 additions & 0 deletions src/cli/cmd/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,19 @@ func mysqlRebuildMeCommandFn(cmd *cobra.Command, args []string) {
ErrorOK(err)
log.Warning("S10-->apply-log.end....")
}

//Pre 11 change datadir owner ->mysql. patch by wubx
{
datadir := conf.Backup.BackupDir
cmds :="bash"
args := []string{
"-c",
fmt.Sprintf("chown -R mysql:mysql %s", datadir),
}
_, err := common.RunCommand(cmds, args...)
ErrorOK(err)
log.Warning("Pre-S11-->chown owner to mysql[%v]", datadir)
}

// 11. start mysqld
{
Expand Down
5 changes: 5 additions & 0 deletions src/mysql/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ func (m *Mysql) Promotable() bool {
log.Error("can't.promotable.GetGTID.error:%v", err)
return false
}
//Slave_IO_Running = Yes, So master is alive
//if (gtid.Slave_IO_Running) {
// log.Warning("Maybe Master is alive. Slave IO_thread not timeout (slave_net_timeout)")
// return false
//}

promotable = (gtid.Slave_SQL_Running)
log.Warning("mysql[%v].Promotable.sql_thread[%v]", m.getConnStr(), promotable)
Expand Down
9 changes: 5 additions & 4 deletions src/mysqld/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
const (
// backupOk used to completed of xtrabackup
backupOk = "completed OK!"
backupOkCheckTimes = 2
backupOkCheckTimes = 1
)

// Backup tuple.
Expand Down Expand Up @@ -99,7 +99,7 @@ func (b *Backup) backupCommands(iskey bool, req *model.BackupRPCRequest) []strin
var ssh string

if b.conf.Passwd == "" {
backup = fmt.Sprintf("%s/innobackupex --defaults-file=%s --host=%s --port=%d --user=%s --throttle=%d --parallel=%d --stream=xbstream ./",
backup = fmt.Sprintf("%s/xtrabackup --defaults-file=%s --host=%s --port=%d --user=%s --backup --throttle=%d --parallel=%d --stream=xbstream --target-dir=./",
b.conf.XtrabackupBinDir,
b.conf.DefaultsFile,
b.conf.Host,
Expand All @@ -108,7 +108,7 @@ func (b *Backup) backupCommands(iskey bool, req *model.BackupRPCRequest) []strin
req.IOPSLimits,
b.conf.Parallel)
} else {
backup = fmt.Sprintf("%s/innobackupex --defaults-file=%s --host=%s --port=%d --user=%s --password=%s --throttle=%d --parallel=%d --stream=xbstream ./",
backup = fmt.Sprintf("%s/xtrabackup --defaults-file=%s --host=%s --port=%d --user=%s --password=%s --backup --throttle=%d --parallel=%d --stream=xbstream --target-dir=./",
b.conf.XtrabackupBinDir,
b.conf.DefaultsFile,
b.conf.Host,
Expand Down Expand Up @@ -136,6 +136,7 @@ func (b *Backup) backupCommands(iskey bool, req *model.BackupRPCRequest) []strin
req.BackupDir)
}
arg = fmt.Sprintf("%s | %s", backup, ssh)
b.log.Warning(arg)
return []string{
"-c",
arg,
Expand Down Expand Up @@ -204,7 +205,7 @@ func (b *Backup) Cancel() error {
}

func (b *Backup) applylogCommands(req *model.BackupRPCRequest) []string {
arg := fmt.Sprintf("%s/innobackupex --defaults-file=%s --use-memory=%s --apply-log %s", b.conf.XtrabackupBinDir, b.conf.DefaultsFile, b.conf.UseMemory, req.BackupDir)
arg := fmt.Sprintf("%s/xtrabackup --defaults-file=%s --use-memory=%s --prepare --target-dir=%s", b.conf.XtrabackupBinDir, b.conf.DefaultsFile, b.conf.UseMemory, req.BackupDir)
return []string{
"-c",
arg,
Expand Down