1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-01-12 04:23:00 +02:00

Improved issue #110: 'db-version' is required but not defined.

Improved the error message and added hints.
This commit is contained in:
David Steele 2015-06-22 09:51:16 -04:00
parent 61dfeca3c1
commit 3f841fcd95
14 changed files with 98 additions and 3 deletions

View File

@ -855,6 +855,8 @@ example: db-path=/data/db
* Added file and directory syncs to the File object for additional safety during backup and archiving. Suggested by Andres Freund. * Added file and directory syncs to the File object for additional safety during backup and archiving. Suggested by Andres Freund.
* Improved error message when backup is run without archive_command set and without --no-archive-check specified. Found by Eric Radman.
### v0.75: New repository format, info command and experimental 9.5 support ### v0.75: New repository format, info command and experimental 9.5 support
* IMPORTANT NOTE: This flag day release breaks compatibility with older versions of PgBackRest. The manifest format, on-disk structure, and the binary names have all changed. You must create a new repository to hold backups for this version of PgBackRest and keep your older repository for a time in case you need to do a restore. The `pg_backrest.conf` file has not changed but you'll need to change any references to `pg_backrest.pl` in cron (or elsewhere) to `pg_backrest` (without the `.pl` extension). * IMPORTANT NOTE: This flag day release breaks compatibility with older versions of PgBackRest. The manifest format, on-disk structure, and the binary names have all changed. You must create a new repository to hold backups for this version of PgBackRest and keep your older repository for a time in case you need to do a restore. The `pg_backrest.conf` file has not changed but you'll need to change any references to `pg_backrest.pl` in cron (or elsewhere) to `pg_backrest` (without the `.pl` extension).

View File

@ -152,7 +152,7 @@
./test.pl --module=backup --module-test=full --db-version=all --thread-max=<# threads> ./test.pl --module=backup --module-test=full --db-version=all --thread-max=<# threads>
</code-block> </code-block>
This will run full backup/restore regression with a variety of options on all installed versions of <postgres/>. If you are only interested in one version then modify the <setting>db-version</setting> setting to X.X (e.g. 9.4). <setting>--thread-max</setting> can be omitted if you are running single-threaded. This will run full backup/restore regression with a variety of options on all installed versions of <postgres/>. If you are only interested in one version then modify the <setting>db-version</setting> setting to X.X (e.g. 9.4). <setting>--thread-max</setting> can be omitted if you are running single-threaded.
If there are errors in this test then run full regression to help isolate problems: If there are errors in this test then run full regression to help isolate problems:
<code-block> <code-block>
./test.pl --db-version=all --thread-max=&lt;# threads&gt; ./test.pl --db-version=all --thread-max=&lt;# threads&gt;
@ -812,6 +812,9 @@ Run a <id>full</id> backup on the <id>db</id> stanza. <param>--type</param> can
<release-feature> <release-feature>
<text>Added file and directory syncs to the File object for additional safety during backup and archiving. Suggested by Andres Freund.</text> <text>Added file and directory syncs to the File object for additional safety during backup and archiving. Suggested by Andres Freund.</text>
</release-feature> </release-feature>
<release-feature>
<text>Improved error message when backup is run without archive_command set and without --no-archive-check specified. Found by Eric Radman.</text>
</release-feature>
</release-feature-bullet-list> </release-feature-bullet-list>
</release-version> </release-version>

View File

@ -335,7 +335,7 @@ sub getCheck
} }
else else
{ {
$strArchiveId = (new BackRest::ArchiveInfo($oFile->path_get(PATH_BACKUP_ARCHIVE)))->archiveId(); $strArchiveId = (new BackRest::ArchiveInfo($oFile->path_get(PATH_BACKUP_ARCHIVE), true))->archiveId();
} }
# Set operation and debug strings # Set operation and debug strings

View File

