Skip to content
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
10 changes: 10 additions & 0 deletions go/vt/mysqlctl/builtinbackupengine.go
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,16 @@ 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
// 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 {
params.Logger.Warningf(`engine "pargzip" doesn't support decompression, using "pgzip" instead`)
bm.CompressionEngine = PgzipCompressor
defer func() {
bm.CompressionEngine = PargzipCompressor
}()
}

fes := bm.FileEntries
sema := sync2.NewSemaphore(params.Concurrency, 0)
rec := concurrency.AllErrorRecorder{}
Expand Down
2 changes: 1 addition & 1 deletion go/vt/mysqlctl/compression.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func newExternalDecompressor(ctx context.Context, cmdStr string, reader io.Reade
// This returns a reader that will decompress the underlying provided reader and will use the specified supported engine.
func newBuiltinDecompressor(engine string, reader io.Reader, logger logutil.Logger) (decompressor io.ReadCloser, err error) {
if engine == PargzipCompressor {
logger.Warningf("engine \"pargzip\" doesn't support decompression, using \"pgzip\" instead")
logger.Warningf(`engine "pargzip" doesn't support decompression, using "pgzip" instead`)
engine = PgzipCompressor
}

Expand Down
11 changes: 10 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,16 @@ 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 {
logger.Warningf(`engine "pargzip" doesn't support decompression, using "pgzip" instead`)
bm.CompressionEngine = PgzipCompressor
defer func() {
bm.CompressionEngine = PargzipCompressor
}()
}

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