mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-06-02 22:57:34 +02:00
Closed #122: 9.5 Integration
The archive_mode = always setting is not included but is covered by issue #125.
This commit is contained in:
parent
c7502f341b
commit
a0a3d1e97e
@ -7,7 +7,9 @@ __No Release Date Set__
|
||||
|
||||
* Generate an error when `archive-check=y` but `archive_command` does not execute `pg_backrest`. _Contributed by Jason O'Donnell_
|
||||
|
||||
* Provisional support for PostgreSQL 9.5 including partial WAL segments. The `archive_mode = 'always'` setting is not yet supported.
|
||||
* Support for PostgreSQL 9.5 partial WAL segments and `recovery_target_action` setting. The `archive_mode = 'always'` setting is not yet supported.
|
||||
|
||||
* Support for `recovery_target = 'immediate'` recovery setting introduced in PostgreSQL 9.4.
|
||||
|
||||
## v0.89: Timeout Bug Fix and Restore Read-Only Repositories
|
||||
__Released December 24, 2015__
|
||||
|
@ -15,7 +15,10 @@
|
||||
<text>Generate an error when <setting>archive-check=y</setting> but <setting>archive_command</setting> does not execute <file>pg_backrest</file>. <i>Contributed by Jason O'Donnell</i></text>
|
||||
</release-feature>
|
||||
<release-feature>
|
||||
<text>Provisional support for <postgres/> 9.5 including partial WAL segments. The <setting>archive_mode = 'always'</setting> setting is not yet supported.</text>
|
||||
<text>Support for <postgres/> 9.5 partial WAL segments and <setting>recovery_target_action</setting> setting. The <setting>archive_mode = 'always'</setting> setting is not yet supported.</text>
|
||||
</release-feature>
|
||||
<release-feature>
|
||||
<text>Support for <setting>recovery_target = 'immediate'</setting> recovery setting introduced in <postgres/> 9.4.</text>
|
||||
</release-feature>
|
||||
</release-feature-bullet-list>
|
||||
</changelog-release>
|
||||
|
@ -610,6 +610,7 @@
|
||||
<text>The following recovery types are supported:
|
||||
<ul>
|
||||
<li><id>default</id> - recover to the end of the archive stream.</li>
|
||||
<li><id>immediate</id> - recover only until the database becomes consistent. This option is only supported on <postgres/> >= 9.4.</li>
|
||||
<li><id>name</id> - recover the restore point specified in <br-option>--target</br-option>.</li>
|
||||
<li><id>xid</id> - recover to the transaction id specified in <br-option>--target</br-option>.</li>
|
||||
<li><id>time</id> - recover to the time specified in <br-option>--target</br-option>.</li>
|
||||
@ -633,16 +634,21 @@
|
||||
|
||||
<text>Defines whether recovery to the target would be exclusive (the default is inclusive) and is only valid when <br-option>--type</br-option> is <id>time</id> or <id>xid</id>. For example, using <br-option>--target-exclusive</br-option> would exclude the contents of transaction <id>1007</id> when <br-option>--type=xid</br-option> and <br-option>--target=1007</br-option>. See the <setting>recovery_target_inclusive</setting> option in the <postgres/> docs for more information.</text>
|
||||
|
||||
<example>y</example>
|
||||
<example>n</example>
|
||||
</option>
|
||||
|
||||
<!-- OPERATION - RESTORE COMMAND - TARGET-RESUME OPTION -->
|
||||
<option id="target-resume" name="Target Resume">
|
||||
<summary>Resume when recovery target is reached.</summary>
|
||||
<option id="target-action" name="Target Action">
|
||||
<summary>Action to take when recovery target is reached.</summary>
|
||||
|
||||
<text>Specifies whether recovery should resume when the recovery target is reached. See <setting>pause_at_recovery_target</setting> in the <postgres/> docs for more information.</text>
|
||||
<text>The following actions are supported:
|
||||
<ul>
|
||||
<li><id>pause</id> - pause when recovery target is reached.</li>
|
||||
<li><id>promote</id> - promote and switch timeline when recovery target is reached.</li>
|
||||
<li><id>shutdown</id> - shutdown server when recovery target is reached.</li>
|
||||
</ul>This option is only supported on <postgres/> >= 9.5.</text>
|
||||
|
||||
<example>y</example>
|
||||
<example>promote</example>
|
||||
</option>
|
||||
|
||||
<!-- OPERATION - RESTORE COMMAND - TARGET-TIMELINE OPTION -->
|
||||
|
@ -98,26 +98,38 @@ use constant INFO_OUTPUT_JSON => 'json';
|
||||
####################################################################################################################################
|
||||
# SOURCE Constants
|
||||
####################################################################################################################################
|
||||
use constant SOURCE_CONFIG => 'config';
|
||||
use constant SOURCE_PARAM => 'param';
|
||||
use constant SOURCE_DEFAULT => 'default';
|
||||
use constant SOURCE_CONFIG => 'config';
|
||||
use constant SOURCE_PARAM => 'param';
|
||||
use constant SOURCE_DEFAULT => 'default';
|
||||
|
||||
####################################################################################################################################
|
||||
# RECOVERY Type Constants
|
||||
####################################################################################################################################
|
||||
use constant RECOVERY_TYPE_NAME => 'name';
|
||||
use constant RECOVERY_TYPE_NAME => 'name';
|
||||
push @EXPORT, qw(RECOVERY_TYPE_NAME);
|
||||
use constant RECOVERY_TYPE_TIME => 'time';
|
||||
use constant RECOVERY_TYPE_TIME => 'time';
|
||||
push @EXPORT, qw(RECOVERY_TYPE_TIME);
|
||||
use constant RECOVERY_TYPE_XID => 'xid';
|
||||
use constant RECOVERY_TYPE_XID => 'xid';
|
||||
push @EXPORT, qw(RECOVERY_TYPE_XID);
|
||||
use constant RECOVERY_TYPE_PRESERVE => 'preserve';
|
||||
use constant RECOVERY_TYPE_PRESERVE => 'preserve';
|
||||
push @EXPORT, qw(RECOVERY_TYPE_PRESERVE);
|
||||
use constant RECOVERY_TYPE_NONE => 'none';
|
||||
use constant RECOVERY_TYPE_NONE => 'none';
|
||||
push @EXPORT, qw(RECOVERY_TYPE_NONE);
|
||||
use constant RECOVERY_TYPE_DEFAULT => 'default';
|
||||
use constant RECOVERY_TYPE_IMMEDIATE => 'immediate';
|
||||
push @EXPORT, qw(RECOVERY_TYPE_IMMEDIATE);
|
||||
use constant RECOVERY_TYPE_DEFAULT => 'default';
|
||||
push @EXPORT, qw(RECOVERY_TYPE_DEFAULT);
|
||||
|
||||
####################################################################################################################################
|
||||
# RECOVERY Action Constants
|
||||
####################################################################################################################################
|
||||
use constant RECOVERY_ACTION_PAUSE => 'pause';
|
||||
push @EXPORT, qw(RECOVERY_ACTION_PAUSE);
|
||||
use constant RECOVERY_ACTION_PROMOTE => 'promote';
|
||||
push @EXPORT, qw(RECOVERY_ACTION_PROMOTE);
|
||||
use constant RECOVERY_ACTION_SHUTDOWN => 'shutdown';
|
||||
push @EXPORT, qw(RECOVERY_ACTION_SHUTDOWN);
|
||||
|
||||
####################################################################################################################################
|
||||
# Option Rules
|
||||
####################################################################################################################################
|
||||
@ -153,15 +165,15 @@ use constant OPTION_RULE_TYPE => 'type';
|
||||
####################################################################################################################################
|
||||
# Option Types
|
||||
####################################################################################################################################
|
||||
use constant OPTION_TYPE_BOOLEAN => 'boolean';
|
||||
use constant OPTION_TYPE_BOOLEAN => 'boolean';
|
||||
push @EXPORT, qw(OPTION_TYPE_BOOLEAN);
|
||||
use constant OPTION_TYPE_FLOAT => 'float';
|
||||
use constant OPTION_TYPE_FLOAT => 'float';
|
||||
push @EXPORT, qw(OPTION_TYPE_FLOAT);
|
||||
use constant OPTION_TYPE_HASH => 'hash';
|
||||
use constant OPTION_TYPE_HASH => 'hash';
|
||||
push @EXPORT, qw(OPTION_TYPE_HASH);
|
||||
use constant OPTION_TYPE_INTEGER => 'integer';
|
||||
use constant OPTION_TYPE_INTEGER => 'integer';
|
||||
push @EXPORT, qw(OPTION_TYPE_INTEGER);
|
||||
use constant OPTION_TYPE_STRING => 'string';
|
||||
use constant OPTION_TYPE_STRING => 'string';
|
||||
push @EXPORT, qw(OPTION_TYPE_STRING);
|
||||
|
||||
####################################################################################################################################
|
||||
@ -210,8 +222,8 @@ use constant OPTION_TARGET => 'target';
|
||||
push @EXPORT, qw(OPTION_TARGET);
|
||||
use constant OPTION_TARGET_EXCLUSIVE => 'target-exclusive';
|
||||
push @EXPORT, qw(OPTION_TARGET_EXCLUSIVE);
|
||||
use constant OPTION_TARGET_RESUME => 'target-resume';
|
||||
push @EXPORT, qw(OPTION_TARGET_RESUME);
|
||||
use constant OPTION_TARGET_ACTION => 'target-action';
|
||||
push @EXPORT, qw(OPTION_TARGET_ACTION);
|
||||
use constant OPTION_TARGET_TIMELINE => 'target-timeline';
|
||||
push @EXPORT, qw(OPTION_TARGET_TIMELINE);
|
||||
use constant OPTION_TYPE => 'type';
|
||||
@ -361,8 +373,8 @@ use constant OPTION_DEFAULT_RESTORE_SET => 'latest';
|
||||
push @EXPORT, qw(OPTION_DEFAULT_RESTORE_SET);
|
||||
use constant OPTION_DEFAULT_RESTORE_TARGET_EXCLUSIVE => false;
|
||||
push @EXPORT, qw(OPTION_DEFAULT_RESTORE_TARGET_EXCLUSIVE);
|
||||
use constant OPTION_DEFAULT_RESTORE_TARGET_RESUME => false;
|
||||
push @EXPORT, qw(OPTION_DEFAULT_RESTORE_TARGET_RESUME);
|
||||
use constant OPTION_DEFAULT_RESTORE_TARGET_ACTION => RECOVERY_ACTION_PAUSE;
|
||||
push @EXPORT, qw(OPTION_DEFAULT_RESTORE_TARGET_ACTION);
|
||||
use constant OPTION_DEFAULT_RESTORE_TYPE => RECOVERY_TYPE_DEFAULT;
|
||||
push @EXPORT, qw(OPTION_DEFAULT_RESTORE_TYPE);
|
||||
use constant OPTION_DEFAULT_LOCK => true;
|
||||
@ -670,14 +682,14 @@ my %oOptionRule =
|
||||
}
|
||||
},
|
||||
|
||||
&OPTION_TARGET_RESUME =>
|
||||
&OPTION_TARGET_ACTION =>
|
||||
{
|
||||
&OPTION_RULE_TYPE => OPTION_TYPE_BOOLEAN,
|
||||
&OPTION_RULE_TYPE => OPTION_TYPE_STRING,
|
||||
&OPTION_RULE_COMMAND =>
|
||||
{
|
||||
&CMD_RESTORE =>
|
||||
{
|
||||
&OPTION_RULE_DEFAULT => OPTION_DEFAULT_RESTORE_TARGET_RESUME,
|
||||
&OPTION_RULE_DEFAULT => OPTION_DEFAULT_RESTORE_TARGET_ACTION,
|
||||
&OPTION_RULE_DEPEND =>
|
||||
{
|
||||
&OPTION_RULE_DEPEND_OPTION => OPTION_TYPE,
|
||||
@ -736,12 +748,13 @@ my %oOptionRule =
|
||||
&OPTION_RULE_DEFAULT => OPTION_DEFAULT_RESTORE_TYPE,
|
||||
&OPTION_RULE_ALLOW_LIST =>
|
||||
{
|
||||
&RECOVERY_TYPE_NAME => true,
|
||||
&RECOVERY_TYPE_TIME => true,
|
||||
&RECOVERY_TYPE_XID => true,
|
||||
&RECOVERY_TYPE_PRESERVE => true,
|
||||
&RECOVERY_TYPE_NONE => true,
|
||||
&RECOVERY_TYPE_DEFAULT => true
|
||||
&RECOVERY_TYPE_NAME => true,
|
||||
&RECOVERY_TYPE_TIME => true,
|
||||
&RECOVERY_TYPE_XID => true,
|
||||
&RECOVERY_TYPE_PRESERVE => true,
|
||||
&RECOVERY_TYPE_NONE => true,
|
||||
&RECOVERY_TYPE_IMMEDIATE => true,
|
||||
&RECOVERY_TYPE_DEFAULT => true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -933,6 +933,22 @@ my $oConfigHelpData =
|
||||
"Defines the recovery target when --type is name, xid, or time."
|
||||
},
|
||||
|
||||
# TARGET-ACTION Option Help
|
||||
#-------------------------------------------------------------------------------------------------------------------
|
||||
'target-action' =>
|
||||
{
|
||||
summary =>
|
||||
"Action to take when recovery target is reached.",
|
||||
description =>
|
||||
"The following actions are supported:\n" .
|
||||
"\n" .
|
||||
"* pause - pause when recovery target is reached.\n" .
|
||||
"* promote - promote and switch timeline when recovery target is reached.\n" .
|
||||
"* shutdown - shutdown server when recovery target is reached.\n" .
|
||||
"\n" .
|
||||
"This option is only supported on PostgreSQL >= 9.5."
|
||||
},
|
||||
|
||||
# TARGET-EXCLUSIVE Option Help
|
||||
#-------------------------------------------------------------------------------------------------------------------
|
||||
'target-exclusive' =>
|
||||
@ -946,17 +962,6 @@ my $oConfigHelpData =
|
||||
"the PostgreSQL docs for more information."
|
||||
},
|
||||
|
||||
# TARGET-RESUME Option Help
|
||||
#-------------------------------------------------------------------------------------------------------------------
|
||||
'target-resume' =>
|
||||
{
|
||||
summary =>
|
||||
"Resume when recovery target is reached.",
|
||||
description =>
|
||||
"Specifies whether recovery should resume when the recovery target is reached. See " .
|
||||
"pause_at_recovery_target in the PostgreSQL docs for more information."
|
||||
},
|
||||
|
||||
# TARGET-TIMELINE Option Help
|
||||
#-------------------------------------------------------------------------------------------------------------------
|
||||
'target-timeline' =>
|
||||
@ -980,6 +985,8 @@ my $oConfigHelpData =
|
||||
"The following recovery types are supported:\n" .
|
||||
"\n" .
|
||||
"* default - recover to the end of the archive stream.\n" .
|
||||
"* immediate - recover only until the database becomes consistent. This option is only supported on " .
|
||||
"PostgreSQL >= 9.4.\n" .
|
||||
"* name - recover the restore point specified in --target.\n" .
|
||||
"* xid - recover to the transaction id specified in --target.\n" .
|
||||
"* time - recover to the time specified in --target.\n" .
|
||||
|
@ -577,6 +577,7 @@ sub build
|
||||
sub recovery
|
||||
{
|
||||
my $self = shift; # Class hash
|
||||
my $fDbVersion = shift; # Version to restore
|
||||
|
||||
# Assign function parameters, defaults, and log debug info
|
||||
my ($strOperation) = logDebugParam (OP_RESTORE_RECOVERY);
|
||||
@ -634,8 +635,13 @@ sub recovery
|
||||
$strRecovery .= "restore_command = '" . commandWrite(CMD_ARCHIVE_GET) . " %f \"%p\"'\n";
|
||||
}
|
||||
|
||||
# If RECOVERY_TYPE_DEFAULT do not write target options
|
||||
if (!optionTest(OPTION_TYPE, RECOVERY_TYPE_DEFAULT))
|
||||
# If type is RECOVERY_TYPE_IMMEDIATE
|
||||
if (optionTest(OPTION_TYPE, RECOVERY_TYPE_IMMEDIATE))
|
||||
{
|
||||
$strRecovery .= "recovery_target = '" . RECOVERY_TYPE_IMMEDIATE . "'\n";
|
||||
}
|
||||
# If type is not RECOVERY_TYPE_DEFAULT write target options
|
||||
elsif (!optionTest(OPTION_TYPE, RECOVERY_TYPE_DEFAULT))
|
||||
{
|
||||
# Write the recovery target
|
||||
$strRecovery .= "recovery_target_" . optionGet(OPTION_TYPE) . " = '" . optionGet(OPTION_TARGET) . "'\n";
|
||||
@ -648,9 +654,25 @@ sub recovery
|
||||
}
|
||||
|
||||
# Write pause_at_recovery_target
|
||||
if (optionGet(OPTION_TARGET_RESUME, false))
|
||||
if (optionTest(OPTION_TARGET_ACTION))
|
||||
{
|
||||
$strRecovery .= "pause_at_recovery_target = 'false'\n";
|
||||
my $strTargetAction = optionGet(OPTION_TARGET_ACTION);
|
||||
|
||||
if ($strTargetAction ne OPTION_DEFAULT_RESTORE_TARGET_ACTION)
|
||||
{
|
||||
if ($fDbVersion >= 9.5)
|
||||
{
|
||||
$strRecovery .= "recovery_target_action = '${strTargetAction}'\n";
|
||||
}
|
||||
elsif ($fDbVersion >= 9.1)
|
||||
{
|
||||
$strRecovery .= "pause_at_recovery_target = 'false'\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
confess &log(ERROR, OPTION_TARGET_ACTION . ' option is only available in PostgreSQL >= 9.1')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Write recovery_target_timeline
|
||||
@ -866,7 +888,7 @@ sub process
|
||||
}
|
||||
|
||||
# Create recovery.conf file
|
||||
$self->recovery();
|
||||
$self->recovery($oManifest->get(MANIFEST_SECTION_BACKUP_DB, MANIFEST_KEY_DB_VERSION));
|
||||
|
||||
# Copy pg_control last
|
||||
&log(INFO, 'restore ' . FILE_PG_CONTROL . ' (copied last to ensure aborted restores cannot be started)');
|
||||
|
@ -1295,7 +1295,7 @@ sub BackRestTestBackup_Restore
|
||||
my $strType = shift;
|
||||
my $strTarget = shift;
|
||||
my $bTargetExclusive = shift;
|
||||
my $bTargetResume = shift;
|
||||
my $strTargetAction = shift;
|
||||
my $strTargetTimeline = shift;
|
||||
my $oRecoveryHashRef = shift;
|
||||
my $strComment = shift;
|
||||
@ -1317,7 +1317,8 @@ sub BackRestTestBackup_Restore
|
||||
($strTarget ? ", target '${strTarget}'" : '') .
|
||||
($strTargetTimeline ? ", timeline '${strTargetTimeline}'" : '') .
|
||||
(defined($bTargetExclusive) && $bTargetExclusive ? ', exclusive' : '') .
|
||||
(defined($bTargetResume) && $bTargetResume ? ', resume' : '') .
|
||||
(defined($strTargetAction) && $strTargetAction ne OPTION_DEFAULT_RESTORE_TARGET_ACTION
|
||||
? ', ' . OPTION_TARGET_ACTION . "=${strTargetAction}" : '') .
|
||||
(defined($oRemapHashRef) ? ', remap' : '') .
|
||||
(defined($iExpectedExitStatus) ? ", expect exit ${iExpectedExitStatus}" : '') .
|
||||
(defined($strComment) ? " (${strComment})" : '');
|
||||
@ -1367,7 +1368,8 @@ sub BackRestTestBackup_Restore
|
||||
(defined($strTarget) ? " --target=\"${strTarget}\"" : '') .
|
||||
(defined($strTargetTimeline) ? " --target-timeline=\"${strTargetTimeline}\"" : '') .
|
||||
(defined($bTargetExclusive) && $bTargetExclusive ? " --target-exclusive" : '') .
|
||||
(defined($bTargetResume) && $bTargetResume ? " --target-resume" : '') .
|
||||
(defined($strTargetAction) && $strTargetAction ne OPTION_DEFAULT_RESTORE_TARGET_ACTION
|
||||
? ' --' . OPTION_TARGET_ACTION . "=${strTargetAction}" : '') .
|
||||
" --stanza=${strStanza} restore",
|
||||
{iExpectedExitStatus => $iExpectedExitStatus, strComment => $strComment, oLogTest => $oBackupLogTest});
|
||||
|
||||
|
@ -1374,7 +1374,6 @@ sub BackRestTestBackup_Test
|
||||
BackRestTestBackup_Init($bRemote, $oFile, false, undef, $iThreadMax);
|
||||
|
||||
# Static backup parameters
|
||||
# my $bSynthetic = false;
|
||||
my $fTestDelay = 1;
|
||||
|
||||
# Variable backup parameters
|
||||
@ -1383,10 +1382,9 @@ sub BackRestTestBackup_Test
|
||||
my $strType = undef;
|
||||
my $strTarget = undef;
|
||||
my $bTargetExclusive = false;
|
||||
my $bTargetResume = false;
|
||||
my $strTargetAction;
|
||||
my $strTargetTimeline = undef;
|
||||
my $oRecoveryHashRef = undef;
|
||||
# my $strTestPoint = undef;
|
||||
my $strComment = undef;
|
||||
my $iExpectedExitStatus = undef;
|
||||
|
||||
@ -1402,7 +1400,7 @@ sub BackRestTestBackup_Test
|
||||
# Test invalid archive command
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
$strType = BACKUP_TYPE_FULL;
|
||||
$strComment = 'archive_command invalid';
|
||||
$strComment = 'fail on invalid archive_command';
|
||||
|
||||
# Check archive_command_not_set error
|
||||
BackRestTestBackup_ClusterStop();
|
||||
@ -1552,7 +1550,7 @@ sub BackRestTestBackup_Test
|
||||
$strType = RECOVERY_TYPE_DEFAULT;
|
||||
$strTarget = undef;
|
||||
$bTargetExclusive = undef;
|
||||
$bTargetResume = undef;
|
||||
$strTargetAction = undef;
|
||||
$strTargetTimeline = undef;
|
||||
$oRecoveryHashRef = undef;
|
||||
$strComment = undef;
|
||||
@ -1565,7 +1563,7 @@ sub BackRestTestBackup_Test
|
||||
$iExpectedExitStatus = ERROR_POSTMASTER_RUNNING;
|
||||
|
||||
BackRestTestBackup_Restore($oFile, 'latest', $strStanza, $bRemote, undef, undef, $bDelta, $bForce,
|
||||
$strType, $strTarget, $bTargetExclusive, $bTargetResume, $strTargetTimeline,
|
||||
$strType, $strTarget, $bTargetExclusive, $strTargetAction, $strTargetTimeline,
|
||||
$oRecoveryHashRef, $strComment, $iExpectedExitStatus);
|
||||
|
||||
BackRestTestBackup_ClusterStop();
|
||||
@ -1575,7 +1573,7 @@ sub BackRestTestBackup_Test
|
||||
$iExpectedExitStatus = ERROR_RESTORE_PATH_NOT_EMPTY;
|
||||
|
||||
BackRestTestBackup_Restore($oFile, 'latest', $strStanza, $bRemote, undef, undef, $bDelta, $bForce,
|
||||
$strType, $strTarget, $bTargetExclusive, $bTargetResume, $strTargetTimeline,
|
||||
$strType, $strTarget, $bTargetExclusive, $strTargetAction, $strTargetTimeline,
|
||||
$oRecoveryHashRef, $strComment, $iExpectedExitStatus);
|
||||
|
||||
# Drop and recreate db path
|
||||
@ -1589,12 +1587,39 @@ sub BackRestTestBackup_Test
|
||||
$iExpectedExitStatus = undef;
|
||||
|
||||
BackRestTestBackup_Restore($oFile, 'latest', $strStanza, $bRemote, undef, undef, $bDelta, $bForce,
|
||||
$strType, $strTarget, $bTargetExclusive, $bTargetResume, $strTargetTimeline,
|
||||
$strType, $strTarget, $bTargetExclusive, $strTargetAction, $strTargetTimeline,
|
||||
$oRecoveryHashRef, $strComment, $iExpectedExitStatus);
|
||||
|
||||
BackRestTestBackup_ClusterStart();
|
||||
BackRestTestBackup_PgSelectOneTest('select message from test', $strNameMessage);
|
||||
|
||||
# Restore (restore type = immediate, inclusive)
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
if (BackRestTestCommon_DbVersion() >= 9.4)
|
||||
{
|
||||
$bDelta = false;
|
||||
$bForce = true;
|
||||
$strType = RECOVERY_TYPE_IMMEDIATE;
|
||||
$strTarget = undef;
|
||||
$bTargetExclusive = undef;
|
||||
$strTargetAction = undef;
|
||||
$strTargetTimeline = undef;
|
||||
$oRecoveryHashRef = undef;
|
||||
$strComment = undef;
|
||||
$iExpectedExitStatus = undef;
|
||||
|
||||
&log(INFO, " testing recovery type = ${strType}");
|
||||
|
||||
BackRestTestBackup_ClusterStop();
|
||||
|
||||
BackRestTestBackup_Restore($oFile, $strFullBackup, $strStanza, $bRemote, undef, undef, $bDelta, $bForce,
|
||||
$strType, $strTarget, $bTargetExclusive, $strTargetAction, $strTargetTimeline,
|
||||
$oRecoveryHashRef, $strComment, $iExpectedExitStatus, undef);
|
||||
|
||||
BackRestTestBackup_ClusterStart();
|
||||
BackRestTestBackup_PgSelectOneTest('select message from test', $strFullMessage);
|
||||
}
|
||||
|
||||
# Restore (restore type = xid, inclusive)
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
$bDelta = false;
|
||||
@ -1602,7 +1627,7 @@ sub BackRestTestBackup_Test
|
||||
$strType = RECOVERY_TYPE_XID;
|
||||
$strTarget = $strXidTarget;
|
||||
$bTargetExclusive = undef;
|
||||
$bTargetResume = BackRestTestCommon_DbVersion() >= 9.1 && BackRestTestCommon_DbVersion() < 9.5 ? true : undef;
|
||||
$strTargetAction = BackRestTestCommon_DbVersion() >= 9.1 ? 'promote' : undef;
|
||||
$strTargetTimeline = undef;
|
||||
$oRecoveryHashRef = undef;
|
||||
$strComment = undef;
|
||||
@ -1613,7 +1638,7 @@ sub BackRestTestBackup_Test
|
||||
BackRestTestBackup_ClusterStop();
|
||||
|
||||
BackRestTestBackup_Restore($oFile, $strIncrBackup, $strStanza, $bRemote, undef, undef, $bDelta, $bForce,
|
||||
$strType, $strTarget, $bTargetExclusive, $bTargetResume, $strTargetTimeline,
|
||||
$strType, $strTarget, $bTargetExclusive, $strTargetAction, $strTargetTimeline,
|
||||
$oRecoveryHashRef, $strComment, $iExpectedExitStatus, '--no-tablespace', false);
|
||||
|
||||
# Save recovery file to test so we can use it in the next test
|
||||
@ -1632,7 +1657,7 @@ sub BackRestTestBackup_Test
|
||||
$strType = RECOVERY_TYPE_PRESERVE;
|
||||
$strTarget = undef;
|
||||
$bTargetExclusive = undef;
|
||||
$bTargetResume = undef;
|
||||
$strTargetAction = undef;
|
||||
$strTargetTimeline = undef;
|
||||
$oRecoveryHashRef = undef;
|
||||
$strComment = undef;
|
||||
@ -1647,7 +1672,7 @@ sub BackRestTestBackup_Test
|
||||
PATH_ABSOLUTE, BackRestTestCommon_DbCommonPathGet() . '/recovery.conf');
|
||||
|
||||
BackRestTestBackup_Restore($oFile, 'latest', $strStanza, $bRemote, undef, undef, $bDelta, $bForce,
|
||||
$strType, $strTarget, $bTargetExclusive, $bTargetResume, $strTargetTimeline,
|
||||
$strType, $strTarget, $bTargetExclusive, $strTargetAction, $strTargetTimeline,
|
||||
$oRecoveryHashRef, $strComment, $iExpectedExitStatus);
|
||||
|
||||
BackRestTestBackup_ClusterStart();
|
||||
@ -1663,7 +1688,7 @@ sub BackRestTestBackup_Test
|
||||
$strType = RECOVERY_TYPE_TIME;
|
||||
$strTarget = $strTimeTarget;
|
||||
$bTargetExclusive = undef;
|
||||
$bTargetResume = undef;
|
||||
$strTargetAction = undef;
|
||||
$strTargetTimeline = undef;
|
||||
$oRecoveryHashRef = undef;
|
||||
$strComment = undef;
|
||||
@ -1674,7 +1699,7 @@ sub BackRestTestBackup_Test
|
||||
BackRestTestBackup_ClusterStop();
|
||||
|
||||
BackRestTestBackup_Restore($oFile, $strFullBackup, $strStanza, $bRemote, undef, undef, $bDelta, $bForce,
|
||||
$strType, $strTarget, $bTargetExclusive, $bTargetResume, $strTargetTimeline,
|
||||
$strType, $strTarget, $bTargetExclusive, $strTargetAction, $strTargetTimeline,
|
||||
$oRecoveryHashRef, $strComment, $iExpectedExitStatus);
|
||||
|
||||
BackRestTestBackup_ClusterStart();
|
||||
@ -1687,7 +1712,7 @@ sub BackRestTestBackup_Test
|
||||
$strType = RECOVERY_TYPE_XID;
|
||||
$strTarget = $strXidTarget;
|
||||
$bTargetExclusive = true;
|
||||
$bTargetResume = undef;
|
||||
$strTargetAction = undef;
|
||||
$strTargetTimeline = undef;
|
||||
$oRecoveryHashRef = undef;
|
||||
$strComment = undef;
|
||||
@ -1698,7 +1723,7 @@ sub BackRestTestBackup_Test
|
||||
BackRestTestBackup_ClusterStop();
|
||||
|
||||
BackRestTestBackup_Restore($oFile, $strIncrBackup, $strStanza, $bRemote, undef, undef, $bDelta, $bForce,
|
||||
$strType, $strTarget, $bTargetExclusive, $bTargetResume, $strTargetTimeline,
|
||||
$strType, $strTarget, $bTargetExclusive, $strTargetAction, $strTargetTimeline,
|
||||
$oRecoveryHashRef, $strComment, $iExpectedExitStatus);
|
||||
|
||||
BackRestTestBackup_ClusterStart();
|
||||
@ -1713,7 +1738,7 @@ sub BackRestTestBackup_Test
|
||||
$strType = RECOVERY_TYPE_NAME;
|
||||
$strTarget = $strNameTarget;
|
||||
$bTargetExclusive = undef;
|
||||
$bTargetResume = undef;
|
||||
$strTargetAction = undef;
|
||||
$strTargetTimeline = undef;
|
||||
$oRecoveryHashRef = undef;
|
||||
$strComment = undef;
|
||||
@ -1724,7 +1749,7 @@ sub BackRestTestBackup_Test
|
||||
BackRestTestBackup_ClusterStop();
|
||||
|
||||
BackRestTestBackup_Restore($oFile, 'latest', $strStanza, $bRemote, undef, undef, $bDelta, $bForce,
|
||||
$strType, $strTarget, $bTargetExclusive, $bTargetResume, $strTargetTimeline,
|
||||
$strType, $strTarget, $bTargetExclusive, $strTargetAction, $strTargetTimeline,
|
||||
$oRecoveryHashRef, $strComment, $iExpectedExitStatus);
|
||||
|
||||
BackRestTestBackup_ClusterStart();
|
||||
@ -1740,8 +1765,8 @@ sub BackRestTestBackup_Test
|
||||
$strType = RECOVERY_TYPE_DEFAULT;
|
||||
$strTarget = undef;
|
||||
$bTargetExclusive = undef;
|
||||
$bTargetResume = undef;
|
||||
$strTargetTimeline = 3;
|
||||
$strTargetAction = undef;
|
||||
$strTargetTimeline = 4;
|
||||
$oRecoveryHashRef = BackRestTestCommon_DbVersion() >= 9.0 ? {'standby-mode' => 'on'} : undef;
|
||||
$strComment = undef;
|
||||
$iExpectedExitStatus = undef;
|
||||
@ -1751,7 +1776,7 @@ sub BackRestTestBackup_Test
|
||||
BackRestTestBackup_ClusterStop();
|
||||
|
||||
BackRestTestBackup_Restore($oFile, $strIncrBackup, $strStanza, $bRemote, undef, undef, $bDelta, $bForce,
|
||||
$strType, $strTarget, $bTargetExclusive, $bTargetResume, $strTargetTimeline,
|
||||
$strType, $strTarget, $bTargetExclusive, $strTargetAction, $strTargetTimeline,
|
||||
$oRecoveryHashRef, $strComment, $iExpectedExitStatus);
|
||||
|
||||
BackRestTestBackup_ClusterStart(undef, undef, true);
|
||||
|
Loading…
x
Reference in New Issue
Block a user