1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-06-14 23:44:58 +02:00

Add asynchronous, parallel archive-get.

This feature maintains a queue of WAL segments to help reduce latency when PostgreSQL requests a WAL segment with restore_command.
This commit is contained in:
David Steele
2018-04-30 17:27:39 -04:00
parent c48b0a2a1e
commit 54dd6f3ed4
45 changed files with 1354 additions and 216 deletions

View File

@ -159,12 +159,12 @@ sub run
# Test that the WAL was pushed
$self->archiveCheck($strSourceFile, $strArchiveChecksum, false);
# Remove WAL
storageTest()->remove("${strWalPath}/${strSourceFile}", {bIgnoreMissing => false});
#---------------------------------------------------------------------------------------------------------------------------
&log(INFO, ' get first WAL');
# Remove WAL so it can be recovered
storageTest()->remove("${strWalPath}/${strSourceFile}", {bIgnoreMissing => false});
$oHostDbMaster->executeSimple(
$strCommandGet . " ${strLogDebug} ${strSourceFile} ${strWalPath}/RECOVERYXLOG",
{oLogTest => $self->expect()});
@ -325,6 +325,8 @@ sub run
$oHostDbMaster->start({strStanza => $oHostDbMaster->stanza()});
storageTest->remove("${strWalPath}/RECOVERYXLOG", {bIgnoreMissing => false});
#---------------------------------------------------------------------------------------------------------------------------
&log(INFO, ' WAL duplicate ok');
@ -339,14 +341,15 @@ sub run
$strCommandPush . " ${strWalPath}/${strSourceFile}",
{iExpectedExitStatus => ERROR_ARCHIVE_DUPLICATE, oLogTest => $self->expect()});
#---------------------------------------------------------------------------------------------------------------------------
&log(INFO, ' get second WAL');
# Remove WAL so it can be recovered
# Remove WAL
storageTest()->remove("${strWalPath}/${strSourceFile}", {bIgnoreMissing => false});
#---------------------------------------------------------------------------------------------------------------------------
&log(INFO, " get second WAL (${strSourceFile})");
$oHostDbMaster->executeSimple(
$strCommandGet . ($bRemote ? ' --cmd-ssh=/usr/bin/ssh' : '') . " ${strSourceFile} ${strWalPath}/RECOVERYXLOG",
$strCommandGet . ($bRemote ? ' --cmd-ssh=/usr/bin/ssh' : '') .
" --archive-async --archive-timeout=5 ${strSourceFile} ${strWalPath}/RECOVERYXLOG",
{oLogTest => $self->expect()});
# Check that the destination file exists