1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-03-05 15:05:48 +02:00

Working on archive log copy

This commit is contained in:
David Steele 2014-01-11 02:16:14 -05:00
parent 387439ac8e
commit 3ed83e78f2

View File

@ -683,10 +683,13 @@ sub archive_list_get
my $iStopMajor = hex substr($strArchiveStop, 8, 8); my $iStopMajor = hex substr($strArchiveStop, 8, 8);
my $iStopMinor = hex substr($strArchiveStop, 16, 8); my $iStopMinor = hex substr($strArchiveStop, 16, 8);
while (!($iStartMajor == $iStopMajor && $iStartMinor == $iStopMinor)) do
{ {
if ($iArchiveIdx != 0) $stryArchive[$iArchiveIdx] = uc(sprintf("${strTimeline}%08x%08x", $iStartMajor, $iStartMinor));
if ($strArchiveStart ne $strArchiveStop)
{ {
$iArchiveIdx += 1;
$iStartMinor += 1; $iStartMinor += 1;
if ($iStartMinor == 256) if ($iStartMinor == 256)
@ -695,10 +698,8 @@ sub archive_list_get
$iStartMinor = 0; $iStartMinor = 0;
} }
} }
$stryArchive[$iArchiveIdx] = uc(sprintf("${strTimeline}%08x%08x", $iStartMajor, $iStartMinor));
$iArchiveIdx += 1;
} }
while !($iStartMajor == $iStopMajor && $iStartMinor == $iStopMinor);
return @stryArchive; return @stryArchive;
} }
@ -974,6 +975,8 @@ if ($strOperation eq "backup")
backup($strCommandChecksum, $strCommandCompress, $strCommandDecompress, $strCommandCopy, $strClusterDataPath, backup($strCommandChecksum, $strCommandCompress, $strCommandDecompress, $strCommandCopy, $strClusterDataPath,
$strBackupTmpPath, \%oBackupManifest); $strBackupTmpPath, \%oBackupManifest);
# sleep(30);
# Stop backup # Stop backup
my $strArchiveStop = trim(execute($strCommandPsql . my $strArchiveStop = trim(execute($strCommandPsql .
" -c \"set client_min_messages = 'warning'; copy (select pg_xlogfile_name(xlog) from pg_stop_backup() as xlog) to stdout\" postgres")); " -c \"set client_min_messages = 'warning'; copy (select pg_xlogfile_name(xlog) from pg_stop_backup() as xlog) to stdout\" postgres"));
@ -1002,6 +1005,14 @@ if ($strOperation eq "backup")
} }
# Fetch the archive logs and put them in pg_xlog # Fetch the archive logs and put them in pg_xlog
my @stryArchive = archive_list_get($strArchiveStart, $strArchiveStop);
foreach my $strArchive (@stryArchive)
{
print "archive: $strArchive\n";
# need to put the copy logic here
}
# Need a function for create an array of archive log names from strArchiveBegin and strArchiveEnd # Need a function for create an array of archive log names from strArchiveBegin and strArchiveEnd
# !!! do it # !!! do it