1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-12 10:04:14 +02:00

Closed #150: Fixed an issue where a temp WAL file left over after a well-timed system crash could cause the next archive-push to fail.

This commit is contained in:
David Steele 2016-01-20 21:28:40 -05:00
parent 747346db67
commit 83b1a3cb44
5 changed files with 19 additions and 3 deletions

View File

@ -5,6 +5,8 @@ __No Release Date Set__
* Fixed an issue where specifying `--no-archive-check` would throw a configuration error. _Reported by Jason O'Donnell_.
* Fixed an issue where a temp WAL file left over after a well-timed system crash could cause the next `archive-push` to fail.
* The `retention-archive` option can now be be safely set to less than backup retention (`retention-full` or `retention-diff`) without also specifying `archive-copy=n`. The WAL required to make the backups that fall outside of archive retention consistent will be preserved in the archive. However, in this case PITR will still not be possible for the backups that fall outside of archive retention.
* Generate an error when `archive-check=y` but `archive_command` does not execute `pg_backrest`. _Contributed by Jason O'Donnell_.

View File

@ -11,6 +11,9 @@
<release-feature>
<text>Fixed an issue where specifying <setting>--no-archive-check</setting> would throw a configuration error. <i>Reported by Jason O'Donnell</i>.</text>
</release-feature>
<release-feature>
<text>Fixed an issue where a temp WAL file left over after a well-timed system crash could cause the next <cmd>archive-push</cmd> to fail.</text>
</release-feature>
<release-feature>
<text>The <setting>retention-archive</setting> option can now be be safely set to less than backup retention (<setting>retention-full</setting> or <setting>retention-diff</setting>) without also specifying <setting>archive-copy=n</setting>. The WAL required to make the backups that fall outside of archive retention consistent will be preserved in the archive. However, in this case PITR will still not be possible for the backups that fall outside of archive retention.</text>
</release-feature>

View File

@ -10,7 +10,7 @@ use Carp qw(confess);
use Exporter qw(import);
our @EXPORT = qw();
use Digest::SHA;
use Fcntl qw(:mode :flock O_RDONLY O_WRONLY O_CREAT O_EXCL);
use Fcntl qw(:mode :flock O_RDONLY O_WRONLY O_CREAT);
use File::Basename qw(dirname basename);
use File::Copy qw(cp);
use File::Path qw(make_path remove_tree);
@ -1700,7 +1700,7 @@ sub copy
if (!$bDestinationRemote)
{
my $iCreateFlag = O_WRONLY | O_CREAT | O_EXCL;
my $iCreateFlag = O_WRONLY | O_CREAT;
# Open the destination temp file
if (!sysopen($hDestinationFile, $strDestinationTmpOp, $iCreateFlag))

View File

@ -9,7 +9,7 @@ use Carp qw(confess);
use Exporter qw(import);
our @EXPORT = qw();
use Fcntl qw(:mode :flock O_RDONLY O_WRONLY O_CREAT O_EXCL O_TRUNC);
use Fcntl qw(:mode :flock O_RDONLY O_WRONLY O_CREAT O_TRUNC);
use File::Basename qw(dirname);
use IO::Handle;

View File

@ -247,6 +247,17 @@ sub BackRestTestBackup_Test
', archive ' .sprintf('%02x', $iArchive) .
" - ${strArchiveFile}");
if ($iBackup == 1 && $iArchive == 2)
{
# Should succeed when temp file already exists
&log(INFO, ' test archive when tmp file exists');
($strArchiveFile, $strSourceFile) = archiveGenerate($oFile, $strXlogPath, 2, $iArchiveNo);
executeTest('touch ' . BackRestTestCommon_RepoPathGet() . "/archive/${strStanza}/9.3-1/" .
substr($strArchiveFile, 0, 16) . "/${strArchiveFile}.tmp",
{bRemote => $bRemote});
}
executeTest($strCommand . " ${strSourceFile}", {oLogTest => $oLogTest});
if ($iArchive == $iBackup)