pgbackrest.git / summary / log / commit / refs

commit    bc2bb040c5bf75cb56ec3fa7a00a993d33371a99
Author:   David Steele <david@pgmasters.net>
Date:     Mon Feb 13 14:57:10 2017 +0000

    Fixed an issue where an archive-push error would not be retried.
    
    It would instead return errors to PostgreSQL indefinitely (unless the .error file was manually deleted).
    
    Reported by Jens Wilke.


doc/xml/release.xml | 12 ++++++++++++ lib/pgBackRest/Archive/ArchivePush.pm | 14 +++++++++----- lib/pgBackRest/Version.pm | 2 +- libc/lib/pgBackRest/LibC.pm | 2 +- test/lib/pgBackRestTest/Archive/ArchivePushUnitTest.pm | 17 ++++++++++++++++- 5 files changed, 39 insertions(+), 8 deletions(-) diff --git a/doc/xml/release.xml b/doc/xml/release.xml index 009b36ccb..bfe85f050 100644 --- a/doc/xml/release.xml +++ b/doc/xml/release.xml @@ -149,6 +149,18 @@ <release-list> <release date="XXXX-XX-XX" version="1.14dev" title="UNDER DEVELOPMENT"> + <release-core-list> + <release-bug-list> + <release-item> + <release-item-contributor-list> + <release-item-ideator id="wilke.jens"/> + </release-item-contributor-list> + + <p>Fixed an issue where an archive-push error would not be retried and would instead return errors to <postgres/> indefinitely (unless the <file>.error</file> file was manually deleted).</p> + </release-item> + </release-bug-list> + </release-core-list> + <release-doc-list> <release-feature-list> <release-item> diff --git a/lib/pgBackRest/Archive/ArchivePush.pm b/lib/pgBackRest/Archive/ArchivePush.pm index 7ef115bbe..5d220c3fc 100644 --- a/lib/pgBackRest/Archive/ArchivePush.pm +++ b/lib/pgBackRest/Archive/ArchivePush.pm @@ -85,11 +85,12 @@ sub process # Loop to check for status files and launch async process my $bPushed = false; my $oWait = waitInit(optionGet(OPTION_ARCHIVE_TIMEOUT)); + $self->{bConfessOnError} = false; do { # Check WAL status - $bPushed = $self->walStatus($self->{strSpoolPath}, $strWalFile); + $bPushed = $self->walStatus($self->{strSpoolPath}, $strWalFile, $self->{bConfessOnError}); # If not found then launch async process if (!$bPushed) @@ -99,6 +100,8 @@ sub process $bClient = (new pgBackRest::Archive::ArchivePushAsync( $strWalPath, $self->{strSpoolPath}, $self->{strBackRestBin}))->process(); } + + $self->{bConfessOnError} = true; } while ($bClient && !$bPushed && waitMore($oWait)); @@ -168,12 +171,14 @@ sub walStatus $strOperation, $strSpoolPath, $strWalFile, + $bConfessOnError, ) = logDebugParam ( __PACKAGE__ . '->walStatus', \@_, {name => 'strSpoolPath'}, {name => 'strWalFile'}, + {name => 'bConfessOnError', default => true}, ); # Default result is false @@ -225,9 +230,11 @@ sub walStatus &log(WARN, $strMessage); } + + $bResult = true; } # Process error files - else + elsif ($bConfessOnError) { # Error files must have content if (@stryWalStatus == 0) @@ -235,11 +242,8 @@ sub walStatus confess &log(ASSERT, "$stryStatusFile[0] has no content"); } - # Confess the error confess &log(ERROR, $strMessage, $iCode); } - - $bResult = true; } # Return from function and log return values if any diff --git a/lib/pgBackRest/Version.pm b/lib/pgBackRest/Version.pm index 1872edbb4..9938d1f8a 100644 --- a/lib/pgBackRest/Version.pm +++ b/lib/pgBackRest/Version.pm @@ -35,7 +35,7 @@ use constant BACKREST_BIN => abs_path( # Defines the current version of the BackRest executable. The version number is used to track features but does not affect what # repositories or manifests can be read - that's the job of the format number. #----------------------------------------------------------------------------------------------------------------------------------- -use constant BACKREST_VERSION => '1.13'; +use constant BACKREST_VERSION => '1.14dev'; push @EXPORT, qw(BACKREST_VERSION); # Format Format Number diff --git a/libc/lib/pgBackRest/LibC.pm b/libc/lib/pgBackRest/LibC.pm index a896a848e..3576c56dc 100644 --- a/libc/lib/pgBackRest/LibC.pm +++ b/libc/lib/pgBackRest/LibC.pm @@ -11,7 +11,7 @@ use AutoLoader; our @ISA = qw(Exporter); # Library version (add .999 during development) -our $VERSION = '1.13'; +our $VERSION = '1.14.999'; sub libCVersion {return $VERSION}; diff --git a/test/lib/pgBackRestTest/Archive/ArchivePushUnitTest.pm b/test/lib/pgBackRestTest/Archive/ArchivePushUnitTest.pm index fa0c4762f..c0f7198c7 100644 --- a/test/lib/pgBackRestTest/Archive/ArchivePushUnitTest.pm +++ b/test/lib/pgBackRestTest/Archive/ArchivePushUnitTest.pm @@ -700,9 +700,24 @@ sub run $self->optionSetTest($oOption, OPTION_SPOOL_PATH, $self->{strRepoPath}); logDisable(); $self->configLoadExpect(dclone($oOption), CMD_ARCHIVE_PUSH); logEnable(); - # Write an OK file so the async process is not actually started + # Write an error file and verify that it doesn't error the first time around $strSegment = $self->walSegment($iWalTimeline, $iWalMajor, $iWalMinor++); filePathCreate($self->{strSpoolPath}, undef, undef, true); + fileStringWrite("$self->{strSpoolPath}/${strSegment}.error", ERROR_ARCHIVE_TIMEOUT . "\ntest error"); + + $self->testException( + sub {$oPush->process("$self->{strWalPath}/${strSegment}")}, ERROR_ARCHIVE_TIMEOUT, + "test error"); + + $self->testResult($oPush->{bConfessOnError}, true, "went through error loop"); + + $self->testResult( + sub {walSegmentFind($self->{oFile}, $self->{strArchiveId}, $strSegment)}, '[undef]', + "${strSegment} WAL not in archive"); + + #--------------------------------------------------------------------------------------------------------------------------- + # Write an OK file so the async process is not actually started + $strSegment = $self->walSegment($iWalTimeline, $iWalMajor, $iWalMinor++); fileStringWrite("$self->{strSpoolPath}/${strSegment}.ok"); $self->testResult( [parent: 12041f73e2a4]