mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2024-12-12 10:04:14 +02:00
Added error when archive_mode=always is configured.
This commit is contained in:
parent
7f0f8823df
commit
29102b2887
@ -5,7 +5,7 @@ __No Release Date Set__
|
||||
|
||||
* Fixed an issue where specifying `--no-archive-check` would throw a configuration error. _Reported by Jason O'Donnell_.
|
||||
|
||||
* Provisional support for PostgreSQL 9.5 including partial WAL segments. No support for `archive_mode = 'always'`.
|
||||
* Provisional support for PostgreSQL 9.5 including partial WAL segments. The `archive_mode = 'always'` setting is not yet supported.
|
||||
|
||||
## v0.89: Timeout Bug Fix and Restore Read-Only Repositories
|
||||
__Released December 24, 2015__
|
||||
|
@ -12,7 +12,7 @@
|
||||
<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>Provisional support for <postgres/> 9.5 including partial WAL segments. No support for <setting>archive_mode = 'always'</setting>.</text>
|
||||
<text>Provisional support for <postgres/> 9.5 including partial WAL segments. The <setting>archive_mode = 'always'</setting> setting is not yet supported.</text>
|
||||
</release-feature>
|
||||
</release-feature-bullet-list>
|
||||
</changelog-release>
|
||||
|
@ -396,7 +396,7 @@ sub get
|
||||
|
||||
# Get the wal segment filename
|
||||
my $strArchiveId = $self->getCheck($oFile);
|
||||
my $strArchiveFile = $self->walFileName($oFile, $strArchiveId, $strSourceArchive);
|
||||
my $strArchiveFile = $self->walFileName($oFile, $strArchiveId, $strSourceArchive, false);
|
||||
|
||||
# If there are no matching archive files then there are two possibilities:
|
||||
# 1) The end of the archive stream has been reached, this is normal and a 1 will be returned
|
||||
|
@ -944,7 +944,7 @@ sub process
|
||||
|
||||
foreach my $strArchive (@stryArchive)
|
||||
{
|
||||
my $strArchiveFile = $oArchive->walFileName($self->{oFile}, $strArchiveId, $strArchive, 600);
|
||||
my $strArchiveFile = $oArchive->walFileName($self->{oFile}, $strArchiveId, $strArchive, false, 600);
|
||||
|
||||
if (optionGet(OPTION_BACKUP_ARCHIVE_COPY))
|
||||
{
|
||||
|
@ -102,6 +102,8 @@ use constant ERROR_UNHANDLED_EXCEPTION => ERROR_MIN
|
||||
push @EXPORT, qw(ERROR_UNHANDLED_EXCEPTION);
|
||||
use constant ERROR_PROTOCOL_TIMEOUT => ERROR_MINIMUM + 41;
|
||||
push @EXPORT, qw(ERROR_PROTOCOL_TIMEOUT);
|
||||
use constant ERROR_FEATURE_NOT_SUPPORTED => ERROR_MINIMUM + 42;
|
||||
push @EXPORT, qw(ERROR_FEATURE_NOT_SUPPORTED);
|
||||
|
||||
use constant ERROR_INVALID_VALUE => ERROR_MAXIMUM - 1;
|
||||
push @EXPORT, qw(ERROR_INVALID_VALUE);
|
||||
|
@ -611,6 +611,14 @@ sub backupStart
|
||||
$bStartFast = false;
|
||||
}
|
||||
|
||||
# Error if archive_mode = always (support has not been added yet)
|
||||
my $strArchiveMode = trim($self->executeSql('show archive_mode'));
|
||||
|
||||
if ($strArchiveMode eq 'always')
|
||||
{
|
||||
confess &log(ERROR, "archive_mode=always not supported", ERROR_FEATURE_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
# Acquire the backup advisory lock to make sure that backups are not running from multiple backup servers against the same
|
||||
# database cluster. This lock helps make the stop-auto option safe.
|
||||
if (!$self->executeSqlOne('select pg_try_advisory_lock(' . DB_BACKUP_ADVISORY_LOCK . ')'))
|
||||
|
@ -286,12 +286,14 @@ sub BackRestTestBackup_ClusterStart
|
||||
my $iPort = shift;
|
||||
my $bHotStandby = shift;
|
||||
my $bArchive = shift;
|
||||
my $bArchiveAlways = shift;
|
||||
|
||||
# Set default
|
||||
$iPort = defined($iPort) ? $iPort : BackRestTestCommon_DbPortGet();
|
||||
$strPath = defined($strPath) ? $strPath : BackRestTestCommon_DbCommonPathGet();
|
||||
$bHotStandby = defined($bHotStandby) ? $bHotStandby : false;
|
||||
$bArchive = defined($bArchive) ? $bArchive : true;
|
||||
$bArchiveAlways = defined($bArchiveAlways) ? $bArchiveAlways : false;
|
||||
|
||||
# Make sure postgres is not running
|
||||
if (-e $strPath . '/postmaster.pid')
|
||||
@ -311,7 +313,14 @@ sub BackRestTestBackup_ClusterStart
|
||||
{
|
||||
if (BackRestTestCommon_DbVersion() >= '8.3')
|
||||
{
|
||||
$strCommand .= " -c archive_mode=on";
|
||||
if (BackRestTestCommon_DbVersion() >= '9.5' && $bArchiveAlways)
|
||||
{
|
||||
$strCommand .= " -c archive_mode=always";
|
||||
}
|
||||
else
|
||||
{
|
||||
$strCommand .= " -c archive_mode=on";
|
||||
}
|
||||
}
|
||||
|
||||
$strCommand .= " -c archive_command='${strArchive}'";
|
||||
|
@ -1455,6 +1455,25 @@ sub BackRestTestBackup_Test
|
||||
my $strTimeTarget = BackRestTestBackup_PgSelectOne("select to_char(current_timestamp, 'YYYY-MM-DD HH24:MI:SS.US TZ')");
|
||||
&log(INFO, " time target is ${strTimeTarget}");
|
||||
|
||||
# Incr backup - fail on archive_mode=always when version >= 9.5
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
if (BackRestTestCommon_DbVersion() >= 9.5)
|
||||
{
|
||||
$strType = BACKUP_TYPE_INCR;
|
||||
|
||||
$strComment = 'fail on archive_mode=always';
|
||||
|
||||
# Set archive_mode=always
|
||||
BackRestTestBackup_ClusterStop();
|
||||
BackRestTestBackup_ClusterStart(undef, undef, undef, undef, true);
|
||||
|
||||
BackRestTestBackup_Backup($strType, $strStanza, $strComment, {iExpectedExitStatus => ERROR_FEATURE_NOT_SUPPORTED});
|
||||
|
||||
# Reset the cluster to a normal state so the next test will work
|
||||
BackRestTestBackup_ClusterStop();
|
||||
BackRestTestBackup_ClusterStart();
|
||||
}
|
||||
|
||||
# Incr backup
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
$strType = BACKUP_TYPE_INCR;
|
||||
|
Loading…
Reference in New Issue
Block a user