Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Commit

Permalink
Revert "backup: Use pargzip instead of pgzip for compression."
Browse files Browse the repository at this point in the history
This reverts commit d2f2d09.

Signed-off-by: Rafael Chacon <rafael@slack-corp.com>
Signed-off-by: Vitaliy Mogilevskiy <vmogilevskiy@slack-corp.com>
  • Loading branch information
rafael authored and vmogilev committed Apr 30, 2022
1 parent eb0ddbd commit 6d1adcb
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 17 deletions.
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ require (
github.com/philhofer/fwd v1.0.0 // indirect
github.com/pires/go-proxyproto v0.0.0-20191211124218-517ecdf5bb2b
github.com/pkg/errors v0.9.1
github.com/planetscale/pargzip v0.0.0-20201116224723-90c7fc03ea8a
github.com/planetscale/tengo v0.9.6-ps.v4
github.com/planetscale/vtprotobuf v0.0.0-20210521163914-5a02622d1e2a
github.com/prometheus/client_golang v1.11.0
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -603,8 +603,6 @@ github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/planetscale/pargzip v0.0.0-20201116224723-90c7fc03ea8a h1:y0OpQ4+5tKxeh9+H+2cVgASl9yMZYV9CILinKOiKafA=
github.com/planetscale/pargzip v0.0.0-20201116224723-90c7fc03ea8a/go.mod h1:GJFUzQuXIoB2Kjn1ZfDhJr/42D5nWOqRcIQVgCxTuIE=
github.com/planetscale/tengo v0.9.6-ps.v4 h1:nLGFobPtYEZDmuRww38RJiP7gVWVLBMzpTUysLIUF7Q=
github.com/planetscale/tengo v0.9.6-ps.v4/go.mod h1:Xwj7BHMQW30k479dZvWIl/WOCy33skXRjYZLsKgAINM=
github.com/planetscale/vtprotobuf v0.0.0-20210521163914-5a02622d1e2a h1:qr27Mt+/BoONcc6hogjN5PPCykCxXvJMpXCtYMMgkws=
Expand Down
12 changes: 6 additions & 6 deletions go/vt/mysqlctl/builtinbackupengine.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
"time"

"github.com/klauspost/pgzip"
"github.com/planetscale/pargzip"

"vitess.io/vitess/go/mysql"
"vitess.io/vitess/go/sync2"
Expand Down Expand Up @@ -409,12 +408,13 @@ func (be *BuiltinBackupEngine) backupFile(ctx context.Context, params BackupPara
}

// Create the gzip compression pipe, if necessary.
var gzip *pargzip.Writer
var gzip *pgzip.Writer
if *backupStorageCompress {
gzip = pargzip.NewWriter(writer)
gzip.ChunkSize = *backupCompressBlockSize
gzip.Parallel = *backupCompressBlocks
gzip.CompressionLevel = pargzip.BestSpeed
gzip, err = pgzip.NewWriterLevel(writer, pgzip.BestSpeed)
if err != nil {
return vterrors.Wrap(err, "cannot create gziper")
}
gzip.SetConcurrency(*backupCompressBlockSize, *backupCompressBlocks)
writer = gzip
}

Expand Down
16 changes: 8 additions & 8 deletions go/vt/mysqlctl/xtrabackupengine.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import (
"time"

"github.com/klauspost/pgzip"
"github.com/planetscale/pargzip"

"vitess.io/vitess/go/mysql"
"vitess.io/vitess/go/vt/logutil"
Expand Down Expand Up @@ -271,18 +270,19 @@ func (be *XtrabackupEngine) backupFiles(ctx context.Context, params BackupParams

destWriters := []io.Writer{}
destBuffers := []*bufio.Writer{}
destCompressors := []io.WriteCloser{}
destCompressors := []*pgzip.Writer{}
for _, file := range destFiles {
buffer := bufio.NewWriterSize(file, writerBufferSize)
destBuffers = append(destBuffers, buffer)
writer := io.Writer(buffer)

// Create the gzip compression pipe, if necessary.
if *backupStorageCompress {
compressor := pargzip.NewWriter(writer)
compressor.ChunkSize = *backupCompressBlockSize
compressor.Parallel = *backupCompressBlocks
compressor.CompressionLevel = pargzip.BestSpeed
compressor, err := pgzip.NewWriterLevel(writer, pgzip.BestSpeed)
if err != nil {
return replicationPosition, vterrors.Wrap(err, "cannot create gzip compressor")
}
compressor.SetConcurrency(*backupCompressBlockSize, *backupCompressBlocks)
writer = compressor
destCompressors = append(destCompressors, compressor)
}
Expand Down Expand Up @@ -522,7 +522,7 @@ func (be *XtrabackupEngine) extractFiles(ctx context.Context, logger logutil.Log
}()

srcReaders := []io.Reader{}
srcDecompressors := []io.ReadCloser{}
srcDecompressors := []*pgzip.Reader{}
for _, file := range srcFiles {
reader := io.Reader(file)

Expand Down Expand Up @@ -736,7 +736,7 @@ func copyToStripes(writers []io.Writer, reader io.Reader, blockSize int64) (writ
}

// Read blocks from source and round-robin them to destination writers.
// Since we put a buffer in front of the destination file, and pargzip has its
// Since we put a buffer in front of the destination file, and pgzip has its
// own buffer as well, we are writing into a buffer either way (whether a
// compressor is in the chain or not). That means these writes should not
// block often, so we shouldn't need separate goroutines here.
Expand Down

0 comments on commit 6d1adcb

Please sign in to comment.