1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-11-06 08:49:29 +02:00

Remove support for PostgreSQL 9.3.

Per our policy to support five EOL versions of PostgreSQL, 9.3 is no longer supported by pgBackRest.

Remove all logic associated with 9.3 and update the tests.
This commit is contained in:
David Steele
2023-11-09 12:59:12 -03:00
committed by GitHub
parent fa5b2d44ad
commit dcf0781987
35 changed files with 203 additions and 405 deletions

View File

@@ -15,8 +15,6 @@ use pgBackRestDoc::Common::Log;
####################################################################################################################################
# PostgreSQL version numbers
####################################################################################################################################
use constant PG_VERSION_93 => '9.3';
push @EXPORT, qw(PG_VERSION_93);
use constant PG_VERSION_94 => '9.4';
push @EXPORT, qw(PG_VERSION_94);
use constant PG_VERSION_95 => '9.5';
@@ -48,8 +46,8 @@ sub versionSupport
# Assign function parameters, defaults, and log debug info
my ($strOperation) = logDebugParam(__PACKAGE__ . '->versionSupport');
my @strySupportVersion = (PG_VERSION_93, PG_VERSION_94, PG_VERSION_95, PG_VERSION_96, PG_VERSION_10, PG_VERSION_11,
PG_VERSION_12, PG_VERSION_13, PG_VERSION_14, PG_VERSION_15, PG_VERSION_16);
my @strySupportVersion = (PG_VERSION_94, PG_VERSION_95, PG_VERSION_96, PG_VERSION_10, PG_VERSION_11, PG_VERSION_12,
PG_VERSION_13, PG_VERSION_14, PG_VERSION_15, PG_VERSION_16);
# Return from function and log return values if any
return logDebugReturn

View File

