pgbackrest.git / summary / log / commit / refs
commit 6e9d5f5bd31c835bf6aa7058c3c00a160d56b6c8
Author: Cynthia Shang <cynthia.shang@crunchydata.com>
Commit: David Steele <david@pgmasters.net>
Date: Fri Jul 29 18:02:11 2016 +0000
Fixed check command to throw an error when database version/id does not match that of the archive.
Fixed by Cynthia Shang.
doc/xml/release.xml | 10 ++
lib/pgBackRest/Archive.pm | 123 +++++++++++++++++--
lib/pgBackRest/ArchiveInfo.pm | 14 ++-
lib/pgBackRest/BackupInfo.pm | 2 +-
lib/pgBackRest/Common/Ini.pm | 4 +-
lib/pgBackRest/Config/Config.pm | 5 +-
lib/pgBackRest/Expire.pm | 2 +-
lib/pgBackRest/Protocol/RemoteMinion.pm | 8 +-
test/expect/backup-archive-get-001.log | 12 +-
test/expect/backup-archive-get-002.log | 22 +++-
test/expect/backup-archive-get-003.log | 12 +-
test/expect/backup-archive-get-004.log | 22 +++-
test/expect/backup-archive-get-005.log | 10 +-
test/expect/backup-archive-get-006.log | 16 ++-
test/expect/backup-archive-get-007.log | 10 +-
test/expect/backup-archive-get-008.log | 16 ++-
test/lib/pgBackRestTest/Backup/BackupTest.pm | 135 ++++++++++++++-------
.../pgBackRestTest/Backup/Common/HostBackupTest.pm | 104 ++++++++++++++++
18 files changed, 439 insertions(+), 88 deletions(-)
diff --git a/doc/xml/release.xml b/doc/xml/release.xml
index 28f2a91fd..046275d1f 100644
--- a/doc/xml/release.xml
+++ b/doc/xml/release.xml
@@ -117,6 +117,16 @@
<p>Fixed an issue where db-path was not required for the <cmd>check</cmd> command so an assert was raised when it was missing rather than a polite error message.</p>
</release-item>
+
+ <release-item>
+ <release-item-contributor-list>
+ <release-item-ideator id="steele.david"/>
+ <release-item-contributor id="shang.cynthia"/>
+ <release-item-reviewer id="steele.david"/>
+ </release-item-contributor-list>
+
+ <p>Fixed <cmd>check</cmd> command to throw an error when database version/id does not match that of the archive.</p>
+ </release-item>
</release-bug-list>
<release-feature-list>
diff --git a/lib/pgBackRest/Archive.pm b/lib/pgBackRest/Archive.pm
index f8c903721..dbdc72dfb 100644
--- a/lib/pgBackRest/Archive.pm
+++ b/lib/pgBackRest/Archive.pm
@@ -31,6 +31,8 @@ use pgBackRest::FileCommon;
use constant OP_ARCHIVE => 'Archive';
use constant OP_ARCHIVE_GET => OP_ARCHIVE . '->get';
+use constant OP_ARCHIVE_GET_ARCHIVE_ID => OP_ARCHIVE . '->getArchiveId';
+ push @EXPORT, qw(OP_ARCHIVE_GET_ARCHIVE_ID);
use constant OP_ARCHIVE_GET_CHECK => OP_ARCHIVE . '->getCheck';
push @EXPORT, qw(OP_ARCHIVE_GET_CHECK);
use constant OP_ARCHIVE_GET_PROCESS => OP_ARCHIVE . '->getProcess';
@@ -440,6 +442,69 @@ sub get
# getCheck
####################################################################################################################################
sub getCheck
+{
+ my $self = shift;
+
+ # Assign function parameters, defaults, and log debug info
+ my
+ (
+ $strOperation,
+ $oFile,
+ $strDbVersion,
+ $ullDbSysId
+ ) =
+ logDebugParam
+ (
+ OP_ARCHIVE_GET_CHECK, \@_,
+ {name => 'oFile'},
+ {name => 'strDbVersion', required => false},
+ {name => 'ullDbSysId', required => false}
+ );
+
+ my $strArchiveId;
+
+ # If the dbVersion/dbSysId are not passed, then we need to retrieve the database information
+ if (!defined($strDbVersion) || !defined($ullDbSysId) )
+ {
+ # get DB info for comparison
+ ($strDbVersion, my $iControlVersion, my $iCatalogVersion, $ullDbSysId) =
+ (new pgBackRest::Db())->info($oFile, optionGet(OPTION_DB_PATH));
+ }
+
+ if ($oFile->isRemote(PATH_BACKUP_ARCHIVE))
+ {
+ # Build param hash
+ my %oParamHash;
+
+ # Pass the database information to the remote server
+ $oParamHash{'db-version'} = $strDbVersion;
+ $oParamHash{'db-sys-id'} = $ullDbSysId;
+
+ $strArchiveId = $oFile->{oProtocol}->cmdExecute(OP_ARCHIVE_GET_CHECK, \%oParamHash, true);
+ }
+ else
+ {
+ # check that the archive info is compatible with the database and create the file if it does not exist
+ $strArchiveId =
+ (new pgBackRest::ArchiveInfo($oFile->pathGet(PATH_BACKUP_ARCHIVE), true))->check($strDbVersion, $ullDbSysId);
+ }
+
+ # Return from function and log return values if any
+ return logDebugReturn
+ (
+ $strOperation,
+ {name => 'strArchiveId', value => $strArchiveId, trace => true}
+ );
+}
+
+####################################################################################################################################
+# getArchiveId
+#
+# CAUTION: Only to be used by commands where the DB Version and DB System ID are not important such that the
+# db-path is not valid for the command (i.e. Expire command). Since this function will not check validity of the database version
+# call getCheck function instead.
+####################################################################################################################################
+sub getArchiveId
{
my $self = shift;
my $oFile = shift;
@@ -451,14 +516,14 @@ sub getCheck
) =
logDebugParam
(
- OP_ARCHIVE_GET_CHECK
+ OP_ARCHIVE_GET_ARCHIVE_ID
);
my $strArchiveId;
if ($oFile->isRemote(PATH_BACKUP_ARCHIVE))
{
- $strArchiveId = $oFile->{oProtocol}->cmdExecute(OP_ARCHIVE_GET_CHECK, undef, true);
+ $strArchiveId = $oFile->{oProtocol}->cmdExecute(OP_ARCHIVE_GET_ARCHIVE_ID, undef, true);
}
else
{
@@ -753,7 +818,7 @@ sub pushCheck
# Create the archive path if it does not exist
$oFile->pathCreate(PATH_BACKUP_ARCHIVE, undef, undef, true, true);
- # If the info file exists check db version and system-id
+ # If the info file exists check db version and system-id, else create it with the db version and system-id passed and the history
$strArchiveId = (new pgBackRest::ArchiveInfo($oFile->pathGet(PATH_BACKUP_ARCHIVE)))->check($strDbVersion, $ullDbSysId);
# Check if the WAL segment already exists in the archive
@@ -1065,7 +1130,7 @@ sub check
my $strOperation = logDebugParam(__PACKAGE__ . '->check');
# Initialize default file object
- $self->{oFile} = new pgBackRest::File
+ my $oFile = new pgBackRest::File
(
optionGet(OPTION_STANZA),
optionGet(OPTION_REPO_PATH),
@@ -1074,13 +1139,13 @@ sub check
);
# Initialize the database object
- $self->{oDb} = new pgBackRest::Db();
+ my $oDb = new pgBackRest::Db();
# Validate the database configuration
- $self->{oDb}->configValidate($self->{oFile}, optionGet(OPTION_DB_PATH));
+ $oDb->configValidate($oFile, optionGet(OPTION_DB_PATH));
# Force archiving
- my $strWalSegment = $self->{oDb}->xlogSwitch();
+ my $strWalSegment = $oDb->xlogSwitch();
# Get the timeout and error message to display - if it is 0 we are testing
my $iArchiveTimeout = optionGet(OPTION_ARCHIVE_TIMEOUT);
@@ -1094,6 +1159,7 @@ sub check
my $strArchiveId = undef;
my $strArchiveFile = undef;
+ my $oBackupInfo = undef;
# Turn off console logging to control when to display the error
logLevelSet(undef, OFF);
@@ -1103,7 +1169,8 @@ sub check
{
eval
{
- $strArchiveId = $self->getCheck($self->{oFile});
+ # check that the archive info file is written and is valid for the current database of the stanza
+ $strArchiveId = $self->getCheck($oFile);
# Clear any previous errors if we've found the archive.info
$iResult = 0;
@@ -1131,10 +1198,10 @@ sub check
{
eval
{
- $strArchiveFile = $self->walFileName($self->{oFile}, $strArchiveId, $strWalSegment, false, $iArchiveTimeout);
+ $strArchiveFile = $self->walFileName($oFile, $strArchiveId, $strWalSegment, false, $iArchiveTimeout);
};
- # If this is a backrest error then capture the last code and message else confess
+ # If this is a backrest error then capture the code and message else confess
if ($@)
{
my $oMessage = $@;
@@ -1155,12 +1222,44 @@ sub check
# Reset the console logging
logLevelSet(undef, optionGet(OPTION_LOG_LEVEL_CONSOLE));
- # Display results
+ # If the archive info was successful, then check the backup info
if ($iResult == 0)
{
+ # If backup repo is local, then check the backup info
+ if (!optionRemoteTypeTest(BACKUP))
+ {
+ # Load or build backup.info
+ eval
+ {
+ $oBackupInfo = new pgBackRest::BackupInfo($oFile->pathGet(PATH_BACKUP_CLUSTER));
+ };
+ if ($@)
+ {
+ my $oMessage = $@;
+
+ # If this is a backrest error but it is not that the file is missing then confess
+ if (blessed($oMessage) && $oMessage->isa('pgBackRest::Common::Exception')
+ && ($oMessage->code() != ERROR_PATH_MISSING))
+ {
+ confess $oMessage;
+ }
+ }
+ else
+ {
+ # Get the current database info
+ my ($strDbVersion, $iControlVersion, $iCatalogVersion, $ullDbSysId) =
+ $oDb->info($oFile, optionGet(OPTION_DB_PATH));
+
+ # Check that the stanza backup info is compatible with the current version of the database
+ # If not, an error will be thrown
+ my $iDbHistoryId = $oBackupInfo->check($strDbVersion, $iControlVersion, $iCatalogVersion, $ullDbSysId);
+ }
+ }
+
+ # If the backup and archive checks were successful, then indicate success
&log(INFO,
"WAL segment ${strWalSegment} successfully stored in the archive at '" .
- $self->{oFile}->pathGet(PATH_BACKUP_ARCHIVE, "$strArchiveId/${strArchiveFile}") . "'");
+ $oFile->pathGet(PATH_BACKUP_ARCHIVE, "$strArchiveId/${strArchiveFile}") . "'");
}
else
{
diff --git a/lib/pgBackRest/ArchiveInfo.pm b/lib/pgBackRest/ArchiveInfo.pm
index 0fda2652b..a19704310 100644
--- a/lib/pgBackRest/ArchiveInfo.pm
+++ b/lib/pgBackRest/ArchiveInfo.pm
@@ -1,5 +1,9 @@
####################################################################################################################################
# ARCHIVE INFO MODULE
+#
+# The archive.info file is created when archiving begins. It is located under the stanza directory. The file contains information
+# regarding the stanza database version, database WAL segment system id and other information to ensure that archiving is being
+# performed on the proper database.
####################################################################################################################################
package pgBackRest::ArchiveInfo;
use parent 'pgBackRest::Common::Ini';
@@ -101,7 +105,8 @@ sub new
####################################################################################################################################
# check
#
-# Check archive info and make it is compatible.
+# Check archive info file and make sure it is compatible with the current version of the database for the stanza. If the file does
+# not exist it will be created with the values passed.
####################################################################################################################################
sub check
{
@@ -135,7 +140,8 @@ sub check
if (!$self->test(INFO_ARCHIVE_SECTION_DB, INFO_ARCHIVE_KEY_DB_SYSTEM_ID, undef, $ullDbSysId))
{
- $strError = "WAL segment system-id ${ullDbSysId} does not match archive system-id " .
+ $strError = (defined($strError) ? ($strError . "\n") : "") .
+ "WAL segment system-id ${ullDbSysId} does not match archive system-id " .
$self->get(INFO_ARCHIVE_SECTION_DB, INFO_ARCHIVE_KEY_DB_SYSTEM_ID);
}
@@ -144,7 +150,7 @@ sub check
confess &log(ERROR, "${strError}\nHINT: are you archiving to the correct stanza?", ERROR_ARCHIVE_MISMATCH);
}
}
- # Else create the info file from the current WAL segment
+ # Else create the info file from the parameters passed which are usually derived from the current WAL segment
else
{
my $iDbId = 1;
@@ -179,7 +185,7 @@ sub check
####################################################################################################################################
# archiveId
#
-# Get the archive id.
+# Get the archive id which is a combination of the DB version and the db-id setting (e.g. 9.4-1)
####################################################################################################################################
sub archiveId
{
diff --git a/lib/pgBackRest/BackupInfo.pm b/lib/pgBackRest/BackupInfo.pm
index 414469b08..efe9f3055 100644
--- a/lib/pgBackRest/BackupInfo.pm
+++ b/lib/pgBackRest/BackupInfo.pm
@@ -187,7 +187,7 @@ sub validate
}
}
- # Remove backups from FILE_BACKUP_INFO that are not longer in the repository
+ # Remove backups from FILE_BACKUP_INFO that are no longer in the repository
foreach my $strBackup ($self->keys(INFO_BACKUP_SECTION_BACKUP_CURRENT))
{
my $strManifestFile = "$self->{strBackupClusterPath}/${strBackup}/" . FILE_MANIFEST;
diff --git a/lib/pgBackRest/Common/Ini.pm b/lib/pgBackRest/Common/Ini.pm
index d5ea057c4..660b285f5 100644
--- a/lib/pgBackRest/Common/Ini.pm
+++ b/lib/pgBackRest/Common/Ini.pm
@@ -209,7 +209,7 @@ sub iniLoad
####################################################################################################################################
# save
#
-# Save the manifest.
+# Save the file.
####################################################################################################################################
sub save
{
@@ -358,7 +358,7 @@ sub hash
# Remove the old checksum
$self->remove(INI_SECTION_BACKREST, INI_KEY_CHECKSUM);
- # Caculate the checksum
+ # Calculate the checksum
my $oChecksumContent = dclone($self->{oContent});
foreach my $strSection (keys(%$oChecksumContent))
diff --git a/lib/pgBackRest/Config/Config.pm b/lib/pgBackRest/Config/Config.pm
index cafb8f7a5..382b42bc4 100644
--- a/lib/pgBackRest/Config/Config.pm
+++ b/lib/pgBackRest/Config/Config.pm
@@ -12,6 +12,7 @@ use Exporter qw(import);
our @EXPORT = qw();
use File::Basename qw(dirname basename);
use Getopt::Long qw(GetOptions);
+use Storable qw(dclone);
use lib dirname($0) . '/../lib';
use pgBackRest::Common::Exception;
@@ -2429,7 +2430,6 @@ push @EXPORT, qw(optionTest);
####################################################################################################################################
sub optionRuleGet
{
- use Storable qw(dclone);
return dclone(\%oOptionRule);
}
@@ -2733,9 +2733,6 @@ sub commandWriteOptionFormat
####################################################################################################################################
sub commandHashGet
{
- require Storable;
- Storable->import();
-
return dclone(\%oCommandHash);
}
diff --git a/lib/pgBackRest/Expire.pm b/lib/pgBackRest/Expire.pm
index ab46ef794..b79995709 100644
--- a/lib/pgBackRest/Expire.pm
+++ b/lib/pgBackRest/Expire.pm
@@ -314,7 +314,7 @@ sub process
{
# Get archive info
my $oArchive = new pgBackRest::Archive();
- my $strArchiveId = $oArchive->getCheck($oFile);
+ my $strArchiveId = $oArchive->getArchiveId($oFile);
my $strArchiveExpireMax;
diff --git a/lib/pgBackRest/Protocol/RemoteMinion.pm b/lib/pgBackRest/Protocol/RemoteMinion.pm
index e8d47fd89..5fef41a7e 100644
--- a/lib/pgBackRest/Protocol/RemoteMinion.pm
+++ b/lib/pgBackRest/Protocol/RemoteMinion.pm
@@ -252,7 +252,13 @@ sub process
}
elsif ($strCommand eq OP_ARCHIVE_GET_CHECK)
{
- $self->outputWrite($oArchive->getCheck($oFile));
+ $self->outputWrite($oArchive->getCheck($oFile,
+ paramGet(\%oParamHash, 'db-version'),
+ paramGet(\%oParamHash, 'db-sys-id')));
+ }
+ elsif ($strCommand eq OP_ARCHIVE_GET_ARCHIVE_ID)
+ {
+ $self->outputWrite($oArchive->getArchiveId($oFile));
}
# Info list stanza
elsif ($strCommand eq OP_INFO_STANZA_LIST)
diff --git a/test/expect/backup-archive-get-001.log b/test/expect/backup-archive-get-001.log
index 0153483bb..c10eaafdd 100644
--- a/test/expect/backup-archive-get-001.log
+++ b/test/expect/backup-archive-get-001.log
@@ -7,6 +7,9 @@ run 001 - rmt 0, cmp 0, exists 0
INFO: get WAL segment 000000010000000100000001
DEBUG: Archive->get(): strDestinationFile = [TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000001, strSourceArchive = 000000010000000100000001
DEBUG: File->new(): iThreadIdx = [undef], oProtocol = [object], strBackupPath = [TEST_PATH]/db-master/repo, strDefaultFileMode = <0640>, strDefaultPathMode = <0750>, strRemote = none, strStanza = db
+ DEBUG: Archive->getCheck(): oFile = [object], strDbVersion = [undef], ullDbSysId = [undef]
+ DEBUG: Db->info(): oFile = [object], strDbPath = [TEST_PATH]/db-master/db/base
+ DEBUG: Db->info=>: iCatalogVersion = 201306121, iControlVersion = 937, strDbVersion = 9.3, ullDbSysId = 6156904820763115222
DEBUG: ArchiveInfo->new(): bRequired = true, strArchiveClusterPath = [TEST_PATH]/db-master/repo/archive/db
ERROR: [130]: archive.info does not exist but is required to get WAL segments
HINT: is archive_command configured in postgresql.conf?
@@ -24,11 +27,11 @@ backrest-version="[VERSION-1]"
[db]
db-id=1
-db-system-id=1234567890123456789
+db-system-id=6156904820763115222
db-version="9.3"
[db:history]
-1={"db-id":1234567890123456789,"db-version":"9.3"}
+1={"db-id":6156904820763115222,"db-version":"9.3"}
stop all stanzas (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf stop
@@ -62,8 +65,13 @@ start all stanzas (db-master host)
INFO: get WAL segment 000000090000000900000009
DEBUG: Archive->get(): strDestinationFile = [TEST_PATH]/db-master/db/base/pg_xlog/RECOVERYXLOG, strSourceArchive = 000000090000000900000009
DEBUG: File->new(): iThreadIdx = [undef], oProtocol = [object], strBackupPath = [TEST_PATH]/db-master/repo, strDefaultFileMode = <0640>, strDefaultPathMode = <0750>, strRemote = none, strStanza = db
+ DEBUG: Archive->getCheck(): oFile = [object], strDbVersion = [undef], ullDbSysId = [undef]
+ DEBUG: Db->info(): oFile = [object], strDbPath = [TEST_PATH]/db-master/db/base
+ DEBUG: Db->info=>: iCatalogVersion = 201306121, iControlVersion = 937, strDbVersion = 9.3, ullDbSysId = 6156904820763115222
DEBUG: ArchiveInfo->new(): bRequired = true, strArchiveClusterPath = [TEST_PATH]/db-master/repo/archive/db
+ DEBUG: ArchiveInfo->check(): strDbVersion = 9.3, ullDbSysId = 6156904820763115222
DEBUG: ArchiveInfo->archiveId=>: strArchiveId = 9.3-1
+ DEBUG: ArchiveInfo->check=>: strArchiveId = 9.3-1
DEBUG: Archive->walFileName(): bPartial = false, iWaitSeconds = [undef], oFile = [object], strArchiveId = 9.3-1, strWalSegment = 000000090000000900000009
DEBUG: File->list(): bIgnoreMissing = true, strExpression = ^000000090000000900000009(-[0-f]+){0,1}(\.gz){0,1}$, strPath = [TEST_PATH]/db-master/repo/archive/db/9.3-1/0000000900000009, strPathType = backup:absolute, strSortOrder = <forward>
DEBUG: File->list=>: stryFileList = ()
diff --git a/test/expect/backup-archive-get-002.log b/test/expect/backup-archive-get-002.log
index cbbd556d5..fa581e770 100644
--- a/test/expect/backup-archive-get-002.log
+++ b/test/expect/backup-archive-get-002.log
@@ -7,6 +7,9 @@ run 002 - rmt 0, cmp 0, exists 1
INFO: get WAL segment 000000010000000100000001
DEBUG: Archive->get(): strDestinationFile = [TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000001, strSourceArchive = 000000010000000100000001
DEBUG: File->new(): iThreadIdx = [undef], oProtocol = [object], strBackupPath = [TEST_PATH]/db-master/repo, strDefaultFileMode = <0640>, strDefaultPathMode = <0750>, strRemote = none, strStanza = db
+ DEBUG: Archive->getCheck(): oFile = [object], strDbVersion = [undef], ullDbSysId = [undef]
+ DEBUG: Db->info(): oFile = [object], strDbPath = [TEST_PATH]/db-master/db/base
+ DEBUG: Db->info=>: iCatalogVersion = 201306121, iControlVersion = 937, strDbVersion = 9.3, ullDbSysId = 6156904820763115222
DEBUG: ArchiveInfo->new(): bRequired = true, strArchiveClusterPath = [TEST_PATH]/db-master/repo/archive/db
ERROR: [130]: archive.info does not exist but is required to get WAL segments
HINT: is archive_command configured in postgresql.conf?
@@ -24,11 +27,11 @@ backrest-version="[VERSION-1]"
[db]
db-id=1
-db-system-id=1234567890123456789
+db-system-id=6156904820763115222
db-version="9.3"
[db:history]
-1={"db-id":1234567890123456789,"db-version":"9.3"}
+1={"db-id":6156904820763115222,"db-version":"9.3"}
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --stanza=db archive-get 000000010000000100000001 [TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000001
------------------------------------------------------------------------------------------------------------------------------------
@@ -36,8 +39,13 @@ db-version="9.3"
INFO: get WAL segment 000000010000000100000001
DEBUG: Archive->get(): strDestinationFile = [TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000001, strSourceArchive = 000000010000000100000001
DEBUG: File->new(): iThreadIdx = [undef], oProtocol = [object], strBackupPath = [TEST_PATH]/db-master/repo, strDefaultFileMode = <0640>, strDefaultPathMode = <0750>, strRemote = none, strStanza = db
+ DEBUG: Archive->getCheck(): oFile = [object], strDbVersion = [undef], ullDbSysId = [undef]
+ DEBUG: Db->info(): oFile = [object], strDbPath = [TEST_PATH]/db-master/db/base
+ DEBUG: Db->info=>: iCatalogVersion = 201306121, iControlVersion = 937, strDbVersion = 9.3, ullDbSysId = 6156904820763115222
DEBUG: ArchiveInfo->new(): bRequired = true, strArchiveClusterPath = [TEST_PATH]/db-master/repo/archive/db
+ DEBUG: ArchiveInfo->check(): strDbVersion = 9.3, ullDbSysId = 6156904820763115222
DEBUG: ArchiveInfo->archiveId=>: strArchiveId = 9.3-1
+ DEBUG: ArchiveInfo->check=>: strArchiveId = 9.3-1
DEBUG: Archive->walFileName(): bPartial = false, iWaitSeconds = [undef], oFile = [object], strArchiveId = 9.3-1, strWalSegment = 000000010000000100000001
DEBUG: File->list(): bIgnoreMissing = true, strExpression = ^000000010000000100000001(-[0-f]+){0,1}(\.gz){0,1}$, strPath = [TEST_PATH]/db-master/repo/archive/db/9.3-1/0000000100000001, strPathType = backup:absolute, strSortOrder = <forward>
DEBUG: File->list=>: stryFileList = (000000010000000100000001-1c7e00fd09b9dd11fc2966590b3e3274645dd031)
@@ -54,8 +62,13 @@ db-version="9.3"
INFO: get WAL segment 000000010000000100000002
DEBUG: Archive->get(): strDestinationFile = [TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000002, strSourceArchive = 000000010000000100000002
DEBUG: File->new(): iThreadIdx = [undef], oProtocol = [object], strBackupPath = [TEST_PATH]/db-master/repo, strDefaultFileMode = <0640>, strDefaultPathMode = <0750>, strRemote = none, strStanza = db
+ DEBUG: Archive->getCheck(): oFile = [object], strDbVersion = [undef], ullDbSysId = [undef]
+ DEBUG: Db->info(): oFile = [object], strDbPath = [TEST_PATH]/db-master/db/base
+ DEBUG: Db->info=>: iCatalogVersion = 201306121, iControlVersion = 937, strDbVersion = 9.3, ullDbSysId = 6156904820763115222
DEBUG: ArchiveInfo->new(): bRequired = true, strArchiveClusterPath = [TEST_PATH]/db-master/repo/archive/db
+ DEBUG: ArchiveInfo->check(): strDbVersion = 9.3, ullDbSysId = 6156904820763115222
DEBUG: ArchiveInfo->archiveId=>: strArchiveId = 9.3-1
+ DEBUG: ArchiveInfo->check=>: strArchiveId = 9.3-1
DEBUG: Archive->walFileName(): bPartial = false, iWaitSeconds = [undef], oFile = [object], strArchiveId = 9.3-1, strWalSegment = 000000010000000100000002
DEBUG: File->list(): bIgnoreMissing = true, strExpression = ^000000010000000100000002(-[0-f]+){0,1}(\.gz){0,1}$, strPath = [TEST_PATH]/db-master/repo/archive/db/9.3-1/0000000100000001, strPathType = backup:absolute, strSortOrder = <forward>
DEBUG: File->list=>: stryFileList = (000000010000000100000002-1c7e00fd09b9dd11fc2966590b3e3274645dd031)
@@ -72,8 +85,13 @@ db-version="9.3"
INFO: get WAL segment 000000010000000100000003
DEBUG: Archive->get(): strDestinationFile = [TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000003, strSourceArchive = 000000010000000100000003
DEBUG: File->new(): iThreadIdx = [undef], oProtocol = [object], strBackupPath = [TEST_PATH]/db-master/repo, strDefaultFileMode = <0640>, strDefaultPathMode = <0750>, strRemote = none, strStanza = db
+ DEBUG: Archive->getCheck(): oFile = [object], strDbVersion = [undef], ullDbSysId = [undef]
+ DEBUG: Db->info(): oFile = [object], strDbPath = [TEST_PATH]/db-master/db/base
+ DEBUG: Db->info=>: iCatalogVersion = 201306121, iControlVersion = 937, strDbVersion = 9.3, ullDbSysId = 6156904820763115222
DEBUG: ArchiveInfo->new(): bRequired = true, strArchiveClusterPath = [TEST_PATH]/db-master/repo/archive/db
+ DEBUG: ArchiveInfo->check(): strDbVersion = 9.3, ullDbSysId = 6156904820763115222
DEBUG: ArchiveInfo->archiveId=>: strArchiveId = 9.3-1
+ DEBUG: ArchiveInfo->check=>: strArchiveId = 9.3-1
DEBUG: Archive->walFileName(): bPartial = false, iWaitSeconds = [undef], oFile = [object], strArchiveId = 9.3-1, strWalSegment = 000000010000000100000003
DEBUG: File->list(): bIgnoreMissing = true, strExpression = ^000000010000000100000003(-[0-f]+){0,1}(\.gz){0,1}$, strPath = [TEST_PATH]/db-master/repo/archive/db/9.3-1/0000000100000001, strPathType = backup:absolute, strSortOrder = <forward>
DEBUG: File->list=>: stryFileList = (000000010000000100000003-1c7e00fd09b9dd11fc2966590b3e3274645dd031)
diff --git a/test/expect/backup-archive-get-003.log b/test/expect/backup-archive-get-003.log
index 368e6c740..2e010f91e 100644
--- a/test/expect/backup-archive-get-003.log
+++ b/test/expect/backup-archive-get-003.log
@@ -7,6 +7,9 @@ run 003 - rmt 0, cmp 1, exists 0
INFO: get WAL segment 000000010000000100000001
DEBUG: Archive->get(): strDestinationFile = [TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000001, strSourceArchive = 000000010000000100000001
DEBUG: File->new(): iThreadIdx = [undef], oProtocol = [object], strBackupPath = [TEST_PATH]/db-master/repo, strDefaultFileMode = <0640>, strDefaultPathMode = <0750>, strRemote = none, strStanza = db
+ DEBUG: Archive->getCheck(): oFile = [object], strDbVersion = [undef], ullDbSysId = [undef]
+ DEBUG: Db->info(): oFile = [object], strDbPath = [TEST_PATH]/db-master/db/base
+ DEBUG: Db->info=>: iCatalogVersion = 201306121, iControlVersion = 937, strDbVersion = 9.3, ullDbSysId = 6156904820763115222
DEBUG: ArchiveInfo->new(): bRequired = true, strArchiveClusterPath = [TEST_PATH]/db-master/repo/archive/db
ERROR: [130]: archive.info does not exist but is required to get WAL segments
HINT: is archive_command configured in postgresql.conf?
@@ -24,11 +27,11 @@ backrest-version="[VERSION-1]"
[db]
db-id=1
-db-system-id=1234567890123456789
+db-system-id=6156904820763115222
db-version="9.3"
[db:history]
-1={"db-id":1234567890123456789,"db-version":"9.3"}
+1={"db-id":6156904820763115222,"db-version":"9.3"}
stop all stanzas (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf stop
@@ -62,8 +65,13 @@ start all stanzas (db-master host)
INFO: get WAL segment 000000090000000900000009
DEBUG: Archive->get(): strDestinationFile = [TEST_PATH]/db-master/db/base/pg_xlog/RECOVERYXLOG, strSourceArchive = 000000090000000900000009
DEBUG: File->new(): iThreadIdx = [undef], oProtocol = [object], strBackupPath = [TEST_PATH]/db-master/repo, strDefaultFileMode = <0640>, strDefaultPathMode = <0750>, strRemote = none, strStanza = db
+ DEBUG: Archive->getCheck(): oFile = [object], strDbVersion = [undef], ullDbSysId = [undef]
+ DEBUG: Db->info(): oFile = [object], strDbPath = [TEST_PATH]/db-master/db/base
+ DEBUG: Db->info=>: iCatalogVersion = 201306121, iControlVersion = 937, strDbVersion = 9.3, ullDbSysId = 6156904820763115222
DEBUG: ArchiveInfo->new(): bRequired = true, strArchiveClusterPath = [TEST_PATH]/db-master/repo/archive/db
+ DEBUG: ArchiveInfo->check(): strDbVersion = 9.3, ullDbSysId = 6156904820763115222
DEBUG: ArchiveInfo->archiveId=>: strArchiveId = 9.3-1
+ DEBUG: ArchiveInfo->check=>: strArchiveId = 9.3-1
DEBUG: Archive->walFileName(): bPartial = false, iWaitSeconds = [undef], oFile = [object], strArchiveId = 9.3-1, strWalSegment = 000000090000000900000009
DEBUG: File->list(): bIgnoreMissing = true, strExpression = ^000000090000000900000009(-[0-f]+){0,1}(\.gz){0,1}$, strPath = [TEST_PATH]/db-master/repo/archive/db/9.3-1/0000000900000009, strPathType = backup:absolute, strSortOrder = <forward>
DEBUG: File->list=>: stryFileList = ()
diff --git a/test/expect/backup-archive-get-004.log b/test/expect/backup-archive-get-004.log
index 45c68af13..197693c49 100644
--- a/test/expect/backup-archive-get-004.log
+++ b/test/expect/backup-archive-get-004.log
@@ -7,6 +7,9 @@ run 004 - rmt 0, cmp 1, exists 1
INFO: get WAL segment 000000010000000100000001
DEBUG: Archive->get(): strDestinationFile = [TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000001, strSourceArchive = 000000010000000100000001
DEBUG: File->new(): iThreadIdx = [undef], oProtocol = [object], strBackupPath = [TEST_PATH]/db-master/repo, strDefaultFileMode = <0640>, strDefaultPathMode = <0750>, strRemote = none, strStanza = db
+ DEBUG: Archive->getCheck(): oFile = [object], strDbVersion = [undef], ullDbSysId = [undef]
+ DEBUG: Db->info(): oFile = [object], strDbPath = [TEST_PATH]/db-master/db/base
+ DEBUG: Db->info=>: iCatalogVersion = 201306121, iControlVersion = 937, strDbVersion = 9.3, ullDbSysId = 6156904820763115222
DEBUG: ArchiveInfo->new(): bRequired = true, strArchiveClusterPath = [TEST_PATH]/db-master/repo/archive/db
ERROR: [130]: archive.info does not exist but is required to get WAL segments
HINT: is archive_command configured in postgresql.conf?
@@ -24,11 +27,11 @@ backrest-version="[VERSION-1]"
[db]
db-id=1
-db-system-id=1234567890123456789
+db-system-id=6156904820763115222
db-version="9.3"
[db:history]
-1={"db-id":1234567890123456789,"db-version":"9.3"}
+1={"db-id":6156904820763115222,"db-version":"9.3"}
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --stanza=db archive-get 000000010000000100000001 [TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000001
------------------------------------------------------------------------------------------------------------------------------------
@@ -36,8 +39,13 @@ db-version="9.3"
INFO: get WAL segment 000000010000000100000001
DEBUG: Archive->get(): strDestinationFile = [TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000001, strSourceArchive = 000000010000000100000001
DEBUG: File->new(): iThreadIdx = [undef], oProtocol = [object], strBackupPath = [TEST_PATH]/db-master/repo, strDefaultFileMode = <0640>, strDefaultPathMode = <0750>, strRemote = none, strStanza = db
+ DEBUG: Archive->getCheck(): oFile = [object], strDbVersion = [undef], ullDbSysId = [undef]
+ DEBUG: Db->info(): oFile = [object], strDbPath = [TEST_PATH]/db-master/db/base
+ DEBUG: Db->info=>: iCatalogVersion = 201306121, iControlVersion = 937, strDbVersion = 9.3, ullDbSysId = 6156904820763115222
DEBUG: ArchiveInfo->new(): bRequired = true, strArchiveClusterPath = [TEST_PATH]/db-master/repo/archive/db
+ DEBUG: ArchiveInfo->check(): strDbVersion = 9.3, ullDbSysId = 6156904820763115222
DEBUG: ArchiveInfo->archiveId=>: strArchiveId = 9.3-1
+ DEBUG: ArchiveInfo->check=>: strArchiveId = 9.3-1
DEBUG: Archive->walFileName(): bPartial = false, iWaitSeconds = [undef], oFile = [object], strArchiveId = 9.3-1, strWalSegment = 000000010000000100000001
DEBUG: File->list(): bIgnoreMissing = true, strExpression = ^000000010000000100000001(-[0-f]+){0,1}(\.gz){0,1}$, strPath = [TEST_PATH]/db-master/repo/archive/db/9.3-1/0000000100000001, strPathType = backup:absolute, strSortOrder = <forward>
DEBUG: File->list=>: stryFileList = (000000010000000100000001-1c7e00fd09b9dd11fc2966590b3e3274645dd031.gz)
@@ -54,8 +62,13 @@ db-version="9.3"
INFO: get WAL segment 000000010000000100000002
DEBUG: Archive->get(): strDestinationFile = [TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000002, strSourceArchive = 000000010000000100000002
DEBUG: File->new(): iThreadIdx = [undef], oProtocol = [object], strBackupPath = [TEST_PATH]/db-master/repo, strDefaultFileMode = <0640>, strDefaultPathMode = <0750>, strRemote = none, strStanza = db
+ DEBUG: Archive->getCheck(): oFile = [object], strDbVersion = [undef], ullDbSysId = [undef]
+ DEBUG: Db->info(): oFile = [object], strDbPath = [TEST_PATH]/db-master/db/base
+ DEBUG: Db->info=>: iCatalogVersion = 201306121, iControlVersion = 937, strDbVersion = 9.3, ullDbSysId = 6156904820763115222
DEBUG: ArchiveInfo->new(): bRequired = true, strArchiveClusterPath = [TEST_PATH]/db-master/repo/archive/db
+ DEBUG: ArchiveInfo->check(): strDbVersion = 9.3, ullDbSysId = 6156904820763115222
DEBUG: ArchiveInfo->archiveId=>: strArchiveId = 9.3-1
+ DEBUG: ArchiveInfo->check=>: strArchiveId = 9.3-1
DEBUG: Archive->walFileName(): bPartial = false, iWaitSeconds = [undef], oFile = [object], strArchiveId = 9.3-1, strWalSegment = 000000010000000100000002
DEBUG: File->list(): bIgnoreMissing = true, strExpression = ^000000010000000100000002(-[0-f]+){0,1}(\.gz){0,1}$, strPath = [TEST_PATH]/db-master/repo/archive/db/9.3-1/0000000100000001, strPathType = backup:absolute, strSortOrder = <forward>
DEBUG: File->list=>: stryFileList = (000000010000000100000002-1c7e00fd09b9dd11fc2966590b3e3274645dd031.gz)
@@ -72,8 +85,13 @@ db-version="9.3"
INFO: get WAL segment 000000010000000100000003
DEBUG: Archive->get(): strDestinationFile = [TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000003, strSourceArchive = 000000010000000100000003
DEBUG: File->new(): iThreadIdx = [undef], oProtocol = [object], strBackupPath = [TEST_PATH]/db-master/repo, strDefaultFileMode = <0640>, strDefaultPathMode = <0750>, strRemote = none, strStanza = db
+ DEBUG: Archive->getCheck(): oFile = [object], strDbVersion = [undef], ullDbSysId = [undef]
+ DEBUG: Db->info(): oFile = [object], strDbPath = [TEST_PATH]/db-master/db/base
+ DEBUG: Db->info=>: iCatalogVersion = 201306121, iControlVersion = 937, strDbVersion = 9.3, ullDbSysId = 6156904820763115222
DEBUG: ArchiveInfo->new(): bRequired = true, strArchiveClusterPath = [TEST_PATH]/db-master/repo/archive/db
+ DEBUG: ArchiveInfo->check(): strDbVersion = 9.3, ullDbSysId = 6156904820763115222
DEBUG: ArchiveInfo->archiveId=>: strArchiveId = 9.3-1
+ DEBUG: ArchiveInfo->check=>: strArchiveId = 9.3-1
DEBUG: Archive->walFileName(): bPartial = false, iWaitSeconds = [undef], oFile = [object], strArchiveId = 9.3-1, strWalSegment = 000000010000000100000003
DEBUG: File->list(): bIgnoreMissing = true, strExpression = ^000000010000000100000003(-[0-f]+){0,1}(\.gz){0,1}$, strPath = [TEST_PATH]/db-master/repo/archive/db/9.3-1/0000000100000001, strPathType = backup:absolute, strSortOrder = <forward>
DEBUG: File->list=>: stryFileList = (000000010000000100000003-1c7e00fd09b9dd11fc2966590b3e3274645dd031.gz)
diff --git a/test/expect/backup-archive-get-005.log b/test/expect/backup-archive-get-005.log
index 13edfed32..f14ec13fb 100644
--- a/test/expect/backup-archive-get-005.log
+++ b/test/expect/backup-archive-get-005.log
@@ -9,6 +9,9 @@ run 005 - rmt 1, cmp 0, exists 0
DEBUG: Protocol::RemoteMaster->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 1830, strCommand = [BACKREST-BIN] --backup-host=backup --command=archive-get --config=[TEST_PATH]/backup/pgbackrest.conf --repo-path=[TEST_PATH]/backup/repo --stanza=db remote, strHost = backup, strUser = [USER-1]
DEBUG: Protocol::CommonMaster->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 1830, strCommand = ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no backrest@backup '[BACKREST-BIN] --backup-host=backup --command=archive-get --config=[TEST_PATH]/backup/pgbackrest.conf --repo-path=[TEST_PATH]/backup/repo --stanza=db remote', strId = backup, strName = remote
DEBUG: File->new(): iThreadIdx = [undef], oProtocol = [object], strBackupPath = [TEST_PATH]/backup/repo, strDefaultFileMode = <0640>, strDefaultPathMode = <0750>, strRemote = backup, strStanza = db
+ DEBUG: Archive->getCheck(): oFile = [object], strDbVersion = [undef], ullDbSysId = [undef]
+ DEBUG: Db->info(): oFile = [object], strDbPath = [TEST_PATH]/db-master/db/base
+ DEBUG: Db->info=>: iCatalogVersion = 201306121, iControlVersion = 937, strDbVersion = 9.3, ullDbSysId = 6156904820763115222
ERROR: [130]: raised on backup host: archive.info does not exist but is required to get WAL segments
HINT: is archive_command configured in postgresql.conf?
HINT: use --no-archive-check to disable archive checks during backup if you have an alternate archiving scheme.
@@ -25,11 +28,11 @@ backrest-version="[VERSION-1]"
[db]
db-id=1
-db-system-id=1234567890123456789
+db-system-id=6156904820763115222
db-version="9.3"
[db:history]
-1={"db-id":1234567890123456789,"db-version":"9.3"}
+1={"db-id":6156904820763115222,"db-version":"9.3"}
stop all stanzas (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf stop
@@ -65,6 +68,9 @@ start all stanzas (db-master host)
DEBUG: Protocol::RemoteMaster->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 1830, strCommand = [BACKREST-BIN] --backup-host=backup --command=archive-get --config=[TEST_PATH]/backup/pgbackrest.conf --repo-path=[TEST_PATH]/backup/repo --stanza=db remote, strHost = backup, strUser = [USER-1]
DEBUG: Protocol::CommonMaster->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 1830, strCommand = ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no backrest@backup '[BACKREST-BIN] --backup-host=backup --command=archive-get --config=[TEST_PATH]/backup/pgbackrest.conf --repo-path=[TEST_PATH]/backup/repo --stanza=db remote', strId = backup, strName = remote
DEBUG: File->new(): iThreadIdx = [undef], oProtocol = [object], strBackupPath = [TEST_PATH]/backup/repo, strDefaultFileMode = <0640>, strDefaultPathMode = <0750>, strRemote = backup, strStanza = db
+ DEBUG: Archive->getCheck(): oFile = [object], strDbVersion = [undef], ullDbSysId = [undef]
+ DEBUG: Db->info(): oFile = [object], strDbPath = [TEST_PATH]/db-master/db/base
+ DEBUG: Db->info=>: iCatalogVersion = 201306121, iControlVersion = 937, strDbVersion = 9.3, ullDbSysId = 6156904820763115222
DEBUG: Archive->walFileName(): bPartial = false, iWaitSeconds = [undef], oFile = [object], strArchiveId = 9.3-1, strWalSegment = 000000090000000900000009
DEBUG: File->list(): bIgnoreMissing = true, strExpression = ^000000090000000900000009(-[0-f]+){0,1}(\.gz){0,1}$, strPath = [TEST_PATH]/backup/repo/archive/db/9.3-1/0000000900000009, strPathType = backup:absolute, strSortOrder = <forward>
DEBUG: File->list=>: stryFileList = ()
diff --git a/test/expect/backup-archive-get-006.log b/test/expect/backup-archive-get-006.log
index 88256f04d..fce5095e4 100644
--- a/test/expect/backup-archive-get-006.log
+++ b/test/expect/backup-archive-get-006.log
@@ -9,6 +9,9 @@ run 006 - rmt 1, cmp 0, exists 1
DEBUG: Protocol::RemoteMaster->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 1830, strCommand = [BACKREST-BIN] --backup-host=backup --command=archive-get --config=[TEST_PATH]/backup/pgbackrest.conf --repo-path=[TEST_PATH]/backup/repo --stanza=db remote, strHost = backup, strUser = [USER-1]
DEBUG: Protocol::CommonMaster->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 1830, strCommand = ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no backrest@backup '[BACKREST-BIN] --backup-host=backup --command=archive-get --config=[TEST_PATH]/backup/pgbackrest.conf --repo-path=[TEST_PATH]/backup/repo --stanza=db remote', strId = backup, strName = remote
DEBUG: File->new(): iThreadIdx = [undef], oProtocol = [object], strBackupPath = [TEST_PATH]/backup/repo, strDefaultFileMode = <0640>, strDefaultPathMode = <0750>, strRemote = backup, strStanza = db
+ DEBUG: Archive->getCheck(): oFile = [object], strDbVersion = [undef], ullDbSysId = [undef]
+ DEBUG: Db->info(): oFile = [object], strDbPath = [TEST_PATH]/db-master/db/base
+ DEBUG: Db->info=>: iCatalogVersion = 201306121, iControlVersion = 937, strDbVersion = 9.3, ullDbSysId = 6156904820763115222
ERROR: [130]: raised on backup host: archive.info does not exist but is required to get WAL segments
HINT: is archive_command configured in postgresql.conf?
HINT: use --no-archive-check to disable archive checks during backup if you have an alternate archiving scheme.
@@ -25,11 +28,11 @@ backrest-version="[VERSION-1]"
[db]
db-id=1
-db-system-id=1234567890123456789
+db-system-id=6156904820763115222
db-version="9.3"
[db:history]
-1={"db-id":1234567890123456789,"db-version":"9.3"}
+1={"db-id":6156904820763115222,"db-version":"9.3"}
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --stanza=db archive-get 000000010000000100000001 [TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000001
------------------------------------------------------------------------------------------------------------------------------------
@@ -39,6 +42,9 @@ db-version="9.3"
DEBUG: Protocol::RemoteMaster->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 1830, strCommand = [BACKREST-BIN] --backup-host=backup --command=archive-get --config=[TEST_PATH]/backup/pgbackrest.conf --repo-path=[TEST_PATH]/backup/repo --stanza=db remote, strHost = backup, strUser = [USER-1]
DEBUG: Protocol::CommonMaster->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 1830, strCommand = ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no backrest@backup '[BACKREST-BIN] --backup-host=backup --command=archive-get --config=[TEST_PATH]/backup/pgbackrest.conf --repo-path=[TEST_PATH]/backup/repo --stanza=db remote', strId = backup, strName = remote
DEBUG: File->new(): iThreadIdx = [undef], oProtocol = [object], strBackupPath = [TEST_PATH]/backup/repo, strDefaultFileMode = <0640>, strDefaultPathMode = <0750>, strRemote = backup, strStanza = db
+ DEBUG: Archive->getCheck(): oFile = [object], strDbVersion = [undef], ullDbSysId = [undef]
+ DEBUG: Db->info(): oFile = [object], strDbPath = [TEST_PATH]/db-master/db/base
+ DEBUG: Db->info=>: iCatalogVersion = 201306121, iControlVersion = 937, strDbVersion = 9.3, ullDbSysId = 6156904820763115222
DEBUG: Archive->walFileName(): bPartial = false, iWaitSeconds = [undef], oFile = [object], strArchiveId = 9.3-1, strWalSegment = 000000010000000100000001
DEBUG: File->list(): bIgnoreMissing = true, strExpression = ^000000010000000100000001(-[0-f]+){0,1}(\.gz){0,1}$, strPath = [TEST_PATH]/backup/repo/archive/db/9.3-1/0000000100000001, strPathType = backup:absolute, strSortOrder = <forward>
DEBUG: File->list=>: stryFileList = (000000010000000100000001-1c7e00fd09b9dd11fc2966590b3e3274645dd031)
@@ -57,6 +63,9 @@ db-version="9.3"
DEBUG: Protocol::RemoteMaster->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 1830, strCommand = [BACKREST-BIN] --backup-host=backup --command=archive-get --config=[TEST_PATH]/backup/pgbackrest.conf --repo-path=[TEST_PATH]/backup/repo --stanza=db remote, strHost = backup, strUser = [USER-1]
DEBUG: Protocol::CommonMaster->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 1830, strCommand = ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no backrest@backup '[BACKREST-BIN] --backup-host=backup --command=archive-get --config=[TEST_PATH]/backup/pgbackrest.conf --repo-path=[TEST_PATH]/backup/repo --stanza=db remote', strId = backup, strName = remote
DEBUG: File->new(): iThreadIdx = [undef], oProtocol = [object], strBackupPath = [TEST_PATH]/backup/repo, strDefaultFileMode = <0640>, strDefaultPathMode = <0750>, strRemote = backup, strStanza = db
+ DEBUG: Archive->getCheck(): oFile = [object], strDbVersion = [undef], ullDbSysId = [undef]
+ DEBUG: Db->info(): oFile = [object], strDbPath = [TEST_PATH]/db-master/db/base
+ DEBUG: Db->info=>: iCatalogVersion = 201306121, iControlVersion = 937, strDbVersion = 9.3, ullDbSysId = 6156904820763115222
DEBUG: Archive->walFileName(): bPartial = false, iWaitSeconds = [undef], oFile = [object], strArchiveId = 9.3-1, strWalSegment = 000000010000000100000002
DEBUG: File->list(): bIgnoreMissing = true, strExpression = ^000000010000000100000002(-[0-f]+){0,1}(\.gz){0,1}$, strPath = [TEST_PATH]/backup/repo/archive/db/9.3-1/0000000100000001, strPathType = backup:absolute, strSortOrder = <forward>
DEBUG: File->list=>: stryFileList = (000000010000000100000002-1c7e00fd09b9dd11fc2966590b3e3274645dd031)
@@ -75,6 +84,9 @@ db-version="9.3"
DEBUG: Protocol::RemoteMaster->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 1830, strCommand = [BACKREST-BIN] --backup-host=backup --command=archive-get --config=[TEST_PATH]/backup/pgbackrest.conf --repo-path=[TEST_PATH]/backup/repo --stanza=db remote, strHost = backup, strUser = [USER-1]
DEBUG: Protocol::CommonMaster->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 1830, strCommand = ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no backrest@backup '[BACKREST-BIN] --backup-host=backup --command=archive-get --config=[TEST_PATH]/backup/pgbackrest.conf --repo-path=[TEST_PATH]/backup/repo --stanza=db remote', strId = backup, strName = remote
DEBUG: File->new(): iThreadIdx = [undef], oProtocol = [object], strBackupPath = [TEST_PATH]/backup/repo, strDefaultFileMode = <0640>, strDefaultPathMode = <0750>, strRemote = backup, strStanza = db
+ DEBUG: Archive->getCheck(): oFile = [object], strDbVersion = [undef], ullDbSysId = [undef]
+ DEBUG: Db->info(): oFile = [object], strDbPath = [TEST_PATH]/db-master/db/base
+ DEBUG: Db->info=>: iCatalogVersion = 201306121, iControlVersion = 937, strDbVersion = 9.3, ullDbSysId = 6156904820763115222
DEBUG: Archive->walFileName(): bPartial = false, iWaitSeconds = [undef], oFile = [object], strArchiveId = 9.3-1, strWalSegment = 000000010000000100000003
DEBUG: File->list(): bIgnoreMissing = true, strExpression = ^000000010000000100000003(-[0-f]+){0,1}(\.gz){0,1}$, strPath = [TEST_PATH]/backup/repo/archive/db/9.3-1/0000000100000001, strPathType = backup:absolute, strSortOrder = <forward>
DEBUG: File->list=>: stryFileList = (000000010000000100000003-1c7e00fd09b9dd11fc2966590b3e3274645dd031)
diff --git a/test/expect/backup-archive-get-007.log b/test/expect/backup-archive-get-007.log
index fc1fad3d9..9fbf4287f 100644
--- a/test/expect/backup-archive-get-007.log
+++ b/test/expect/backup-archive-get-007.log
@@ -9,6 +9,9 @@ run 007 - rmt 1, cmp 1, exists 0
DEBUG: Protocol::RemoteMaster->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 1830, strCommand = [BACKREST-BIN] --backup-host=backup --command=archive-get --config=[TEST_PATH]/backup/pgbackrest.conf --repo-path=[TEST_PATH]/backup/repo --stanza=db remote, strHost = backup, strUser = [USER-1]
DEBUG: Protocol::CommonMaster->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 1830, strCommand = ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no backrest@backup '[BACKREST-BIN] --backup-host=backup --command=archive-get --config=[TEST_PATH]/backup/pgbackrest.conf --repo-path=[TEST_PATH]/backup/repo --stanza=db remote', strId = backup, strName = remote
DEBUG: File->new(): iThreadIdx = [undef], oProtocol = [object], strBackupPath = [TEST_PATH]/backup/repo, strDefaultFileMode = <0640>, strDefaultPathMode = <0750>, strRemote = backup, strStanza = db
+ DEBUG: Archive->getCheck(): oFile = [object], strDbVersion = [undef], ullDbSysId = [undef]
+ DEBUG: Db->info(): oFile = [object], strDbPath = [TEST_PATH]/db-master/db/base
+ DEBUG: Db->info=>: iCatalogVersion = 201306121, iControlVersion = 937, strDbVersion = 9.3, ullDbSysId = 6156904820763115222
ERROR: [130]: raised on backup host: archive.info does not exist but is required to get WAL segments
HINT: is archive_command configured in postgresql.conf?
HINT: use --no-archive-check to disable archive checks during backup if you have an alternate archiving scheme.
@@ -25,11 +28,11 @@ backrest-version="[VERSION-1]"
[db]
db-id=1
-db-system-id=1234567890123456789
+db-system-id=6156904820763115222
db-version="9.3"
[db:history]
-1={"db-id":1234567890123456789,"db-version":"9.3"}
+1={"db-id":6156904820763115222,"db-version":"9.3"}
stop all stanzas (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf stop
@@ -65,6 +68,9 @@ start all stanzas (db-master host)
DEBUG: Protocol::RemoteMaster->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 1830, strCommand = [BACKREST-BIN] --backup-host=backup --command=archive-get --config=[TEST_PATH]/backup/pgbackrest.conf --repo-path=[TEST_PATH]/backup/repo --stanza=db remote, strHost = backup, strUser = [USER-1]
DEBUG: Protocol::CommonMaster->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 1830, strCommand = ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no backrest@backup '[BACKREST-BIN] --backup-host=backup --command=archive-get --config=[TEST_PATH]/backup/pgbackrest.conf --repo-path=[TEST_PATH]/backup/repo --stanza=db remote', strId = backup, strName = remote
DEBUG: File->new(): iThreadIdx = [undef], oProtocol = [object], strBackupPath = [TEST_PATH]/backup/repo, strDefaultFileMode = <0640>, strDefaultPathMode = <0750>, strRemote = backup, strStanza = db
+ DEBUG: Archive->getCheck(): oFile = [object], strDbVersion = [undef], ullDbSysId = [undef]
+ DEBUG: Db->info(): oFile = [object], strDbPath = [TEST_PATH]/db-master/db/base
+ DEBUG: Db->info=>: iCatalogVersion = 201306121, iControlVersion = 937, strDbVersion = 9.3, ullDbSysId = 6156904820763115222
DEBUG: Archive->walFileName(): bPartial = false, iWaitSeconds = [undef], oFile = [object], strArchiveId = 9.3-1, strWalSegment = 000000090000000900000009
DEBUG: File->list(): bIgnoreMissing = true, strExpression = ^000000090000000900000009(-[0-f]+){0,1}(\.gz){0,1}$, strPath = [TEST_PATH]/backup/repo/archive/db/9.3-1/0000000900000009, strPathType = backup:absolute, strSortOrder = <forward>
DEBUG: File->list=>: stryFileList = ()
diff --git a/test/expect/backup-archive-get-008.log b/test/expect/backup-archive-get-008.log
index f20aa8da7..768b75c8d 100644
--- a/test/expect/backup-archive-get-008.log
+++ b/test/expect/backup-archive-get-008.log
@@ -9,6 +9,9 @@ run 008 - rmt 1, cmp 1, exists 1
DEBUG: Protocol::RemoteMaster->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 1830, strCommand = [BACKREST-BIN] --backup-host=backup --command=archive-get --config=[TEST_PATH]/backup/pgbackrest.conf --repo-path=[TEST_PATH]/backup/repo --stanza=db remote, strHost = backup, strUser = [USER-1]
DEBUG: Protocol::CommonMaster->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 1830, strCommand = ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no backrest@backup '[BACKREST-BIN] --backup-host=backup --command=archive-get --config=[TEST_PATH]/backup/pgbackrest.conf --repo-path=[TEST_PATH]/backup/repo --stanza=db remote', strId = backup, strName = remote
DEBUG: File->new(): iThreadIdx = [undef], oProtocol = [object], strBackupPath = [TEST_PATH]/backup/repo, strDefaultFileMode = <0640>, strDefaultPathMode = <0750>, strRemote = backup, strStanza = db
+ DEBUG: Archive->getCheck(): oFile = [object], strDbVersion = [undef], ullDbSysId = [undef]
+ DEBUG: Db->info(): oFile = [object], strDbPath = [TEST_PATH]/db-master/db/base
+ DEBUG: Db->info=>: iCatalogVersion = 201306121, iControlVersion = 937, strDbVersion = 9.3, ullDbSysId = 6156904820763115222
ERROR: [130]: raised on backup host: archive.info does not exist but is required to get WAL segments
HINT: is archive_command configured in postgresql.conf?
HINT: use --no-archive-check to disable archive checks during backup if you have an alternate archiving scheme.
@@ -25,11 +28,11 @@ backrest-version="[VERSION-1]"
[db]
db-id=1
-db-system-id=1234567890123456789
+db-system-id=6156904820763115222
db-version="9.3"
[db:history]
-1={"db-id":1234567890123456789,"db-version":"9.3"}
+1={"db-id":6156904820763115222,"db-version":"9.3"}
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --stanza=db archive-get 000000010000000100000001 [TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000001
------------------------------------------------------------------------------------------------------------------------------------
@@ -39,6 +42,9 @@ db-version="9.3"
DEBUG: Protocol::RemoteMaster->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 1830, strCommand = [BACKREST-BIN] --backup-host=backup --command=archive-get --config=[TEST_PATH]/backup/pgbackrest.conf --repo-path=[TEST_PATH]/backup/repo --stanza=db remote, strHost = backup, strUser = [USER-1]
DEBUG: Protocol::CommonMaster->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 1830, strCommand = ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no backrest@backup '[BACKREST-BIN] --backup-host=backup --command=archive-get --config=[TEST_PATH]/backup/pgbackrest.conf --repo-path=[TEST_PATH]/backup/repo --stanza=db remote', strId = backup, strName = remote
DEBUG: File->new(): iThreadIdx = [undef], oProtocol = [object], strBackupPath = [TEST_PATH]/backup/repo, strDefaultFileMode = <0640>, strDefaultPathMode = <0750>, strRemote = backup, strStanza = db
+ DEBUG: Archive->getCheck(): oFile = [object], strDbVersion = [undef], ullDbSysId = [undef]
+ DEBUG: Db->info(): oFile = [object], strDbPath = [TEST_PATH]/db-master/db/base
+ DEBUG: Db->info=>: iCatalogVersion = 201306121, iControlVersion = 937, strDbVersion = 9.3, ullDbSysId = 6156904820763115222
DEBUG: Archive->walFileName(): bPartial = false, iWaitSeconds = [undef], oFile = [object], strArchiveId = 9.3-1, strWalSegment = 000000010000000100000001
DEBUG: File->list(): bIgnoreMissing = true, strExpression = ^000000010000000100000001(-[0-f]+){0,1}(\.gz){0,1}$, strPath = [TEST_PATH]/backup/repo/archive/db/9.3-1/0000000100000001, strPathType = backup:absolute, strSortOrder = <forward>
DEBUG: File->list=>: stryFileList = (000000010000000100000001-1c7e00fd09b9dd11fc2966590b3e3274645dd031.gz)
@@ -57,6 +63,9 @@ db-version="9.3"
DEBUG: Protocol::RemoteMaster->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 1830, strCommand = [BACKREST-BIN] --backup-host=backup --command=archive-get --config=[TEST_PATH]/backup/pgbackrest.conf --repo-path=[TEST_PATH]/backup/repo --stanza=db remote, strHost = backup, strUser = [USER-1]
DEBUG: Protocol::CommonMaster->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 1830, strCommand = ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no backrest@backup '[BACKREST-BIN] --backup-host=backup --command=archive-get --config=[TEST_PATH]/backup/pgbackrest.conf --repo-path=[TEST_PATH]/backup/repo --stanza=db remote', strId = backup, strName = remote
DEBUG: File->new(): iThreadIdx = [undef], oProtocol = [object], strBackupPath = [TEST_PATH]/backup/repo, strDefaultFileMode = <0640>, strDefaultPathMode = <0750>, strRemote = backup, strStanza = db
+ DEBUG: Archive->getCheck(): oFile = [object], strDbVersion = [undef], ullDbSysId = [undef]
+ DEBUG: Db->info(): oFile = [object], strDbPath = [TEST_PATH]/db-master/db/base
+ DEBUG: Db->info=>: iCatalogVersion = 201306121, iControlVersion = 937, strDbVersion = 9.3, ullDbSysId = 6156904820763115222
DEBUG: Archive->walFileName(): bPartial = false, iWaitSeconds = [undef], oFile = [object], strArchiveId = 9.3-1, strWalSegment = 000000010000000100000002
DEBUG: File->list(): bIgnoreMissing = true, strExpression = ^000000010000000100000002(-[0-f]+){0,1}(\.gz){0,1}$, strPath = [TEST_PATH]/backup/repo/archive/db/9.3-1/0000000100000001, strPathType = backup:absolute, strSortOrder = <forward>
DEBUG: File->list=>: stryFileList = (000000010000000100000002-1c7e00fd09b9dd11fc2966590b3e3274645dd031.gz)
@@ -75,6 +84,9 @@ db-version="9.3"
DEBUG: Protocol::RemoteMaster->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 1830, strCommand = [BACKREST-BIN] --backup-host=backup --command=archive-get --config=[TEST_PATH]/backup/pgbackrest.conf --repo-path=[TEST_PATH]/backup/repo --stanza=db remote, strHost = backup, strUser = [USER-1]
DEBUG: Protocol::CommonMaster->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 1830, strCommand = ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no backrest@backup '[BACKREST-BIN] --backup-host=backup --command=archive-get --config=[TEST_PATH]/backup/pgbackrest.conf --repo-path=[TEST_PATH]/backup/repo --stanza=db remote', strId = backup, strName = remote
DEBUG: File->new(): iThreadIdx = [undef], oProtocol = [object], strBackupPath = [TEST_PATH]/backup/repo, strDefaultFileMode = <0640>, strDefaultPathMode = <0750>, strRemote = backup, strStanza = db
+ DEBUG: Archive->getCheck(): oFile = [object], strDbVersion = [undef], ullDbSysId = [undef]
+ DEBUG: Db->info(): oFile = [object], strDbPath = [TEST_PATH]/db-master/db/base
+ DEBUG: Db->info=>: iCatalogVersion = 201306121, iControlVersion = 937, strDbVersion = 9.3, ullDbSysId = 6156904820763115222
DEBUG: Archive->walFileName(): bPartial = false, iWaitSeconds = [undef], oFile = [object], strArchiveId = 9.3-1, strWalSegment = 000000010000000100000003
DEBUG: File->list(): bIgnoreMissing = true, strExpression = ^000000010000000100000003(-[0-f]+){0,1}(\.gz){0,1}$, strPath = [TEST_PATH]/backup/repo/archive/db/9.3-1/0000000100000001, strPathType = backup:absolute, strSortOrder = <forward>
DEBUG: File->list=>: stryFileList = (000000010000000100000003-1c7e00fd09b9dd11fc2966590b3e3274645dd031.gz)
diff --git a/test/lib/pgBackRestTest/Backup/BackupTest.pm b/test/lib/pgBackRestTest/Backup/BackupTest.pm
index 8c7c5b0d3..a3b5a3070 100755
--- a/test/lib/pgBackRestTest/Backup/BackupTest.pm
+++ b/test/lib/pgBackRestTest/Backup/BackupTest.pm
@@ -20,6 +20,7 @@ use Time::HiRes qw(gettimeofday);
use pgBackRest::Archive;
use pgBackRest::ArchiveInfo;
+use pgBackRest::BackupInfo;
use pgBackRest::Common::Exception;
use pgBackRest::Common::Ini;
use pgBackRest::Common::Log;
@@ -224,17 +225,10 @@ sub backupTestRun
if ($iArchive == $iBackup)
{
- # load the archive info file so it can be munged for testing
- my $strInfoFile = $oFile->pathGet(PATH_BACKUP_ARCHIVE, ARCHIVE_INFO_FILE);
- executeTest("sudo chmod 660 ${strInfoFile}");
- my %oInfo;
- iniLoad($strInfoFile, \%oInfo);
- my $strDbVersion = $oInfo{&INFO_ARCHIVE_SECTION_DB}{&INFO_ARCHIVE_KEY_DB_VERSION};
- my $ullDbSysId = $oInfo{&INFO_ARCHIVE_SECTION_DB}{&INFO_ARCHIVE_KEY_DB_SYSTEM_ID};
-
- # Break the database version
- $oInfo{&INFO_ARCHIVE_SECTION_DB}{&INFO_ARCHIVE_KEY_DB_VERSION} = '8.0';
- testIniSave($strInfoFile, \%oInfo, true);
+ # load the archive info file and munge it for testing by breaking the database version
+ $oHostBackup->infoMunge(
+ $oFile->pathGet(PATH_BACKUP_ARCHIVE, ARCHIVE_INFO_FILE),
+ {&INFO_ARCHIVE_SECTION_DB => {&INFO_ARCHIVE_KEY_DB_VERSION => '8.0'}});
&log(INFO, ' test db version mismatch error');
@@ -242,10 +236,11 @@ sub backupTestRun
$strCommand . " ${strSourceFile}",
{iExpectedExitStatus => ERROR_ARCHIVE_MISMATCH, oLogTest => $oLogTest});
- # Break the system id
- $oInfo{&INFO_ARCHIVE_SECTION_DB}{&INFO_ARCHIVE_KEY_DB_VERSION} = $strDbVersion;
- $oInfo{&INFO_ARCHIVE_SECTION_DB}{&INFO_ARCHIVE_KEY_DB_SYSTEM_ID} = '5000900090001855000';
- testIniSave($strInfoFile, \%oInfo, true);
+
+ # break the system id
+ $oHostBackup->infoMunge(
+ $oFile->pathGet(PATH_BACKUP_ARCHIVE, ARCHIVE_INFO_FILE),
+ {&INFO_ARCHIVE_SECTION_DB => {&INFO_BACKUP_KEY_SYSTEM_ID => 5000900090001855000}});
&log(INFO, ' test db system-id mismatch error');
@@ -253,9 +248,8 @@ sub backupTestRun
$strCommand . " ${strSourceFile}",
{iExpectedExitStatus => ERROR_ARCHIVE_MISMATCH, oLogTest => $oLogTest});
- # Move settings back to original
- $oInfo{&INFO_ARCHIVE_SECTION_DB}{&INFO_ARCHIVE_KEY_DB_SYSTEM_ID} = $ullDbSysId;
- testIniSave($strInfoFile, \%oInfo, true);
+ # Restore the file to its original condition
+ $oHostBackup->infoRestore($oFile->pathGet(PATH_BACKUP_ARCHIVE, ARCHIVE_INFO_FILE));
# Fail because the process was killed
if ($iBackup == 1 && !$bCompress)
@@ -475,6 +469,12 @@ sub backupTestRun
my $strXlogPath = $oHostDbMaster->dbBasePath() . '/pg_xlog';
filePathCreate($strXlogPath, undef, false, true);
+ # Create the test path for pg_control
+ filePathCreate(($oHostDbMaster->dbBasePath() . '/' . DB_PATH_GLOBAL), undef, false, true);
+
+ # Copy pg_control
+ executeTest('cp ' . testDataPath() . '/pg_control ' . $oHostDbMaster->dbBasePath() . '/' . DB_FILE_PGCONTROL);
+
my $strCommand =
$oHostDbMaster->backrestExe() .
' --config=' . $oHostDbMaster->backrestConfig() .
@@ -486,7 +486,7 @@ sub backupTestRun
# Create the archive info file
filePathCreate($oFile->pathGet(PATH_BACKUP_ARCHIVE), '0770', undef, true);
- (new pgBackRest::ArchiveInfo($oFile->pathGet(PATH_BACKUP_ARCHIVE)))->check(PG_VERSION_93, 1234567890123456789);
+ (new pgBackRest::ArchiveInfo($oFile->pathGet(PATH_BACKUP_ARCHIVE)))->check(PG_VERSION_93, 6156904820763115222);
if (defined($oLogTest))
{
@@ -756,8 +756,7 @@ sub backupTestRun
'56fe5780b8dca9705e0c22032a83828860a21235', $lTime - 100);
# Copy pg_control
- executeTest('cp ' . testDataPath() . '/pg_control ' .
- $oHostDbMaster->dbBasePath() . '/' . DB_FILE_PGCONTROL);
+ executeTest('cp ' . testDataPath() . '/pg_control ' . $oHostDbMaster->dbBasePath() . '/' . DB_FILE_PGCONTROL);
utime($lTime - 100, $lTime - 100, $oHostDbMaster->dbBasePath() . '/' . DB_FILE_PGCONTROL)
or confess &log(ERROR, "unable to set time");
$oManifest{&MANIFEST_SECTION_TARGET_FILE}{MANIFEST_TARGET_PGDATA . '/' . DB_FILE_PGCONTROL}
@@ -1085,58 +1084,48 @@ sub backupTestRun
$strType = BACKUP_TYPE_INCR;
$oHostDbMaster->manifestReference(\%oManifest, $strFullBackup);
- my $strInfoFile = $oHostBackup->repoPath() . "/backup/${strStanza}/backup.info";
- executeTest("sudo chmod 660 $strInfoFile");
- my %oInfo;
- iniLoad($strInfoFile, \%oInfo);
-
# Break the database version
- my $strDbVersion = $oInfo{'db'}{&MANIFEST_KEY_DB_VERSION};
-
- $oInfo{db}{&MANIFEST_KEY_DB_VERSION} = '8.0';
- testIniSave($strInfoFile, \%oInfo, true);
+ $oHostBackup->infoMunge(
+ $oFile->pathGet(PATH_BACKUP_CLUSTER, FILE_BACKUP_INFO),
+ {&INFO_BACKUP_SECTION_DB => {&INFO_BACKUP_KEY_DB_VERSION => '8.0'}});
$oHostBackup->backup(
$strType, 'invalid database version',
{oExpectedManifest => \%oManifest, iExpectedExitStatus => ERROR_BACKUP_MISMATCH,
strOptionalParam => '--log-level-console=detail'});
- $oInfo{db}{&MANIFEST_KEY_DB_VERSION} = $strDbVersion;
# Break the database system id
- my $ullDbSysId = $oInfo{'db'}{&MANIFEST_KEY_SYSTEM_ID};
- $oInfo{db}{&MANIFEST_KEY_SYSTEM_ID} = 6999999999999999999;
- testIniSave($strInfoFile, \%oInfo, true);
+ $oHostBackup->infoMunge(
+ $oFile->pathGet(PATH_BACKUP_CLUSTER, FILE_BACKUP_INFO),
+ {&INFO_BACKUP_SECTION_DB => {&INFO_BACKUP_KEY_SYSTEM_ID => 6999999999999999999}});
$oHostBackup->backup(
$strType, 'invalid system id',
{oExpectedManifest => \%oManifest, iExpectedExitStatus => ERROR_BACKUP_MISMATCH,
strOptionalParam => '--log-level-console=detail'});
- $oInfo{db}{&MANIFEST_KEY_SYSTEM_ID} = $ullDbSysId;
# Break the control version
- my $iControlVersion = $oInfo{'db'}{&MANIFEST_KEY_CONTROL};
- $oInfo{db}{&MANIFEST_KEY_CONTROL} = 842;
- testIniSave($strInfoFile, \%oInfo, true);
+ $oHostBackup->infoMunge(
+ $oFile->pathGet(PATH_BACKUP_CLUSTER, FILE_BACKUP_INFO),
+ {&INFO_BACKUP_SECTION_DB => {&INFO_BACKUP_KEY_CONTROL => 842}});
$oHostBackup->backup(
$strType, 'invalid control version',
{oExpectedManifest => \%oManifest, iExpectedExitStatus => ERROR_BACKUP_MISMATCH,
strOptionalParam => '--log-level-console=detail'});
- $oInfo{db}{&MANIFEST_KEY_CONTROL} = $iControlVersion;
# Break the catalog version
- my $iCatalogVersion = $oInfo{'db'}{&MANIFEST_KEY_CATALOG};
- $oInfo{db}{&MANIFEST_KEY_CATALOG} = 197208141;
- testIniSave($strInfoFile, \%oInfo, true);
+ $oHostBackup->infoMunge(
+ $oFile->pathGet(PATH_BACKUP_CLUSTER, FILE_BACKUP_INFO),
+ {&INFO_BACKUP_SECTION_DB => {&INFO_BACKUP_KEY_CATALOG => 197208141}});
$oHostBackup->backup(
$strType, 'invalid catalog version',
{oExpectedManifest => \%oManifest, iExpectedExitStatus => ERROR_BACKUP_MISMATCH,
strOptionalParam => '--log-level-console=detail'});
- # Fix up info file for next test
- $oInfo{db}{&MANIFEST_KEY_CATALOG} = $iCatalogVersion;
- testIniSave($strInfoFile, \%oInfo, true);
+ # Restore the file to its original condition
+ $oHostBackup->infoRestore($oFile->pathGet(PATH_BACKUP_CLUSTER, FILE_BACKUP_INFO));
# Test broken tablespace configuration
#-----------------------------------------------------------------------------------------------------------------------
@@ -1592,7 +1581,7 @@ sub backupTestRun
$oHostDbMaster->sqlExecute('create database test1', {bAutoCommit => true});
$oHostDbMaster->sqlExecute('create database test2', {bAutoCommit => true});
- # Test invalid archive command
+ # Test invalid check command
#-----------------------------------------------------------------------------------------------------------------------
$strType = BACKUP_TYPE_FULL;
@@ -1639,7 +1628,26 @@ sub backupTestRun
$oHostBackup->check($strComment, {iTimeout => 5});
}
- # Check archive_timeout error
+ # Check archive mismatch due to upgrade error
+ $strComment = 'fail on archive mismatch after upgrade';
+
+ # load the archive info file and munge it for testing by breaking the database version
+ $oHostBackup->infoMunge(
+ $oFile->pathGet(PATH_BACKUP_ARCHIVE, ARCHIVE_INFO_FILE),
+ {&INFO_ARCHIVE_SECTION_DB => {&INFO_ARCHIVE_KEY_DB_VERSION => '8.0'}});
+
+ $oHostDbMaster->check($strComment, {iTimeout => 0.1, iExpectedExitStatus => ERROR_ARCHIVE_MISMATCH});
+
+ # If running the remote tests then also need to run check locally
+ if ($bRemote)
+ {
+ $oHostBackup->check($strComment, {iTimeout => 0.1, iExpectedExitStatus => ERROR_ARCHIVE_MISMATCH});
+ }
+
+ # Restore the file to its original condition
+ $oHostBackup->infoRestore($oFile->pathGet(PATH_BACKUP_ARCHIVE, ARCHIVE_INFO_FILE));
+
+ # Check archive_timeout error when WAL segment is not found
$strComment = 'fail on archive timeout';
$oHostDbMaster->clusterRestart({bArchiveInvalid => true});
@@ -1654,6 +1662,39 @@ sub backupTestRun
# Restart the cluster ignoring any errors in the postgresql log
$oHostDbMaster->clusterRestart({bIgnoreLogError => true});
+ # If local, then with a valid archive info, create the backup.info file by running a backup then munge the
+ # backup.info file.
+ if (!$bRemote)
+ {
+ # Check backup mismatch error
+ $strComment = 'fail on backup info mismatch';
+
+ # First run a successful backup to create the backup.info file
+ $oHostBackup->backup($strType, 'run a successful backup');
+
+ # Load the backup.info file and munge it for testing by breaking the database version and system id
+ $oHostBackup->infoMunge(
+ $oFile->pathGet(PATH_BACKUP_CLUSTER, FILE_BACKUP_INFO),
+ {&INFO_BACKUP_SECTION_DB =>
+ {&INFO_BACKUP_KEY_DB_VERSION => '8.0', &INFO_BACKUP_KEY_SYSTEM_ID => 6999999999999999999}});
+
+ # Run the test
+ $oHostBackup->check($strComment, {iTimeout => 5, iExpectedExitStatus => ERROR_BACKUP_MISMATCH});
+
+ # Restore the file to its original condition
+ $oHostBackup->infoRestore($oFile->pathGet(PATH_BACKUP_CLUSTER, FILE_BACKUP_INFO));
+
+ # Providing a sufficient archive-timeout, verify that the check command runs successfully now with valid
+ # archive.info and backup.info files
+ $strComment = 'verify success after backup';
+
+ $oHostBackup->check($strComment, {iTimeout => 5});
+ }
+
+ # Clear cluster for next set of tests
+ $oHostDbMaster->clusterStop();
+ $oHostDbMaster->clusterStart();
+
# Full backup
#-----------------------------------------------------------------------------------------------------------------------
$strType = BACKUP_TYPE_FULL;
diff --git a/test/lib/pgBackRestTest/Backup/Common/HostBackupTest.pm b/test/lib/pgBackRestTest/Backup/Common/HostBackupTest.pm
index aef749696..1295b3293 100644
--- a/test/lib/pgBackRestTest/Backup/Common/HostBackupTest.pm
+++ b/test/lib/pgBackRestTest/Backup/Common/HostBackupTest.pm
@@ -14,6 +14,8 @@ use Carp qw(confess);
use Exporter qw(import);
our @EXPORT = qw();
+use Storable qw(dclone);
+
use pgBackRest::Common::Exception;
use pgBackRest::Common::Ini;
use pgBackRest::Common::Log;
@@ -26,6 +28,7 @@ use pgBackRest::Version;
use pgBackRestTest::Backup::Common::HostBaseTest;
use pgBackRestTest::Common::ExecuteTest;
use pgBackRestTest::Common::HostGroupTest;
+use pgBackRestTest::CommonTest;
####################################################################################################################################
# Host constants
@@ -71,6 +74,12 @@ use constant HOST_STANZA => 'db';
use constant HOST_PROTOCOL_TIMEOUT => 10;
push @EXPORT, qw(HOST_PROTOCOL_TIMEOUT);
+####################################################################################################################################
+# Cached data sections
+####################################################################################################################################
+use constant SECTION_FILE_NAME => 'strFileName';
+ push @EXPORT, qw(SECTION_FILE_NAME);
+
####################################################################################################################################
# new
####################################################################################################################################
@@ -156,6 +165,9 @@ sub new
HOST_PROTOCOL_TIMEOUT # Protocol timeout
));
+ # Create a placeholder hash for file munging
+ $self->{hInfoFile} = {};
+
# Return from function and log return values if any
return logDebugReturn
(
@@ -846,6 +858,98 @@ sub manifestMunge
iniSave($self->{oFile}->pathGet(PATH_BACKUP_CLUSTER, $strManifestFile), \%oManifest);
}
+####################################################################################################################################
+# infoMunge
+#
+# With the file name specified (e.g. /repo/archive/db/archive.info) copy the current values from the file into the global hash and
+# update the file with the new values passed. Later, using infoRestore, the global variable will be used to restore the file to its
+# original state.
+####################################################################################################################################
+sub infoMunge
+{
+ my $self = shift;
+
+ # Assign function parameters, defaults, and log debug info
+ my
+ (
+ $strOperation,
+ $strFileName,
+ $hParam
+ ) =
+ logDebugParam
+ (
+ __PACKAGE__ . '->infoMunge', \@_,
+ {name => 'strFileName'},
+ {name => 'hParam'}
+ );
+
+ # If the original file content does not exist then load it
+ if (!defined($self->{hInfoFile}{$strFileName}))
+ {
+ $self->{hInfoFile}{$strFileName} = iniLoad($strFileName);
+ # Modify the file permissions so it can be saved
+ executeTest("sudo chmod 660 ${strFileName}");
+ }
+
+ # Make a copy of the original file contents
+ my $hContent = dclone($self->{hInfoFile}{$strFileName});
+
+ # Load params
+ foreach my $strSection (sort(keys(%{$hParam})))
+ {
+ foreach my $strKey (keys(%{$$hParam{$strSection}}))
+ {
+ # Munge the copy with the new parameter values
+ $$hContent{$strSection}{$strKey} = $$hParam{$strSection}{$strKey};
+ }
+ }
+
+ # Save the munged data to the file
+ testIniSave($strFileName, \%{$hContent}, true);
+
+ # Return from function and log return values if any
+ return logDebugReturn($strOperation);
+}
+
+####################################################################################################################################
+# infoRestore
+#
+# With the file name specified (e.g. /repo/archive/db/archive.info) use the original file contents in the global hash to restore the
+# file to its original state after modifying the values with infoMunge.
+####################################################################################################################################
+sub infoRestore
+{
+ my $self = shift;
+
+ # Assign function parameters, defaults, and log debug info
+ my
+ (
+ $strOperation,
+ $strFileName
+ ) =
+ logDebugParam
+ (
+ __PACKAGE__ . '->infoRestore', \@_,
+ {name => 'strFileName'}
+ );
+
+ # If the original file content exists in the global hash, then save it to the file
+ if (defined($self->{hInfoFile}{$strFileName}))
+ {
+ iniSave($strFileName, $self->{hInfoFile}{$strFileName});
+ }
+ else
+ {
+ confess &log(ASSERT, "There is no original data cached for $strFileName. infoMunge must be called first.");
+ }
+
+ # Remove the element from the hash
+ delete($self->{hInfoFile}{$strFileName});
+
+ # Return from function and log return values if any
+ return logDebugReturn($strOperation);
+}
+
####################################################################################################################################
# Getters
####################################################################################################################################
[parent: f95d4af64a9e]