Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
11 changes: 11 additions & 0 deletions go/vt/mysqlctl/builtinbackupengine.go
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,17 @@ func (be *BuiltinBackupEngine) ExecuteRestore(ctx context.Context, params Restor
// restoreFiles will copy all the files from the BackupStorage to the
// right place.
func (be *BuiltinBackupEngine) restoreFiles(ctx context.Context, params RestoreParams, bh backupstorage.BackupHandle, bm builtinBackupManifest) error {
// For optimization, we are replacing pargzip with pgzip, so newBuiltinDecompressor doesn't have to compare and print warning for every file
Comment thread
deepthi marked this conversation as resolved.
// since newBuiltinDecompressor is helper method and does not hold any state, it was hard to do it in that method itself.
if bm.CompressionEngine == PargzipCompressor {
originalEngineValue := bm.CompressionEngine
params.Logger.Warningf("engine \"pargzip\" doesn't support decompression, using \"pgzip\" instead")
Comment thread
rsajwani marked this conversation as resolved.
Outdated
bm.CompressionEngine = PgzipCompressor
defer func() {
bm.CompressionEngine = originalEngineValue
}()
Comment thread
rsajwani marked this conversation as resolved.
Outdated
}

fes := bm.FileEntries
sema := sync2.NewSemaphore(params.Concurrency, 0)
rec := concurrency.AllErrorRecorder{}
Expand Down
12 changes: 11 additions & 1 deletion go/vt/mysqlctl/xtrabackupengine.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,6 @@ func (be *XtrabackupEngine) ExecuteRestore(ctx context.Context, params RestorePa
func (be *XtrabackupEngine) restoreFromBackup(ctx context.Context, cnf *Mycnf, bh backupstorage.BackupHandle, bm xtraBackupManifest, logger logutil.Logger) error {
// first download the file into a tmp dir
// and extract all the files

tempDir := fmt.Sprintf("%v/%v", cnf.TmpDir, time.Now().UTC().Format("xtrabackup-2006-01-02.150405"))
// create tempDir
if err := os.MkdirAll(tempDir, os.ModePerm); err != nil {
Expand All @@ -465,6 +464,17 @@ func (be *XtrabackupEngine) restoreFromBackup(ctx context.Context, cnf *Mycnf, b
}
}(tempDir, logger)

// For optimization, we are replacing pargzip with pgzip, so newBuiltinDecompressor doesn't have to compare and print warning for every file
// since newBuiltinDecompressor is helper method and does not hold any state, it was hard to do it in that method itself.
if bm.CompressionEngine == PargzipCompressor {
originalEngineValue := bm.CompressionEngine
logger.Warningf("engine \"pargzip\" doesn't support decompression, using \"pgzip\" instead")
bm.CompressionEngine = PgzipCompressor
defer func() {
bm.CompressionEngine = originalEngineValue
}()
}

if err := be.extractFiles(ctx, logger, bh, bm, tempDir); err != nil {
logger.Errorf("error extracting backup files: %v", err)
return err
Expand Down