mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2024-12-12 10:04:14 +02:00
The archive-start and archive-stop settings are now filled in backup.manifest.
This commit is contained in:
parent
cc9c8819ee
commit
0d5a1eaf9e
@ -139,6 +139,10 @@
|
||||
<p>Exclude contents of <path>$PGDATA/pg_replslot</path> directory so that replication slots on the master do not become part of the backup.</p>
|
||||
</release-item>
|
||||
|
||||
<release-item>
|
||||
<p>The <setting>archive-start</setting> and <setting>archive-stop</setting> settings are now filled in <file>backup.manifest</file> even when <br-option>archive-check-n</br-option>.</p>
|
||||
</release-item>
|
||||
|
||||
<release-item>
|
||||
<p>Experimental support for non-exclusive backups in <postgres/> 9.6 rc1. Changes to the control/catalog/WAL versions in subsequent betas may break compatibility but <backrest/> will be updated with each release to keep pace.</p>
|
||||
</release-item>
|
||||
|
@ -662,9 +662,10 @@ sub process
|
||||
}
|
||||
|
||||
# Start backup (unless --no-online is set)
|
||||
my $strArchiveStart;
|
||||
my $oTablespaceMap;
|
||||
my $oDatabaseMap;
|
||||
my $strArchiveStart = undef;
|
||||
my $strLsnStart = undef;
|
||||
my $oTablespaceMap = undef;
|
||||
my $oDatabaseMap = undef;
|
||||
|
||||
# Don't start the backup but do check if PostgreSQL is running
|
||||
if (!optionGet(OPTION_ONLINE))
|
||||
@ -688,13 +689,14 @@ sub process
|
||||
else
|
||||
{
|
||||
# Start the backup
|
||||
($strArchiveStart) =
|
||||
($strArchiveStart, $strLsnStart) =
|
||||
$oDbMaster->backupStart(
|
||||
BACKREST_NAME . ' backup started at ' . timestampFormat(undef, $lTimestampStart), optionGet(OPTION_START_FAST));
|
||||
|
||||
# Record the archive start location
|
||||
$oBackupManifest->set(MANIFEST_SECTION_BACKUP, MANIFEST_KEY_LSN_START, undef, $strArchiveStart);
|
||||
&log(INFO, "backup lsn start: ${strArchiveStart}");
|
||||
$oBackupManifest->set(MANIFEST_SECTION_BACKUP, MANIFEST_KEY_ARCHIVE_START, undef, $strArchiveStart);
|
||||
$oBackupManifest->set(MANIFEST_SECTION_BACKUP, MANIFEST_KEY_LSN_START, undef, $strLsnStart);
|
||||
&log(INFO, "backup start archive = ${strArchiveStart}, lsn = ${strLsnStart}");
|
||||
|
||||
# Get tablespace map
|
||||
$oTablespaceMap = $oDbMaster->tablespaceMapGet();
|
||||
@ -710,9 +712,9 @@ sub process
|
||||
|
||||
$oDbStandby->configValidate();
|
||||
|
||||
&log(INFO, "wait for replay on the standby to reach ${strArchiveStart}");
|
||||
&log(INFO, "wait for replay on the standby to reach ${strLsnStart}");
|
||||
|
||||
my ($strReplayedLSN, $strCheckpointLSN) = $oDbStandby->replayWait($strArchiveStart);
|
||||
my ($strReplayedLSN, $strCheckpointLSN) = $oDbStandby->replayWait($strLsnStart);
|
||||
|
||||
&log(
|
||||
INFO,
|
||||
@ -858,14 +860,16 @@ sub process
|
||||
&log(INFO, "${strType} backup size = " . fileSizeFormat($lBackupSizeTotal));
|
||||
|
||||
# Stop backup (unless --no-online is set)
|
||||
my $strArchiveStop;
|
||||
my $strArchiveStop = undef;
|
||||
my $strLsnStop = undef;
|
||||
|
||||
if (optionGet(OPTION_ONLINE))
|
||||
{
|
||||
($strArchiveStop, my $strTimestampDbStop, my $oFileHash) = $oDbMaster->backupStop();
|
||||
($strArchiveStop, $strLsnStop, my $strTimestampDbStop, my $oFileHash) = $oDbMaster->backupStop();
|
||||
|
||||
$oBackupManifest->set(MANIFEST_SECTION_BACKUP, MANIFEST_KEY_LSN_STOP, undef, $strArchiveStop);
|
||||
&log(INFO, 'backup lsn stop: ' . $strArchiveStop);
|
||||
$oBackupManifest->set(MANIFEST_SECTION_BACKUP, MANIFEST_KEY_ARCHIVE_STOP, undef, $strArchiveStop);
|
||||
$oBackupManifest->set(MANIFEST_SECTION_BACKUP, MANIFEST_KEY_LSN_STOP, undef, $strLsnStop);
|
||||
&log(INFO, "backup stop archive = ${strArchiveStop}, lsn = ${strLsnStop}");
|
||||
|
||||
# Write out files returned from stop backup
|
||||
foreach my $strFile (sort(keys(%{$oFileHash})))
|
||||
@ -912,7 +916,7 @@ sub process
|
||||
logDebugMisc($strOperation, "retrieve archive logs ${strArchiveStart}:${strArchiveStop}");
|
||||
my $oArchive = new pgBackRest::Archive();
|
||||
my $strArchiveId = $oArchive->getArchiveId($oFileLocal);
|
||||
my @stryArchive = lsnFileRange($strArchiveStart, $strArchiveStop, $strDbVersion);
|
||||
my @stryArchive = lsnFileRange($strLsnStart, $strLsnStop, $strDbVersion);
|
||||
|
||||
foreach my $strArchive (@stryArchive)
|
||||
{
|
||||
@ -920,16 +924,6 @@ sub process
|
||||
$oArchive->walFileName($oFileLocal, $strArchiveId, $strArchive, false, optionGet(OPTION_ARCHIVE_TIMEOUT));
|
||||
$strArchive = substr($strArchiveFile, 0, 24);
|
||||
|
||||
if (!$oBackupManifest->test(MANIFEST_SECTION_BACKUP, MANIFEST_KEY_ARCHIVE_START))
|
||||
{
|
||||
$oBackupManifest->set(MANIFEST_SECTION_BACKUP, MANIFEST_KEY_ARCHIVE_START, undef, $strArchive);
|
||||
$oBackupManifest->set(MANIFEST_SECTION_BACKUP, MANIFEST_KEY_ARCHIVE_STOP, undef, $strArchive);
|
||||
}
|
||||
else
|
||||
{
|
||||
$oBackupManifest->set(MANIFEST_SECTION_BACKUP, MANIFEST_KEY_ARCHIVE_STOP, undef, $strArchive);
|
||||
}
|
||||
|
||||
if (optionGet(OPTION_BACKUP_ARCHIVE_COPY))
|
||||
{
|
||||
logDebugMisc($strOperation, "archive: ${strArchive} (${strArchiveFile})");
|
||||
|
@ -673,8 +673,8 @@ sub backupStart
|
||||
"exclusive pg_start_backup() with label \"${strLabel}\": backup begins after " .
|
||||
($bStartFast ? "the requested immediate checkpoint" : "the next regular checkpoint") . " completes");
|
||||
|
||||
my ($strTimestampDbStart, $strArchiveStart) = $self->executeSqlRow(
|
||||
"select to_char(current_timestamp, 'YYYY-MM-DD HH24:MI:SS.US TZ'), lsn::text" .
|
||||
my ($strTimestampDbStart, $strArchiveStart, $strLsnStart) = $self->executeSqlRow(
|
||||
"select to_char(current_timestamp, 'YYYY-MM-DD HH24:MI:SS.US TZ'), pg_xlogfile_name(lsn), lsn::text" .
|
||||
" from pg_start_backup('${strLabel}'" .
|
||||
($bStartFast ? ', true' : $self->{strDbVersion} >= PG_VERSION_84 ? ', false' : '') .
|
||||
($self->{strDbVersion} >= PG_VERSION_96 ? ', false' : '') . ') as lsn');
|
||||
@ -684,6 +684,7 @@ sub backupStart
|
||||
(
|
||||
$strOperation,
|
||||
{name => 'strArchiveStart', value => $strArchiveStart},
|
||||
{name => 'strLsnStart', value => $strLsnStart},
|
||||
{name => 'strTimestampDbStart', value => $strTimestampDbStart}
|
||||
);
|
||||
}
|
||||
@ -702,9 +703,9 @@ sub backupStop
|
||||
&log(INFO, 'execute ' . ($self->{strDbVersion} >= PG_VERSION_96 ? 'non-' : '') .
|
||||
'exclusive pg_stop_backup() and wait for all WAL segments to archive');
|
||||
|
||||
my ($strTimestampDbStop, $strArchiveStop, $strLabel, $strTablespaceMap) =
|
||||
my ($strTimestampDbStop, $strArchiveStop, $strLsnStop, $strLabel, $strTablespaceMap) =
|
||||
$self->executeSqlRow(
|
||||
"select to_char(clock_timestamp(), 'YYYY-MM-DD HH24:MI:SS.US TZ'), lsn::text, " .
|
||||
"select to_char(clock_timestamp(), 'YYYY-MM-DD HH24:MI:SS.US TZ'), pg_xlogfile_name(lsn), lsn::text, " .
|
||||
($self->{strDbVersion} >= PG_VERSION_96 ? 'labelfile, spcmapfile' : "null as labelfile, null as spcmapfile") .
|
||||
' from pg_stop_backup(' .
|
||||
($self->{strDbVersion} >= PG_VERSION_96 ? 'false)' : ') as lsn'));
|
||||
@ -721,6 +722,7 @@ sub backupStop
|
||||
(
|
||||
$strOperation,
|
||||
{name => 'strArchiveStop', value => $strArchiveStop},
|
||||
{name => 'strLsnStop', value => $strLsnStop},
|
||||
{name => 'strTimestampDbStop', value => $strTimestampDbStop},
|
||||
{name => 'oFileHash', value => $oFileHash}
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user