diff --git a/README.md b/README.md
index f5591aca9..3634c15d3 100644
--- a/README.md
+++ b/README.md
@@ -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.
+* 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
* 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).
diff --git a/doc/doc.xml b/doc/doc.xml
index a4d3a144c..a953ac1a4 100644
--- a/doc/doc.xml
+++ b/doc/doc.xml
@@ -152,7 +152,7 @@
./test.pl --module=backup --module-test=full --db-version=all --thread-max=<# threads>
This will run full backup/restore regression with a variety of options on all installed versions of . If you are only interested in one version then modify the db-version setting to X.X (e.g. 9.4). --thread-max can be omitted if you are running single-threaded.
-
+
If there are errors in this test then run full regression to help isolate problems:
./test.pl --db-version=all --thread-max=<# threads>
@@ -812,6 +812,9 @@ Run a full backup on the db stanza. --type can
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.
+
diff --git a/lib/BackRest/Archive.pm b/lib/BackRest/Archive.pm
index a3c0a9347..27805c377 100644
--- a/lib/BackRest/Archive.pm
+++ b/lib/BackRest/Archive.pm
@@ -335,7 +335,7 @@ sub getCheck
}
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
diff --git a/lib/BackRest/ArchiveInfo.pm b/lib/BackRest/ArchiveInfo.pm
index d6a070620..c6b41b13b 100644
--- a/lib/BackRest/ArchiveInfo.pm
+++ b/lib/BackRest/ArchiveInfo.pm
@@ -56,6 +56,7 @@ sub new
{
my $class = shift; # Class name
my $strArchiveClusterPath = shift; # Backup cluster path
+ my $bRequired = shift; # Is archive info required?
logDebug(OP_ARCHIVE_INFO_NEW, DEBUG_CALL, undef, {archiveClusterPath => $strArchiveClusterPath});
@@ -63,6 +64,14 @@ sub new
my $strArchiveInfoFile = "${strArchiveClusterPath}/" . ARCHIVE_INFO_FILE;
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
my $self = $class->SUPER::new($strArchiveInfoFile, $bExists);
diff --git a/lib/BackRest/Exception.pm b/lib/BackRest/Exception.pm
index 58cd50a6d..d0b15d491 100644
--- a/lib/BackRest/Exception.pm
+++ b/lib/BackRest/Exception.pm
@@ -44,6 +44,7 @@ use constant
ERROR_FILE_SYNC => 127,
ERROR_PATH_OPEN => 128,
ERROR_PATH_SYNC => 129,
+ ERROR_FILE_MISSING => 130,
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_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_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
diff --git a/test/lib/BackRestTest/BackupTest.pm b/test/lib/BackRestTest/BackupTest.pm
index f5f7495f0..46e1cd020 100755
--- a/test/lib/BackRestTest/BackupTest.pm
+++ b/test/lib/BackRestTest/BackupTest.pm
@@ -1912,6 +1912,9 @@ sub BackRestTestBackup_Test
'/pg_backrest.conf --stanza=db archive-get';
+ BackRestTestCommon_Execute($strCommand . " 000000010000000100000001 ${strXlogPath}/000000010000000100000001",
+ undef, undef, undef, ERROR_FILE_MISSING);
+
# Create the archive info file
if ($bRemote)
{
diff --git a/test/log/backup-archive-get-001.log b/test/log/backup-archive-get-001.log
index 43f64f18f..5255749dc 100644
--- a/test/log/backup-archive-get-001.log
+++ b/test/log/backup-archive-get-001.log
@@ -1,6 +1,15 @@
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
-----------------------------------------------------------------
[backrest]
diff --git a/test/log/backup-archive-get-002.log b/test/log/backup-archive-get-002.log
index c5a39ae3d..b63e1d589 100644
--- a/test/log/backup-archive-get-002.log
+++ b/test/log/backup-archive-get-002.log
@@ -1,6 +1,15 @@
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
-----------------------------------------------------------------
[backrest]
diff --git a/test/log/backup-archive-get-003.log b/test/log/backup-archive-get-003.log
index e54431d84..b057de3dd 100644
--- a/test/log/backup-archive-get-003.log
+++ b/test/log/backup-archive-get-003.log
@@ -1,6 +1,15 @@
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
-----------------------------------------------------------------
[backrest]
diff --git a/test/log/backup-archive-get-004.log b/test/log/backup-archive-get-004.log
index ccdd2afae..687c0f520 100644
--- a/test/log/backup-archive-get-004.log
+++ b/test/log/backup-archive-get-004.log
@@ -1,6 +1,15 @@
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
-----------------------------------------------------------------
[backrest]
diff --git a/test/log/backup-archive-get-005.log b/test/log/backup-archive-get-005.log
index 5f845375b..8e5b80483 100644
--- a/test/log/backup-archive-get-005.log
+++ b/test/log/backup-archive-get-005.log
@@ -1,6 +1,16 @@
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
-----------------------------------------------------------------
[backrest]
diff --git a/test/log/backup-archive-get-006.log b/test/log/backup-archive-get-006.log
index 0e2a22275..d6562b9d5 100644
--- a/test/log/backup-archive-get-006.log
+++ b/test/log/backup-archive-get-006.log
@@ -1,6 +1,16 @@
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
-----------------------------------------------------------------
[backrest]
diff --git a/test/log/backup-archive-get-007.log b/test/log/backup-archive-get-007.log
index 9c84bc047..7291c6a16 100644
--- a/test/log/backup-archive-get-007.log
+++ b/test/log/backup-archive-get-007.log
@@ -1,6 +1,16 @@
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
-----------------------------------------------------------------
[backrest]
diff --git a/test/log/backup-archive-get-008.log b/test/log/backup-archive-get-008.log
index 44676ffb1..405d85515 100644
--- a/test/log/backup-archive-get-008.log
+++ b/test/log/backup-archive-get-008.log
@@ -1,6 +1,16 @@
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
-----------------------------------------------------------------
[backrest]