diff --git a/src/cli/cmd/mysql.go b/src/cli/cmd/mysql.go index 70d49c7..a2e56bb 100644 --- a/src/cli/cmd/mysql.go +++ b/src/cli/cmd/mysql.go @@ -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 { diff --git a/src/mysql/api.go b/src/mysql/api.go index a0b64d7..f0362fd 100644 --- a/src/mysql/api.go +++ b/src/mysql/api.go @@ -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) diff --git a/src/mysqld/backup.go b/src/mysqld/backup.go index 42d32b2..e9a7f85 100644 --- a/src/mysqld/backup.go +++ b/src/mysqld/backup.go @@ -23,7 +23,7 @@ import ( const ( // backupOk used to completed of xtrabackup backupOk = "completed OK!" - backupOkCheckTimes = 2 + backupOkCheckTimes = 1 ) // Backup tuple. @@ -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, @@ -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, @@ -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, @@ -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,