@@ -136,7 +136,6 @@ my $oyVm =
&VM_DB =>
[
PG_VERSION_93,
PG_VERSION_94,
PG_VERSION_95,
PG_VERSION_96,
@@ -144,8 +143,8 @@ my $oyVm =
&VM_DB_TEST =>
[
PG_VERSION_93,
PG_VERSION_94,
PG_VERSION_96,
],
},
@@ -217,7 +216,6 @@ my $oyVm =
&VM_DB =>
[
PG_VERSION_93,
PG_VERSION_94,
PG_VERSION_95,
PG_VERSION_96,
@@ -250,7 +248,6 @@ my $oyVm =
&VM_DB =>
[
PG_VERSION_93,
PG_VERSION_94,
PG_VERSION_95,
PG_VERSION_96,
@@ -266,7 +263,6 @@ my $oyVm =
&VM_DB_TEST =>
[
PG_VERSION_95,
PG_VERSION_96,
PG_VERSION_10,
PG_VERSION_15,
PG_VERSION_16,

View File

@@ -77,7 +77,6 @@ sub new
my $oPgControlVersionHash =
{
# iControlVersion => {iCatalogVersion => strDbVersion}
937 => {201306121 => PG_VERSION_93},
942 =>
{
201409291 => PG_VERSION_94,
@@ -390,8 +389,8 @@ sub backupCreate
my $strManifestFile = "$$oStanza{strBackupClusterPath}/${strBackupLabel}/" . FILE_MANIFEST;
my $oManifest = new pgBackRestTest::Env::Manifest($strManifestFile, {bLoad => false, strDbVersion => PG_VERSION_93,
iDbCatalogVersion => $self->dbCatalogVersion(PG_VERSION_93),
my $oManifest = new pgBackRestTest::Env::Manifest($strManifestFile, {bLoad => false, strDbVersion => PG_VERSION_94,
iDbCatalogVersion => $self->dbCatalogVersion(PG_VERSION_94),
strCipherPass => $strCipherPassManifest, strCipherPassSub => $strCipherPassBackupSet});
# Store information about the backup into the backup section

View File

@@ -351,8 +351,7 @@ sub clusterCreate
my $strWalPath = defined($$hParam{strWalPath}) ? $$hParam{strWalPath} : $self->dbPath() . '/pg_' . $self->walId();
$self->executeSimple(
$self->pgBinPath() . '/initdb ' .
($self->pgVersion() >= PG_VERSION_93 ? ' -k' : '') .
$self->pgBinPath() . '/initdb -k' .
($self->pgVersion() >= PG_VERSION_11 ? ' --wal-segsize=1' : '') .
' --' . $self->walId() . "dir=${strWalPath}" . ' --pgdata=' . $self->dbBasePath() . ' --auth=trust');
@@ -456,7 +455,7 @@ sub clusterStart
' -c log_rotation_age=0' .
' -c log_rotation_size=0' .
' -c log_error_verbosity=verbose' .
' -c unix_socket_director' . ($self->pgVersion() < PG_VERSION_93 ? 'y=\'' : 'ies=\'') . $self->dbPath() . '\'"' .
' -c unix_socket_directories=\'' . $self->dbPath() . '\'"' .
' -D ' . $self->dbBasePath() . ' -l ' . $self->pgLogFile() . ' -s';
$self->executeSimple($strCommand);

View File

@@ -250,7 +250,6 @@ sub dbCatalogVersion
my $hCatalogVersion =
{
&PG_VERSION_93 => 201306121,
&PG_VERSION_94 => 201409291,
&PG_VERSION_95 => 201510051,
&PG_VERSION_96 => 201608131,
@@ -294,11 +293,6 @@ sub controlGenerateContent
{
32 =>
{
&PG_VERSION_93 =>
"5d0064a7b3b6e00da903000009b0ff0b00000000000000000000000001000000000000000000000000000000000000000000000001000000" .
"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" .
"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" .
"00000000000000000000000000200000000000000000000000000001000000000000000000000000000000000000000043d77e50",
&PG_VERSION_94 =>
"5e0064a7b3b6e00dae0300000b43010c00000000000000000000000001000000000000000000000000000000000000000000000001000000" .
"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" .
@@ -326,12 +320,6 @@ sub controlGenerateContent
},
64 =>
{
&PG_VERSION_93 =>
"5d0064a7b3b6e00da903000009b0ff0b00000000000000000000000000000000010000000000000000000000000000000000000000000000" .
"0100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" .
"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" .
"0000000000000000000000000000000000000000000000000020000000000000000000000000000100000000000000000000000000000000" .
"0000000003fff8cc",
&PG_VERSION_94 =>
"5e0064a7b3b6e00dae0300000b43010c00000000000000000000000000000000010000000000000000000000000000000000000000000000" .
"0100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" .
@@ -448,7 +436,6 @@ sub walGenerateContent
# Get WAL magic for the PG version
my $hWalMagic =
{
&PG_VERSION_93 => hex('0xD075'),
&PG_VERSION_94 => hex('0xD07E'),
&PG_VERSION_95 => hex('0xD087'),
&PG_VERSION_96 => hex('0xD093'),
@@ -464,7 +451,7 @@ sub walGenerateContent
$tWalContent .= pack('S', 2);
# Add junk (H for header) for the bytes that won't be read by the tests
my $iOffset = 12 + ($strPgVersion >= PG_VERSION_93 ? testRunGet()->archBits() / 8 : 0);
my $iOffset = 12 + (testRunGet()->archBits() / 8);
$tWalContent .= ('H' x $iOffset);
# Add the system identifier

View File

@@ -1422,7 +1422,7 @@ sub isPrimaryFile
####################################################################################################################################
# isChecksumPage
#
# Can this file have page checksums in PG >= 9.3?
# Can this file have page checksums?
####################################################################################################################################
sub isChecksumPage
{

View File

@@ -173,7 +173,7 @@ sub run
#-----------------------------------------------------------------------------------------------------------------------
$strDescription = 'Upgrade stanza and expire only earliest db backup and archive';
$oExpireTest->stanzaUpgrade($self->stanza(), PG_VERSION_93);
$oExpireTest->stanzaUpgrade($self->stanza(), PG_VERSION_94);
$oExpireTest->backupCreate($self->stanza(), CFGOPTVAL_BACKUP_TYPE_FULL, $lBaseTime += SECONDS_PER_DAY);
$oExpireTest->backupCreate($self->stanza(), CFGOPTVAL_BACKUP_TYPE_INCR, $lBaseTime += SECONDS_PER_DAY, 246);
$oExpireTest->backupCreate($self->stanza(), CFGOPTVAL_BACKUP_TYPE_FULL, $lBaseTime += SECONDS_PER_DAY);

View File

@@ -85,7 +85,7 @@ sub run
# Generate pg_control for stanza-create
storageTest()->pathCreate(($oHostDbPrimary->dbBasePath() . '/' . DB_PATH_GLOBAL), {bCreateParent => true});
$self->controlGenerate($oHostDbPrimary->dbBasePath(), PG_VERSION_93);
$self->controlGenerate($oHostDbPrimary->dbBasePath(), PG_VERSION_94);
# Fail stanza upgrade before stanza-create has been performed
#--------------------------------------------------------------------------------------------------------------------------
@@ -105,13 +105,13 @@ sub run
# Stanza Create fails when not using force - database mismatch with pg_control file
#--------------------------------------------------------------------------------------------------------------------------
# Change the database version by copying a new pg_control file
$self->controlGenerate($oHostDbPrimary->dbBasePath(), PG_VERSION_94);
$self->controlGenerate($oHostDbPrimary->dbBasePath(), PG_VERSION_95);
$oHostBackup->stanzaCreate('fail on database mismatch and warn force option deprecated',
{iExpectedExitStatus => ERROR_FILE_INVALID, strOptionalParam => '--no-online --force'});
# Restore pg_control
$self->controlGenerate($oHostDbPrimary->dbBasePath(), PG_VERSION_93);
$self->controlGenerate($oHostDbPrimary->dbBasePath(), PG_VERSION_94);
# Perform a stanza upgrade which will indicate already up to date
#--------------------------------------------------------------------------------------------------------------------------
@@ -125,7 +125,7 @@ sub run
#--------------------------------------------------------------------------------------------------------------------------
# Generate WAL then push to get valid archive data in the archive directory
my $strArchiveFile = $self->walSegment(1, 1, 1);
my $strSourceFile = $self->walGenerate($strWalPath, PG_VERSION_93, 1, $strArchiveFile);
my $strSourceFile = $self->walGenerate($strWalPath, PG_VERSION_94, 1, $strArchiveFile);
my $strCommand = $oHostDbPrimary->backrestExe() . ' --config=' . $oHostDbPrimary->backrestConfig() .
' --stanza=db archive-push';
@@ -148,16 +148,16 @@ sub run
# Just before upgrading push one last WAL on the old version to ensure it can be retrieved later
#--------------------------------------------------------------------------------------------------------------------------
$strArchiveFile = $self->walSegment(1, 1, 2);
$strSourceFile = $self->walGenerate($strWalPath, PG_VERSION_93, 1, $strArchiveFile);
$strSourceFile = $self->walGenerate($strWalPath, PG_VERSION_94, 1, $strArchiveFile);
$oHostDbPrimary->executeSimple($strCommand . " ${strSourceFile}");
# Fail on archive push due to mismatch of DB since stanza not upgraded
#--------------------------------------------------------------------------------------------------------------------------
my $strArchiveTestFile = $self->testPath() . '/test-wal';
storageTest()->put($strArchiveTestFile, $self->walGenerateContent(PG_VERSION_94));
storageTest()->put($strArchiveTestFile, $self->walGenerateContent(PG_VERSION_95));
# Upgrade the DB by copying new pg_control
$self->controlGenerate($oHostDbPrimary->dbBasePath(), PG_VERSION_94);
$self->controlGenerate($oHostDbPrimary->dbBasePath(), PG_VERSION_95);
forceStorageMode(storageTest(), $oHostDbPrimary->dbBasePath() . '/' . DB_FILE_PGCONTROL, '600');
# Fail on attempt to push an archive
@@ -173,7 +173,7 @@ sub run
# Make sure that WAL from the old version can still be retrieved
#--------------------------------------------------------------------------------------------------------------------------
# Generate the old pg_control so it looks like the original db has been restored
$self->controlGenerate($oHostDbPrimary->dbBasePath(), PG_VERSION_93);
$self->controlGenerate($oHostDbPrimary->dbBasePath(), PG_VERSION_94);
# Attempt to get the last archive log that was pushed to this repo
$oHostDbPrimary->executeSimple(
@@ -181,7 +181,7 @@ sub run
" --stanza=db archive-get ${strArchiveFile} " . $oHostDbPrimary->dbBasePath() . '/pg_xlog/RECOVERYXLOG');
# Copy the new pg_control back so the tests can continue with the upgraded stanza
$self->controlGenerate($oHostDbPrimary->dbBasePath(), PG_VERSION_94);
$self->controlGenerate($oHostDbPrimary->dbBasePath(), PG_VERSION_95);
forceStorageMode(storageTest(), $oHostDbPrimary->dbBasePath() . '/' . DB_FILE_PGCONTROL, '600');
# After stanza upgrade, make sure archives are pushed to the new db verion-id directory (9.4-2)
@@ -189,8 +189,8 @@ sub run
# Push a WAL segment so have a valid file in the latest DB archive dir only
$oHostDbPrimary->archivePush($strWalPath, $strArchiveTestFile, 1);
$self->testResult(
sub {storageRepo()->list($oHostBackup->repoArchivePath(PG_VERSION_94 . '-2/0000000100000001'))},
'000000010000000100000001-' . $self->walGenerateContentChecksum(PG_VERSION_94) . ".${strCompressType}",
sub {storageRepo()->list($oHostBackup->repoArchivePath(PG_VERSION_95 . '-2/0000000100000001'))},
'000000010000000100000001-' . $self->walGenerateContentChecksum(PG_VERSION_95) . ".${strCompressType}",
'check that WAL is in the archive at -2');
# Create the tablespace directory and perform a backup
@@ -201,8 +201,8 @@ sub run
# Upgrade the stanza
#--------------------------------------------------------------------------------------------------------------------------
# Copy pg_control for 9.5
$self->controlGenerate($oHostDbPrimary->dbBasePath(), PG_VERSION_95);
# Copy pg_control for 9.6
$self->controlGenerate($oHostDbPrimary->dbBasePath(), PG_VERSION_96);
forceStorageMode(storageTest(), $oHostDbPrimary->dbBasePath() . '/' . DB_FILE_PGCONTROL, '600');
# Run from the db server to ensure ability to run remotely
@@ -217,9 +217,9 @@ sub run
my $oArchiveInfo = new pgBackRestTest::Env::ArchiveInfo($oHostBackup->repoArchivePath());
my $oBackupInfo = new pgBackRestTest::Env::BackupInfo($oHostBackup->repoBackupPath());
$self->testResult(sub {$oArchiveInfo->test(INFO_ARCHIVE_SECTION_DB, INFO_ARCHIVE_KEY_DB_VERSION, undef,
PG_VERSION_93)}, true, 'archive at old pg version');
PG_VERSION_94)}, true, 'archive at old pg version');
$self->testResult(sub {$oBackupInfo->test(INFO_BACKUP_SECTION_DB, INFO_BACKUP_KEY_DB_VERSION, undef,
PG_VERSION_95)}, true, 'backup at new pg version');
PG_VERSION_96)}, true, 'backup at new pg version');
$oHostBackup->stanzaUpgrade(
'upgrade fails with mismatched db-ids', {iExpectedExitStatus => ERROR_FILE_INVALID, strOptionalParam => '--no-online'});
@@ -229,7 +229,7 @@ sub run
# Push a WAL and create a backup in the new DB to confirm diff changed to full
#--------------------------------------------------------------------------------------------------------------------------
storageTest()->put($strArchiveTestFile, $self->walGenerateContent(PG_VERSION_95));
storageTest()->put($strArchiveTestFile, $self->walGenerateContent(PG_VERSION_96));
$oHostDbPrimary->archivePush($strWalPath, $strArchiveTestFile, 1);
# Test backup is changed from type=DIFF to FULL (WARN message displayed)

View File

@@ -52,7 +52,6 @@ sub run
foreach my $rhRun
(
{pg => '9.3', dst => 'backup', tls => 0, stg => AZURE, enc => 0, cmp => NONE, rt => 2, bnd => 0, bi => 0},
{pg => '9.4', dst => 'db-standby', tls => 0, stg => POSIX, enc => 1, cmp => LZ4, rt => 1, bnd => 1, bi => 0},
{pg => '9.5', dst => 'backup', tls => 1, stg => GCS, enc => 0, cmp => BZ2, rt => 1, bnd => 0, bi => 1},
{pg => '9.6', dst => 'backup', tls => 0, stg => POSIX, enc => 0, cmp => NONE, rt => 2, bnd => 1, bi => 1},
@@ -62,7 +61,7 @@ sub run
{pg => '13', dst => 'db-standby', tls => 1, stg => GCS, enc => 0, cmp => ZST, rt => 1, bnd => 1, bi => 1},
{pg => '14', dst => 'sftp-srvr', tls => 0, stg => SFTP, enc => 0, cmp => LZ4, rt => 1, bnd => 1, bi => 0},
{pg => '15', dst => 'db-standby', tls => 0, stg => AZURE, enc => 0, cmp => NONE, rt => 2, bnd => 1, bi => 1},
{pg => '16', dst => 'db-standby', tls => 0, stg => S3, enc => 1, cmp => NONE, rt => 1, bnd => 0, bi => 0},
{pg => '16', dst => 'backup', tls => 0, stg => S3, enc => 1, cmp => NONE, rt => 1, bnd => 0, bi => 0},
)
{
# Only run tests for this pg version
@@ -419,7 +418,7 @@ sub run
# Start a backup so the next backup has to restart it. This test is not required for PostgreSQL >= 9.6 since backups are run
# in non-exclusive mode.
if ($oHostDbPrimary->pgVersion() >= PG_VERSION_93 && $oHostDbPrimary->pgVersion() < PG_VERSION_96)
if ($oHostDbPrimary->pgVersion() < PG_VERSION_96)
{
$oHostDbPrimary->sqlSelectOne("select pg_start_backup('test backup that will cause an error', true)");