You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2026-05-22 10:15:16 +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:
@@ -476,9 +476,9 @@ sub backupCompare
|
||||
foreach my $strFileKey ($oActualManifest->keys(MANIFEST_SECTION_TARGET_FILE))
|
||||
{
|
||||
# Determine repo size if compression or encryption is enabled
|
||||
my $bCompressed = $oExpectedManifest->{&MANIFEST_SECTION_BACKUP_OPTION}{&MANIFEST_KEY_COMPRESS};
|
||||
my $strCompressType = $oExpectedManifest->{&MANIFEST_SECTION_BACKUP_OPTION}{&MANIFEST_KEY_COMPRESS_TYPE};
|
||||
|
||||
if ($bCompressed ||
|
||||
if ($strCompressType ne CFGOPTVAL_COMPRESS_TYPE_NONE ||
|
||||
(defined($oExpectedManifest->{&INI_SECTION_CIPHER}) &&
|
||||
defined($oExpectedManifest->{&INI_SECTION_CIPHER}{&INI_KEY_CIPHER_PASS})))
|
||||
{
|
||||
@@ -487,7 +487,8 @@ sub backupCompare
|
||||
$oActualManifest->test(MANIFEST_SECTION_TARGET_FILE, $strFileKey, MANIFEST_SUBKEY_REFERENCE) ?
|
||||
$oActualManifest->numericGet(MANIFEST_SECTION_TARGET_FILE, $strFileKey, MANIFEST_SUBKEY_REPO_SIZE, false) :
|
||||
(storageRepo()->info(STORAGE_REPO_BACKUP .
|
||||
"/${strBackup}/${strFileKey}" . ($bCompressed ? '.gz' : '')))->{size};
|
||||
"/${strBackup}/${strFileKey}" .
|
||||
($strCompressType eq CFGOPTVAL_COMPRESS_TYPE_NONE ? '' : ".${strCompressType}")))->{size};
|
||||
|
||||
if (defined($lRepoSize) &&
|
||||
$lRepoSize != $oExpectedManifest->{&MANIFEST_SECTION_TARGET_FILE}{$strFileKey}{&MANIFEST_SUBKEY_SIZE})
|
||||
@@ -1031,9 +1032,9 @@ sub configCreate
|
||||
$oParamHash{&CFGDEF_SECTION_GLOBAL}{cfgOptionName(CFGOPT_COMPRESS_LEVEL_NETWORK)} = 1;
|
||||
}
|
||||
|
||||
if (defined($$oParam{bCompress}) && !$$oParam{bCompress})
|
||||
if (defined($oParam->{strCompressType}) && $oParam->{strCompressType} ne CFGOPTVAL_COMPRESS_TYPE_GZ)
|
||||
{
|
||||
$oParamHash{&CFGDEF_SECTION_GLOBAL}{cfgOptionName(CFGOPT_COMPRESS)} = 'n';
|
||||
$oParamHash{&CFGDEF_SECTION_GLOBAL}{cfgOptionName(CFGOPT_COMPRESS_TYPE)} = $oParam->{strCompressType};
|
||||
}
|
||||
|
||||
if ($self->isHostBackup())
|
||||
@@ -1200,7 +1201,14 @@ sub configUpdate
|
||||
{
|
||||
foreach my $strKey (keys(%{$hParam->{$strSection}}))
|
||||
{
|
||||
$oConfig->{$strSection}{$strKey} = $hParam->{$strSection}{$strKey};
|
||||
if (defined($hParam->{$strSection}{$strKey}))
|
||||
{
|
||||
$oConfig->{$strSection}{$strKey} = $hParam->{$strSection}{$strKey};
|
||||
}
|
||||
else
|
||||
{
|
||||
delete($oConfig->{$strSection}{$strKey});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1792,6 +1800,8 @@ sub restoreCompare
|
||||
$oExpectedManifestRef->{&MANIFEST_SECTION_BACKUP_OPTION}{&MANIFEST_KEY_DELTA}, $oTablespaceMap);
|
||||
$oActualManifest->boolSet(MANIFEST_SECTION_BACKUP_OPTION, MANIFEST_KEY_DELTA, undef,
|
||||
$oExpectedManifestRef->{&MANIFEST_SECTION_BACKUP_OPTION}{&MANIFEST_KEY_DELTA});
|
||||
$oActualManifest->set(MANIFEST_SECTION_BACKUP_OPTION, MANIFEST_KEY_COMPRESS_TYPE, undef,
|
||||
$oExpectedManifestRef->{&MANIFEST_SECTION_BACKUP_OPTION}{&MANIFEST_KEY_COMPRESS_TYPE});
|
||||
|
||||
my $strSectionPath = $oActualManifest->get(MANIFEST_SECTION_BACKUP_TARGET, MANIFEST_TARGET_PGDATA, MANIFEST_SUBKEY_PATH);
|
||||
|
||||
|
||||
@@ -43,6 +43,11 @@ use constant ENCRYPTION_KEY_MANIFEST => 'manifest';
|
||||
use constant ENCRYPTION_KEY_BACKUPSET => 'backupset';
|
||||
push @EXPORT, qw(ENCRYPTION_KEY_BACKUPSET);
|
||||
|
||||
use constant NONE => CFGOPTVAL_COMPRESS_TYPE_NONE;
|
||||
push @EXPORT, qw(NONE);
|
||||
use constant GZ => CFGOPTVAL_COMPRESS_TYPE_GZ;
|
||||
push @EXPORT, qw(GZ);
|
||||
|
||||
####################################################################################################################################
|
||||
# setup
|
||||
####################################################################################################################################
|
||||
@@ -127,7 +132,7 @@ sub setup
|
||||
# Create db master config
|
||||
$oHostDbMaster->configCreate({
|
||||
strBackupSource => $$oConfigParam{strBackupSource},
|
||||
bCompress => $$oConfigParam{bCompress},
|
||||
strCompressType => $$oConfigParam{strCompressType},
|
||||
bHardlink => $bHostBackup ? undef : $$oConfigParam{bHardLink},
|
||||
bArchiveAsync => $$oConfigParam{bArchiveAsync},
|
||||
bS3 => $$oConfigParam{bS3}});
|
||||
@@ -136,7 +141,7 @@ sub setup
|
||||
if (defined($oHostBackup))
|
||||
{
|
||||
$oHostBackup->configCreate({
|
||||
bCompress => $$oConfigParam{bCompress},
|
||||
strCompressType => $$oConfigParam{strCompressType},
|
||||
bHardlink => $$oConfigParam{bHardLink},
|
||||
bS3 => $$oConfigParam{bS3}});
|
||||
}
|
||||
@@ -151,7 +156,7 @@ sub setup
|
||||
{
|
||||
$oHostDbStandby->configCreate({
|
||||
strBackupSource => $$oConfigParam{strBackupSource},
|
||||
bCompress => $$oConfigParam{bCompress},
|
||||
strCompressType => $$oConfigParam{strCompressType},
|
||||
bHardlink => $bHostBackup ? undef : $$oConfigParam{bHardLink},
|
||||
bArchiveAsync => $$oConfigParam{bArchiveAsync}});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user