Skip to content

Commit

Permalink
fixing issue with xtrabackup and long gtids (vitessio#16304)
Browse files Browse the repository at this point in the history
Signed-off-by: Renan Rangel <[email protected]>
  • Loading branch information
rvrangel authored and tanjinx committed Oct 15, 2024
1 parent 37b690c commit 89794c0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
16 changes: 8 additions & 8 deletions go/vt/mysqlctl/xtrabackupengine.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ import (
// it implements the BackupEngine interface and contains all the logic
// required to implement a backup/restore by invoking xtrabackup with
// the appropriate parameters
type XtrabackupEngine struct {
}
type XtrabackupEngine struct{}

var (
// path where backup engine program is located
Expand Down Expand Up @@ -156,7 +155,6 @@ func closeFile(wc io.WriteCloser, fileName string, logger logutil.Logger, finalE
// ExecuteBackup returns a boolean that indicates if the backup is usable,
// and an overall error.
func (be *XtrabackupEngine) ExecuteBackup(ctx context.Context, params BackupParams, bh backupstorage.BackupHandle) (complete bool, finalErr error) {

if xtrabackupUser == "" {
return false, vterrors.New(vtrpc.Code_INVALID_ARGUMENT, "xtrabackupUser must be specified.")
}
Expand Down Expand Up @@ -248,7 +246,8 @@ func (be *XtrabackupEngine) backupFiles(
flavor string,
) (replicationPosition mysql.Position, finalErr error) {
backupProgram := path.Join(xtrabackupEnginePath, xtrabackupBinaryName)
flagsToExec := []string{"--defaults-file=" + params.Cnf.Path,
flagsToExec := []string{
"--defaults-file=" + params.Cnf.Path,
"--backup",
"--socket=" + params.Cnf.SocketFile,
"--slave-info",
Expand Down Expand Up @@ -414,7 +413,6 @@ func (be *XtrabackupEngine) backupFiles(

// ExecuteRestore restores from a backup. Any error is returned.
func (be *XtrabackupEngine) ExecuteRestore(ctx context.Context, params RestoreParams, bh backupstorage.BackupHandle) (*BackupManifest, error) {

var bm xtraBackupManifest

if err := getBackupManifestInto(ctx, bh, &bm); err != nil {
Expand Down Expand Up @@ -477,7 +475,8 @@ func (be *XtrabackupEngine) restoreFromBackup(ctx context.Context, cnf *Mycnf, b
logger.Infof("Restore: Preparing the extracted files")
// prepare the backup
restoreProgram := path.Join(xtrabackupEnginePath, xtrabackupBinaryName)
flagsToExec := []string{"--defaults-file=" + cnf.Path,
flagsToExec := []string{
"--defaults-file=" + cnf.Path,
"--prepare",
"--target-dir=" + tempDir,
}
Expand Down Expand Up @@ -512,7 +511,8 @@ func (be *XtrabackupEngine) restoreFromBackup(ctx context.Context, cnf *Mycnf, b
// then move-back
logger.Infof("Restore: Move extracted and prepared files to final locations")

flagsToExec = []string{"--defaults-file=" + cnf.Path,
flagsToExec = []string{
"--defaults-file=" + cnf.Path,
"--move-back",
"--target-dir=" + tempDir,
}
Expand Down Expand Up @@ -579,7 +579,7 @@ func (be *XtrabackupEngine) extractFiles(ctx context.Context, logger logutil.Log
// Create the decompressor if needed.
if compressed {
var decompressor io.ReadCloser
var deCompressionEngine = bm.CompressionEngine
deCompressionEngine := bm.CompressionEngine
if deCompressionEngine == "" {
// For backward compatibility. Incase if Manifest is from N-1 binary
// then we assign the default value of compressionEngine.
Expand Down
1 change: 0 additions & 1 deletion go/vt/mysqlctl/xtrabackupengine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"testing"

"github.com/stretchr/testify/assert"

"vitess.io/vitess/go/vt/logutil"
)

Expand Down

0 comments on commit 89794c0

Please sign in to comment.