@ -56,6 +56,7 @@ sub new
{ {
my $class = shift; # Class name my $class = shift; # Class name
my $strArchiveClusterPath = shift; # Backup cluster path my $strArchiveClusterPath = shift; # Backup cluster path
my $bRequired = shift; # Is archive info required?
logDebug(OP_ARCHIVE_INFO_NEW, DEBUG_CALL, undef, {archiveClusterPath => $strArchiveClusterPath}); logDebug(OP_ARCHIVE_INFO_NEW, DEBUG_CALL, undef, {archiveClusterPath => $strArchiveClusterPath});
@ -63,6 +64,14 @@ sub new
my $strArchiveInfoFile = "${strArchiveClusterPath}/" . ARCHIVE_INFO_FILE; my $strArchiveInfoFile = "${strArchiveClusterPath}/" . ARCHIVE_INFO_FILE;
my $bExists = -e $strArchiveInfoFile ? true : false; my $bExists = -e $strArchiveInfoFile ? true : false;
if (!$bExists && defined($bRequired) && $bRequired)
{
confess &log(ERROR, ARCHIVE_INFO_FILE . " does not exist but is required to get WAL segments\n" .
"HINT: Is archive_command configured in postgresql.conf?\n" .
"HINT: Use --no-archive-check to disable archive checks during backup if you have an alternate archiving" .
" scheme.", ERROR_FILE_MISSING);
}
# Init object and store variables # Init object and store variables
my $self = $class->SUPER::new($strArchiveInfoFile, $bExists); my $self = $class->SUPER::new($strArchiveInfoFile, $bExists);

View File

@ -44,6 +44,7 @@ use constant
ERROR_FILE_SYNC => 127, ERROR_FILE_SYNC => 127,
ERROR_PATH_OPEN => 128, ERROR_PATH_OPEN => 128,
ERROR_PATH_SYNC => 129, ERROR_PATH_SYNC => 129,
ERROR_FILE_MISSING => 130,
ERROR_UNKNOWN => 199 ERROR_UNKNOWN => 199
}; };
@ -53,7 +54,8 @@ our @EXPORT = qw(ERROR_ASSERT ERROR_CHECKSUM ERROR_CONFIG ERROR_FILE_INVALID ERR
ERROR_OPTION_DUPLICATE_KEY ERROR_OPTION_NEGATE ERROR_OPTION_REQUIRED ERROR_POSTMASTER_RUNNING ERROR_PROTOCOL ERROR_OPTION_DUPLICATE_KEY ERROR_OPTION_NEGATE ERROR_OPTION_REQUIRED ERROR_POSTMASTER_RUNNING ERROR_PROTOCOL
ERROR_RESTORE_PATH_NOT_EMPTY ERROR_FILE_OPEN ERROR_FILE_READ ERROR_PARAM_REQUIRED ERROR_ARCHIVE_MISMATCH ERROR_RESTORE_PATH_NOT_EMPTY ERROR_FILE_OPEN ERROR_FILE_READ ERROR_PARAM_REQUIRED ERROR_ARCHIVE_MISMATCH
ERROR_ARCHIVE_DUPLICATE ERROR_VERSION_NOT_SUPPORTED ERROR_PATH_CREATE ERROR_COMMAND_INVALID ERROR_HOST_CONNECT ERROR_ARCHIVE_DUPLICATE ERROR_VERSION_NOT_SUPPORTED ERROR_PATH_CREATE ERROR_COMMAND_INVALID ERROR_HOST_CONNECT
ERROR_UNKNOWN ERROR_LOCK_ACQUIRE ERROR_BACKUP_MISMATCH ERROR_FILE_SYNC ERROR_PATH_OPEN ERROR_PATH_SYNC); ERROR_UNKNOWN ERROR_LOCK_ACQUIRE ERROR_BACKUP_MISMATCH ERROR_FILE_SYNC ERROR_PATH_OPEN ERROR_PATH_SYNC
ERROR_FILE_MISSING);
#################################################################################################################################### ####################################################################################################################################
# CONSTRUCTOR # CONSTRUCTOR

View File

