1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-03 00:26:59 +02:00

Add infrastructure for multiple compression type support.

Add compress-type option and deprecate compress option. Since the compress option is boolean it won't work with multiple compression types. Add logic to cfgLoadUpdateOption() to update compress-type if it is not set directly. The compress option should no longer be referenced outside the cfgLoadUpdateOption() function.

Add common/compress/helper module to contain interface functions that work with multiple compression types. Code outside this module should no longer call specific compression drivers, though it may be OK to reference a specific compression type using the new interface (e.g., saving backup history files in gz format).

Unit tests only test compression using the gz format because other formats may not be available in all builds. It is the job of integration tests to exercise all compression types.

Additional compression types will be added in future commits.
This commit is contained in:
David Steele
2020-03-06 14:41:03 -05:00
parent 02aa03d1a2
commit 438b957f9c
70 changed files with 1237 additions and 490 deletions

View File

@ -44,14 +44,14 @@ sub run
foreach my $rhRun
(
{vm => VM1, remote => false, s3 => false, encrypt => false, compress => true, error => 0},
{vm => VM1, remote => true, s3 => true, encrypt => true, compress => false, error => 1},
{vm => VM2, remote => false, s3 => true, encrypt => false, compress => false, error => 0},
{vm => VM2, remote => true, s3 => false, encrypt => true, compress => true, error => 0},
{vm => VM3, remote => false, s3 => false, encrypt => true, compress => false, error => 0},
{vm => VM3, remote => true, s3 => true, encrypt => false, compress => true, error => 1},
{vm => VM4, remote => false, s3 => true, encrypt => true, compress => true, error => 0},
{vm => VM4, remote => true, s3 => false, encrypt => false, compress => false, error => 0},
{vm => VM1, remote => false, s3 => false, encrypt => false, compress => GZ, error => 0},
{vm => VM1, remote => true, s3 => true, encrypt => true, compress => GZ, error => 1},
{vm => VM2, remote => false, s3 => true, encrypt => false, compress => NONE, error => 0},
{vm => VM2, remote => true, s3 => false, encrypt => true, compress => GZ, error => 0},
{vm => VM3, remote => false, s3 => false, encrypt => true, compress => NONE, error => 0},
{vm => VM3, remote => true, s3 => true, encrypt => false, compress => GZ, error => 1},
{vm => VM4, remote => false, s3 => true, encrypt => true, compress => GZ, error => 0},
{vm => VM4, remote => true, s3 => false, encrypt => false, compress => NONE, error => 0},
)
{
# Only run tests for this vm
@ -61,20 +61,21 @@ sub run
my $bRemote = $rhRun->{remote};
my $bS3 = $rhRun->{s3};
my $bEncrypt = $rhRun->{encrypt};
my $bCompress = $rhRun->{compress};
my $strCompressType = $rhRun->{compress};
my $iError = $rhRun->{error};
# Increment the run, log, and decide whether this unit test should be run
if (!$self->begin("rmt ${bRemote}, cmp ${bCompress}, error " . ($iError ? 'connect' : 'version') . ", s3 ${bS3}, " .
"enc ${bEncrypt}")) {next}
if (!$self->begin(
"rmt ${bRemote}, cmp ${strCompressType}, error " . ($iError ? 'connect' : 'version') .
", s3 ${bS3}, enc ${bEncrypt}")) {next}
# Create hosts, file object, and config
my ($oHostDbMaster, $oHostDbStandby, $oHostBackup, $oHostS3) = $self->setup(
true, $self->expect(), {bHostBackup => $bRemote, bCompress => $bCompress, bArchiveAsync => true, bS3 => $bS3,
bRepoEncrypt => $bEncrypt});
true, $self->expect(), {bHostBackup => $bRemote, strCompressType => $strCompressType, bArchiveAsync => true,
bS3 => $bS3, bRepoEncrypt => $bEncrypt});
# Create compression extension
my $strCompressExt = $bCompress ? qw{.} . COMPRESS_EXT : '';
my $strCompressExt = $strCompressType ne NONE ? ".${strCompressType}" : '';
# Create the wal path
my $strWalPath = $oHostDbMaster->dbBasePath() . '/pg_xlog';