1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-08-10 22:21:39 +02:00

Improved stanza-create command so that it can repair broken repositories in most cases and is robust enough to be made mandatory.

Contributed by Cynthia Shang.
This commit is contained in:
Cynthia Shang
2016-12-20 16:52:20 -05:00
committed by David Steele
parent aecc0f737e
commit 974a02dbe4
62 changed files with 4498 additions and 1317 deletions

View File

@@ -396,6 +396,8 @@ use constant OPTION_DEFAULT_RESTORE_TYPE => RECOVERY_
push @EXPORT, qw(OPTION_DEFAULT_RESTORE_TYPE);
use constant OPTION_DEFAULT_LOCK => true;
push @EXPORT, qw(OPTION_DEFAULT_LOCK);
use constant OPTION_DEFAULT_STANZA_CREATE_FORCE => false;
push @EXPORT, qw(OPTION_DEFAULT_STANZA_CREATE_FORCE);
# Command-line only test
#-----------------------------------------------------------------------------------------------------------------------------------
@@ -647,6 +649,11 @@ my %oOptionRule =
&OPTION_RULE_DEFAULT => OPTION_DEFAULT_RESTORE_FORCE,
},
&CMD_STANZA_CREATE =>
{
&OPTION_RULE_DEFAULT => OPTION_DEFAULT_STANZA_CREATE_FORCE,
},
&CMD_STOP =>
{
&OPTION_RULE_DEFAULT => OPTION_DEFAULT_STOP_FORCE
@@ -674,6 +681,7 @@ my %oOptionRule =
{
&CMD_BACKUP => true,
&CMD_CHECK => true,
&CMD_STANZA_CREATE => true,
}
},
@@ -1005,7 +1013,6 @@ my %oOptionRule =
{
&CMD_BACKUP => true,
&CMD_CHECK => true,
&CMD_STANZA_CREATE => true,
},
},
@@ -1062,7 +1069,7 @@ my %oOptionRule =
&CMD_ARCHIVE_PUSH => true,
&CMD_BACKUP => true,
&CMD_EXPIRE => false,
&CMD_RESTORE => true
&CMD_RESTORE => true,
}
},
@@ -1162,13 +1169,14 @@ my %oOptionRule =
&CMD_ARCHIVE_PUSH => true,
&CMD_STANZA_CREATE => true,
&CMD_BACKUP => true,
&CMD_EXPIRE => true,
&CMD_INFO => true,
&CMD_LOCAL => true,
&CMD_REMOTE => true,
&CMD_RESTORE => true,
&CMD_STANZA_CREATE => true,
&CMD_START => true,
&CMD_STOP => true,
&CMD_EXPIRE => true
},
},
@@ -1522,6 +1530,7 @@ my %oOptionRule =
{
&CMD_BACKUP => true,
&CMD_CHECK => true,
&CMD_STANZA_CREATE => true,
},
},

View File

@@ -987,7 +987,9 @@ my $oConfigHelpData =
"\n" .
"Note that pg_create_restore_point('pgBackRest Archive Check') and pg_switch_xlog() are called to force " .
"PostgreSQL to archive a WAL segment. Restore points are only supported in PostgreSQL >= 9.1 so for older " .
"versions the check command may fail if there has been no write activity since the last log rotation.",
"versions the check command may fail if there has been no write activity since the last log rotation, " .
"therefore it is recommended that activity be generated by the user if there have been no writes since the " .
"last xlog switch before running the check command.",
option =>
{
@@ -1286,15 +1288,15 @@ my $oConfigHelpData =
summary =>
"Create the required stanza data.",
description =>
"Must be run during pgBackRest installation on the host where the repository is located. The check command will " .
"also be invoked if the PostgreSQL database version is greater than or equal to 9.1.",
"The stanza-create command must be run on the host where the repository is located after the stanza has been " .
"configured in pgbackrest.conf.",
option =>
{
'archive-timeout' => 'section',
'backup-cmd' => 'section',
'backup-config' => 'section',
'backup-host' => 'section',
'backup-standby' => 'section',
'backup-user' => 'section',
'buffer-size' => 'section',
'cmd-ssh' => 'section',
@@ -1309,11 +1311,26 @@ my $oConfigHelpData =
'db-socket-path' => 'section',
'db-timeout' => 'section',
'db-user' => 'section',
# FORCE Option Help
#-------------------------------------------------------------------------------------------------------------------
'force' =>
{
summary =>
"Force stanza creation.",
description =>
"If the required stanza information does not exist in the repository but backups or WAL segments do " .
"exist, then this option can be used to force the stanza to be created from the existing data in " .
"the repository. This is most likely to be useful after corruption or an incomplete restore of the " .
"repository from elsewhere."
},
'lock-path' => 'section',
'log-level-console' => 'section',
'log-level-file' => 'section',
'log-path' => 'section',
'neutral-umask' => 'section',
'online' => 'default',
'protocol-timeout' => 'section',
'repo-path' => 'section',
'repo-sync' => 'section',