@ -1912,6 +1912,9 @@ sub BackRestTestBackup_Test
'/pg_backrest.conf --stanza=db archive-get'; '/pg_backrest.conf --stanza=db archive-get';
BackRestTestCommon_Execute($strCommand . " 000000010000000100000001 ${strXlogPath}/000000010000000100000001",
undef, undef, undef, ERROR_FILE_MISSING);
# Create the archive info file # Create the archive info file
if ($bRemote) if ($bRemote)
{ {

View File

@ -1,6 +1,15 @@
run 001 - rmt 0, cmp 0, exists 0 run 001 - rmt 0, cmp 0, exists 0
================================ ================================
> ../bin/pg_backrest --config=[TEST_PATH]/db/pg_backrest.conf --stanza=db archive-get 000000010000000100000001 [TEST_PATH]/db/common/pg_xlog/000000010000000100000001
------------------------------------------------------------------------------------------------------------------------------------
INFO: getting WAL segment 000000010000000100000001
DEBUG: ArchiveInfo->new(): archiveClusterPath = [TEST_PATH]/backrest/archive/db
ERROR: [130]: archive.info does not exist but is required to get WAL segments
HINT: Is archive_command configured in postgresql.conf?
HINT: Use --no-archive-check to disable archive checks during backup if you have an alternate archiving scheme.
DEBUG: safe exit called, terminating threads
+ supplemental file: [TEST_PATH]/backrest/archive/db/archive.info + supplemental file: [TEST_PATH]/backrest/archive/db/archive.info
----------------------------------------------------------------- -----------------------------------------------------------------
[backrest] [backrest]

View File

@ -1,6 +1,15 @@
run 002 - rmt 0, cmp 0, exists 1 run 002 - rmt 0, cmp 0, exists 1
================================ ================================
> ../bin/pg_backrest --config=[TEST_PATH]/db/pg_backrest.conf --stanza=db archive-get 000000010000000100000001 [TEST_PATH]/db/common/pg_xlog/000000010000000100000001
------------------------------------------------------------------------------------------------------------------------------------
INFO: getting WAL segment 000000010000000100000001
DEBUG: ArchiveInfo->new(): archiveClusterPath = [TEST_PATH]/backrest/archive/db
ERROR: [130]: archive.info does not exist but is required to get WAL segments
HINT: Is archive_command configured in postgresql.conf?
HINT: Use --no-archive-check to disable archive checks during backup if you have an alternate archiving scheme.
DEBUG: safe exit called, terminating threads
+ supplemental file: [TEST_PATH]/backrest/archive/db/archive.info + supplemental file: [TEST_PATH]/backrest/archive/db/archive.info
----------------------------------------------------------------- -----------------------------------------------------------------
[backrest] [backrest]

View File

@ -1,6 +1,15 @@
run 003 - rmt 0, cmp 1, exists 0 run 003 - rmt 0, cmp 1, exists 0
================================ ================================
> ../bin/pg_backrest --config=[TEST_PATH]/db/pg_backrest.conf --stanza=db archive-get 000000010000000100000001 [TEST_PATH]/db/common/pg_xlog/000000010000000100000001
------------------------------------------------------------------------------------------------------------------------------------
INFO: getting WAL segment 000000010000000100000001
DEBUG: ArchiveInfo->new(): archiveClusterPath = [TEST_PATH]/backrest/archive/db
ERROR: [130]: archive.info does not exist but is required to get WAL segments
HINT: Is archive_command configured in postgresql.conf?
HINT: Use --no-archive-check to disable archive checks during backup if you have an alternate archiving scheme.
DEBUG: safe exit called, terminating threads
+ supplemental file: [TEST_PATH]/backrest/archive/db/archive.info + supplemental file: [TEST_PATH]/backrest/archive/db/archive.info
----------------------------------------------------------------- -----------------------------------------------------------------
[backrest] [backrest]

View File

@ -1,6 +1,15 @@
run 004 - rmt 0, cmp 1, exists 1 run 004 - rmt 0, cmp 1, exists 1
================================ ================================
> ../bin/pg_backrest --config=[TEST_PATH]/db/pg_backrest.conf --stanza=db archive-get 000000010000000100000001 [TEST_PATH]/db/common/pg_xlog/000000010000000100000001
------------------------------------------------------------------------------------------------------------------------------------
INFO: getting WAL segment 000000010000000100000001
DEBUG: ArchiveInfo->new(): archiveClusterPath = [TEST_PATH]/backrest/archive/db
ERROR: [130]: archive.info does not exist but is required to get WAL segments
HINT: Is archive_command configured in postgresql.conf?
HINT: Use --no-archive-check to disable archive checks during backup if you have an alternate archiving scheme.
DEBUG: safe exit called, terminating threads
+ supplemental file: [TEST_PATH]/backrest/archive/db/archive.info + supplemental file: [TEST_PATH]/backrest/archive/db/archive.info
----------------------------------------------------------------- -----------------------------------------------------------------
[backrest] [backrest]

View File

@ -1,6 +1,16 @@
run 005 - rmt 1, cmp 0, exists 0 run 005 - rmt 1, cmp 0, exists 0
================================ ================================
> ../bin/pg_backrest --config=[TEST_PATH]/db/pg_backrest.conf --stanza=db archive-get 000000010000000100000001 [TEST_PATH]/db/common/pg_xlog/000000010000000100000001
------------------------------------------------------------------------------------------------------------------------------------
INFO: getting WAL segment 000000010000000100000001
DEBUG: Remote->new(): command = [BACKREST_BIN_PATH]/pg_backrest --no-config --repo-remote-path=[TEST_PATH]/backrest --stanza=db remote, host = 127.0.0.1, user = [USER-1]
DEBUG: Protocol->new(): blockSize = 4194304, command = [BACKREST_BIN_PATH]/pg_backrest --no-config --repo-remote-path=[TEST_PATH]/backrest --stanza=db remote, compressLevel = 6, compressLevelNetwork = 3, host = 127.0.0.1, isBackend = false, name = remote, user = [USER-1]
ERROR: [130]: archive.info does not exist but is required to get WAL segments
HINT: Is archive_command configured in postgresql.conf?
HINT: Use --no-archive-check to disable archive checks during backup if you have an alternate archiving scheme.
DEBUG: safe exit called, terminating threads
+ supplemental file: [TEST_PATH]/backrest/archive/db/archive.info + supplemental file: [TEST_PATH]/backrest/archive/db/archive.info
----------------------------------------------------------------- -----------------------------------------------------------------
[backrest] [backrest]

View File

@ -1,6 +1,16 @@
run 006 - rmt 1, cmp 0, exists 1 run 006 - rmt 1, cmp 0, exists 1
================================ ================================
> ../bin/pg_backrest --config=[TEST_PATH]/db/pg_backrest.conf --stanza=db archive-get 000000010000000100000001 [TEST_PATH]/db/common/pg_xlog/000000010000000100000001
------------------------------------------------------------------------------------------------------------------------------------
INFO: getting WAL segment 000000010000000100000001
DEBUG: Remote->new(): command = [BACKREST_BIN_PATH]/pg_backrest --no-config --repo-remote-path=[TEST_PATH]/backrest --stanza=db remote, host = 127.0.0.1, user = [USER-1]
DEBUG: Protocol->new(): blockSize = 4194304, command = [BACKREST_BIN_PATH]/pg_backrest --no-config --repo-remote-path=[TEST_PATH]/backrest --stanza=db remote, compressLevel = 6, compressLevelNetwork = 3, host = 127.0.0.1, isBackend = false, name = remote, user = [USER-1]
ERROR: [130]: archive.info does not exist but is required to get WAL segments
HINT: Is archive_command configured in postgresql.conf?
HINT: Use --no-archive-check to disable archive checks during backup if you have an alternate archiving scheme.
DEBUG: safe exit called, terminating threads
+ supplemental file: [TEST_PATH]/backrest/archive/db/archive.info + supplemental file: [TEST_PATH]/backrest/archive/db/archive.info
----------------------------------------------------------------- -----------------------------------------------------------------
[backrest] [backrest]

View File

@ -1,6 +1,16 @@
run 007 - rmt 1, cmp 1, exists 0 run 007 - rmt 1, cmp 1, exists 0
================================ ================================
> ../bin/pg_backrest --config=[TEST_PATH]/db/pg_backrest.conf --stanza=db archive-get 000000010000000100000001 [TEST_PATH]/db/common/pg_xlog/000000010000000100000001
------------------------------------------------------------------------------------------------------------------------------------
INFO: getting WAL segment 000000010000000100000001
DEBUG: Remote->new(): command = [BACKREST_BIN_PATH]/pg_backrest --no-config --repo-remote-path=[TEST_PATH]/backrest --stanza=db remote, host = 127.0.0.1, user = [USER-1]
DEBUG: Protocol->new(): blockSize = 4194304, command = [BACKREST_BIN_PATH]/pg_backrest --no-config --repo-remote-path=[TEST_PATH]/backrest --stanza=db remote, compressLevel = 6, compressLevelNetwork = 3, host = 127.0.0.1, isBackend = false, name = remote, user = [USER-1]
ERROR: [130]: archive.info does not exist but is required to get WAL segments
HINT: Is archive_command configured in postgresql.conf?
HINT: Use --no-archive-check to disable archive checks during backup if you have an alternate archiving scheme.
DEBUG: safe exit called, terminating threads
+ supplemental file: [TEST_PATH]/backrest/archive/db/archive.info + supplemental file: [TEST_PATH]/backrest/archive/db/archive.info
----------------------------------------------------------------- -----------------------------------------------------------------
[backrest] [backrest]

View File

@ -1,6 +1,16 @@
run 008 - rmt 1, cmp 1, exists 1 run 008 - rmt 1, cmp 1, exists 1
================================ ================================
> ../bin/pg_backrest --config=[TEST_PATH]/db/pg_backrest.conf --stanza=db archive-get 000000010000000100000001 [TEST_PATH]/db/common/pg_xlog/000000010000000100000001
------------------------------------------------------------------------------------------------------------------------------------
INFO: getting WAL segment 000000010000000100000001
DEBUG: Remote->new(): command = [BACKREST_BIN_PATH]/pg_backrest --no-config --repo-remote-path=[TEST_PATH]/backrest --stanza=db remote, host = 127.0.0.1, user = [USER-1]
DEBUG: Protocol->new(): blockSize = 4194304, command = [BACKREST_BIN_PATH]/pg_backrest --no-config --repo-remote-path=[TEST_PATH]/backrest --stanza=db remote, compressLevel = 6, compressLevelNetwork = 3, host = 127.0.0.1, isBackend = false, name = remote, user = [USER-1]
ERROR: [130]: archive.info does not exist but is required to get WAL segments
HINT: Is archive_command configured in postgresql.conf?
HINT: Use --no-archive-check to disable archive checks during backup if you have an alternate archiving scheme.
DEBUG: safe exit called, terminating threads
+ supplemental file: [TEST_PATH]/backrest/archive/db/archive.info + supplemental file: [TEST_PATH]/backrest/archive/db/archive.info
----------------------------------------------------------------- -----------------------------------------------------------------
[backrest] [backrest]