2018-12-13 16:22:34 -05:00
|
|
|
/***********************************************************************************************************************************
|
|
|
|
Test Info Command
|
|
|
|
***********************************************************************************************************************************/
|
2021-06-24 08:55:44 -04:00
|
|
|
#include "common/crypto/cipherBlock.h"
|
|
|
|
#include "common/io/bufferRead.h"
|
|
|
|
#include "common/io/bufferWrite.h"
|
2019-05-03 15:46:15 -04:00
|
|
|
#include "storage/posix/storage.h"
|
2018-12-13 16:22:34 -05:00
|
|
|
|
|
|
|
#include "common/harnessConfig.h"
|
2019-04-23 14:02:30 -04:00
|
|
|
#include "common/harnessInfo.h"
|
2020-04-24 08:00:00 -04:00
|
|
|
#include "common/harnessFork.h"
|
2018-12-13 16:22:34 -05:00
|
|
|
|
|
|
|
/***********************************************************************************************************************************
|
|
|
|
Test Run
|
|
|
|
***********************************************************************************************************************************/
|
|
|
|
void
|
|
|
|
testRun(void)
|
|
|
|
{
|
|
|
|
FUNCTION_HARNESS_VOID();
|
|
|
|
|
2021-06-24 08:55:44 -04:00
|
|
|
// Create storage object for writing to test locations when a stanza is not set
|
|
|
|
Storage *storageTest = storagePosixNewP(TEST_PATH_STR, .write = true);
|
|
|
|
|
2019-10-10 19:43:42 -04:00
|
|
|
// The tests expect the timezone to be UTC
|
|
|
|
setenv("TZ", "UTC", true);
|
|
|
|
|
2018-12-13 16:22:34 -05:00
|
|
|
// *****************************************************************************************************************************
|
|
|
|
if (testBegin("infoRender()"))
|
|
|
|
{
|
|
|
|
StringList *argList = strLstNew();
|
2021-06-28 13:28:28 -04:00
|
|
|
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH "/repo");
|
2018-12-13 16:22:34 -05:00
|
|
|
StringList *argListText = strLstDup(argList);
|
|
|
|
|
2021-06-24 08:55:44 -04:00
|
|
|
hrnCfgArgRawZ(argList, cfgOptOutput, "json");
|
2021-06-01 09:03:44 -04:00
|
|
|
HRN_CFG_LOAD(cfgCmdInfo, argList);
|
2018-12-13 16:22:34 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------------------------------
|
2021-06-24 08:55:44 -04:00
|
|
|
TEST_TITLE("no stanzas have been created");
|
|
|
|
|
2019-12-26 18:08:27 -07:00
|
|
|
TEST_RESULT_STR_Z(infoRender(), "[]", "json - repo but no stanzas");
|
2018-12-13 16:22:34 -05:00
|
|
|
|
2021-06-01 09:03:44 -04:00
|
|
|
HRN_CFG_LOAD(cfgCmdInfo, argListText);
|
2019-12-26 18:08:27 -07:00
|
|
|
TEST_RESULT_STR_Z(infoRender(), "No stanzas exist in the repository.\n", "text - no stanzas");
|
2019-01-13 22:44:58 +02:00
|
|
|
|
2020-10-27 13:34:18 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------------------------------
|
2021-06-24 08:55:44 -04:00
|
|
|
TEST_TITLE("repo is still empty but stanza option is specified");
|
|
|
|
|
2020-10-27 13:34:18 +01:00
|
|
|
StringList *argListStanzaOpt = strLstDup(argList);
|
2021-06-24 08:55:44 -04:00
|
|
|
hrnCfgArgRawZ(argListStanzaOpt, cfgOptStanza, "stanza1");
|
2021-06-01 09:03:44 -04:00
|
|
|
HRN_CFG_LOAD(cfgCmdInfo, argListStanzaOpt);
|
2020-10-27 13:34:18 +01:00
|
|
|
TEST_RESULT_STR_Z(
|
|
|
|
infoRender(),
|
|
|
|
"["
|
|
|
|
"{"
|
2020-12-30 16:17:56 -05:00
|
|
|
"\"archive\":[],"
|
2020-10-27 13:34:18 +01:00
|
|
|
"\"backup\":[],"
|
2021-01-21 15:21:50 -05:00
|
|
|
"\"cipher\":\"none\","
|
2020-10-27 13:34:18 +01:00
|
|
|
"\"db\":[],"
|
|
|
|
"\"name\":\"stanza1\","
|
2021-01-21 15:21:50 -05:00
|
|
|
"\"repo\":["
|
|
|
|
"{"
|
|
|
|
"\"cipher\":\"none\","
|
|
|
|
"\"key\":1,"
|
|
|
|
"\"status\":{"
|
|
|
|
"\"code\":1,"
|
|
|
|
"\"message\":\"missing stanza path\""
|
|
|
|
"}"
|
|
|
|
"}"
|
|
|
|
"],"
|
2020-10-27 13:34:18 +01:00
|
|
|
"\"status\":{"
|
|
|
|
"\"code\":1,"
|
|
|
|
"\"lock\":{\"backup\":{\"held\":false}},"
|
|
|
|
"\"message\":\"missing stanza path\""
|
|
|
|
"}"
|
|
|
|
"}"
|
|
|
|
"]",
|
|
|
|
"json - empty repo, stanza option specified");
|
|
|
|
|
|
|
|
StringList *argListTextStanzaOpt = strLstDup(argListText);
|
2021-06-24 08:55:44 -04:00
|
|
|
hrnCfgArgRawZ(argListTextStanzaOpt, cfgOptStanza, "stanza1");
|
2021-06-01 09:03:44 -04:00
|
|
|
HRN_CFG_LOAD(cfgCmdInfo, argListTextStanzaOpt);
|
2020-10-27 13:34:18 +01:00
|
|
|
TEST_RESULT_STR_Z(
|
|
|
|
infoRender(),
|
|
|
|
"stanza: stanza1\n"
|
|
|
|
" status: error (missing stanza path)\n",
|
|
|
|
"text - empty repo, stanza option specified");
|
|
|
|
|
2018-12-13 16:22:34 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------------------------------
|
2021-06-24 08:55:44 -04:00
|
|
|
TEST_TITLE("stanza path exists but is empty");
|
|
|
|
|
|
|
|
HRN_STORAGE_PATH_CREATE(storageRepoWrite(), STORAGE_REPO_ARCHIVE, .comment = "create repo stanza archive path");
|
|
|
|
HRN_STORAGE_PATH_CREATE(storageRepoWrite(), STORAGE_REPO_BACKUP, .comment = "create repo stanza backup path");
|
|
|
|
|
2019-12-26 18:08:27 -07:00
|
|
|
TEST_RESULT_STR_Z(
|
|
|
|
infoRender(),
|
2018-12-13 16:22:34 -05:00
|
|
|
"stanza: stanza1\n"
|
|
|
|
" status: error (missing stanza data)\n"
|
2019-12-26 18:08:27 -07:00
|
|
|
" cipher: none\n",
|
|
|
|
"text - missing stanza data");
|
2018-12-13 16:22:34 -05:00
|
|
|
|
2021-06-01 09:03:44 -04:00
|
|
|
HRN_CFG_LOAD(cfgCmdInfo, argList);
|
2019-12-26 18:08:27 -07:00
|
|
|
TEST_RESULT_STR_Z(
|
|
|
|
infoRender(),
|
2019-10-11 12:56:03 -04:00
|
|
|
"["
|
|
|
|
"{"
|
|
|
|
"\"archive\":[],"
|
|
|
|
"\"backup\":[],"
|
|
|
|
"\"cipher\":\"none\","
|
|
|
|
"\"db\":[],"
|
|
|
|
"\"name\":\"stanza1\","
|
2021-01-21 15:21:50 -05:00
|
|
|
"\"repo\":["
|
|
|
|
"{"
|
|
|
|
"\"cipher\":\"none\","
|
|
|
|
"\"key\":1,"
|
|
|
|
"\"status\":{"
|
|
|
|
"\"code\":3,"
|
|
|
|
"\"message\":\"missing stanza data\""
|
|
|
|
"}"
|
|
|
|
"}"
|
|
|
|
"],"
|
2019-10-11 12:56:03 -04:00
|
|
|
"\"status\":{"
|
|
|
|
"\"code\":3,"
|
2020-04-24 08:00:00 -04:00
|
|
|
"\"lock\":{\"backup\":{\"held\":false}},"
|
2019-10-11 12:56:03 -04:00
|
|
|
"\"message\":\"missing stanza data\""
|
|
|
|
"}"
|
|
|
|
"}"
|
2019-12-26 18:08:27 -07:00
|
|
|
"]",
|
|
|
|
"json - missing stanza data");
|
2018-12-13 16:22:34 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------------------------------
|
2021-06-24 08:55:44 -04:00
|
|
|
TEST_TITLE("backup.info file exists, but archive.info does not");
|
|
|
|
|
|
|
|
// Put backup info to file
|
|
|
|
HRN_INFO_PUT(
|
2021-06-28 13:28:28 -04:00
|
|
|
storageTest, TEST_PATH "/repo/" STORAGE_PATH_BACKUP "/stanza1/" INFO_BACKUP_FILE,
|
2018-12-13 16:22:34 -05:00
|
|
|
"[db]\n"
|
|
|
|
"db-catalog-version=201409291\n"
|
|
|
|
"db-control-version=942\n"
|
|
|
|
"db-id=2\n"
|
|
|
|
"db-system-id=6569239123849665679\n"
|
|
|
|
"db-version=\"9.4\"\n"
|
|
|
|
"\n"
|
|
|
|
"[db:history]\n"
|
|
|
|
"1={\"db-catalog-version\":201306121,\"db-control-version\":937,\"db-system-id\":6569239123849665666,"
|
|
|
|
"\"db-version\":\"9.3\"}\n"
|
|
|
|
"2={\"db-catalog-version\":201409291,\"db-control-version\":942,\"db-system-id\":6569239123849665679,"
|
2021-06-24 08:55:44 -04:00
|
|
|
"\"db-version\":\"9.4\"}\n");
|
2018-12-13 16:22:34 -05:00
|
|
|
|
2021-06-24 08:55:44 -04:00
|
|
|
TEST_RESULT_STR_Z(
|
|
|
|
infoRender(),
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
"["
|
|
|
|
"{"
|
|
|
|
"\"archive\":[],"
|
|
|
|
"\"backup\":[],"
|
|
|
|
"\"cipher\":\"none\","
|
|
|
|
"\"db\":[],"
|
|
|
|
"\"name\":\"stanza1\","
|
|
|
|
"\"repo\":["
|
|
|
|
"{"
|
|
|
|
"\"cipher\":\"none\","
|
|
|
|
"\"key\":1,"
|
|
|
|
"\"status\":{"
|
|
|
|
"\"code\":99,"
|
2021-06-24 08:55:44 -04:00
|
|
|
"\"message\":\"[FileMissingError] unable to load info file '"
|
2021-06-28 13:28:28 -04:00
|
|
|
TEST_PATH "/repo/archive/stanza1/archive.info' or '"
|
|
|
|
TEST_PATH "/repo/archive/stanza1/archive.info.copy':\\n"
|
|
|
|
"FileMissingError: unable to open missing file '" TEST_PATH "/repo/archive/stanza1/archive.info'"
|
2021-06-28 10:58:27 -04:00
|
|
|
" for read\\n"
|
2021-06-28 13:28:28 -04:00
|
|
|
"FileMissingError: unable to open missing file '" TEST_PATH
|
|
|
|
"/repo/archive/stanza1/archive.info.copy' for read\\n"
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
"HINT: archive.info cannot be opened but is required to push/get WAL segments.\\n"
|
|
|
|
"HINT: is archive_command configured correctly in postgresql.conf?\\n"
|
|
|
|
"HINT: has a stanza-create been performed?\\n"
|
|
|
|
"HINT: use --no-archive-check to disable archive checks during backup if you have an alternate"
|
|
|
|
" archiving scheme.\""
|
|
|
|
"}"
|
|
|
|
"}"
|
|
|
|
"],"
|
|
|
|
"\"status\":{"
|
|
|
|
"\"code\":99,"
|
|
|
|
"\"lock\":{\"backup\":{\"held\":false}},"
|
|
|
|
"\"message\":\"other\""
|
|
|
|
"}"
|
|
|
|
"}"
|
2021-06-24 08:55:44 -04:00
|
|
|
"]",
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
"json - other error, single repo");
|
|
|
|
|
2021-06-01 09:03:44 -04:00
|
|
|
HRN_CFG_LOAD(cfgCmdInfo, argListTextStanzaOpt);
|
2021-06-24 08:55:44 -04:00
|
|
|
TEST_RESULT_STR_Z(
|
|
|
|
infoRender(),
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
"stanza: stanza1\n"
|
|
|
|
" status: error (other)\n"
|
2021-06-28 13:28:28 -04:00
|
|
|
" [FileMissingError] unable to load info file '" TEST_PATH "/repo/archive/stanza1/archive.info' or '"
|
|
|
|
TEST_PATH "/repo/archive/stanza1/archive.info.copy':\n"
|
|
|
|
" FileMissingError: unable to open missing file '" TEST_PATH "/repo/archive/stanza1/archive.info' for read\n"
|
|
|
|
" FileMissingError: unable to open missing file '" TEST_PATH "/repo/archive/stanza1/archive.info.copy'"
|
2021-06-28 10:58:27 -04:00
|
|
|
" for read\n"
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
" HINT: archive.info cannot be opened but is required to push/get WAL segments.\n"
|
|
|
|
" HINT: is archive_command configured correctly in postgresql.conf?\n"
|
|
|
|
" HINT: has a stanza-create been performed?\n"
|
|
|
|
" HINT: use --no-archive-check to disable archive checks during backup if you have an alternate archiving"
|
|
|
|
" scheme.\n"
|
2021-06-24 08:55:44 -04:00
|
|
|
" cipher: none\n",
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
"text - other error, single repo");
|
2018-12-13 16:22:34 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------------------------------
|
2021-06-24 08:55:44 -04:00
|
|
|
TEST_TITLE("info files exist with mismatched db-ids and no current backups - lock detected");
|
|
|
|
|
|
|
|
// Only the current db information from the db:history will be processed.
|
|
|
|
HRN_INFO_PUT(
|
|
|
|
storageRepoWrite(), INFO_ARCHIVE_PATH_FILE,
|
2018-12-13 16:22:34 -05:00
|
|
|
"[db]\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
"db-id=3\n"
|
2018-12-13 16:22:34 -05:00
|
|
|
"db-system-id=6569239123849665679\n"
|
|
|
|
"db-version=\"9.4\"\n"
|
|
|
|
"\n"
|
|
|
|
"[db:history]\n"
|
|
|
|
"1={\"db-id\":6569239123849665679,\"db-version\":\"9.4\"}\n"
|
|
|
|
"2={\"db-id\":6569239123849665666,\"db-version\":\"9.3\"}\n"
|
2021-06-24 08:55:44 -04:00
|
|
|
"3={\"db-id\":6569239123849665679,\"db-version\":\"9.4\"}\n");
|
2018-12-13 16:22:34 -05:00
|
|
|
|
2021-01-21 15:21:50 -05:00
|
|
|
// Create a WAL directory in 9.3-2 but since there are no WAL files or backups it will not show
|
2021-06-24 08:55:44 -04:00
|
|
|
HRN_STORAGE_PATH_CREATE(
|
|
|
|
storageRepoWrite(), STORAGE_REPO_ARCHIVE "/9.3-2/0000000100000000",
|
|
|
|
.comment = "create empty db2 archive WAL1 directory");
|
2021-01-21 15:21:50 -05:00
|
|
|
|
2018-12-13 16:22:34 -05:00
|
|
|
// archive section will cross reference backup db-id 2 to archive db-id 3 but db section will only use the db-ids from
|
2021-01-05 15:14:16 -05:00
|
|
|
// backup.info. Execute while a backup lock is held.
|
2021-07-13 11:58:23 -04:00
|
|
|
HRN_FORK_BEGIN()
|
2020-04-24 08:00:00 -04:00
|
|
|
{
|
2021-07-13 11:58:23 -04:00
|
|
|
HRN_FORK_CHILD_BEGIN(0, false)
|
2020-04-24 08:00:00 -04:00
|
|
|
{
|
|
|
|
TEST_RESULT_INT_NE(
|
2021-05-21 17:36:43 -04:00
|
|
|
lockAcquire(cfgOptionStr(cfgOptLockPath), STRDEF("stanza1"), STRDEF("999-ffffffff"), lockTypeBackup, 0, true),
|
2020-11-23 12:41:54 -05:00
|
|
|
-1, "create backup/expire lock");
|
2020-04-24 08:00:00 -04:00
|
|
|
|
|
|
|
sleepMSec(1000);
|
|
|
|
lockRelease(true);
|
|
|
|
}
|
2021-07-13 11:58:23 -04:00
|
|
|
HRN_FORK_CHILD_END();
|
2020-04-24 08:00:00 -04:00
|
|
|
|
2021-07-13 11:58:23 -04:00
|
|
|
HRN_FORK_PARENT_BEGIN()
|
2020-04-24 08:00:00 -04:00
|
|
|
{
|
|
|
|
sleepMSec(250);
|
|
|
|
|
2021-06-01 09:03:44 -04:00
|
|
|
HRN_CFG_LOAD(cfgCmdInfo, argList);
|
2020-04-24 08:00:00 -04:00
|
|
|
TEST_RESULT_STR_Z(
|
|
|
|
infoRender(),
|
|
|
|
"["
|
|
|
|
"{"
|
|
|
|
"\"archive\":["
|
|
|
|
"{"
|
|
|
|
"\"database\":{"
|
2021-01-21 15:21:50 -05:00
|
|
|
"\"id\":2,"
|
|
|
|
"\"repo-key\":1"
|
2020-04-24 08:00:00 -04:00
|
|
|
"},"
|
|
|
|
"\"id\":\"9.4-3\","
|
|
|
|
"\"max\":null,"
|
|
|
|
"\"min\":null"
|
|
|
|
"}"
|
|
|
|
"],"
|
|
|
|
"\"backup\":[],"
|
2021-01-21 15:21:50 -05:00
|
|
|
"\"cipher\":\"none\","
|
2020-04-24 08:00:00 -04:00
|
|
|
"\"db\":["
|
|
|
|
"{"
|
|
|
|
"\"id\":1,"
|
2021-01-21 15:21:50 -05:00
|
|
|
"\"repo-key\":1,"
|
2020-04-24 08:00:00 -04:00
|
|
|
"\"system-id\":6569239123849665666,"
|
|
|
|
"\"version\":\"9.3\""
|
|
|
|
"},"
|
|
|
|
"{"
|
|
|
|
"\"id\":2,"
|
2021-01-21 15:21:50 -05:00
|
|
|
"\"repo-key\":1,"
|
2020-04-24 08:00:00 -04:00
|
|
|
"\"system-id\":6569239123849665679,"
|
|
|
|
"\"version\":\"9.4\""
|
|
|
|
"}"
|
|
|
|
"],"
|
2021-01-21 15:21:50 -05:00
|
|
|
"\"name\":\"stanza1\","
|
|
|
|
"\"repo\":["
|
|
|
|
"{"
|
|
|
|
"\"cipher\":\"none\","
|
|
|
|
"\"key\":1,"
|
|
|
|
"\"status\":{"
|
|
|
|
"\"code\":2,"
|
|
|
|
"\"message\":\"no valid backups\""
|
|
|
|
"}"
|
|
|
|
"}"
|
|
|
|
"],"
|
|
|
|
"\"status\":{"
|
2020-04-24 08:00:00 -04:00
|
|
|
"\"code\":2,"
|
|
|
|
"\"lock\":{\"backup\":{\"held\":true}},"
|
|
|
|
"\"message\":\"no valid backups\""
|
|
|
|
"}"
|
|
|
|
"}"
|
|
|
|
"]",
|
|
|
|
"json - single stanza, no valid backups, backup/expire lock detected");
|
|
|
|
|
2021-06-01 09:03:44 -04:00
|
|
|
HRN_CFG_LOAD(cfgCmdInfo, argListText);
|
2020-04-24 08:00:00 -04:00
|
|
|
TEST_RESULT_STR_Z(
|
|
|
|
infoRender(),
|
|
|
|
"stanza: stanza1\n"
|
|
|
|
" status: error (no valid backups, backup/expire running)\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
" cipher: none\n"
|
2020-04-24 08:00:00 -04:00
|
|
|
"\n"
|
|
|
|
" db (current)\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
" wal archive min/max (9.4): none present\n",
|
2020-04-24 08:00:00 -04:00
|
|
|
"text - single stanza, no valid backups, backup/expire lock detected");
|
|
|
|
|
|
|
|
}
|
2021-07-13 11:58:23 -04:00
|
|
|
HRN_FORK_PARENT_END();
|
2020-04-24 08:00:00 -04:00
|
|
|
}
|
2021-07-13 11:58:23 -04:00
|
|
|
HRN_FORK_END();
|
2020-04-24 08:00:00 -04:00
|
|
|
|
2019-02-21 12:09:12 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------------------------------
|
2021-06-24 08:55:44 -04:00
|
|
|
TEST_TITLE("multi-repo - stanza missing on specified repo");
|
2019-02-21 12:09:12 +02:00
|
|
|
|
2021-06-24 08:55:44 -04:00
|
|
|
StringList *argList2 = strLstDup(argListTextStanzaOpt);
|
2021-05-22 09:30:54 -04:00
|
|
|
hrnCfgArgKeyRawZ(argList2, cfgOptRepoPath, 2, TEST_PATH "/repo2");
|
2021-06-24 08:55:44 -04:00
|
|
|
hrnCfgArgRawZ(argList2, cfgOptRepo, "2");
|
2021-06-01 09:03:44 -04:00
|
|
|
HRN_CFG_LOAD(cfgCmdInfo, argList2);
|
2019-02-21 12:09:12 +02:00
|
|
|
|
2019-12-26 18:08:27 -07:00
|
|
|
TEST_RESULT_STR_Z(
|
|
|
|
infoRender(),
|
2019-02-21 12:09:12 +02:00
|
|
|
"stanza: stanza1\n"
|
2021-06-24 08:55:44 -04:00
|
|
|
" status: error (missing stanza path)\n",
|
|
|
|
"text - multi-repo, requested stanza missing on selected repo");
|
2019-02-21 12:09:12 +02:00
|
|
|
|
2021-01-21 15:21:50 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------------------------------
|
2021-06-24 08:55:44 -04:00
|
|
|
TEST_TITLE("multi-repo - WAL segment on repo1");
|
|
|
|
|
|
|
|
argList2 = strLstDup(argListTextStanzaOpt);
|
2021-05-22 09:30:54 -04:00
|
|
|
hrnCfgArgKeyRawZ(argList2, cfgOptRepoPath, 2, TEST_PATH "/repo2");
|
2021-06-24 08:55:44 -04:00
|
|
|
hrnCfgArgRawZ(argList2, cfgOptRepo, "1");
|
2021-06-01 09:03:44 -04:00
|
|
|
HRN_CFG_LOAD(cfgCmdInfo, argList2);
|
2021-01-21 15:21:50 -05:00
|
|
|
|
2021-06-24 08:55:44 -04:00
|
|
|
// Add WAL segment
|
|
|
|
HRN_STORAGE_PUT_EMPTY(
|
|
|
|
storageRepoIdxWrite(0),
|
|
|
|
STORAGE_REPO_ARCHIVE "/9.4-3/0000000300000000/000000030000000000000001-47dff2b7552a9d66e4bae1a762488a6885e7082c.gz",
|
|
|
|
.comment = "write WAL db3 timeline 3 repo1");
|
|
|
|
|
2021-01-21 15:21:50 -05:00
|
|
|
TEST_RESULT_STR_Z(
|
|
|
|
infoRender(),
|
|
|
|
"stanza: stanza1\n"
|
2021-06-24 08:55:44 -04:00
|
|
|
" status: error (no valid backups)\n"
|
|
|
|
" cipher: none\n"
|
|
|
|
"\n"
|
|
|
|
" db (current)\n"
|
|
|
|
" wal archive min/max (9.4): 000000030000000000000001/000000030000000000000001\n",
|
|
|
|
"text - multi-repo, single stanza, one wal segment");
|
2021-01-21 15:21:50 -05:00
|
|
|
|
2018-12-13 16:22:34 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------------------------------
|
2021-06-24 08:55:44 -04:00
|
|
|
TEST_TITLE("coverage for stanzaStatus branches");
|
|
|
|
|
|
|
|
// Db1 and Db3 (from above) have same system-id and db-version so consider them the same for WAL reporting
|
|
|
|
HRN_STORAGE_PUT_EMPTY(
|
|
|
|
storageRepoIdxWrite(0),
|
|
|
|
STORAGE_REPO_ARCHIVE "/9.4-1/0000000100000000/000000010000000000000002-ac61b8f1ec7b1e6c3eaee9345214595eb7daa9a1.gz",
|
|
|
|
.comment = "write WAL db1 timeline 1 repo1");
|
|
|
|
HRN_STORAGE_PUT_EMPTY(
|
|
|
|
storageRepoIdxWrite(0),
|
|
|
|
STORAGE_REPO_ARCHIVE "/9.4-1/0000000100000000/000000010000000000000003-37dff2b7552a9d66e4bae1a762488a6885e7082c.gz",
|
|
|
|
.comment = "write WAL db1 timeline 1 repo1");
|
|
|
|
HRN_STORAGE_PUT_EMPTY(
|
|
|
|
storageRepoIdxWrite(0),
|
|
|
|
STORAGE_REPO_ARCHIVE "/9.4-1/0000000200000000/000000020000000000000003-37dff2b7552a9d66e4bae1a762488a6885e7082c.gz",
|
|
|
|
.comment = "write WAL db1 timeline 2 repo1");
|
|
|
|
HRN_STORAGE_PATH_CREATE(
|
|
|
|
storageRepoWrite(), STORAGE_REPO_ARCHIVE "/9.4-1/0000000300000000",
|
|
|
|
.comment = "create empty db1 timeline 3 directory");
|
2021-01-21 15:21:50 -05:00
|
|
|
|
|
|
|
// Create a WAL file in 9.3-2 so that a prior will show
|
2021-06-24 08:55:44 -04:00
|
|
|
HRN_STORAGE_PUT_EMPTY(
|
|
|
|
storageRepoIdxWrite(0),
|
|
|
|
STORAGE_REPO_ARCHIVE "/9.3-2/0000000100000000/000000010000000000000001-ac61b8f1ec7b1e6c3eaee9345214595eb7daa9a1.gz",
|
|
|
|
.comment = "write WAL db2 timeline 1 repo1");
|
2021-01-21 15:21:50 -05:00
|
|
|
|
2021-06-24 08:55:44 -04:00
|
|
|
HRN_INFO_PUT(
|
|
|
|
storageRepoIdxWrite(0), INFO_BACKUP_PATH_FILE,
|
2018-12-13 16:22:34 -05:00
|
|
|
"[db]\n"
|
|
|
|
"db-catalog-version=201409291\n"
|
|
|
|
"db-control-version=942\n"
|
|
|
|
"db-id=3\n"
|
|
|
|
"db-system-id=6569239123849665679\n"
|
|
|
|
"db-version=\"9.4\"\n"
|
|
|
|
"\n"
|
|
|
|
"[backup:current]\n"
|
|
|
|
"20181116-154756F={\"backrest-format\":5,\"backrest-version\":\"2.04\","
|
|
|
|
"\"backup-archive-start\":null,\"backup-archive-stop\":null,"
|
|
|
|
"\"backup-info-repo-size\":3159776,\"backup-info-repo-size-delta\":3159,\"backup-info-size\":26897030,"
|
|
|
|
"\"backup-info-size-delta\":26897030,\"backup-timestamp-start\":1542383276,\"backup-timestamp-stop\":1542383289,"
|
|
|
|
"\"backup-type\":\"full\",\"db-id\":1,\"option-archive-check\":true,\"option-archive-copy\":false,"
|
|
|
|
"\"option-backup-standby\":false,\"option-checksum-page\":true,\"option-compress\":true,\"option-hardlink\":false,"
|
|
|
|
"\"option-online\":true}\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
"20201116-154900F={\"backrest-format\":5,\"backrest-version\":\"2.30\","
|
|
|
|
"\"backup-archive-start\":\"000000030000000000000001\",\"backup-archive-stop\":\"000000030000000000000001\","
|
|
|
|
"\"backup-info-repo-size\":3159776,\"backup-info-repo-size-delta\":3159,\"backup-info-size\":26897033,"
|
|
|
|
"\"backup-info-size-delta\":26897033,\"backup-timestamp-start\":1605541676,\"backup-timestamp-stop\":1605541680,"
|
|
|
|
"\"backup-type\":\"full\",\"db-id\":3,\"option-archive-check\":true,\"option-archive-copy\":false,"
|
|
|
|
"\"option-backup-standby\":false,\"option-checksum-page\":true,\"option-compress\":true,\"option-hardlink\":false,"
|
|
|
|
"\"option-online\":true}\n"
|
2018-12-13 16:22:34 -05:00
|
|
|
"\n"
|
|
|
|
"[db:history]\n"
|
|
|
|
"1={\"db-catalog-version\":201409291,\"db-control-version\":942,\"db-system-id\":6569239123849665679,"
|
|
|
|
"\"db-version\":\"9.4\"}\n"
|
|
|
|
"2={\"db-catalog-version\":201306121,\"db-control-version\":937,\"db-system-id\":6569239123849665666,"
|
|
|
|
"\"db-version\":\"9.3\"}\n"
|
|
|
|
"3={\"db-catalog-version\":201409291,\"db-control-version\":942,\"db-system-id\":6569239123849665679,"
|
2021-06-24 08:55:44 -04:00
|
|
|
"\"db-version\":\"9.4\"}\n");
|
2018-12-13 16:22:34 -05:00
|
|
|
|
2021-01-05 15:14:16 -05:00
|
|
|
// Execute while a backup lock is held
|
2021-07-13 11:58:23 -04:00
|
|
|
HRN_FORK_BEGIN()
|
2020-04-24 08:00:00 -04:00
|
|
|
{
|
2021-07-13 11:58:23 -04:00
|
|
|
HRN_FORK_CHILD_BEGIN(0, false)
|
2020-04-24 08:00:00 -04:00
|
|
|
{
|
|
|
|
TEST_RESULT_INT_NE(
|
2021-05-21 17:36:43 -04:00
|
|
|
lockAcquire(cfgOptionStr(cfgOptLockPath), STRDEF("stanza1"), STRDEF("777-afafafaf"), lockTypeBackup, 0, true),
|
2020-11-23 12:41:54 -05:00
|
|
|
-1, "create backup/expire lock");
|
2020-04-24 08:00:00 -04:00
|
|
|
|
|
|
|
sleepMSec(1000);
|
|
|
|
lockRelease(true);
|
|
|
|
}
|
2021-07-13 11:58:23 -04:00
|
|
|
HRN_FORK_CHILD_END();
|
2020-04-24 08:00:00 -04:00
|
|
|
|
2021-07-13 11:58:23 -04:00
|
|
|
HRN_FORK_PARENT_BEGIN()
|
2020-04-24 08:00:00 -04:00
|
|
|
{
|
|
|
|
sleepMSec(250);
|
|
|
|
|
2021-06-01 09:03:44 -04:00
|
|
|
HRN_CFG_LOAD(cfgCmdInfo, argList);
|
2020-04-24 08:00:00 -04:00
|
|
|
TEST_RESULT_STR_Z(
|
|
|
|
infoRender(),
|
|
|
|
"["
|
|
|
|
"{"
|
|
|
|
"\"archive\":["
|
|
|
|
"{"
|
|
|
|
"\"database\":{"
|
2021-01-21 15:21:50 -05:00
|
|
|
"\"id\":1,"
|
|
|
|
"\"repo-key\":1"
|
2020-04-24 08:00:00 -04:00
|
|
|
"},"
|
|
|
|
"\"id\":\"9.4-1\","
|
|
|
|
"\"max\":\"000000020000000000000003\","
|
|
|
|
"\"min\":\"000000010000000000000002\""
|
|
|
|
"},"
|
|
|
|
"{"
|
|
|
|
"\"database\":{"
|
2021-01-21 15:21:50 -05:00
|
|
|
"\"id\":2,"
|
|
|
|
"\"repo-key\":1"
|
|
|
|
"},"
|
|
|
|
"\"id\":\"9.3-2\","
|
|
|
|
"\"max\":\"000000010000000000000001\","
|
|
|
|
"\"min\":\"000000010000000000000001\""
|
|
|
|
"},"
|
|
|
|
"{"
|
|
|
|
"\"database\":{"
|
|
|
|
"\"id\":3,"
|
|
|
|
"\"repo-key\":1"
|
2020-04-24 08:00:00 -04:00
|
|
|
"},"
|
|
|
|
"\"id\":\"9.4-3\","
|
2021-01-21 15:21:50 -05:00
|
|
|
"\"max\":\"000000030000000000000001\","
|
|
|
|
"\"min\":\"000000030000000000000001\""
|
2020-04-24 08:00:00 -04:00
|
|
|
"}"
|
|
|
|
"],"
|
|
|
|
"\"backup\":["
|
|
|
|
"{"
|
|
|
|
"\"archive\":{"
|
|
|
|
"\"start\":null,"
|
|
|
|
"\"stop\":null"
|
|
|
|
"},"
|
|
|
|
"\"backrest\":{"
|
|
|
|
"\"format\":5,"
|
|
|
|
"\"version\":\"2.04\""
|
|
|
|
"},"
|
|
|
|
"\"database\":{"
|
2021-01-21 15:21:50 -05:00
|
|
|
"\"id\":1,"
|
|
|
|
"\"repo-key\":1"
|
2020-04-24 08:00:00 -04:00
|
|
|
"},"
|
|
|
|
"\"info\":{"
|
|
|
|
"\"delta\":26897030,"
|
|
|
|
"\"repository\":{"
|
|
|
|
"\"delta\":3159,"
|
|
|
|
"\"size\":3159776"
|
|
|
|
"},"
|
|
|
|
"\"size\":26897030"
|
|
|
|
"},"
|
|
|
|
"\"label\":\"20181116-154756F\","
|
|
|
|
"\"prior\":null,"
|
|
|
|
"\"reference\":null,"
|
|
|
|
"\"timestamp\":{"
|
|
|
|
"\"start\":1542383276,"
|
|
|
|
"\"stop\":1542383289"
|
|
|
|
"},"
|
|
|
|
"\"type\":\"full\""
|
2021-01-21 15:21:50 -05:00
|
|
|
"},"
|
|
|
|
"{"
|
|
|
|
"\"archive\":{"
|
|
|
|
"\"start\":\"000000030000000000000001\","
|
|
|
|
"\"stop\":\"000000030000000000000001\""
|
|
|
|
"},"
|
|
|
|
"\"backrest\":{"
|
|
|
|
"\"format\":5,"
|
|
|
|
"\"version\":\"2.30\""
|
|
|
|
"},"
|
|
|
|
"\"database\":{"
|
|
|
|
"\"id\":3,"
|
|
|
|
"\"repo-key\":1"
|
|
|
|
"},"
|
|
|
|
"\"info\":{"
|
|
|
|
"\"delta\":26897033,"
|
|
|
|
"\"repository\":{"
|
|
|
|
"\"delta\":3159,"
|
|
|
|
"\"size\":3159776"
|
|
|
|
"},"
|
|
|
|
"\"size\":26897033"
|
|
|
|
"},"
|
|
|
|
"\"label\":\"20201116-154900F\","
|
|
|
|
"\"prior\":null,"
|
|
|
|
"\"reference\":null,"
|
|
|
|
"\"timestamp\":{"
|
|
|
|
"\"start\":1605541676,"
|
|
|
|
"\"stop\":1605541680"
|
|
|
|
"},"
|
|
|
|
"\"type\":\"full\""
|
2020-04-24 08:00:00 -04:00
|
|
|
"}"
|
|
|
|
"],"
|
|
|
|
"\"cipher\":\"none\","
|
|
|
|
"\"db\":["
|
|
|
|
"{"
|
|
|
|
"\"id\":1,"
|
2021-01-21 15:21:50 -05:00
|
|
|
"\"repo-key\":1,"
|
2020-04-24 08:00:00 -04:00
|
|
|
"\"system-id\":6569239123849665679,"
|
|
|
|
"\"version\":\"9.4\""
|
|
|
|
"},"
|
|
|
|
"{"
|
|
|
|
"\"id\":2,"
|
2021-01-21 15:21:50 -05:00
|
|
|
"\"repo-key\":1,"
|
2020-04-24 08:00:00 -04:00
|
|
|
"\"system-id\":6569239123849665666,"
|
|
|
|
"\"version\":\"9.3\""
|
|
|
|
"},"
|
|
|
|
"{"
|
|
|
|
"\"id\":3,"
|
2021-01-21 15:21:50 -05:00
|
|
|
"\"repo-key\":1,"
|
2020-04-24 08:00:00 -04:00
|
|
|
"\"system-id\":6569239123849665679,"
|
|
|
|
"\"version\":\"9.4\""
|
|
|
|
"}"
|
|
|
|
"],"
|
2021-01-21 15:21:50 -05:00
|
|
|
"\"name\":\"stanza1\","
|
|
|
|
"\"repo\":["
|
|
|
|
"{"
|
|
|
|
"\"cipher\":\"none\","
|
|
|
|
"\"key\":1,"
|
|
|
|
"\"status\":{"
|
|
|
|
"\"code\":0,"
|
|
|
|
"\"message\":\"ok\""
|
|
|
|
"}"
|
|
|
|
"}"
|
|
|
|
"],"
|
|
|
|
"\"status\":{"
|
2020-04-24 08:00:00 -04:00
|
|
|
"\"code\":0,"
|
|
|
|
"\"lock\":{\"backup\":{\"held\":true}},"
|
|
|
|
"\"message\":\"ok\""
|
|
|
|
"}"
|
|
|
|
"}"
|
|
|
|
"]",
|
|
|
|
"json - single stanza, valid backup, no priors, no archives in latest DB, backup/expire lock detected");
|
|
|
|
|
2021-06-01 09:03:44 -04:00
|
|
|
HRN_CFG_LOAD(cfgCmdInfo, argListText);
|
2020-04-24 08:00:00 -04:00
|
|
|
TEST_RESULT_STR_Z(
|
|
|
|
infoRender(),
|
|
|
|
"stanza: stanza1\n"
|
|
|
|
" status: ok (backup/expire running)\n"
|
|
|
|
" cipher: none\n"
|
|
|
|
"\n"
|
|
|
|
" db (prior)\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
" wal archive min/max (9.3): 000000010000000000000001/000000010000000000000001\n"
|
|
|
|
"\n"
|
|
|
|
" db (current)\n"
|
|
|
|
" wal archive min/max (9.4): 000000010000000000000002/000000030000000000000001\n"
|
2020-04-24 08:00:00 -04:00
|
|
|
"\n"
|
|
|
|
" full backup: 20181116-154756F\n"
|
|
|
|
" timestamp start/stop: 2018-11-16 15:47:56 / 2018-11-16 15:48:09\n"
|
|
|
|
" wal start/stop: n/a\n"
|
2021-01-25 09:19:05 -05:00
|
|
|
" database size: 25.7MB, database backup size: 25.7MB\n"
|
|
|
|
" repo1: backup set size: 3MB, backup size: 3KB\n"
|
2020-04-24 08:00:00 -04:00
|
|
|
"\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
" full backup: 20201116-154900F\n"
|
|
|
|
" timestamp start/stop: 2020-11-16 15:47:56 / 2020-11-16 15:48:00\n"
|
|
|
|
" wal start/stop: 000000030000000000000001 / 000000030000000000000001\n"
|
2021-01-25 09:19:05 -05:00
|
|
|
" database size: 25.7MB, database backup size: 25.7MB\n"
|
|
|
|
" repo1: backup set size: 3MB, backup size: 3KB\n",
|
2020-04-24 08:00:00 -04:00
|
|
|
"text - single stanza, valid backup, no priors, no archives in latest DB, backup/expire lock detected");
|
|
|
|
}
|
2021-07-13 11:58:23 -04:00
|
|
|
HRN_FORK_PARENT_END();
|
2020-04-24 08:00:00 -04:00
|
|
|
}
|
2021-07-13 11:58:23 -04:00
|
|
|
HRN_FORK_END();
|
2020-04-24 08:00:00 -04:00
|
|
|
|
2021-01-21 15:21:50 -05:00
|
|
|
// Cleanup
|
2021-06-28 13:28:28 -04:00
|
|
|
HRN_STORAGE_PATH_REMOVE(storageTest, TEST_PATH "/repo/" STORAGE_PATH_ARCHIVE "/stanza1/9.3-2", .recurse = true);
|
|
|
|
HRN_STORAGE_PATH_REMOVE(storageTest, TEST_PATH "/repo/" STORAGE_PATH_ARCHIVE "/stanza1/9.4-3", .recurse = true);
|
2021-01-21 15:21:50 -05:00
|
|
|
|
|
|
|
// backup.info/archive.info files exist, backups exist, archives exist, multi-repo (mixed) with one stanza existing on both
|
|
|
|
// repos and the db history is different between the repos
|
2018-12-13 16:22:34 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------------------------------
|
2021-01-21 15:21:50 -05:00
|
|
|
TEST_TITLE("mixed multi-repo");
|
|
|
|
|
2021-06-24 08:55:44 -04:00
|
|
|
HRN_INFO_PUT(
|
2021-06-28 13:28:28 -04:00
|
|
|
storageTest, TEST_PATH "/repo/" STORAGE_PATH_ARCHIVE "/stanza1/" INFO_ARCHIVE_FILE,
|
2018-12-13 16:22:34 -05:00
|
|
|
"[db]\n"
|
|
|
|
"db-id=2\n"
|
|
|
|
"db-system-id=6626363367545678089\n"
|
|
|
|
"db-version=\"9.5\"\n"
|
|
|
|
"\n"
|
|
|
|
"[db:history]\n"
|
|
|
|
"1={\"db-id\":6625592122879095702,\"db-version\":\"9.4\"}\n"
|
2021-06-24 08:55:44 -04:00
|
|
|
"2={\"db-id\":6626363367545678089,\"db-version\":\"9.5\"}\n",
|
|
|
|
.comment = "put archive info to file - stanza1, repo1");
|
2018-12-13 16:22:34 -05:00
|
|
|
|
2021-06-24 08:55:44 -04:00
|
|
|
HRN_INFO_PUT(
|
2021-06-28 13:28:28 -04:00
|
|
|
storageTest, TEST_PATH "/repo/" STORAGE_PATH_BACKUP "/stanza1/" INFO_BACKUP_FILE,
|
2018-12-13 16:22:34 -05:00
|
|
|
"[backup:current]\n"
|
|
|
|
"20181119-152138F={"
|
|
|
|
"\"backrest-format\":5,\"backrest-version\":\"2.08dev\","
|
|
|
|
"\"backup-archive-start\":\"000000010000000000000002\",\"backup-archive-stop\":\"000000010000000000000002\","
|
|
|
|
"\"backup-info-repo-size\":2369186,\"backup-info-repo-size-delta\":2369186,"
|
|
|
|
"\"backup-info-size\":20162900,\"backup-info-size-delta\":20162900,"
|
2021-01-21 15:21:50 -05:00
|
|
|
"\"backup-timestamp-start\":1542640898,\"backup-timestamp-stop\":1542640899,\"backup-type\":\"full\","
|
2018-12-13 16:22:34 -05:00
|
|
|
"\"db-id\":1,\"option-archive-check\":true,\"option-archive-copy\":false,\"option-backup-standby\":false,"
|
|
|
|
"\"option-checksum-page\":true,\"option-compress\":true,\"option-hardlink\":false,\"option-online\":true}\n"
|
|
|
|
"20181119-152138F_20181119-152152D={"
|
|
|
|
"\"backrest-format\":5,\"backrest-version\":\"2.08dev\",\"backup-archive-start\":\"000000010000000000000003\","
|
2021-01-21 15:21:50 -05:00
|
|
|
"\"backup-archive-stop\":\"000000020000000000000003\",\"backup-info-repo-size\":2369186,"
|
2018-12-13 16:22:34 -05:00
|
|
|
"\"backup-info-repo-size-delta\":346,\"backup-info-size\":20162900,\"backup-info-size-delta\":8428,"
|
|
|
|
"\"backup-prior\":\"20181119-152138F\",\"backup-reference\":[\"20181119-152138F\"],"
|
|
|
|
"\"backup-timestamp-start\":1542640912,\"backup-timestamp-stop\":1542640915,\"backup-type\":\"diff\","
|
|
|
|
"\"db-id\":1,\"option-archive-check\":true,\"option-archive-copy\":false,\"option-backup-standby\":false,"
|
|
|
|
"\"option-checksum-page\":true,\"option-compress\":true,\"option-hardlink\":false,\"option-online\":true}\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
"20181119-152138F_20181119-152155I={"
|
2018-12-13 16:22:34 -05:00
|
|
|
"\"backrest-format\":5,\"backrest-version\":\"2.08dev\",\"backup-archive-start\":\"000000010000000000000003\","
|
|
|
|
"\"backup-info-repo-size\":2369186,"
|
|
|
|
"\"backup-info-repo-size-delta\":346,\"backup-info-size\":20162900,\"backup-info-size-delta\":8428,"
|
|
|
|
"\"backup-prior\":\"20181119-152138F_20181119-152152D\","
|
|
|
|
"\"backup-reference\":[\"20181119-152138F\",\"20181119-152138F_20181119-152152D\"],"
|
2021-01-21 15:21:50 -05:00
|
|
|
"\"backup-timestamp-start\":1542640915,\"backup-timestamp-stop\":1542640917,\"backup-type\":\"incr\","
|
2018-12-13 16:22:34 -05:00
|
|
|
"\"db-id\":1,\"option-archive-check\":true,\"option-archive-copy\":false,\"option-backup-standby\":false,"
|
|
|
|
"\"option-checksum-page\":true,\"option-compress\":true,\"option-hardlink\":false,\"option-online\":true}\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
"20201116-155000F={"
|
|
|
|
"\"backrest-format\":5,\"backrest-version\":\"2.30\","
|
|
|
|
"\"backup-archive-start\":\"000000010000000000000002\",\"backup-archive-stop\":\"000000010000000000000003\","
|
|
|
|
"\"backup-info-repo-size\":3159000,\"backup-info-repo-size-delta\":3100,\"backup-info-size\":26897000,"
|
|
|
|
"\"backup-info-size-delta\":26897020,\"backup-timestamp-start\":1605541800,\"backup-timestamp-stop\":1605541802,"
|
|
|
|
"\"backup-type\":\"full\",\"db-id\":2,\"option-archive-check\":true,\"option-archive-copy\":true,"
|
|
|
|
"\"option-backup-standby\":false,\"option-checksum-page\":false,\"option-compress\":false,\"option-hardlink\":false,"
|
|
|
|
"\"option-online\":true}\n"
|
|
|
|
"20201116-155000F_20201119-152100I={"
|
|
|
|
"\"backrest-format\":5,\"backrest-version\":\"2.30\","
|
|
|
|
"\"backup-archive-start\":\"000000010000000000000005\",\"backup-archive-stop\":\"000000010000000000000005\","
|
|
|
|
"\"backup-info-repo-size\":2369186,"
|
|
|
|
"\"backup-info-repo-size-delta\":346,\"backup-info-size\":20162900,\"backup-info-size-delta\":8428,"
|
|
|
|
"\"backup-prior\":\"20201116-155000F\",\"backup-reference\":[\"20201116-155000F\"],"
|
|
|
|
"\"backup-timestamp-start\":1605799260,\"backup-timestamp-stop\":1605799263,\"backup-type\":\"incr\","
|
|
|
|
"\"db-id\":2,\"option-archive-check\":true,\"option-archive-copy\":false,\"option-backup-standby\":false,"
|
|
|
|
"\"option-checksum-page\":true,\"option-compress\":true,\"option-hardlink\":false,\"option-online\":true}\n"
|
2018-12-13 16:22:34 -05:00
|
|
|
"\n"
|
|
|
|
"[db]\n"
|
|
|
|
"db-catalog-version=201510051\n"
|
|
|
|
"db-control-version=942\n"
|
|
|
|
"db-id=2\n"
|
|
|
|
"db-system-id=6626363367545678089\n"
|
|
|
|
"db-version=\"9.5\"\n"
|
|
|
|
"\n"
|
|
|
|
"[db:history]\n"
|
|
|
|
"1={\"db-catalog-version\":201409291,\"db-control-version\":942,\"db-system-id\":6625592122879095702,"
|
|
|
|
"\"db-version\":\"9.4\"}\n"
|
|
|
|
"2={\"db-catalog-version\":201510051,\"db-control-version\":942,\"db-system-id\":6626363367545678089,"
|
2021-06-24 08:55:44 -04:00
|
|
|
"\"db-version\":\"9.5\"}\n",
|
|
|
|
.comment = "put backup info to file - stanza1, repo1");
|
2018-12-13 16:22:34 -05:00
|
|
|
|
2019-09-30 12:39:38 -04:00
|
|
|
// Manifest with all features
|
|
|
|
#define TEST_MANIFEST_HEADER \
|
|
|
|
"[backup]\n" \
|
|
|
|
"backup-archive-start=\"000000030000028500000089\"\n" \
|
|
|
|
"backup-archive-stop=\"000000030000028500000089\"\n" \
|
|
|
|
"backup-label=\"20190818-084502F_20190820-084502D\"\n" \
|
|
|
|
"backup-lsn-start=\"285/89000028\"\n" \
|
|
|
|
"backup-lsn-stop=\"285/89001F88\"\n" \
|
|
|
|
"backup-prior=\"20190818-084502F\"\n" \
|
|
|
|
"backup-timestamp-copy-start=1565282141\n" \
|
|
|
|
"backup-timestamp-start=1565282140\n" \
|
|
|
|
"backup-timestamp-stop=1565282142\n" \
|
|
|
|
"backup-type=\"full\"\n" \
|
|
|
|
"\n" \
|
|
|
|
"[backup:db]\n" \
|
|
|
|
"db-catalog-version=201409291\n" \
|
|
|
|
"db-control-version=942\n" \
|
|
|
|
"db-id=1\n" \
|
|
|
|
"db-system-id=1000000000000000094\n" \
|
|
|
|
"db-version=\"9.4\"\n" \
|
|
|
|
"\n" \
|
|
|
|
"[backup:option]\n" \
|
|
|
|
"option-archive-check=true\n" \
|
|
|
|
"option-archive-copy=true\n" \
|
|
|
|
"option-backup-standby=false\n" \
|
|
|
|
"option-buffer-size=16384\n" \
|
|
|
|
"option-checksum-page=true\n" \
|
|
|
|
"option-compress=false\n" \
|
|
|
|
"option-compress-level=3\n" \
|
|
|
|
"option-compress-level-network=3\n" \
|
|
|
|
"option-delta=false\n" \
|
|
|
|
"option-hardlink=false\n" \
|
|
|
|
"option-online=false\n" \
|
|
|
|
"option-process-max=32\n"
|
|
|
|
|
|
|
|
#define TEST_MANIFEST_TARGET \
|
|
|
|
"\n" \
|
|
|
|
"[backup:target]\n" \
|
|
|
|
"pg_data={\"path\":\"/pg/base\",\"type\":\"path\"}\n" \
|
|
|
|
"pg_data/pg_hba.conf={\"file\":\"pg_hba.conf\",\"path\":\"../pg_config\",\"type\":\"link\"}\n" \
|
|
|
|
"pg_data/pg_stat={\"path\":\"../pg_stat\",\"type\":\"link\"}\n" \
|
|
|
|
"pg_tblspc/1={\"path\":\"/tblspc/ts1\",\"tablespace-id\":\"1\",\"tablespace-name\":\"ts1\",\"type\":\"link\"}\n" \
|
|
|
|
"pg_tblspc/12={\"path\":\"/tblspc/ts12\",\"tablespace-id\":\"12\",\"tablespace-name\":\"ts12\",\"type\":\"link\"}\n"
|
|
|
|
|
|
|
|
#define TEST_MANIFEST_DB \
|
|
|
|
"\n" \
|
|
|
|
"[db]\n" \
|
|
|
|
"mail={\"db-id\":16456,\"db-last-system-id\":12168}\n" \
|
|
|
|
"postgres={\"db-id\":12173,\"db-last-system-id\":12168}\n" \
|
|
|
|
"template0={\"db-id\":12168,\"db-last-system-id\":12168}\n" \
|
|
|
|
"template1={\"db-id\":1,\"db-last-system-id\":12168}\n" \
|
|
|
|
|
|
|
|
#define TEST_MANIFEST_FILE \
|
|
|
|
"\n" \
|
|
|
|
"[target:file]\n" \
|
|
|
|
"pg_data/PG_VERSION={\"checksum\":\"184473f470864e067ee3a22e64b47b0a1c356f29\",\"master\":true" \
|
|
|
|
",\"reference\":\"20190818-084502F_20190819-084506D\",\"size\":4,\"timestamp\":1565282114}\n" \
|
|
|
|
"pg_data/base/16384/17000={\"checksum\":\"e0101dd8ffb910c9c202ca35b5f828bcb9697bed\",\"checksum-page\":false" \
|
|
|
|
",\"checksum-page-error\":[1],\"repo-size\":4096,\"size\":8192,\"timestamp\":1565282114}\n" \
|
|
|
|
"pg_data/base/16384/PG_VERSION={\"checksum\":\"184473f470864e067ee3a22e64b47b0a1c356f29\",\"group\":false,\"size\":4" \
|
|
|
|
",\"timestamp\":1565282115}\n" \
|
|
|
|
"pg_data/base/32768/33000={\"checksum\":\"7a16d165e4775f7c92e8cdf60c0af57313f0bf90\",\"checksum-page\":true" \
|
|
|
|
",\"reference\":\"20190818-084502F\",\"size\":1073741824,\"timestamp\":1565282116}\n" \
|
|
|
|
"pg_data/base/32768/33000.32767={\"checksum\":\"6e99b589e550e68e934fd235ccba59fe5b592a9e\",\"checksum-page\":true" \
|
|
|
|
",\"reference\":\"20190818-084502F\",\"size\":32768,\"timestamp\":1565282114}\n" \
|
|
|
|
"pg_data/postgresql.conf={\"checksum\":\"6721d92c9fcdf4248acff1f9a1377127d9064807\",\"master\":true,\"size\":4457" \
|
|
|
|
",\"timestamp\":1565282114}\n" \
|
|
|
|
"pg_data/special={\"master\":true,\"mode\":\"0640\",\"size\":0,\"timestamp\":1565282120,\"user\":false}\n"
|
|
|
|
|
|
|
|
#define TEST_MANIFEST_FILE_DEFAULT \
|
|
|
|
"\n" \
|
|
|
|
"[target:file:default]\n" \
|
|
|
|
"group=\"group1\"\n" \
|
|
|
|
"master=false\n" \
|
|
|
|
"mode=\"0600\"\n" \
|
|
|
|
"user=\"user1\"\n"
|
|
|
|
|
|
|
|
#define TEST_MANIFEST_LINK \
|
|
|
|
"\n" \
|
|
|
|
"[target:link]\n" \
|
|
|
|
"pg_data/pg_stat={\"destination\":\"../pg_stat\"}\n" \
|
|
|
|
"pg_data/postgresql.conf={\"destination\":\"../pg_config/postgresql.conf\",\"group\":false,\"user\":\"user1\"}\n"
|
|
|
|
|
|
|
|
#define TEST_MANIFEST_LINK_DEFAULT \
|
|
|
|
"\n" \
|
|
|
|
"[target:link:default]\n" \
|
|
|
|
"group=\"group1\"\n" \
|
|
|
|
"user=false\n"
|
|
|
|
|
|
|
|
#define TEST_MANIFEST_PATH \
|
|
|
|
"\n" \
|
|
|
|
"[target:path]\n" \
|
|
|
|
"pg_data={\"user\":\"user2\"}\n" \
|
|
|
|
"pg_data/base={\"group\":\"group2\"}\n" \
|
|
|
|
"pg_data/base/16384={\"mode\":\"0750\"}\n" \
|
|
|
|
"pg_data/base/32768={}\n" \
|
|
|
|
"pg_data/base/65536={\"user\":false}\n"
|
|
|
|
|
|
|
|
#define TEST_MANIFEST_PATH_DEFAULT \
|
|
|
|
"\n" \
|
|
|
|
"[target:path:default]\n" \
|
|
|
|
"group=false\n" \
|
|
|
|
"mode=\"0700\"\n" \
|
|
|
|
"user=\"user1\"\n"
|
|
|
|
|
2021-06-24 08:55:44 -04:00
|
|
|
HRN_INFO_PUT(
|
2021-06-28 13:28:28 -04:00
|
|
|
storageTest, TEST_PATH "/repo/" STORAGE_PATH_BACKUP "/stanza1/20181119-152138F_20181119-152155I/" BACKUP_MANIFEST_FILE,
|
2019-09-30 12:39:38 -04:00
|
|
|
TEST_MANIFEST_HEADER
|
|
|
|
TEST_MANIFEST_TARGET
|
|
|
|
TEST_MANIFEST_DB
|
|
|
|
TEST_MANIFEST_FILE
|
|
|
|
TEST_MANIFEST_FILE_DEFAULT
|
|
|
|
TEST_MANIFEST_LINK
|
|
|
|
TEST_MANIFEST_LINK_DEFAULT
|
|
|
|
TEST_MANIFEST_PATH
|
2021-06-24 08:55:44 -04:00
|
|
|
TEST_MANIFEST_PATH_DEFAULT,
|
|
|
|
.comment = "write manifest - stanza1, repo1");
|
2018-12-13 16:22:34 -05:00
|
|
|
|
2021-06-24 08:55:44 -04:00
|
|
|
HRN_INFO_PUT(
|
2021-06-28 13:28:28 -04:00
|
|
|
storageTest, TEST_PATH "/repo/" STORAGE_PATH_ARCHIVE "/stanza2/" INFO_ARCHIVE_FILE,
|
2018-12-13 16:22:34 -05:00
|
|
|
"[db]\n"
|
|
|
|
"db-id=1\n"
|
|
|
|
"db-system-id=6625633699176220261\n"
|
|
|
|
"db-version=\"9.4\"\n"
|
|
|
|
"\n"
|
|
|
|
"[db:history]\n"
|
2021-06-24 08:55:44 -04:00
|
|
|
"1={\"db-id\":6625633699176220261,\"db-version\":\"9.4\"}\n",
|
|
|
|
.comment = "put archive info to file - stanza2, repo1");
|
|
|
|
HRN_INFO_PUT(
|
2021-06-28 13:28:28 -04:00
|
|
|
storageTest, TEST_PATH "/repo/" STORAGE_PATH_BACKUP "/stanza2/" INFO_BACKUP_FILE,
|
2018-12-13 16:22:34 -05:00
|
|
|
"[db]\n"
|
|
|
|
"db-catalog-version=201409291\n"
|
|
|
|
"db-control-version=942\n"
|
|
|
|
"db-id=1\n"
|
|
|
|
"db-system-id=6625633699176220261\n"
|
|
|
|
"db-version=\"9.4\"\n"
|
|
|
|
"\n"
|
|
|
|
"[db:history]\n"
|
|
|
|
"1={\"db-catalog-version\":201409291,\"db-control-version\":942,\"db-system-id\":6625633699176220261,"
|
2021-06-24 08:55:44 -04:00
|
|
|
"\"db-version\":\"9.4\"}\n",
|
|
|
|
.comment = "put backup info to file - stanza2, repo1");
|
|
|
|
|
|
|
|
// Write encrypted info files to encrypted repo2
|
|
|
|
HRN_INFO_PUT(
|
|
|
|
storageTest, TEST_PATH "/repo2/" STORAGE_PATH_ARCHIVE "/stanza1/" INFO_ARCHIVE_FILE,
|
2021-01-21 15:21:50 -05:00
|
|
|
"[db]\n"
|
|
|
|
"db-id=1\n"
|
|
|
|
"db-system-id=6626363367545678089\n"
|
|
|
|
"db-version=\"9.5\"\n"
|
2018-12-13 16:22:34 -05:00
|
|
|
"\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
"[cipher]\n"
|
|
|
|
"cipher-pass=\"" TEST_CIPHER_PASS_ARCHIVE "\"\n"
|
2018-12-13 16:22:34 -05:00
|
|
|
"\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
"[db:history]\n"
|
2021-06-24 08:55:44 -04:00
|
|
|
"1={\"db-id\":6626363367545678089,\"db-version\":\"9.5\"}\n",
|
|
|
|
.cipherType = cipherTypeAes256Cbc, .cipherPass = TEST_CIPHER_PASS,
|
|
|
|
.comment = "write encrypted archive.info, stanza1, repo2");
|
|
|
|
HRN_INFO_PUT(
|
|
|
|
storageTest, TEST_PATH "/repo2/" STORAGE_PATH_BACKUP "/stanza1/" INFO_BACKUP_FILE,
|
2021-01-21 15:21:50 -05:00
|
|
|
"[db]\n"
|
|
|
|
"db-catalog-version=201510051\n"
|
|
|
|
"db-control-version=942\n"
|
|
|
|
"db-id=1\n"
|
|
|
|
"db-system-id=6626363367545678089\n"
|
|
|
|
"db-version=\"9.5\"\n"
|
2018-12-13 16:22:34 -05:00
|
|
|
"\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
"[backup:current]\n"
|
|
|
|
"20201116-200000F={\"backrest-format\":5,\"backrest-version\":\"2.30\","
|
|
|
|
"\"backup-archive-start\":\"000000010000000000000004\",\"backup-archive-stop\":\"000000010000000000000004\","
|
|
|
|
"\"backup-info-repo-size\":3159000,\"backup-info-repo-size-delta\":3100,\"backup-info-size\":26897000,"
|
|
|
|
"\"backup-info-size-delta\":26897020,\"backup-timestamp-start\":1605556800,\"backup-timestamp-stop\":1605556805,"
|
|
|
|
"\"backup-type\":\"full\",\"db-id\":1,\"option-archive-check\":true,\"option-archive-copy\":true,"
|
|
|
|
"\"option-backup-standby\":true,\"option-checksum-page\":false,\"option-compress\":false,\"option-hardlink\":true,"
|
|
|
|
"\"option-online\":true}\n"
|
2018-12-14 18:25:31 -05:00
|
|
|
"\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
"[cipher]\n"
|
|
|
|
"cipher-pass=\"somepass\"\n"
|
2018-12-13 16:22:34 -05:00
|
|
|
"\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
"[db:history]\n"
|
|
|
|
"1={\"db-catalog-version\":201510051,\"db-control-version\":942,\"db-system-id\":6626363367545678089,"
|
2021-06-24 08:55:44 -04:00
|
|
|
"\"db-version\":\"9.5\"}\n",
|
|
|
|
.cipherType = cipherTypeAes256Cbc, .cipherPass = TEST_CIPHER_PASS,
|
|
|
|
.comment = "write encrypted backup.info, stanza1, repo2");
|
2019-09-30 12:39:38 -04:00
|
|
|
|
2021-01-21 15:21:50 -05:00
|
|
|
// Add WAL on repo1 and encrypted repo2 for stanza1
|
2021-06-24 08:55:44 -04:00
|
|
|
HRN_STORAGE_PUT_EMPTY(
|
2021-06-28 13:28:28 -04:00
|
|
|
storageTest, TEST_PATH "/repo/" STORAGE_PATH_ARCHIVE
|
2021-06-24 08:55:44 -04:00
|
|
|
"/stanza1/9.5-2/0000000100000000/000000010000000000000002-ac61b8f1ec7b1e6c3eaee9345214595eb7daa9a1.gz");
|
|
|
|
HRN_STORAGE_PUT_EMPTY(
|
2021-06-28 13:28:28 -04:00
|
|
|
storageTest, TEST_PATH "/repo/" STORAGE_PATH_ARCHIVE
|
2021-06-24 08:55:44 -04:00
|
|
|
"/stanza1/9.5-2/0000000100000000/000000010000000000000003-37dff2b7552a9d66e4bae1a762488a6885e7082c.gz");
|
|
|
|
HRN_STORAGE_PUT_EMPTY(
|
2021-06-28 13:28:28 -04:00
|
|
|
storageTest, TEST_PATH "/repo/" STORAGE_PATH_ARCHIVE
|
2021-06-24 08:55:44 -04:00
|
|
|
"/stanza1/9.5-2/0000000100000000/000000010000000000000004-ee61b8f1ec7b1e6c3eaee9345214595eb7daa9a1.gz");
|
|
|
|
HRN_STORAGE_PUT_EMPTY(
|
2021-06-28 13:28:28 -04:00
|
|
|
storageTest, TEST_PATH "/repo/" STORAGE_PATH_ARCHIVE
|
2021-06-24 08:55:44 -04:00
|
|
|
"/stanza1/9.5-2/0000000100000000/000000010000000000000005-abc123f1ec7b1e6c3eaee9345214595eb7daa9a1.gz");
|
|
|
|
|
|
|
|
HRN_STORAGE_PUT_EMPTY(
|
|
|
|
storageTest, TEST_PATH "/repo2/" STORAGE_PATH_ARCHIVE
|
|
|
|
"/stanza1/9.5-1/0000000100000000/000000010000000000000003-37dff2b7552a9d66e4bae1a762488a6885e7082c.gz");
|
|
|
|
HRN_STORAGE_PUT_EMPTY(
|
|
|
|
storageTest, TEST_PATH "/repo2/" STORAGE_PATH_ARCHIVE
|
|
|
|
"/stanza1/9.5-1/0000000100000000/000000010000000000000004-ff61b8f1ec7b1e6c3eaee9345214595eb7daa9a1.gz");
|
2021-01-21 15:21:50 -05:00
|
|
|
|
|
|
|
// Add a manifest on the encrypted repo2
|
|
|
|
#define TEST_MANIFEST_HEADER2 \
|
|
|
|
"[backup]\n" \
|
|
|
|
"backup-archive-start=\"000000010000000000000004\"\n" \
|
|
|
|
"backup-archive-stop=\"000000010000000000000004\"\n" \
|
|
|
|
"backup-label=\"20201116-200000F\"\n" \
|
|
|
|
"backup-timestamp-copy-start=1605556800\n" \
|
|
|
|
"backup-timestamp-start=1605556800\n" \
|
|
|
|
"backup-timestamp-stop=1605556802\n" \
|
|
|
|
"backup-type=\"full\"\n" \
|
|
|
|
"\n" \
|
|
|
|
"[backup:db]\n" \
|
|
|
|
"db-catalog-version=201510051\n" \
|
|
|
|
"db-control-version=942\n" \
|
|
|
|
"db-id=1\n" \
|
|
|
|
"db-system-id=6626363367545678089\n" \
|
|
|
|
"db-version=\"9.5\"\n" \
|
|
|
|
"\n" \
|
|
|
|
"[backup:option]\n" \
|
|
|
|
"option-archive-check=true\n" \
|
|
|
|
"option-archive-copy=true\n" \
|
|
|
|
"option-backup-standby=true\n" \
|
|
|
|
"option-buffer-size=16384\n" \
|
|
|
|
"option-checksum-page=false\n" \
|
|
|
|
"option-compress=false\n" \
|
|
|
|
"option-compress-level=3\n" \
|
|
|
|
"option-compress-level-network=3\n" \
|
|
|
|
"option-delta=false\n" \
|
|
|
|
"option-hardlink=true\n" \
|
|
|
|
"option-online=true\n" \
|
|
|
|
"option-process-max=32\n" \
|
|
|
|
|
2021-06-24 08:55:44 -04:00
|
|
|
// Create encrypted manifest file
|
|
|
|
HRN_INFO_PUT(
|
|
|
|
storageTest, TEST_PATH "/repo2/" STORAGE_PATH_BACKUP "/stanza1/20201116-200000F/" BACKUP_MANIFEST_FILE,
|
2021-01-21 15:21:50 -05:00
|
|
|
TEST_MANIFEST_HEADER2
|
|
|
|
TEST_MANIFEST_TARGET
|
|
|
|
"\n"
|
|
|
|
"[cipher]\n"
|
|
|
|
"cipher-pass=\"someotherpass\"\n"
|
|
|
|
TEST_MANIFEST_DB
|
|
|
|
TEST_MANIFEST_FILE
|
|
|
|
TEST_MANIFEST_FILE_DEFAULT
|
|
|
|
TEST_MANIFEST_LINK
|
|
|
|
TEST_MANIFEST_LINK_DEFAULT
|
|
|
|
TEST_MANIFEST_PATH
|
2021-06-24 08:55:44 -04:00
|
|
|
TEST_MANIFEST_PATH_DEFAULT,
|
|
|
|
.cipherType = cipherTypeAes256Cbc, .cipherPass = "somepass",
|
|
|
|
.comment = "write encrypted manifest, stanza1, repo2");
|
2021-01-21 15:21:50 -05:00
|
|
|
|
|
|
|
// Create a stanza on repo2 that is not on repo1
|
2021-06-24 08:55:44 -04:00
|
|
|
HRN_INFO_PUT(
|
|
|
|
storageTest, TEST_PATH "/repo2/" STORAGE_PATH_ARCHIVE "/stanza3/" INFO_ARCHIVE_FILE,
|
2021-01-21 15:21:50 -05:00
|
|
|
"[db]\n"
|
|
|
|
"db-id=1\n"
|
|
|
|
"db-system-id=6626363367545678089\n"
|
|
|
|
"db-version=\"9.4\"\n"
|
|
|
|
"\n"
|
|
|
|
"[cipher]\n"
|
|
|
|
"cipher-pass=\"" TEST_CIPHER_PASS_ARCHIVE "\"\n"
|
|
|
|
"\n"
|
|
|
|
"[db:history]\n"
|
2021-06-24 08:55:44 -04:00
|
|
|
"1={\"db-id\":6626363367545678089,\"db-version\":\"9.4\"}\n",
|
|
|
|
.cipherType = cipherTypeAes256Cbc, .cipherPass = TEST_CIPHER_PASS,
|
|
|
|
.comment = "write encrypted archive.info, repo2, stanza3");
|
|
|
|
HRN_INFO_PUT(
|
|
|
|
storageTest, TEST_PATH "/repo2/" STORAGE_PATH_BACKUP "/stanza3/" INFO_BACKUP_FILE,
|
2021-01-21 15:21:50 -05:00
|
|
|
"[db]\n"
|
|
|
|
"db-catalog-version=201409291\n"
|
|
|
|
"db-control-version=942\n"
|
|
|
|
"db-id=1\n"
|
|
|
|
"db-system-id=6626363367545678089\n"
|
|
|
|
"db-version=\"9.4\"\n"
|
|
|
|
"\n"
|
|
|
|
"[backup:current]\n"
|
|
|
|
"20201110-100000F={\"backrest-format\":5,\"backrest-version\":\"2.25\","
|
|
|
|
"\"backup-archive-start\":\"000000010000000000000001\",\"backup-archive-stop\":\"000000010000000000000002\","
|
|
|
|
"\"backup-info-repo-size\":3159000,\"backup-info-repo-size-delta\":3100,\"backup-info-size\":26897000,"
|
|
|
|
"\"backup-info-size-delta\":26897020,\"backup-timestamp-start\":1605002400,\"backup-timestamp-stop\":1605002402,"
|
|
|
|
"\"backup-type\":\"full\",\"db-id\":1,\"option-archive-check\":true,\"option-archive-copy\":true,"
|
|
|
|
"\"option-backup-standby\":true,\"option-checksum-page\":false,\"option-compress\":false,\"option-hardlink\":true,"
|
|
|
|
"\"option-online\":true}\n"
|
|
|
|
"\n"
|
|
|
|
"[cipher]\n"
|
|
|
|
"cipher-pass=\"somepass\"\n"
|
|
|
|
"\n"
|
|
|
|
"[db:history]\n"
|
|
|
|
"1={\"db-catalog-version\":201409291,\"db-control-version\":942,\"db-system-id\":6626363367545678089,"
|
2021-06-24 08:55:44 -04:00
|
|
|
"\"db-version\":\"9.4\"}\n",
|
|
|
|
.cipherType = cipherTypeAes256Cbc, .cipherPass = TEST_CIPHER_PASS,
|
|
|
|
.comment = "write encrypted backup.info, repo2, stanza3");
|
|
|
|
|
|
|
|
// Store some WAL in stanza on repo2 that is not on repo1
|
|
|
|
HRN_STORAGE_PUT_EMPTY(
|
|
|
|
storageTest, TEST_PATH "/repo2/" STORAGE_PATH_ARCHIVE
|
|
|
|
"/stanza3/9.4-1/0000000100000000/000000010000000000000001-11dff2b7552a9d66e4bae1a762488a6885e7082c.gz");
|
|
|
|
HRN_STORAGE_PUT_EMPTY(
|
|
|
|
storageTest, TEST_PATH "/repo2/" STORAGE_PATH_ARCHIVE
|
|
|
|
"/stanza3/9.4-1/0000000100000000/000000010000000000000002-2261b8f1ec7b1e6c3eaee9345214595eb7daa9a1.gz");
|
2021-01-21 15:21:50 -05:00
|
|
|
|
|
|
|
// Set up the configuration
|
|
|
|
StringList *argListMultiRepo = strLstNew();
|
2021-06-28 13:28:28 -04:00
|
|
|
hrnCfgArgRawZ(argListMultiRepo, cfgOptRepoPath, TEST_PATH "/repo");
|
2021-05-22 09:30:54 -04:00
|
|
|
hrnCfgArgKeyRawZ(argListMultiRepo, cfgOptRepoPath, 2, TEST_PATH "/repo2");
|
2021-04-28 11:36:20 -04:00
|
|
|
hrnCfgArgKeyRawStrId(argListMultiRepo, cfgOptRepoCipherType, 2, cipherTypeAes256Cbc);
|
2021-01-21 15:21:50 -05:00
|
|
|
hrnCfgEnvKeyRawZ(cfgOptRepoCipherPass, 2, TEST_CIPHER_PASS);
|
|
|
|
|
|
|
|
StringList *argListMultiRepoJson = strLstDup(argListMultiRepo);
|
|
|
|
hrnCfgArgRawZ(argListMultiRepoJson, cfgOptOutput, "json");
|
|
|
|
|
2021-07-13 11:58:23 -04:00
|
|
|
HRN_FORK_BEGIN()
|
2021-01-21 15:21:50 -05:00
|
|
|
{
|
2021-07-13 11:58:23 -04:00
|
|
|
HRN_FORK_CHILD_BEGIN(0, false)
|
2021-01-21 15:21:50 -05:00
|
|
|
{
|
|
|
|
TEST_RESULT_INT_NE(
|
2021-05-21 17:36:43 -04:00
|
|
|
lockAcquire(cfgOptionStr(cfgOptLockPath), STRDEF("stanza2"), STRDEF("999-ffffffff"), lockTypeBackup, 0, true),
|
2021-01-21 15:21:50 -05:00
|
|
|
-1, "create backup/expire lock");
|
|
|
|
|
|
|
|
sleepMSec(1000);
|
|
|
|
lockRelease(true);
|
|
|
|
}
|
2021-07-13 11:58:23 -04:00
|
|
|
HRN_FORK_CHILD_END();
|
2021-01-21 15:21:50 -05:00
|
|
|
|
2021-07-13 11:58:23 -04:00
|
|
|
HRN_FORK_PARENT_BEGIN()
|
2021-01-21 15:21:50 -05:00
|
|
|
{
|
|
|
|
sleepMSec(250);
|
|
|
|
|
2021-06-01 09:03:44 -04:00
|
|
|
HRN_CFG_LOAD(cfgCmdInfo, argListMultiRepoJson);
|
2021-01-21 15:21:50 -05:00
|
|
|
TEST_RESULT_STR_Z(
|
|
|
|
infoRender(),
|
|
|
|
"["
|
|
|
|
"{"
|
|
|
|
"\"archive\":["
|
|
|
|
"{"
|
|
|
|
"\"database\":{"
|
|
|
|
"\"id\":1,"
|
|
|
|
"\"repo-key\":1"
|
|
|
|
"},"
|
|
|
|
"\"id\":\"9.4-1\","
|
|
|
|
"\"max\":\"000000020000000000000003\","
|
|
|
|
"\"min\":\"000000010000000000000002\""
|
|
|
|
"},"
|
|
|
|
"{"
|
|
|
|
"\"database\":{"
|
|
|
|
"\"id\":2,"
|
|
|
|
"\"repo-key\":1"
|
|
|
|
"},"
|
|
|
|
"\"id\":\"9.5-2\","
|
|
|
|
"\"max\":\"000000010000000000000005\","
|
|
|
|
"\"min\":\"000000010000000000000002\""
|
|
|
|
"},"
|
|
|
|
"{"
|
|
|
|
"\"database\":{"
|
|
|
|
"\"id\":1,"
|
|
|
|
"\"repo-key\":2"
|
|
|
|
"},"
|
|
|
|
"\"id\":\"9.5-1\","
|
|
|
|
"\"max\":\"000000010000000000000004\","
|
|
|
|
"\"min\":\"000000010000000000000003\""
|
|
|
|
"}"
|
|
|
|
"],"
|
|
|
|
"\"backup\":["
|
|
|
|
"{"
|
|
|
|
"\"archive\":{"
|
|
|
|
"\"start\":\"000000010000000000000002\","
|
|
|
|
"\"stop\":\"000000010000000000000002\""
|
|
|
|
"},"
|
|
|
|
"\"backrest\":{"
|
|
|
|
"\"format\":5,"
|
|
|
|
"\"version\":\"2.08dev\""
|
|
|
|
"},"
|
|
|
|
"\"database\":{"
|
|
|
|
"\"id\":1,"
|
|
|
|
"\"repo-key\":1"
|
|
|
|
"},"
|
|
|
|
"\"info\":{"
|
|
|
|
"\"delta\":20162900,"
|
|
|
|
"\"repository\":{"
|
|
|
|
"\"delta\":2369186,"
|
|
|
|
"\"size\":2369186"
|
|
|
|
"},"
|
|
|
|
"\"size\":20162900"
|
|
|
|
"},"
|
|
|
|
"\"label\":\"20181119-152138F\","
|
|
|
|
"\"prior\":null,"
|
|
|
|
"\"reference\":null,"
|
|
|
|
"\"timestamp\":{"
|
|
|
|
"\"start\":1542640898,"
|
|
|
|
"\"stop\":1542640899"
|
|
|
|
"},"
|
|
|
|
"\"type\":\"full\""
|
|
|
|
"},"
|
|
|
|
"{"
|
|
|
|
"\"archive\":{"
|
|
|
|
"\"start\":\"000000010000000000000003\","
|
|
|
|
"\"stop\":\"000000020000000000000003\""
|
|
|
|
"},"
|
|
|
|
"\"backrest\":{"
|
|
|
|
"\"format\":5,"
|
|
|
|
"\"version\":\"2.08dev\""
|
|
|
|
"},"
|
|
|
|
"\"database\":{"
|
|
|
|
"\"id\":1,"
|
|
|
|
"\"repo-key\":1"
|
|
|
|
"},"
|
|
|
|
"\"info\":{"
|
|
|
|
"\"delta\":8428,"
|
|
|
|
"\"repository\":{"
|
|
|
|
"\"delta\":346,"
|
|
|
|
"\"size\":2369186"
|
|
|
|
"},"
|
|
|
|
"\"size\":20162900"
|
|
|
|
"},"
|
|
|
|
"\"label\":\"20181119-152138F_20181119-152152D\","
|
|
|
|
"\"prior\":\"20181119-152138F\","
|
|
|
|
"\"reference\":["
|
|
|
|
"\"20181119-152138F\""
|
|
|
|
"],"
|
|
|
|
"\"timestamp\":{"
|
|
|
|
"\"start\":1542640912,"
|
|
|
|
"\"stop\":1542640915"
|
|
|
|
"},"
|
|
|
|
"\"type\":\"diff\""
|
|
|
|
"},"
|
|
|
|
"{"
|
|
|
|
"\"archive\":{"
|
|
|
|
"\"start\":\"000000010000000000000003\","
|
|
|
|
"\"stop\":null"
|
|
|
|
"},"
|
|
|
|
"\"backrest\":{"
|
|
|
|
"\"format\":5,"
|
|
|
|
"\"version\":\"2.08dev\""
|
|
|
|
"},"
|
|
|
|
"\"database\":{"
|
|
|
|
"\"id\":1,"
|
|
|
|
"\"repo-key\":1"
|
|
|
|
"},"
|
|
|
|
"\"info\":{"
|
|
|
|
"\"delta\":8428,"
|
|
|
|
"\"repository\":{"
|
|
|
|
"\"delta\":346,"
|
|
|
|
"\"size\":2369186"
|
|
|
|
"},"
|
|
|
|
"\"size\":20162900"
|
|
|
|
"},"
|
|
|
|
"\"label\":\"20181119-152138F_20181119-152155I\","
|
|
|
|
"\"prior\":\"20181119-152138F_20181119-152152D\","
|
|
|
|
"\"reference\":["
|
|
|
|
"\"20181119-152138F\","
|
|
|
|
"\"20181119-152138F_20181119-152152D\""
|
|
|
|
"],"
|
|
|
|
"\"timestamp\":{"
|
|
|
|
"\"start\":1542640915,"
|
|
|
|
"\"stop\":1542640917"
|
|
|
|
"},"
|
|
|
|
"\"type\":\"incr\""
|
|
|
|
"},"
|
|
|
|
"{"
|
|
|
|
"\"archive\":{"
|
|
|
|
"\"start\":\"000000010000000000000002\","
|
|
|
|
"\"stop\":\"000000010000000000000003\""
|
|
|
|
"},"
|
|
|
|
"\"backrest\":{"
|
|
|
|
"\"format\":5,"
|
|
|
|
"\"version\":\"2.30\""
|
|
|
|
"},"
|
|
|
|
"\"database\":{"
|
|
|
|
"\"id\":2,"
|
|
|
|
"\"repo-key\":1"
|
|
|
|
"},"
|
|
|
|
"\"info\":{"
|
|
|
|
"\"delta\":26897020,"
|
|
|
|
"\"repository\":{"
|
|
|
|
"\"delta\":3100,"
|
|
|
|
"\"size\":3159000"
|
|
|
|
"},"
|
|
|
|
"\"size\":26897000"
|
|
|
|
"},"
|
|
|
|
"\"label\":\"20201116-155000F\","
|
|
|
|
"\"prior\":null,"
|
|
|
|
"\"reference\":null,"
|
|
|
|
"\"timestamp\":{"
|
|
|
|
"\"start\":1605541800,"
|
|
|
|
"\"stop\":1605541802"
|
|
|
|
"},"
|
|
|
|
"\"type\":\"full\""
|
|
|
|
"},"
|
|
|
|
"{"
|
|
|
|
"\"archive\":{"
|
|
|
|
"\"start\":\"000000010000000000000004\","
|
|
|
|
"\"stop\":\"000000010000000000000004\""
|
|
|
|
"},"
|
|
|
|
"\"backrest\":{"
|
|
|
|
"\"format\":5,"
|
|
|
|
"\"version\":\"2.30\""
|
|
|
|
"},"
|
|
|
|
"\"database\":{"
|
|
|
|
"\"id\":1,"
|
|
|
|
"\"repo-key\":2"
|
|
|
|
"},"
|
|
|
|
"\"info\":{"
|
|
|
|
"\"delta\":26897020,"
|
|
|
|
"\"repository\":{"
|
|
|
|
"\"delta\":3100,"
|
|
|
|
"\"size\":3159000"
|
|
|
|
"},"
|
|
|
|
"\"size\":26897000"
|
|
|
|
"},"
|
|
|
|
"\"label\":\"20201116-200000F\","
|
|
|
|
"\"prior\":null,"
|
|
|
|
"\"reference\":null,"
|
|
|
|
"\"timestamp\":{"
|
|
|
|
"\"start\":1605556800,"
|
|
|
|
"\"stop\":1605556805"
|
|
|
|
"},"
|
|
|
|
"\"type\":\"full\""
|
|
|
|
"},"
|
|
|
|
"{"
|
|
|
|
"\"archive\":{"
|
|
|
|
"\"start\":\"000000010000000000000005\","
|
|
|
|
"\"stop\":\"000000010000000000000005\""
|
|
|
|
"},"
|
|
|
|
"\"backrest\":{"
|
|
|
|
"\"format\":5,"
|
|
|
|
"\"version\":\"2.30\""
|
|
|
|
"},"
|
|
|
|
"\"database\":{"
|
|
|
|
"\"id\":2,"
|
|
|
|
"\"repo-key\":1"
|
|
|
|
"},"
|
|
|
|
"\"info\":{"
|
|
|
|
"\"delta\":8428,"
|
|
|
|
"\"repository\":{"
|
|
|
|
"\"delta\":346,"
|
|
|
|
"\"size\":2369186"
|
|
|
|
"},"
|
|
|
|
"\"size\":20162900"
|
|
|
|
"},"
|
|
|
|
"\"label\":\"20201116-155000F_20201119-152100I\","
|
|
|
|
"\"prior\":\"20201116-155000F\","
|
|
|
|
"\"reference\":["
|
|
|
|
"\"20201116-155000F\""
|
|
|
|
"],"
|
|
|
|
"\"timestamp\":{"
|
|
|
|
"\"start\":1605799260,"
|
|
|
|
"\"stop\":1605799263"
|
|
|
|
"},"
|
|
|
|
"\"type\":\"incr\""
|
|
|
|
"}"
|
|
|
|
"],"
|
|
|
|
"\"cipher\":\"mixed\","
|
|
|
|
"\"db\":["
|
|
|
|
"{"
|
|
|
|
"\"id\":1,"
|
|
|
|
"\"repo-key\":1,"
|
|
|
|
"\"system-id\":6625592122879095702,"
|
|
|
|
"\"version\":\"9.4\""
|
|
|
|
"},"
|
|
|
|
"{"
|
|
|
|
"\"id\":2,"
|
|
|
|
"\"repo-key\":1,"
|
|
|
|
"\"system-id\":6626363367545678089,"
|
|
|
|
"\"version\":\"9.5\""
|
|
|
|
"},"
|
|
|
|
"{"
|
|
|
|
"\"id\":1,"
|
|
|
|
"\"repo-key\":2,"
|
|
|
|
"\"system-id\":6626363367545678089,"
|
|
|
|
"\"version\":\"9.5\""
|
|
|
|
"}"
|
|
|
|
"],"
|
|
|
|
"\"name\":\"stanza1\","
|
|
|
|
"\"repo\":["
|
|
|
|
"{"
|
|
|
|
"\"cipher\":\"none\","
|
|
|
|
"\"key\":1,"
|
|
|
|
"\"status\":{"
|
|
|
|
"\"code\":0,"
|
|
|
|
"\"message\":\"ok\""
|
|
|
|
"}"
|
|
|
|
"},"
|
|
|
|
"{"
|
|
|
|
"\"cipher\":\"aes-256-cbc\","
|
|
|
|
"\"key\":2,"
|
|
|
|
"\"status\":{"
|
|
|
|
"\"code\":0,"
|
|
|
|
"\"message\":\"ok\""
|
|
|
|
"}"
|
|
|
|
"}"
|
|
|
|
"],"
|
|
|
|
"\"status\":{"
|
|
|
|
"\"code\":0,"
|
|
|
|
"\"lock\":{\"backup\":{\"held\":false}},"
|
|
|
|
"\"message\":\"ok\""
|
|
|
|
"}"
|
|
|
|
"},"
|
|
|
|
"{"
|
|
|
|
"\"archive\":["
|
|
|
|
"{"
|
|
|
|
"\"database\":{"
|
|
|
|
"\"id\":1,"
|
|
|
|
"\"repo-key\":1"
|
|
|
|
"},"
|
|
|
|
"\"id\":\"9.4-1\","
|
|
|
|
"\"max\":null,"
|
|
|
|
"\"min\":null"
|
|
|
|
"}"
|
|
|
|
"],"
|
|
|
|
"\"backup\":[],"
|
|
|
|
"\"cipher\":\"mixed\","
|
|
|
|
"\"db\":["
|
|
|
|
"{"
|
|
|
|
"\"id\":1,"
|
|
|
|
"\"repo-key\":1,"
|
|
|
|
"\"system-id\":6625633699176220261,"
|
|
|
|
"\"version\":\"9.4\""
|
|
|
|
"}"
|
|
|
|
"],"
|
|
|
|
"\"name\":\"stanza2\","
|
|
|
|
"\"repo\":["
|
|
|
|
"{"
|
|
|
|
"\"cipher\":\"none\","
|
|
|
|
"\"key\":1,"
|
|
|
|
"\"status\":{"
|
|
|
|
"\"code\":2,"
|
|
|
|
"\"message\":\"no valid backups\""
|
|
|
|
"}"
|
|
|
|
"},"
|
|
|
|
"{"
|
|
|
|
"\"cipher\":\"aes-256-cbc\","
|
|
|
|
"\"key\":2,"
|
|
|
|
"\"status\":{"
|
|
|
|
"\"code\":1,"
|
|
|
|
"\"message\":\"missing stanza path\""
|
|
|
|
"}"
|
|
|
|
"}"
|
|
|
|
"],"
|
|
|
|
"\"status\":{"
|
|
|
|
"\"code\":4,"
|
|
|
|
"\"lock\":{\"backup\":{\"held\":true}},"
|
|
|
|
"\"message\":\"different across repos\""
|
|
|
|
"}"
|
|
|
|
"},"
|
|
|
|
"{"
|
|
|
|
"\"archive\":["
|
|
|
|
"{"
|
|
|
|
"\"database\":{"
|
|
|
|
"\"id\":1,"
|
|
|
|
"\"repo-key\":2"
|
|
|
|
"},"
|
|
|
|
"\"id\":\"9.4-1\","
|
|
|
|
"\"max\":\"000000010000000000000002\","
|
|
|
|
"\"min\":\"000000010000000000000001\""
|
|
|
|
"}"
|
|
|
|
"],"
|
|
|
|
"\"backup\":["
|
|
|
|
"{"
|
|
|
|
"\"archive\":{"
|
|
|
|
"\"start\":\"000000010000000000000001\","
|
|
|
|
"\"stop\":\"000000010000000000000002\""
|
|
|
|
"},"
|
|
|
|
"\"backrest\":{"
|
|
|
|
"\"format\":5,"
|
|
|
|
"\"version\":\"2.25\""
|
|
|
|
"},"
|
|
|
|
"\"database\":{"
|
|
|
|
"\"id\":1,"
|
|
|
|
"\"repo-key\":2"
|
|
|
|
"},"
|
|
|
|
"\"info\":{"
|
|
|
|
"\"delta\":26897020,"
|
|
|
|
"\"repository\":{"
|
|
|
|
"\"delta\":3100,"
|
|
|
|
"\"size\":3159000"
|
|
|
|
"},"
|
|
|
|
"\"size\":26897000"
|
|
|
|
"},"
|
|
|
|
"\"label\":\"20201110-100000F\","
|
|
|
|
"\"prior\":null,"
|
|
|
|
"\"reference\":null,"
|
|
|
|
"\"timestamp\":{"
|
|
|
|
"\"start\":1605002400,"
|
|
|
|
"\"stop\":1605002402"
|
|
|
|
"},"
|
|
|
|
"\"type\":\"full\""
|
|
|
|
"}"
|
|
|
|
"],"
|
|
|
|
"\"cipher\":\"mixed\","
|
|
|
|
"\"db\":["
|
|
|
|
"{"
|
|
|
|
"\"id\":1,"
|
|
|
|
"\"repo-key\":2,"
|
|
|
|
"\"system-id\":6626363367545678089,"
|
|
|
|
"\"version\":\"9.4\""
|
|
|
|
"}"
|
|
|
|
"],"
|
|
|
|
"\"name\":\"stanza3\","
|
|
|
|
"\"repo\":["
|
|
|
|
"{"
|
|
|
|
"\"cipher\":\"none\","
|
|
|
|
"\"key\":1,"
|
|
|
|
"\"status\":{"
|
|
|
|
"\"code\":1,"
|
|
|
|
"\"message\":\"missing stanza path\""
|
|
|
|
"}"
|
|
|
|
"},"
|
|
|
|
"{"
|
|
|
|
"\"cipher\":\"aes-256-cbc\","
|
|
|
|
"\"key\":2,"
|
|
|
|
"\"status\":{"
|
|
|
|
"\"code\":0,"
|
|
|
|
"\"message\":\"ok\""
|
|
|
|
"}"
|
|
|
|
"}"
|
|
|
|
"],"
|
|
|
|
"\"status\":{"
|
|
|
|
"\"code\":4,"
|
|
|
|
"\"lock\":{\"backup\":{\"held\":false}},"
|
|
|
|
"\"message\":\"different across repos\""
|
|
|
|
"}"
|
|
|
|
"}"
|
|
|
|
"]",
|
|
|
|
"json - multiple stanzas, some with valid backups, archives in latest DB, backup lock held on one stanza");
|
|
|
|
}
|
2021-07-13 11:58:23 -04:00
|
|
|
HRN_FORK_PARENT_END();
|
2021-01-21 15:21:50 -05:00
|
|
|
}
|
2021-07-13 11:58:23 -04:00
|
|
|
HRN_FORK_END();
|
2021-01-21 15:21:50 -05:00
|
|
|
|
2021-07-13 11:58:23 -04:00
|
|
|
HRN_FORK_BEGIN()
|
2021-01-21 15:21:50 -05:00
|
|
|
{
|
2021-07-13 11:58:23 -04:00
|
|
|
HRN_FORK_CHILD_BEGIN(0, false)
|
2021-01-21 15:21:50 -05:00
|
|
|
{
|
|
|
|
TEST_RESULT_INT_NE(
|
2021-05-21 17:36:43 -04:00
|
|
|
lockAcquire(cfgOptionStr(cfgOptLockPath), STRDEF("stanza2"), STRDEF("999-ffffffff"), lockTypeBackup, 0, true),
|
2021-01-21 15:21:50 -05:00
|
|
|
-1, "create backup/expire lock");
|
|
|
|
|
|
|
|
sleepMSec(1000);
|
|
|
|
lockRelease(true);
|
|
|
|
}
|
2021-07-13 11:58:23 -04:00
|
|
|
HRN_FORK_CHILD_END();
|
2021-01-21 15:21:50 -05:00
|
|
|
|
2021-07-13 11:58:23 -04:00
|
|
|
HRN_FORK_PARENT_BEGIN()
|
2021-01-21 15:21:50 -05:00
|
|
|
{
|
|
|
|
sleepMSec(250);
|
|
|
|
|
2021-06-01 09:03:44 -04:00
|
|
|
HRN_CFG_LOAD(cfgCmdInfo, argListMultiRepo);
|
2021-01-21 15:21:50 -05:00
|
|
|
TEST_RESULT_STR_Z(
|
|
|
|
infoRender(),
|
|
|
|
"stanza: stanza1\n"
|
|
|
|
" status: ok\n"
|
|
|
|
" cipher: mixed\n"
|
|
|
|
" repo1: none\n"
|
|
|
|
" repo2: aes-256-cbc\n"
|
|
|
|
"\n"
|
|
|
|
" db (prior)\n"
|
|
|
|
" wal archive min/max (9.4): 000000010000000000000002/000000020000000000000003\n"
|
|
|
|
"\n"
|
|
|
|
" full backup: 20181119-152138F\n"
|
|
|
|
" timestamp start/stop: 2018-11-19 15:21:38 / 2018-11-19 15:21:39\n"
|
|
|
|
" wal start/stop: 000000010000000000000002 / 000000010000000000000002\n"
|
2021-01-25 09:19:05 -05:00
|
|
|
" database size: 19.2MB, database backup size: 19.2MB\n"
|
|
|
|
" repo1: backup set size: 2.3MB, backup size: 2.3MB\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
"\n"
|
|
|
|
" diff backup: 20181119-152138F_20181119-152152D\n"
|
|
|
|
" timestamp start/stop: 2018-11-19 15:21:52 / 2018-11-19 15:21:55\n"
|
|
|
|
" wal start/stop: 000000010000000000000003 / 000000020000000000000003\n"
|
2021-01-25 09:19:05 -05:00
|
|
|
" database size: 19.2MB, database backup size: 8.2KB\n"
|
|
|
|
" repo1: backup set size: 2.3MB, backup size: 346B\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
" backup reference list: 20181119-152138F\n"
|
|
|
|
"\n"
|
|
|
|
" incr backup: 20181119-152138F_20181119-152155I\n"
|
|
|
|
" timestamp start/stop: 2018-11-19 15:21:55 / 2018-11-19 15:21:57\n"
|
|
|
|
" wal start/stop: n/a\n"
|
2021-01-25 09:19:05 -05:00
|
|
|
" database size: 19.2MB, database backup size: 8.2KB\n"
|
|
|
|
" repo1: backup set size: 2.3MB, backup size: 346B\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
" backup reference list: 20181119-152138F, 20181119-152138F_20181119-152152D\n"
|
|
|
|
"\n"
|
|
|
|
" db (current)\n"
|
|
|
|
" wal archive min/max (9.5): 000000010000000000000002/000000010000000000000005\n"
|
|
|
|
"\n"
|
|
|
|
" full backup: 20201116-155000F\n"
|
|
|
|
" timestamp start/stop: 2020-11-16 15:50:00 / 2020-11-16 15:50:02\n"
|
|
|
|
" wal start/stop: 000000010000000000000002 / 000000010000000000000003\n"
|
2021-01-25 09:19:05 -05:00
|
|
|
" database size: 25.7MB, database backup size: 25.7MB\n"
|
|
|
|
" repo1: backup set size: 3MB, backup size: 3KB\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
"\n"
|
|
|
|
" full backup: 20201116-200000F\n"
|
|
|
|
" timestamp start/stop: 2020-11-16 20:00:00 / 2020-11-16 20:00:05\n"
|
|
|
|
" wal start/stop: 000000010000000000000004 / 000000010000000000000004\n"
|
2021-01-25 09:19:05 -05:00
|
|
|
" database size: 25.7MB, database backup size: 25.7MB\n"
|
|
|
|
" repo2: backup set size: 3MB, backup size: 3KB\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
"\n"
|
|
|
|
" incr backup: 20201116-155000F_20201119-152100I\n"
|
|
|
|
" timestamp start/stop: 2020-11-19 15:21:00 / 2020-11-19 15:21:03\n"
|
|
|
|
" wal start/stop: 000000010000000000000005 / 000000010000000000000005\n"
|
2021-01-25 09:19:05 -05:00
|
|
|
" database size: 19.2MB, database backup size: 8.2KB\n"
|
|
|
|
" repo1: backup set size: 2.3MB, backup size: 346B\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
" backup reference list: 20201116-155000F\n"
|
|
|
|
"\n"
|
|
|
|
"stanza: stanza2\n"
|
|
|
|
" status: mixed (backup/expire running)\n"
|
|
|
|
" repo1: error (no valid backups)\n"
|
|
|
|
" repo2: error (missing stanza path)\n"
|
|
|
|
" cipher: mixed\n"
|
|
|
|
" repo1: none\n"
|
|
|
|
" repo2: aes-256-cbc\n"
|
|
|
|
"\n"
|
|
|
|
" db (current)\n"
|
|
|
|
" wal archive min/max (9.4): none present\n"
|
|
|
|
"\n"
|
|
|
|
"stanza: stanza3\n"
|
|
|
|
" status: mixed\n"
|
|
|
|
" repo1: error (missing stanza path)\n"
|
|
|
|
" repo2: ok\n"
|
|
|
|
" cipher: mixed\n"
|
|
|
|
" repo1: none\n"
|
|
|
|
" repo2: aes-256-cbc\n"
|
|
|
|
"\n"
|
|
|
|
" db (current)\n"
|
|
|
|
" wal archive min/max (9.4): 000000010000000000000001/000000010000000000000002\n"
|
|
|
|
"\n"
|
|
|
|
" full backup: 20201110-100000F\n"
|
|
|
|
" timestamp start/stop: 2020-11-10 10:00:00 / 2020-11-10 10:00:02\n"
|
|
|
|
" wal start/stop: 000000010000000000000001 / 000000010000000000000002\n"
|
2021-01-25 09:19:05 -05:00
|
|
|
" database size: 25.7MB, database backup size: 25.7MB\n"
|
|
|
|
" repo2: backup set size: 3MB, backup size: 3KB\n",
|
2021-01-21 15:21:50 -05:00
|
|
|
"text - multiple stanzas, multi-repo with valid backups, backup lock held on one stanza");
|
|
|
|
}
|
2021-07-13 11:58:23 -04:00
|
|
|
HRN_FORK_PARENT_END();
|
2021-01-21 15:21:50 -05:00
|
|
|
}
|
2021-07-13 11:58:23 -04:00
|
|
|
HRN_FORK_END();
|
2021-01-21 15:21:50 -05:00
|
|
|
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
//--------------------------------------------------------------------------------------------------------------------------
|
2021-06-24 08:55:44 -04:00
|
|
|
TEST_TITLE("multi-repo: stanza exists but requested backup does not");
|
|
|
|
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
argList2 = strLstDup(argListMultiRepo);
|
2021-06-24 08:55:44 -04:00
|
|
|
hrnCfgArgRawZ(argList2, cfgOptStanza, "stanza1");
|
|
|
|
hrnCfgArgRawZ(argList2, cfgOptSet, "bogus");
|
2021-06-01 09:03:44 -04:00
|
|
|
HRN_CFG_LOAD(cfgCmdInfo, argList2);
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
|
|
|
|
TEST_RESULT_STR_Z(
|
|
|
|
infoRender(),
|
|
|
|
"stanza: stanza1\n"
|
|
|
|
" status: error (requested backup not found)\n"
|
|
|
|
" cipher: mixed\n"
|
|
|
|
" repo1: none\n"
|
|
|
|
" repo2: aes-256-cbc\n",
|
|
|
|
"text, multi-repo, backup not found");
|
|
|
|
|
2021-01-21 15:21:50 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------------------------------
|
2021-06-24 08:55:44 -04:00
|
|
|
TEST_TITLE("multi-repo: backup set requested on single repo, with 1 checksum error");
|
|
|
|
|
2021-01-21 15:21:50 -05:00
|
|
|
argList2 = strLstDup(argListMultiRepo);
|
2021-06-24 08:55:44 -04:00
|
|
|
hrnCfgArgRawZ(argList2, cfgOptStanza, "stanza1");
|
|
|
|
hrnCfgArgRawZ(argList2, cfgOptSet, "20181119-152138F_20181119-152155I");
|
|
|
|
hrnCfgArgRawZ(argList2, cfgOptRepo, "1");
|
2021-06-01 09:03:44 -04:00
|
|
|
HRN_CFG_LOAD(cfgCmdInfo, argList2);
|
2021-01-21 15:21:50 -05:00
|
|
|
|
|
|
|
TEST_RESULT_STR_Z(
|
|
|
|
infoRender(),
|
|
|
|
"stanza: stanza1\n"
|
|
|
|
" status: ok\n"
|
|
|
|
" cipher: none\n"
|
|
|
|
"\n"
|
|
|
|
" db (prior)\n"
|
|
|
|
" wal archive min/max (9.4): 000000010000000000000002/000000020000000000000003\n"
|
|
|
|
"\n"
|
|
|
|
" incr backup: 20181119-152138F_20181119-152155I\n"
|
|
|
|
" timestamp start/stop: 2018-11-19 15:21:55 / 2018-11-19 15:21:57\n"
|
|
|
|
" wal start/stop: n/a\n"
|
2021-01-25 09:19:05 -05:00
|
|
|
" database size: 19.2MB, database backup size: 8.2KB\n"
|
|
|
|
" repo1: backup set size: 2.3MB, backup size: 346B\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
" backup reference list: 20181119-152138F, 20181119-152138F_20181119-152152D\n"
|
|
|
|
" database list: mail (16456), postgres (12173)\n"
|
|
|
|
" symlinks:\n"
|
2019-09-30 12:39:38 -04:00
|
|
|
" pg_hba.conf => ../pg_config/pg_hba.conf\n"
|
|
|
|
" pg_stat => ../pg_stat\n"
|
|
|
|
" tablespaces:\n"
|
|
|
|
" ts1 (1) => /tblspc/ts1\n"
|
2020-11-25 18:14:03 +01:00
|
|
|
" ts12 (12) => /tblspc/ts12\n"
|
|
|
|
" page checksum error: base/16384/17000\n",
|
2019-12-26 18:08:27 -07:00
|
|
|
"text - backup set requested");
|
2019-09-30 12:39:38 -04:00
|
|
|
|
2021-01-21 15:21:50 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------------------------------
|
2021-06-24 08:55:44 -04:00
|
|
|
TEST_TITLE("multi-repo: read encrypted manifest and confirm requested database found without setting --repo");
|
|
|
|
|
2021-01-21 15:21:50 -05:00
|
|
|
argList2 = strLstDup(argListMultiRepo);
|
2021-06-24 08:55:44 -04:00
|
|
|
hrnCfgArgRawZ(argList2, cfgOptStanza, "stanza1");
|
|
|
|
hrnCfgArgRawZ(argList2, cfgOptSet, "20201116-200000F");
|
2021-06-01 09:03:44 -04:00
|
|
|
HRN_CFG_LOAD(cfgCmdInfo, argList2);
|
2021-01-21 15:21:50 -05:00
|
|
|
|
|
|
|
TEST_RESULT_STR_Z(
|
|
|
|
infoRender(),
|
|
|
|
"stanza: stanza1\n"
|
|
|
|
" status: ok\n"
|
2021-01-25 09:19:05 -05:00
|
|
|
" cipher: mixed\n"
|
|
|
|
" repo1: none\n"
|
|
|
|
" repo2: aes-256-cbc\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
"\n"
|
|
|
|
" db (current)\n"
|
2021-01-25 09:19:05 -05:00
|
|
|
" wal archive min/max (9.5): 000000010000000000000002/000000010000000000000005\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
"\n"
|
|
|
|
" full backup: 20201116-200000F\n"
|
|
|
|
" timestamp start/stop: 2020-11-16 20:00:00 / 2020-11-16 20:00:05\n"
|
|
|
|
" wal start/stop: 000000010000000000000004 / 000000010000000000000004\n"
|
2021-01-25 09:19:05 -05:00
|
|
|
" database size: 25.7MB, database backup size: 25.7MB\n"
|
|
|
|
" repo2: backup set size: 3MB, backup size: 3KB\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
" database list: mail (16456), postgres (12173)\n"
|
|
|
|
" symlinks:\n"
|
|
|
|
" pg_hba.conf => ../pg_config/pg_hba.conf\n"
|
|
|
|
" pg_stat => ../pg_stat\n"
|
|
|
|
" tablespaces:\n"
|
|
|
|
" ts1 (1) => /tblspc/ts1\n"
|
|
|
|
" ts12 (12) => /tblspc/ts12\n"
|
|
|
|
" page checksum error: base/16384/17000\n",
|
2021-01-25 09:19:05 -05:00
|
|
|
"text - multi-repo, backup set requested, found on repo2, report stanza and db over all repos");
|
2021-01-21 15:21:50 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------------------------------
|
2021-06-24 08:55:44 -04:00
|
|
|
TEST_TITLE("option 'set' not valid for json output");
|
|
|
|
|
|
|
|
hrnCfgArgRawZ(argList2, cfgOptOutput, "json");
|
2021-06-01 09:03:44 -04:00
|
|
|
HRN_CFG_LOAD(cfgCmdInfo, argList2);
|
2019-09-30 12:39:38 -04:00
|
|
|
|
2020-07-30 07:49:06 -04:00
|
|
|
TEST_ERROR(strZ(infoRender()), ConfigError, "option 'set' is currently only valid for text output");
|
2019-09-30 12:39:38 -04:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------------------------------
|
2021-06-24 08:55:44 -04:00
|
|
|
TEST_TITLE("backup set requested but no links, multiple checksum errors");
|
|
|
|
|
|
|
|
// Remove the environment variable so config system will only count one repo
|
|
|
|
hrnCfgEnvKeyRemoveRaw(cfgOptRepoCipherPass, 2);
|
|
|
|
|
|
|
|
argList2 = strLstDup(argListTextStanzaOpt);
|
|
|
|
hrnCfgArgRawZ(argList2, cfgOptSet, "20181119-152138F_20181119-152155I");
|
|
|
|
hrnCfgArgRawZ(argList2, cfgOptRepo, "1");
|
2021-06-01 09:03:44 -04:00
|
|
|
HRN_CFG_LOAD(cfgCmdInfo, argList2);
|
2019-09-30 12:39:38 -04:00
|
|
|
|
|
|
|
#define TEST_MANIFEST_TARGET_NO_LINK \
|
|
|
|
"\n" \
|
|
|
|
"[backup:target]\n" \
|
|
|
|
"pg_data={\"path\":\"/pg/base\",\"type\":\"path\"}\n" \
|
|
|
|
|
2020-11-25 18:14:03 +01:00
|
|
|
#define TEST_MANIFEST_FILE_MULTIPLE_CHECKSUM_ERRORS \
|
|
|
|
"\n" \
|
|
|
|
"[target:file]\n" \
|
|
|
|
"pg_data/PG_VERSION={\"checksum\":\"184473f470864e067ee3a22e64b47b0a1c356f29\",\"master\":true" \
|
|
|
|
",\"reference\":\"20190818-084502F_20190819-084506D\",\"size\":4,\"timestamp\":1565282114}\n" \
|
|
|
|
"pg_data/base/16384/17000={\"checksum\":\"e0101dd8ffb910c9c202ca35b5f828bcb9697bed\",\"checksum-page\":false" \
|
|
|
|
",\"checksum-page-error\":[1],\"repo-size\":4096,\"size\":8192,\"timestamp\":1565282114}\n" \
|
|
|
|
"pg_data/base/16384/PG_VERSION={\"checksum\":\"184473f470864e067ee3a22e64b47b0a1c356f29\",\"group\":false,\"size\":4" \
|
|
|
|
",\"timestamp\":1565282115}\n" \
|
|
|
|
"pg_data/base/32768/33000={\"checksum\":\"7a16d165e4775f7c92e8cdf60c0af57313f0bf90\",\"checksum-page\":false" \
|
|
|
|
",\"reference\":\"20190818-084502F\",\"size\":1073741824,\"timestamp\":1565282116}\n" \
|
|
|
|
"pg_data/base/32768/33000.32767={\"checksum\":\"6e99b589e550e68e934fd235ccba59fe5b592a9e\",\"checksum-page\":true" \
|
|
|
|
",\"reference\":\"20190818-084502F\",\"size\":32768,\"timestamp\":1565282114}\n" \
|
|
|
|
"pg_data/postgresql.conf={\"checksum\":\"6721d92c9fcdf4248acff1f9a1377127d9064807\",\"master\":true,\"size\":4457" \
|
|
|
|
",\"timestamp\":1565282114}\n" \
|
|
|
|
"pg_data/special={\"master\":true,\"mode\":\"0640\",\"size\":0,\"timestamp\":1565282120,\"user\":false}\n"
|
|
|
|
|
2021-06-24 08:55:44 -04:00
|
|
|
HRN_INFO_PUT(
|
|
|
|
storageRepoWrite(), STORAGE_REPO_BACKUP "/20181119-152138F_20181119-152155I/" BACKUP_MANIFEST_FILE,
|
2019-09-30 12:39:38 -04:00
|
|
|
TEST_MANIFEST_HEADER
|
|
|
|
TEST_MANIFEST_TARGET_NO_LINK
|
|
|
|
TEST_MANIFEST_DB
|
2020-11-25 18:14:03 +01:00
|
|
|
TEST_MANIFEST_FILE_MULTIPLE_CHECKSUM_ERRORS
|
2019-09-30 12:39:38 -04:00
|
|
|
TEST_MANIFEST_FILE_DEFAULT
|
|
|
|
TEST_MANIFEST_LINK
|
|
|
|
TEST_MANIFEST_LINK_DEFAULT
|
|
|
|
TEST_MANIFEST_PATH
|
2021-06-24 08:55:44 -04:00
|
|
|
TEST_MANIFEST_PATH_DEFAULT,
|
|
|
|
.comment = "write manifest with checksum errors and no links");
|
2019-09-30 12:39:38 -04:00
|
|
|
|
2019-12-26 18:08:27 -07:00
|
|
|
TEST_RESULT_STR_Z(
|
|
|
|
infoRender(),
|
2019-09-30 12:39:38 -04:00
|
|
|
"stanza: stanza1\n"
|
|
|
|
" status: ok\n"
|
|
|
|
" cipher: none\n"
|
|
|
|
"\n"
|
|
|
|
" db (prior)\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
" wal archive min/max (9.4): 000000010000000000000002/000000020000000000000003\n"
|
2019-09-30 12:39:38 -04:00
|
|
|
"\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
" incr backup: 20181119-152138F_20181119-152155I\n"
|
|
|
|
" timestamp start/stop: 2018-11-19 15:21:55 / 2018-11-19 15:21:57\n"
|
2019-09-30 12:39:38 -04:00
|
|
|
" wal start/stop: n/a\n"
|
2021-01-25 09:19:05 -05:00
|
|
|
" database size: 19.2MB, database backup size: 8.2KB\n"
|
|
|
|
" repo1: backup set size: 2.3MB, backup size: 346B\n"
|
2019-09-30 12:39:38 -04:00
|
|
|
" backup reference list: 20181119-152138F, 20181119-152138F_20181119-152152D\n"
|
2020-11-25 18:14:03 +01:00
|
|
|
" database list: mail (16456), postgres (12173)\n"
|
|
|
|
" page checksum error: base/16384/17000, base/32768/33000\n",
|
2019-12-26 18:08:27 -07:00
|
|
|
"text - backup set requested, no links");
|
2019-09-30 12:39:38 -04:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------------------------------
|
2021-06-24 08:55:44 -04:00
|
|
|
TEST_TITLE("backup set requested but no databases, no checksum error");
|
|
|
|
|
|
|
|
// Using the same configuration from previous test
|
2021-06-01 09:03:44 -04:00
|
|
|
HRN_CFG_LOAD(cfgCmdInfo, argList2);
|
2019-09-30 12:39:38 -04:00
|
|
|
|
|
|
|
#define TEST_MANIFEST_NO_DB \
|
|
|
|
"\n" \
|
|
|
|
"[db]\n" \
|
|
|
|
"template0={\"db-id\":12168,\"db-last-system-id\":12168}\n" \
|
|
|
|
"template1={\"db-id\":1,\"db-last-system-id\":12168}\n" \
|
|
|
|
|
2020-11-25 18:14:03 +01:00
|
|
|
#define TEST_MANIFEST_FILE_NO_CHECKSUM_ERROR \
|
|
|
|
"\n" \
|
|
|
|
"[target:file]\n" \
|
|
|
|
"pg_data/PG_VERSION={\"checksum\":\"184473f470864e067ee3a22e64b47b0a1c356f29\",\"master\":true" \
|
|
|
|
",\"reference\":\"20190818-084502F_20190819-084506D\",\"size\":4,\"timestamp\":1565282114}\n" \
|
|
|
|
"pg_data/base/16384/17000={\"checksum\":\"e0101dd8ffb910c9c202ca35b5f828bcb9697bed\",\"checksum-page\":true" \
|
|
|
|
",\"checksum-page-error\":[1],\"repo-size\":4096,\"size\":8192,\"timestamp\":1565282114}\n" \
|
|
|
|
"pg_data/base/16384/PG_VERSION={\"checksum\":\"184473f470864e067ee3a22e64b47b0a1c356f29\",\"group\":false,\"size\":4" \
|
|
|
|
",\"timestamp\":1565282115}\n" \
|
|
|
|
"pg_data/base/32768/33000={\"checksum\":\"7a16d165e4775f7c92e8cdf60c0af57313f0bf90\",\"checksum-page\":true" \
|
|
|
|
",\"reference\":\"20190818-084502F\",\"size\":1073741824,\"timestamp\":1565282116}\n" \
|
|
|
|
"pg_data/base/32768/33000.32767={\"checksum\":\"6e99b589e550e68e934fd235ccba59fe5b592a9e\",\"checksum-page\":true" \
|
|
|
|
",\"reference\":\"20190818-084502F\",\"size\":32768,\"timestamp\":1565282114}\n" \
|
|
|
|
"pg_data/postgresql.conf={\"checksum\":\"6721d92c9fcdf4248acff1f9a1377127d9064807\",\"master\":true,\"size\":4457" \
|
|
|
|
",\"timestamp\":1565282114}\n" \
|
|
|
|
"pg_data/special={\"master\":true,\"mode\":\"0640\",\"size\":0,\"timestamp\":1565282120,\"user\":false}\n"
|
|
|
|
|
2021-06-24 08:55:44 -04:00
|
|
|
HRN_INFO_PUT(
|
|
|
|
storageRepoWrite(), STORAGE_REPO_BACKUP "/20181119-152138F_20181119-152155I/" BACKUP_MANIFEST_FILE,
|
2019-09-30 12:39:38 -04:00
|
|
|
TEST_MANIFEST_HEADER
|
|
|
|
TEST_MANIFEST_TARGET_NO_LINK
|
|
|
|
TEST_MANIFEST_NO_DB
|
2020-11-25 18:14:03 +01:00
|
|
|
TEST_MANIFEST_FILE_NO_CHECKSUM_ERROR
|
2019-09-30 12:39:38 -04:00
|
|
|
TEST_MANIFEST_FILE_DEFAULT
|
|
|
|
TEST_MANIFEST_LINK
|
|
|
|
TEST_MANIFEST_LINK_DEFAULT
|
|
|
|
TEST_MANIFEST_PATH
|
2021-06-24 08:55:44 -04:00
|
|
|
TEST_MANIFEST_PATH_DEFAULT,
|
|
|
|
.comment = " rewrite same manifest withut checksum errors");
|
2019-09-30 12:39:38 -04:00
|
|
|
|
2019-12-26 18:08:27 -07:00
|
|
|
TEST_RESULT_STR_Z(
|
|
|
|
infoRender(),
|
2019-09-30 12:39:38 -04:00
|
|
|
"stanza: stanza1\n"
|
|
|
|
" status: ok\n"
|
|
|
|
" cipher: none\n"
|
|
|
|
"\n"
|
|
|
|
" db (prior)\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
" wal archive min/max (9.4): 000000010000000000000002/000000020000000000000003\n"
|
2019-09-30 12:39:38 -04:00
|
|
|
"\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
" incr backup: 20181119-152138F_20181119-152155I\n"
|
|
|
|
" timestamp start/stop: 2018-11-19 15:21:55 / 2018-11-19 15:21:57\n"
|
2019-09-30 12:39:38 -04:00
|
|
|
" wal start/stop: n/a\n"
|
2021-01-25 09:19:05 -05:00
|
|
|
" database size: 19.2MB, database backup size: 8.2KB\n"
|
|
|
|
" repo1: backup set size: 2.3MB, backup size: 346B\n"
|
2019-09-30 12:39:38 -04:00
|
|
|
" backup reference list: 20181119-152138F, 20181119-152138F_20181119-152152D\n"
|
2019-12-26 18:08:27 -07:00
|
|
|
" database list: none\n",
|
2020-11-25 18:14:03 +01:00
|
|
|
"text - backup set requested, no db and no checksum error");
|
2019-09-30 12:39:38 -04:00
|
|
|
|
2021-01-21 15:21:50 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------------------------------
|
2021-06-24 08:55:44 -04:00
|
|
|
TEST_TITLE("multi-repo: stanza found");
|
|
|
|
|
|
|
|
// Reconfigure environment variable for repo2
|
|
|
|
hrnCfgEnvKeyRawZ(cfgOptRepoCipherPass, 2, TEST_CIPHER_PASS);
|
|
|
|
|
|
|
|
argList2 = strLstDup(argListMultiRepoJson);
|
|
|
|
hrnCfgArgRawZ(argList2, cfgOptStanza, "stanza2");
|
2021-06-01 09:03:44 -04:00
|
|
|
HRN_CFG_LOAD(cfgCmdInfo, argList2);
|
2021-01-21 15:21:50 -05:00
|
|
|
TEST_RESULT_STR_Z(
|
|
|
|
infoRender(),
|
|
|
|
"["
|
|
|
|
"{"
|
|
|
|
"\"archive\":["
|
|
|
|
"{"
|
|
|
|
"\"database\":{"
|
|
|
|
"\"id\":1,"
|
|
|
|
"\"repo-key\":1"
|
|
|
|
"},"
|
|
|
|
"\"id\":\"9.4-1\","
|
|
|
|
"\"max\":null,"
|
|
|
|
"\"min\":null"
|
|
|
|
"}"
|
|
|
|
"],"
|
|
|
|
"\"backup\":[],"
|
2021-06-24 08:55:44 -04:00
|
|
|
"\"cipher\":\"mixed\","
|
2021-01-21 15:21:50 -05:00
|
|
|
"\"db\":["
|
|
|
|
"{"
|
|
|
|
"\"id\":1,"
|
|
|
|
"\"repo-key\":1,"
|
|
|
|
"\"system-id\":6625633699176220261,"
|
|
|
|
"\"version\":\"9.4\""
|
|
|
|
"}"
|
|
|
|
"],"
|
|
|
|
"\"name\":\"stanza2\","
|
|
|
|
"\"repo\":["
|
|
|
|
"{"
|
|
|
|
"\"cipher\":\"none\","
|
|
|
|
"\"key\":1,"
|
|
|
|
"\"status\":{"
|
|
|
|
"\"code\":2,"
|
|
|
|
"\"message\":\"no valid backups\""
|
|
|
|
"}"
|
|
|
|
"},"
|
|
|
|
"{"
|
2021-06-24 08:55:44 -04:00
|
|
|
"\"cipher\":\"aes-256-cbc\","
|
2021-01-21 15:21:50 -05:00
|
|
|
"\"key\":2,"
|
|
|
|
"\"status\":{"
|
|
|
|
"\"code\":1,"
|
|
|
|
"\"message\":\"missing stanza path\""
|
|
|
|
"}"
|
|
|
|
"}"
|
|
|
|
"],"
|
|
|
|
"\"status\":{"
|
|
|
|
"\"code\":4,"
|
|
|
|
"\"lock\":{\"backup\":{\"held\":false}},"
|
|
|
|
"\"message\":\"different across repos\""
|
|
|
|
"}"
|
|
|
|
"}"
|
|
|
|
"]",
|
|
|
|
"json - multiple stanzas - selected found, repo1");
|
|
|
|
|
2021-06-24 08:55:44 -04:00
|
|
|
argList2 = strLstDup(argListMultiRepo);
|
|
|
|
hrnCfgArgRawZ(argList2, cfgOptStanza, "stanza2");
|
2021-06-01 09:03:44 -04:00
|
|
|
HRN_CFG_LOAD(cfgCmdInfo, argList2);
|
2021-01-21 15:21:50 -05:00
|
|
|
TEST_RESULT_STR_Z(
|
|
|
|
infoRender(),
|
|
|
|
"stanza: stanza2\n"
|
|
|
|
" status: mixed\n"
|
|
|
|
" repo1: error (no valid backups)\n"
|
|
|
|
" repo2: error (missing stanza path)\n"
|
2021-06-24 08:55:44 -04:00
|
|
|
" cipher: mixed\n"
|
|
|
|
" repo1: none\n"
|
|
|
|
" repo2: aes-256-cbc\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
"\n"
|
|
|
|
" db (current)\n"
|
|
|
|
" wal archive min/max (9.4): none present\n",
|
|
|
|
"text - multiple stanzas - selected found, repo1");
|
|
|
|
|
|
|
|
// Remove backups from repo2 for stanza1 so multi-repos are scanned but backups are on only 1 repo
|
|
|
|
//--------------------------------------------------------------------------------------------------------------------------
|
|
|
|
TEST_TITLE("multi-repo, backups only on one");
|
|
|
|
|
2021-06-24 08:55:44 -04:00
|
|
|
argList2 = strLstDup(argListMultiRepo);
|
|
|
|
hrnCfgArgRawZ(argList2, cfgOptStanza, "stanza1");
|
|
|
|
HRN_CFG_LOAD(cfgCmdInfo, argList2);
|
|
|
|
|
|
|
|
HRN_INFO_PUT(
|
|
|
|
storageRepoIdxWrite(1), INFO_BACKUP_PATH_FILE,
|
2021-01-21 15:21:50 -05:00
|
|
|
"[db]\n"
|
|
|
|
"db-catalog-version=201510051\n"
|
|
|
|
"db-control-version=942\n"
|
|
|
|
"db-id=1\n"
|
|
|
|
"db-system-id=6626363367545678089\n"
|
|
|
|
"db-version=\"9.5\"\n"
|
|
|
|
"\n"
|
|
|
|
"[cipher]\n"
|
|
|
|
"cipher-pass=\"somepass\"\n"
|
|
|
|
"\n"
|
|
|
|
"[db:history]\n"
|
|
|
|
"1={\"db-catalog-version\":201510051,\"db-control-version\":942,\"db-system-id\":6626363367545678089,"
|
2021-06-24 08:55:44 -04:00
|
|
|
"\"db-version\":\"9.5\"}\n",
|
|
|
|
.cipherType = cipherTypeAes256Cbc, .cipherPass = TEST_CIPHER_PASS,
|
|
|
|
.comment = "backup.info without current, repo2, stanza1");
|
2021-01-21 15:21:50 -05:00
|
|
|
|
|
|
|
TEST_RESULT_STR_Z(
|
|
|
|
infoRender(),
|
|
|
|
"stanza: stanza1\n"
|
|
|
|
" status: mixed\n"
|
|
|
|
" repo1: ok\n"
|
|
|
|
" repo2: error (no valid backups)\n"
|
|
|
|
" cipher: mixed\n"
|
|
|
|
" repo1: none\n"
|
|
|
|
" repo2: aes-256-cbc\n"
|
|
|
|
"\n"
|
|
|
|
" db (prior)\n"
|
|
|
|
" wal archive min/max (9.4): 000000010000000000000002/000000020000000000000003\n"
|
|
|
|
"\n"
|
|
|
|
" full backup: 20181119-152138F\n"
|
|
|
|
" timestamp start/stop: 2018-11-19 15:21:38 / 2018-11-19 15:21:39\n"
|
|
|
|
" wal start/stop: 000000010000000000000002 / 000000010000000000000002\n"
|
2021-01-25 09:19:05 -05:00
|
|
|
" database size: 19.2MB, database backup size: 19.2MB\n"
|
|
|
|
" repo1: backup set size: 2.3MB, backup size: 2.3MB\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
"\n"
|
|
|
|
" diff backup: 20181119-152138F_20181119-152152D\n"
|
|
|
|
" timestamp start/stop: 2018-11-19 15:21:52 / 2018-11-19 15:21:55\n"
|
|
|
|
" wal start/stop: 000000010000000000000003 / 000000020000000000000003\n"
|
2021-01-25 09:19:05 -05:00
|
|
|
" database size: 19.2MB, database backup size: 8.2KB\n"
|
|
|
|
" repo1: backup set size: 2.3MB, backup size: 346B\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
" backup reference list: 20181119-152138F\n"
|
|
|
|
"\n"
|
|
|
|
" incr backup: 20181119-152138F_20181119-152155I\n"
|
|
|
|
" timestamp start/stop: 2018-11-19 15:21:55 / 2018-11-19 15:21:57\n"
|
|
|
|
" wal start/stop: n/a\n"
|
2021-01-25 09:19:05 -05:00
|
|
|
" database size: 19.2MB, database backup size: 8.2KB\n"
|
|
|
|
" repo1: backup set size: 2.3MB, backup size: 346B\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
" backup reference list: 20181119-152138F, 20181119-152138F_20181119-152152D\n"
|
|
|
|
"\n"
|
|
|
|
" db (current)\n"
|
|
|
|
" wal archive min/max (9.5): 000000010000000000000002/000000010000000000000005\n"
|
|
|
|
"\n"
|
|
|
|
" full backup: 20201116-155000F\n"
|
|
|
|
" timestamp start/stop: 2020-11-16 15:50:00 / 2020-11-16 15:50:02\n"
|
|
|
|
" wal start/stop: 000000010000000000000002 / 000000010000000000000003\n"
|
2021-01-25 09:19:05 -05:00
|
|
|
" database size: 25.7MB, database backup size: 25.7MB\n"
|
|
|
|
" repo1: backup set size: 3MB, backup size: 3KB\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
"\n"
|
|
|
|
" incr backup: 20201116-155000F_20201119-152100I\n"
|
|
|
|
" timestamp start/stop: 2020-11-19 15:21:00 / 2020-11-19 15:21:03\n"
|
|
|
|
" wal start/stop: 000000010000000000000005 / 000000010000000000000005\n"
|
2021-01-25 09:19:05 -05:00
|
|
|
" database size: 19.2MB, database backup size: 8.2KB\n"
|
|
|
|
" repo1: backup set size: 2.3MB, backup size: 346B\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
" backup reference list: 20201116-155000F\n",
|
|
|
|
"text - multi-repo, valid backups only on repo1");
|
|
|
|
|
|
|
|
// Remove archives for prior backup so archiveMin prior DB == NULL but backupList > 0 (edge case)
|
|
|
|
//--------------------------------------------------------------------------------------------------------------------------
|
|
|
|
TEST_TITLE("multi-repo, prior backup: no archives but backups (code coverage)");
|
|
|
|
|
2021-06-24 08:55:44 -04:00
|
|
|
HRN_STORAGE_PATH_REMOVE(
|
|
|
|
storageRepoIdxWrite(0), STORAGE_REPO_ARCHIVE "/9.4-1", .recurse = true, .comment = "remove archives on db prior");
|
2021-01-21 15:21:50 -05:00
|
|
|
|
|
|
|
TEST_RESULT_STR_Z(
|
|
|
|
infoRender(),
|
|
|
|
"stanza: stanza1\n"
|
|
|
|
" status: mixed\n"
|
|
|
|
" repo1: ok\n"
|
|
|
|
" repo2: error (no valid backups)\n"
|
|
|
|
" cipher: mixed\n"
|
|
|
|
" repo1: none\n"
|
|
|
|
" repo2: aes-256-cbc\n"
|
|
|
|
"\n"
|
|
|
|
" db (prior)\n"
|
|
|
|
" wal archive min/max (9.4): none present\n"
|
|
|
|
"\n"
|
|
|
|
" full backup: 20181119-152138F\n"
|
|
|
|
" timestamp start/stop: 2018-11-19 15:21:38 / 2018-11-19 15:21:39\n"
|
|
|
|
" wal start/stop: 000000010000000000000002 / 000000010000000000000002\n"
|
2021-01-25 09:19:05 -05:00
|
|
|
" database size: 19.2MB, database backup size: 19.2MB\n"
|
|
|
|
" repo1: backup set size: 2.3MB, backup size: 2.3MB\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
"\n"
|
|
|
|
" diff backup: 20181119-152138F_20181119-152152D\n"
|
|
|
|
" timestamp start/stop: 2018-11-19 15:21:52 / 2018-11-19 15:21:55\n"
|
|
|
|
" wal start/stop: 000000010000000000000003 / 000000020000000000000003\n"
|
2021-01-25 09:19:05 -05:00
|
|
|
" database size: 19.2MB, database backup size: 8.2KB\n"
|
|
|
|
" repo1: backup set size: 2.3MB, backup size: 346B\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
" backup reference list: 20181119-152138F\n"
|
|
|
|
"\n"
|
|
|
|
" incr backup: 20181119-152138F_20181119-152155I\n"
|
|
|
|
" timestamp start/stop: 2018-11-19 15:21:55 / 2018-11-19 15:21:57\n"
|
|
|
|
" wal start/stop: n/a\n"
|
2021-01-25 09:19:05 -05:00
|
|
|
" database size: 19.2MB, database backup size: 8.2KB\n"
|
|
|
|
" repo1: backup set size: 2.3MB, backup size: 346B\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
" backup reference list: 20181119-152138F, 20181119-152138F_20181119-152152D\n"
|
|
|
|
"\n"
|
|
|
|
" db (current)\n"
|
|
|
|
" wal archive min/max (9.5): 000000010000000000000002/000000010000000000000005\n"
|
|
|
|
"\n"
|
|
|
|
" full backup: 20201116-155000F\n"
|
|
|
|
" timestamp start/stop: 2020-11-16 15:50:00 / 2020-11-16 15:50:02\n"
|
|
|
|
" wal start/stop: 000000010000000000000002 / 000000010000000000000003\n"
|
2021-01-25 09:19:05 -05:00
|
|
|
" database size: 25.7MB, database backup size: 25.7MB\n"
|
|
|
|
" repo1: backup set size: 3MB, backup size: 3KB\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
"\n"
|
|
|
|
" incr backup: 20201116-155000F_20201119-152100I\n"
|
|
|
|
" timestamp start/stop: 2020-11-19 15:21:00 / 2020-11-19 15:21:03\n"
|
|
|
|
" wal start/stop: 000000010000000000000005 / 000000010000000000000005\n"
|
2021-01-25 09:19:05 -05:00
|
|
|
" database size: 19.2MB, database backup size: 8.2KB\n"
|
|
|
|
" repo1: backup set size: 2.3MB, backup size: 346B\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
" backup reference list: 20201116-155000F\n",
|
|
|
|
"text - multi-repo, prior backup: no archives but backups (code coverage)");
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------------------------------
|
|
|
|
TEST_TITLE("multi-repo, stanza requested does not exist, but other stanzas do");
|
|
|
|
|
|
|
|
argList2 = strLstDup(argListMultiRepo);
|
|
|
|
hrnCfgArgRawZ(argList2, cfgOptStanza, "stanza4");
|
2021-06-01 09:03:44 -04:00
|
|
|
HRN_CFG_LOAD(cfgCmdInfo, argList2);
|
2021-01-21 15:21:50 -05:00
|
|
|
|
|
|
|
TEST_RESULT_STR_Z(
|
|
|
|
infoRender(),
|
|
|
|
"stanza: stanza4\n"
|
|
|
|
" status: error (missing stanza path)\n",
|
|
|
|
"multi-repo, stanza requested does not exist, but other stanzas do");
|
|
|
|
|
|
|
|
// Add stanza3 to repo1 but with a current PG that is different than repo2
|
|
|
|
//--------------------------------------------------------------------------------------------------------------------------
|
|
|
|
TEST_TITLE("multi-repo, current database different across repos");
|
|
|
|
|
2021-06-24 08:55:44 -04:00
|
|
|
argList2 = strLstDup(argListMultiRepo);
|
|
|
|
hrnCfgArgRawZ(argList2, cfgOptStanza, "stanza3");
|
|
|
|
HRN_CFG_LOAD(cfgCmdInfo, argList2);
|
|
|
|
|
|
|
|
HRN_INFO_PUT(
|
|
|
|
storageRepoIdxWrite(0), INFO_ARCHIVE_PATH_FILE,
|
2021-01-21 15:21:50 -05:00
|
|
|
"[db]\n"
|
|
|
|
"db-id=2\n"
|
|
|
|
"db-system-id=6626363367545678888\n"
|
|
|
|
"db-version=\"9.5\"\n"
|
|
|
|
"\n"
|
|
|
|
"[db:history]\n"
|
|
|
|
"1={\"db-id\":6626363367545678089,\"db-version\":\"9.4\"}\n"
|
2021-06-24 08:55:44 -04:00
|
|
|
"2={\"db-id\":6626363367545678888,\"db-version\":\"9.5\"}\n",
|
|
|
|
.comment = "put archive info to file - stanza3, repo1 stanza upgraded");
|
2021-01-21 15:21:50 -05:00
|
|
|
|
2021-06-24 08:55:44 -04:00
|
|
|
HRN_INFO_PUT(
|
|
|
|
storageRepoIdxWrite(0), INFO_BACKUP_PATH_FILE,
|
2021-01-21 15:21:50 -05:00
|
|
|
"[db]\n"
|
|
|
|
"db-catalog-version=201409291\n"
|
|
|
|
"db-control-version=942\n"
|
|
|
|
"db-id=2\n"
|
|
|
|
"db-system-id=6626363367545678888\n"
|
|
|
|
"db-version=\"9.5\"\n"
|
|
|
|
"\n"
|
|
|
|
"[backup:current]\n"
|
|
|
|
"20201212-192538F={\"backrest-format\":5,\"backrest-version\":\"2.25\","
|
|
|
|
"\"backup-archive-start\":\"000000010000000000000002\",\"backup-archive-stop\":\"000000010000000000000003\","
|
|
|
|
"\"backup-info-repo-size\":3159000,\"backup-info-repo-size-delta\":3100,\"backup-info-size\":26897000,"
|
|
|
|
"\"backup-info-size-delta\":26897020,\"backup-timestamp-start\":1607801138,\"backup-timestamp-stop\":1607801140,"
|
|
|
|
"\"backup-type\":\"full\",\"db-id\":1,\"option-archive-check\":true,\"option-archive-copy\":true,"
|
|
|
|
"\"option-backup-standby\":true,\"option-checksum-page\":false,\"option-compress\":false,\"option-hardlink\":true,"
|
|
|
|
"\"option-online\":true}\n"
|
|
|
|
"20210112-192538F={\"backrest-format\":5,\"backrest-version\":\"2.25\","
|
|
|
|
"\"backup-archive-start\":\"000000010000000000000006\",\"backup-archive-stop\":\"000000010000000000000006\","
|
|
|
|
"\"backup-info-repo-size\":3159000,\"backup-info-repo-size-delta\":3100,\"backup-info-size\":26897000,"
|
|
|
|
"\"backup-info-size-delta\":26897020,\"backup-timestamp-start\":1610479538,\"backup-timestamp-stop\":1610479540,"
|
|
|
|
"\"backup-type\":\"full\",\"db-id\":2,\"option-archive-check\":true,\"option-archive-copy\":true,"
|
|
|
|
"\"option-backup-standby\":true,\"option-checksum-page\":false,\"option-compress\":false,\"option-hardlink\":true,"
|
|
|
|
"\"option-online\":true}\n"
|
|
|
|
"\n"
|
|
|
|
"[db:history]\n"
|
|
|
|
"1={\"db-catalog-version\":201409291,\"db-control-version\":942,\"db-system-id\":6626363367545678089,"
|
|
|
|
"\"db-version\":\"9.4\"}\n"
|
|
|
|
"2={\"db-catalog-version\":201409291,\"db-control-version\":942,\"db-system-id\":6626363367545678888,"
|
2021-06-24 08:55:44 -04:00
|
|
|
"\"db-version\":\"9.5\"}\n",
|
|
|
|
.comment = "put backup info to file - stanza3, repo1 stanza upgraded");
|
|
|
|
|
|
|
|
// Create stanza3 db1 WAL, repo1
|
|
|
|
HRN_STORAGE_PUT_EMPTY(
|
|
|
|
storageRepoIdxWrite(0), STORAGE_REPO_ARCHIVE
|
|
|
|
"/9.4-1/0000000100000000/000000010000000000000002-47dff2b7552a9d66e4bae1a762488a6885e7082c.gz");
|
|
|
|
HRN_STORAGE_PUT_EMPTY(
|
|
|
|
storageRepoIdxWrite(0), STORAGE_REPO_ARCHIVE
|
|
|
|
"/9.4-1/0000000100000000/000000010000000000000003-47dff2b7552a9d66e4bae1a762488a6885e7082c.gz");
|
|
|
|
HRN_STORAGE_PUT_EMPTY(
|
|
|
|
storageRepoIdxWrite(0), STORAGE_REPO_ARCHIVE
|
|
|
|
"/9.5-2/0000000100000000/000000010000000000000006-47dff2b7552a9d66e4bae1a762488a6885e7082c.gz");
|
2021-01-21 15:21:50 -05:00
|
|
|
|
|
|
|
TEST_RESULT_STR_Z(
|
|
|
|
infoRender(),
|
|
|
|
"stanza: stanza3\n"
|
|
|
|
" status: error (database mismatch across repos)\n"
|
|
|
|
" repo1: ok\n"
|
|
|
|
" repo2: ok\n"
|
|
|
|
" cipher: mixed\n"
|
|
|
|
" repo1: none\n"
|
|
|
|
" repo2: aes-256-cbc\n"
|
|
|
|
"\n"
|
|
|
|
" db (prior)\n"
|
|
|
|
" wal archive min/max (9.4): 000000010000000000000001/000000010000000000000003\n"
|
|
|
|
"\n"
|
|
|
|
" full backup: 20201110-100000F\n"
|
|
|
|
" timestamp start/stop: 2020-11-10 10:00:00 / 2020-11-10 10:00:02\n"
|
|
|
|
" wal start/stop: 000000010000000000000001 / 000000010000000000000002\n"
|
2021-01-25 09:19:05 -05:00
|
|
|
" database size: 25.7MB, database backup size: 25.7MB\n"
|
|
|
|
" repo2: backup set size: 3MB, backup size: 3KB\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
"\n"
|
|
|
|
" full backup: 20201212-192538F\n"
|
|
|
|
" timestamp start/stop: 2020-12-12 19:25:38 / 2020-12-12 19:25:40\n"
|
|
|
|
" wal start/stop: 000000010000000000000002 / 000000010000000000000003\n"
|
2021-01-25 09:19:05 -05:00
|
|
|
" database size: 25.7MB, database backup size: 25.7MB\n"
|
|
|
|
" repo1: backup set size: 3MB, backup size: 3KB\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
"\n"
|
|
|
|
" db (current)\n"
|
|
|
|
" wal archive min/max (9.5): 000000010000000000000006/000000010000000000000006\n"
|
|
|
|
"\n"
|
|
|
|
" full backup: 20210112-192538F\n"
|
|
|
|
" timestamp start/stop: 2021-01-12 19:25:38 / 2021-01-12 19:25:40\n"
|
|
|
|
" wal start/stop: 000000010000000000000006 / 000000010000000000000006\n"
|
2021-01-25 09:19:05 -05:00
|
|
|
" database size: 25.7MB, database backup size: 25.7MB\n"
|
|
|
|
" repo1: backup set size: 3MB, backup size: 3KB\n",
|
2021-01-21 15:21:50 -05:00
|
|
|
"text - multi-repo, database mismatch, repo2 stanza-upgrade needed");
|
|
|
|
|
|
|
|
hrnCfgArgRawZ(argList2, cfgOptOutput, "json");
|
2021-06-01 09:03:44 -04:00
|
|
|
HRN_CFG_LOAD(cfgCmdInfo, argList2);
|
2021-01-21 15:21:50 -05:00
|
|
|
|
2019-12-26 18:08:27 -07:00
|
|
|
TEST_RESULT_STR_Z(
|
|
|
|
infoRender(),
|
2019-10-11 12:56:03 -04:00
|
|
|
"["
|
|
|
|
"{"
|
|
|
|
"\"archive\":["
|
|
|
|
"{"
|
|
|
|
"\"database\":{"
|
2021-01-21 15:21:50 -05:00
|
|
|
"\"id\":1,"
|
|
|
|
"\"repo-key\":1"
|
2019-10-11 12:56:03 -04:00
|
|
|
"},"
|
|
|
|
"\"id\":\"9.4-1\","
|
2021-01-21 15:21:50 -05:00
|
|
|
"\"max\":\"000000010000000000000003\","
|
|
|
|
"\"min\":\"000000010000000000000002\""
|
|
|
|
"},"
|
|
|
|
"{"
|
|
|
|
"\"database\":{"
|
|
|
|
"\"id\":2,"
|
|
|
|
"\"repo-key\":1"
|
|
|
|
"},"
|
|
|
|
"\"id\":\"9.5-2\","
|
|
|
|
"\"max\":\"000000010000000000000006\","
|
|
|
|
"\"min\":\"000000010000000000000006\""
|
|
|
|
"},"
|
|
|
|
"{"
|
|
|
|
"\"database\":{"
|
|
|
|
"\"id\":1,"
|
|
|
|
"\"repo-key\":2"
|
|
|
|
"},"
|
|
|
|
"\"id\":\"9.4-1\","
|
|
|
|
"\"max\":\"000000010000000000000002\","
|
|
|
|
"\"min\":\"000000010000000000000001\""
|
2019-10-11 12:56:03 -04:00
|
|
|
"}"
|
|
|
|
"],"
|
2021-01-21 15:21:50 -05:00
|
|
|
"\"backup\":["
|
|
|
|
"{"
|
|
|
|
"\"archive\":{"
|
|
|
|
"\"start\":\"000000010000000000000001\","
|
|
|
|
"\"stop\":\"000000010000000000000002\""
|
|
|
|
"},"
|
|
|
|
"\"backrest\":{"
|
|
|
|
"\"format\":5,"
|
|
|
|
"\"version\":\"2.25\""
|
|
|
|
"},"
|
|
|
|
"\"database\":{"
|
|
|
|
"\"id\":1,"
|
|
|
|
"\"repo-key\":2"
|
|
|
|
"},"
|
|
|
|
"\"info\":{"
|
|
|
|
"\"delta\":26897020,"
|
|
|
|
"\"repository\":{"
|
|
|
|
"\"delta\":3100,"
|
|
|
|
"\"size\":3159000"
|
|
|
|
"},"
|
|
|
|
"\"size\":26897000"
|
|
|
|
"},"
|
|
|
|
"\"label\":\"20201110-100000F\","
|
|
|
|
"\"prior\":null,"
|
|
|
|
"\"reference\":null,"
|
|
|
|
"\"timestamp\":{"
|
|
|
|
"\"start\":1605002400,"
|
|
|
|
"\"stop\":1605002402"
|
|
|
|
"},"
|
|
|
|
"\"type\":\"full\""
|
|
|
|
"},"
|
|
|
|
"{"
|
|
|
|
"\"archive\":{"
|
|
|
|
"\"start\":\"000000010000000000000002\","
|
|
|
|
"\"stop\":\"000000010000000000000003\""
|
|
|
|
"},"
|
|
|
|
"\"backrest\":{"
|
|
|
|
"\"format\":5,"
|
|
|
|
"\"version\":\"2.25\""
|
|
|
|
"},"
|
|
|
|
"\"database\":{"
|
|
|
|
"\"id\":1,"
|
|
|
|
"\"repo-key\":1"
|
|
|
|
"},"
|
|
|
|
"\"info\":{"
|
|
|
|
"\"delta\":26897020,"
|
|
|
|
"\"repository\":{"
|
|
|
|
"\"delta\":3100,"
|
|
|
|
"\"size\":3159000"
|
|
|
|
"},"
|
|
|
|
"\"size\":26897000"
|
|
|
|
"},"
|
|
|
|
"\"label\":\"20201212-192538F\","
|
|
|
|
"\"prior\":null,"
|
|
|
|
"\"reference\":null,"
|
|
|
|
"\"timestamp\":{"
|
|
|
|
"\"start\":1607801138,"
|
|
|
|
"\"stop\":1607801140"
|
|
|
|
"},"
|
|
|
|
"\"type\":\"full\""
|
|
|
|
"},"
|
|
|
|
"{"
|
|
|
|
"\"archive\":{"
|
|
|
|
"\"start\":\"000000010000000000000006\","
|
|
|
|
"\"stop\":\"000000010000000000000006\""
|
|
|
|
"},"
|
|
|
|
"\"backrest\":{"
|
|
|
|
"\"format\":5,"
|
|
|
|
"\"version\":\"2.25\""
|
|
|
|
"},"
|
|
|
|
"\"database\":{"
|
|
|
|
"\"id\":2,"
|
|
|
|
"\"repo-key\":1"
|
|
|
|
"},"
|
|
|
|
"\"info\":{"
|
|
|
|
"\"delta\":26897020,"
|
|
|
|
"\"repository\":{"
|
|
|
|
"\"delta\":3100,"
|
|
|
|
"\"size\":3159000"
|
|
|
|
"},"
|
|
|
|
"\"size\":26897000"
|
|
|
|
"},"
|
|
|
|
"\"label\":\"20210112-192538F\","
|
|
|
|
"\"prior\":null,"
|
|
|
|
"\"reference\":null,"
|
|
|
|
"\"timestamp\":{"
|
|
|
|
"\"start\":1610479538,"
|
|
|
|
"\"stop\":1610479540"
|
|
|
|
"},"
|
|
|
|
"\"type\":\"full\""
|
|
|
|
"}"
|
|
|
|
"],"
|
|
|
|
"\"cipher\":\"mixed\","
|
2019-10-11 12:56:03 -04:00
|
|
|
"\"db\":["
|
|
|
|
"{"
|
|
|
|
"\"id\":1,"
|
2021-01-21 15:21:50 -05:00
|
|
|
"\"repo-key\":1,"
|
|
|
|
"\"system-id\":6626363367545678089,"
|
|
|
|
"\"version\":\"9.4\""
|
|
|
|
"},"
|
|
|
|
"{"
|
|
|
|
"\"id\":2,"
|
|
|
|
"\"repo-key\":1,"
|
|
|
|
"\"system-id\":6626363367545678888,"
|
|
|
|
"\"version\":\"9.5\""
|
|
|
|
"},"
|
|
|
|
"{"
|
|
|
|
"\"id\":1,"
|
|
|
|
"\"repo-key\":2,"
|
|
|
|
"\"system-id\":6626363367545678089,"
|
2019-10-11 12:56:03 -04:00
|
|
|
"\"version\":\"9.4\""
|
|
|
|
"}"
|
|
|
|
"],"
|
2021-01-21 15:21:50 -05:00
|
|
|
"\"name\":\"stanza3\","
|
|
|
|
"\"repo\":["
|
|
|
|
"{"
|
|
|
|
"\"cipher\":\"none\","
|
|
|
|
"\"key\":1,"
|
|
|
|
"\"status\":{"
|
|
|
|
"\"code\":0,"
|
|
|
|
"\"message\":\"ok\""
|
|
|
|
"}"
|
|
|
|
"},"
|
|
|
|
"{"
|
|
|
|
"\"cipher\":\"aes-256-cbc\","
|
|
|
|
"\"key\":2,"
|
|
|
|
"\"status\":{"
|
|
|
|
"\"code\":0,"
|
|
|
|
"\"message\":\"ok\""
|
|
|
|
"}"
|
|
|
|
"}"
|
|
|
|
"],"
|
|
|
|
"\"status\":{"
|
|
|
|
"\"code\":5,"
|
2020-04-24 08:00:00 -04:00
|
|
|
"\"lock\":{\"backup\":{\"held\":false}},"
|
2021-01-21 15:21:50 -05:00
|
|
|
"\"message\":\"database mismatch across repos\""
|
2019-10-11 12:56:03 -04:00
|
|
|
"}"
|
|
|
|
"}"
|
2019-12-26 18:08:27 -07:00
|
|
|
"]",
|
2021-01-21 15:21:50 -05:00
|
|
|
"json - multi-repo, database mismatch, repo2 stanza-upgrade needed");
|
2018-12-13 16:22:34 -05:00
|
|
|
|
|
|
|
// Crypto error
|
|
|
|
//--------------------------------------------------------------------------------------------------------------------------
|
2021-01-21 15:21:50 -05:00
|
|
|
TEST_TITLE("encryption error");
|
|
|
|
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
// Change repo1 to have the same cipher type as repo2 even though on disk it does not
|
2021-06-24 08:55:44 -04:00
|
|
|
HRN_STORAGE_PUT_Z(storageTest, TEST_PATH "/pgbackrest.conf", "[global]\nrepo-cipher-pass=123abc\n");
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
|
|
|
|
argList2 = strLstDup(argListMultiRepo);
|
2021-06-24 08:55:44 -04:00
|
|
|
hrnCfgArgKeyRawStrId(argList2, cfgOptRepoCipherType, 1, cipherTypeAes256Cbc);
|
|
|
|
hrnCfgArgRawZ(argList2, cfgOptConfig, TEST_PATH "/pgbackrest.conf");
|
2021-06-01 09:03:44 -04:00
|
|
|
HRN_CFG_LOAD(cfgCmdInfo, argList2);
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
|
2021-06-24 08:55:44 -04:00
|
|
|
TEST_RESULT_STR_Z(
|
|
|
|
infoRender(),
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
"stanza: stanza1\n"
|
|
|
|
" status: mixed\n"
|
|
|
|
" repo1: error (other)\n"
|
2021-06-28 13:28:28 -04:00
|
|
|
" [CryptoError] unable to load info file '" TEST_PATH "/repo/backup/stanza1/backup.info' or '"
|
|
|
|
TEST_PATH "/repo/backup/stanza1/backup.info.copy':\n"
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
" CryptoError: cipher header invalid\n"
|
|
|
|
" HINT: is or was the repo encrypted?\n"
|
2021-06-28 13:28:28 -04:00
|
|
|
" FileMissingError: unable to open missing file '" TEST_PATH "/repo/backup/stanza1/backup.info.copy'"
|
2021-06-28 10:58:27 -04:00
|
|
|
" for read\n"
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
" HINT: backup.info cannot be opened and is required to perform a backup.\n"
|
|
|
|
" HINT: has a stanza-create been performed?\n"
|
|
|
|
" HINT: use option --stanza if encryption settings are different for the stanza than the global"
|
|
|
|
" settings.\n"
|
|
|
|
" repo2: error (no valid backups)\n"
|
|
|
|
" cipher: aes-256-cbc\n"
|
|
|
|
"\n"
|
|
|
|
" db (current)\n"
|
|
|
|
" wal archive min/max (9.5): 000000010000000000000003/000000010000000000000004\n"
|
|
|
|
"\n"
|
|
|
|
"stanza: stanza2\n"
|
|
|
|
" status: mixed\n"
|
|
|
|
" repo1: error (other)\n"
|
2021-06-28 13:28:28 -04:00
|
|
|
" [CryptoError] unable to load info file '" TEST_PATH "/repo/backup/stanza2/backup.info' or '"
|
|
|
|
TEST_PATH "/repo/backup/stanza2/backup.info.copy':\n"
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
" CryptoError: cipher header invalid\n"
|
|
|
|
" HINT: is or was the repo encrypted?\n"
|
2021-06-28 13:28:28 -04:00
|
|
|
" FileMissingError: unable to open missing file '" TEST_PATH "/repo/backup/stanza2/backup.info.copy'"
|
2021-06-28 10:58:27 -04:00
|
|
|
" for read\n"
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
" HINT: backup.info cannot be opened and is required to perform a backup.\n"
|
|
|
|
" HINT: has a stanza-create been performed?\n"
|
|
|
|
" HINT: use option --stanza if encryption settings are different for the stanza than the global"
|
|
|
|
" settings.\n"
|
|
|
|
" repo2: error (missing stanza path)\n"
|
|
|
|
" cipher: aes-256-cbc\n"
|
|
|
|
"\n"
|
|
|
|
"stanza: stanza3\n"
|
|
|
|
" status: mixed\n"
|
|
|
|
" repo1: error (other)\n"
|
2021-06-28 13:28:28 -04:00
|
|
|
" [CryptoError] unable to load info file '" TEST_PATH "/repo/backup/stanza3/backup.info' or '"
|
|
|
|
TEST_PATH "/repo/backup/stanza3/backup.info.copy':\n"
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
" CryptoError: cipher header invalid\n"
|
|
|
|
" HINT: is or was the repo encrypted?\n"
|
2021-06-28 13:28:28 -04:00
|
|
|
" FileMissingError: unable to open missing file '" TEST_PATH "/repo/backup/stanza3/backup.info.copy'"
|
2021-06-28 10:58:27 -04:00
|
|
|
" for read\n"
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
" HINT: backup.info cannot be opened and is required to perform a backup.\n"
|
|
|
|
" HINT: has a stanza-create been performed?\n"
|
|
|
|
" HINT: use option --stanza if encryption settings are different for the stanza than the global"
|
|
|
|
" settings.\n"
|
|
|
|
" repo2: ok\n"
|
|
|
|
" cipher: aes-256-cbc\n"
|
|
|
|
"\n"
|
|
|
|
" db (current)\n"
|
|
|
|
" wal archive min/max (9.4): 000000010000000000000001/000000010000000000000002\n"
|
|
|
|
"\n"
|
|
|
|
" full backup: 20201110-100000F\n"
|
|
|
|
" timestamp start/stop: 2020-11-10 10:00:00 / 2020-11-10 10:00:02\n"
|
|
|
|
" wal start/stop: 000000010000000000000001 / 000000010000000000000002\n"
|
|
|
|
" database size: 25.7MB, database backup size: 25.7MB\n"
|
|
|
|
" repo2: backup set size: 3MB, backup size: 3KB\n",
|
|
|
|
"text - multi-repo, multi-stanza cipher error");
|
|
|
|
|
|
|
|
// Backup label not found, one repo in error
|
|
|
|
//--------------------------------------------------------------------------------------------------------------------------
|
|
|
|
TEST_TITLE("backup label exists on one repo, other repo in error");
|
|
|
|
|
|
|
|
hrnCfgArgRawZ(argList2, cfgOptStanza, "stanza3");
|
|
|
|
hrnCfgArgRawZ(argList2, cfgOptSet, "20201110-100000F");
|
2021-06-01 09:03:44 -04:00
|
|
|
HRN_CFG_LOAD(cfgCmdInfo, argList2);
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
|
2021-06-24 08:55:44 -04:00
|
|
|
TEST_RESULT_STR_Z(
|
|
|
|
infoRender(),
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
"stanza: stanza3\n"
|
|
|
|
" status: mixed\n"
|
|
|
|
" repo1: error (other)\n"
|
2021-06-28 13:28:28 -04:00
|
|
|
" [CryptoError] unable to load info file '" TEST_PATH "/repo/backup/stanza3/backup.info' or '"
|
|
|
|
TEST_PATH "/repo/backup/stanza3/backup.info.copy':\n"
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
" CryptoError: cipher header invalid\n"
|
|
|
|
" HINT: is or was the repo encrypted?\n"
|
2021-06-28 13:28:28 -04:00
|
|
|
" FileMissingError: unable to open missing file '" TEST_PATH "/repo/backup/stanza3/backup.info.copy'"
|
2021-06-28 10:58:27 -04:00
|
|
|
" for read\n"
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
" HINT: backup.info cannot be opened and is required to perform a backup.\n"
|
|
|
|
" HINT: has a stanza-create been performed?\n"
|
|
|
|
" HINT: use option --stanza if encryption settings are different for the stanza than the global"
|
|
|
|
" settings.\n"
|
|
|
|
" repo2: error (requested backup not found)\n"
|
2021-06-24 08:55:44 -04:00
|
|
|
" cipher: aes-256-cbc\n",
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
"backup label not found, one repo in error");
|
|
|
|
|
|
|
|
// Crypto error
|
|
|
|
//--------------------------------------------------------------------------------------------------------------------------
|
|
|
|
TEST_TITLE("WAL read error");
|
|
|
|
|
|
|
|
argList2 = strLstDup(argListMultiRepo);
|
|
|
|
hrnCfgArgRawZ(argList2, cfgOptStanza, "stanza1");
|
2021-06-01 09:03:44 -04:00
|
|
|
HRN_CFG_LOAD(cfgCmdInfo, argList2);
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
|
2021-06-24 08:55:44 -04:00
|
|
|
HRN_STORAGE_PATH_CREATE(
|
|
|
|
storageRepoWrite(), STORAGE_REPO_ARCHIVE "/9.4-1", .mode = 0200, .comment = "WAL directory with bad permissions");
|
|
|
|
|
|
|
|
TEST_RESULT_STR_Z(
|
|
|
|
infoRender(),
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
"stanza: stanza1\n"
|
|
|
|
" status: mixed\n"
|
|
|
|
" repo1: error (other)\n"
|
2021-06-28 13:28:28 -04:00
|
|
|
" [PathOpenError] unable to list file info for path '" TEST_PATH "/repo/archive/stanza1/9.4-1': [13]"
|
2021-06-28 10:58:27 -04:00
|
|
|
" Permission denied\n"
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
" repo2: error (no valid backups)\n"
|
|
|
|
" cipher: mixed\n"
|
|
|
|
" repo1: none\n"
|
|
|
|
" repo2: aes-256-cbc\n"
|
|
|
|
"\n"
|
|
|
|
" db (current)\n"
|
2021-06-24 08:55:44 -04:00
|
|
|
" wal archive min/max (9.5): 000000010000000000000003/000000010000000000000004\n",
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
"WAL directory read error");
|
2021-01-21 15:21:50 -05:00
|
|
|
|
|
|
|
// Unset environment key
|
|
|
|
hrnCfgEnvKeyRemoveRaw(cfgOptRepoCipherPass, 2);
|
2018-12-13 16:22:34 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//******************************************************************************************************************************
|
2021-01-21 15:21:50 -05:00
|
|
|
if (testBegin("database mismatch - special cases"))
|
2018-12-13 16:22:34 -05:00
|
|
|
{
|
|
|
|
// These tests cover branches not covered in other tests
|
2021-01-21 15:21:50 -05:00
|
|
|
TEST_TITLE("multi-repo, database mismatch, pg system-id only");
|
|
|
|
|
2021-06-24 08:55:44 -04:00
|
|
|
StringList *argList2 = strLstNew();
|
2021-06-28 13:28:28 -04:00
|
|
|
hrnCfgArgRawZ(argList2, cfgOptRepoPath, TEST_PATH "/repo");
|
2021-06-24 08:55:44 -04:00
|
|
|
hrnCfgArgRawZ(argList2, cfgOptStanza, "stanza1");
|
|
|
|
hrnCfgArgKeyRawZ(argList2, cfgOptRepoPath, 2, TEST_PATH "/repo2");
|
|
|
|
HRN_CFG_LOAD(cfgCmdInfo, argList2);
|
2021-01-21 15:21:50 -05:00
|
|
|
|
2021-06-24 08:55:44 -04:00
|
|
|
HRN_INFO_PUT(
|
|
|
|
storageRepoIdxWrite(0), INFO_BACKUP_PATH_FILE,
|
2021-01-21 15:21:50 -05:00
|
|
|
"[db]\n"
|
|
|
|
"db-catalog-version=201409291\n"
|
|
|
|
"db-control-version=942\n"
|
|
|
|
"db-id=1\n"
|
|
|
|
"db-system-id=6569239123849665679\n"
|
|
|
|
"db-version=\"9.4\"\n"
|
|
|
|
"\n"
|
|
|
|
"[backup:current]\n"
|
|
|
|
"20201116-155000F={"
|
|
|
|
"\"backrest-format\":5,\"backrest-version\":\"2.30\","
|
|
|
|
"\"backup-archive-start\":\"000000010000000000000002\",\"backup-archive-stop\":\"000000010000000000000003\","
|
|
|
|
"\"backup-info-repo-size\":3159000,\"backup-info-repo-size-delta\":3100,\"backup-info-size\":26897000,"
|
|
|
|
"\"backup-info-size-delta\":26897020,\"backup-timestamp-start\":1605541800,\"backup-timestamp-stop\":1605541802,"
|
|
|
|
"\"backup-type\":\"full\",\"db-id\":1,\"option-archive-check\":true,\"option-archive-copy\":true,"
|
|
|
|
"\"option-backup-standby\":false,\"option-checksum-page\":false,\"option-compress\":false,\"option-hardlink\":false,"
|
|
|
|
"\"option-online\":true}\n"
|
|
|
|
"\n"
|
|
|
|
"[db:history]\n"
|
|
|
|
"1={\"db-catalog-version\":201409291,\"db-control-version\":942,\"db-system-id\":6569239123849665679,"
|
2021-06-24 08:55:44 -04:00
|
|
|
"\"db-version\":\"9.4\"}\n",
|
|
|
|
.comment = "put backup info to file, repo1");
|
2021-01-21 15:21:50 -05:00
|
|
|
|
2021-06-24 08:55:44 -04:00
|
|
|
HRN_INFO_PUT(
|
|
|
|
storageRepoIdxWrite(0), INFO_ARCHIVE_PATH_FILE,
|
2021-01-21 15:21:50 -05:00
|
|
|
"[db]\n"
|
|
|
|
"db-id=1\n"
|
|
|
|
"db-system-id=6569239123849665679\n"
|
|
|
|
"db-version=\"9.4\"\n"
|
|
|
|
"\n"
|
|
|
|
"[db:history]\n"
|
2021-06-24 08:55:44 -04:00
|
|
|
"1={\"db-id\":6569239123849665679,\"db-version\":\"9.4\"}\n",
|
|
|
|
.comment = "put archive info to file, repo1");
|
|
|
|
|
|
|
|
// Create stanza1, repo1, archives
|
|
|
|
HRN_STORAGE_PUT_EMPTY(
|
|
|
|
storageRepoIdxWrite(0), STORAGE_REPO_ARCHIVE
|
|
|
|
"/9.4-1/0000000100000000/000000010000000000000002-22dff2b7552a9d66e4bae1a762488a6885e7082c.gz");
|
|
|
|
HRN_STORAGE_PUT_EMPTY(
|
|
|
|
storageRepoIdxWrite(0), STORAGE_REPO_ARCHIVE
|
|
|
|
"/9.4-1/0000000100000000/000000010000000000000003-37dff2b7552a9d66e4bae1a762488a6885e7082c.gz");
|
|
|
|
|
|
|
|
HRN_INFO_PUT(
|
|
|
|
storageRepoIdxWrite(1), INFO_BACKUP_PATH_FILE,
|
2021-01-21 15:21:50 -05:00
|
|
|
"[db]\n"
|
|
|
|
"db-catalog-version=201409291\n"
|
|
|
|
"db-control-version=942\n"
|
|
|
|
"db-id=1\n"
|
|
|
|
"db-system-id=6569239123849665679\n"
|
|
|
|
"db-version=\"9.5\"\n"
|
|
|
|
"\n"
|
|
|
|
"[backup:current]\n"
|
|
|
|
"20201116-155010F={"
|
|
|
|
"\"backrest-format\":5,\"backrest-version\":\"2.30\","
|
|
|
|
"\"backup-archive-start\":\"000000010000000000000001\",\"backup-archive-stop\":\"000000010000000000000002\","
|
|
|
|
"\"backup-info-repo-size\":3159000,\"backup-info-repo-size-delta\":3100,\"backup-info-size\":26897000,"
|
|
|
|
"\"backup-info-size-delta\":26897020,\"backup-timestamp-start\":1605541810,\"backup-timestamp-stop\":1605541812,"
|
|
|
|
"\"backup-type\":\"full\",\"db-id\":1,\"option-archive-check\":true,\"option-archive-copy\":true,"
|
|
|
|
"\"option-backup-standby\":false,\"option-checksum-page\":false,\"option-compress\":false,\"option-hardlink\":false,"
|
|
|
|
"\"option-online\":true}\n"
|
|
|
|
"\n"
|
|
|
|
"[db:history]\n"
|
|
|
|
"1={\"db-catalog-version\":201409291,\"db-control-version\":942,\"db-system-id\":6569239123849665679,"
|
2021-06-24 08:55:44 -04:00
|
|
|
"\"db-version\":\"9.5\"}\n",
|
|
|
|
.comment = "put backup info to file, repo2, same system-id, different version");
|
2021-01-21 15:21:50 -05:00
|
|
|
|
2021-06-24 08:55:44 -04:00
|
|
|
HRN_INFO_PUT(
|
|
|
|
storageRepoIdxWrite(1), INFO_ARCHIVE_PATH_FILE,
|
2021-01-21 15:21:50 -05:00
|
|
|
"[db]\n"
|
|
|
|
"db-id=1\n"
|
|
|
|
"db-system-id=6569239123849665679\n"
|
|
|
|
"db-version=\"9.5\"\n"
|
|
|
|
"\n"
|
|
|
|
"[db:history]\n"
|
2021-06-24 08:55:44 -04:00
|
|
|
"1={\"db-id\":6569239123849665679,\"db-version\":\"9.5\"}\n",
|
|
|
|
.comment = "put archive info to file, repo2, same system-id, different version");
|
2021-01-21 15:21:50 -05:00
|
|
|
|
2021-06-24 08:55:44 -04:00
|
|
|
HRN_STORAGE_PUT_EMPTY(
|
|
|
|
storageRepoIdxWrite(1), STORAGE_REPO_ARCHIVE
|
|
|
|
"/9.5-1/0000000100000000/000000010000000000000001-11dff2b7552a9d66e4bae1a762488a6885e7082c.gz");
|
|
|
|
HRN_STORAGE_PUT_EMPTY(
|
|
|
|
storageRepoIdxWrite(1), STORAGE_REPO_ARCHIVE
|
|
|
|
"/9.5-1/0000000100000000/000000010000000000000002-222ff2b7552a9d66e4bae1a762488a6885e7082c.gz");
|
2018-12-13 16:22:34 -05:00
|
|
|
|
2021-01-21 15:21:50 -05:00
|
|
|
// Note that although the time on the backup in repo2 > repo1, repo1 current db is not the same because of the version so
|
|
|
|
// the repo1, since read first, will be considered the current PG
|
2019-12-26 18:08:27 -07:00
|
|
|
TEST_RESULT_STR_Z(
|
2021-01-21 15:21:50 -05:00
|
|
|
infoRender(),
|
|
|
|
"stanza: stanza1\n"
|
|
|
|
" status: error (database mismatch across repos)\n"
|
|
|
|
" repo1: ok\n"
|
|
|
|
" repo2: ok\n"
|
|
|
|
" cipher: none\n"
|
|
|
|
"\n"
|
|
|
|
" db (prior)\n"
|
|
|
|
" wal archive min/max (9.5): 000000010000000000000001/000000010000000000000002\n"
|
|
|
|
"\n"
|
|
|
|
" full backup: 20201116-155010F\n"
|
|
|
|
" timestamp start/stop: 2020-11-16 15:50:10 / 2020-11-16 15:50:12\n"
|
|
|
|
" wal start/stop: 000000010000000000000001 / 000000010000000000000002\n"
|
2021-01-25 09:19:05 -05:00
|
|
|
" database size: 25.7MB, database backup size: 25.7MB\n"
|
|
|
|
" repo2: backup set size: 3MB, backup size: 3KB\n"
|
2018-12-13 16:22:34 -05:00
|
|
|
"\n"
|
|
|
|
" db (current)\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
" wal archive min/max (9.4): 000000010000000000000002/000000010000000000000003\n"
|
|
|
|
"\n"
|
|
|
|
" full backup: 20201116-155000F\n"
|
|
|
|
" timestamp start/stop: 2020-11-16 15:50:00 / 2020-11-16 15:50:02\n"
|
|
|
|
" wal start/stop: 000000010000000000000002 / 000000010000000000000003\n"
|
2021-01-25 09:19:05 -05:00
|
|
|
" database size: 25.7MB, database backup size: 25.7MB\n"
|
|
|
|
" repo1: backup set size: 3MB, backup size: 3KB\n",
|
2021-01-21 15:21:50 -05:00
|
|
|
"text - db mismatch, diff system-id across repos, repo1 considered current db since read first");
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------------------------------
|
|
|
|
TEST_TITLE("multi-repo, database mismatch, pg version only");
|
|
|
|
|
2021-06-24 08:55:44 -04:00
|
|
|
HRN_INFO_PUT(
|
|
|
|
storageRepoIdxWrite(1), INFO_BACKUP_PATH_FILE,
|
2021-01-21 15:21:50 -05:00
|
|
|
"[db]\n"
|
|
|
|
"db-catalog-version=201409291\n"
|
|
|
|
"db-control-version=942\n"
|
|
|
|
"db-id=1\n"
|
|
|
|
"db-system-id=6569239123849665888\n"
|
|
|
|
"db-version=\"9.4\"\n"
|
|
|
|
"\n"
|
|
|
|
"[backup:current]\n"
|
|
|
|
"20201116-155010F={"
|
|
|
|
"\"backrest-format\":5,\"backrest-version\":\"2.30\","
|
|
|
|
"\"backup-archive-start\":\"000000010000000000000001\",\"backup-archive-stop\":\"000000010000000000000002\","
|
|
|
|
"\"backup-info-repo-size\":3159000,\"backup-info-repo-size-delta\":3100,\"backup-info-size\":26897000,"
|
|
|
|
"\"backup-info-size-delta\":26897020,\"backup-timestamp-start\":1605541810,\"backup-timestamp-stop\":1605541812,"
|
|
|
|
"\"backup-type\":\"full\",\"db-id\":1,\"option-archive-check\":true,\"option-archive-copy\":true,"
|
|
|
|
"\"option-backup-standby\":false,\"option-checksum-page\":false,\"option-compress\":false,\"option-hardlink\":false,"
|
|
|
|
"\"option-online\":true}\n"
|
|
|
|
"\n"
|
|
|
|
"[db:history]\n"
|
|
|
|
"1={\"db-catalog-version\":201409291,\"db-control-version\":942,\"db-system-id\":6569239123849665888,"
|
2021-06-24 08:55:44 -04:00
|
|
|
"\"db-version\":\"9.4\"}\n",
|
|
|
|
.comment = "put backup info to file, repo2, different system-id, same version");
|
2021-01-21 15:21:50 -05:00
|
|
|
|
2021-06-24 08:55:44 -04:00
|
|
|
HRN_INFO_PUT(
|
|
|
|
storageRepoIdxWrite(1), INFO_ARCHIVE_PATH_FILE,
|
2021-01-21 15:21:50 -05:00
|
|
|
"[db]\n"
|
|
|
|
"db-id=1\n"
|
|
|
|
"db-system-id=6569239123849665888\n"
|
|
|
|
"db-version=\"9.4\"\n"
|
|
|
|
"\n"
|
|
|
|
"[db:history]\n"
|
2021-06-24 08:55:44 -04:00
|
|
|
"1={\"db-id\":6569239123849665888,\"db-version\":\"9.4\"}\n",
|
|
|
|
.comment = "put archive info to file, repo2, different system-id, same version");
|
2021-01-21 15:21:50 -05:00
|
|
|
|
|
|
|
TEST_RESULT_STR_Z(
|
|
|
|
infoRender(),
|
|
|
|
"stanza: stanza1\n"
|
|
|
|
" status: error (database mismatch across repos)\n"
|
|
|
|
" repo1: ok\n"
|
|
|
|
" repo2: ok\n"
|
|
|
|
" cipher: none\n"
|
|
|
|
"\n"
|
|
|
|
" db (prior)\n"
|
|
|
|
" wal archive min/max (9.4): none present\n"
|
|
|
|
"\n"
|
|
|
|
" full backup: 20201116-155010F\n"
|
|
|
|
" timestamp start/stop: 2020-11-16 15:50:10 / 2020-11-16 15:50:12\n"
|
|
|
|
" wal start/stop: 000000010000000000000001 / 000000010000000000000002\n"
|
2021-01-25 09:19:05 -05:00
|
|
|
" database size: 25.7MB, database backup size: 25.7MB\n"
|
|
|
|
" repo2: backup set size: 3MB, backup size: 3KB\n"
|
2021-01-21 15:21:50 -05:00
|
|
|
"\n"
|
|
|
|
" db (current)\n"
|
|
|
|
" wal archive min/max (9.4): 000000010000000000000002/000000010000000000000003\n"
|
|
|
|
"\n"
|
|
|
|
" full backup: 20201116-155000F\n"
|
|
|
|
" timestamp start/stop: 2020-11-16 15:50:00 / 2020-11-16 15:50:02\n"
|
|
|
|
" wal start/stop: 000000010000000000000002 / 000000010000000000000003\n"
|
2021-01-25 09:19:05 -05:00
|
|
|
" database size: 25.7MB, database backup size: 25.7MB\n"
|
|
|
|
" repo1: backup set size: 3MB, backup size: 3KB\n",
|
2021-01-21 15:21:50 -05:00
|
|
|
"text - db mismatch, diff version across repos, repo1 considered current db since read first");
|
2018-12-13 16:22:34 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//******************************************************************************************************************************
|
|
|
|
if (testBegin("cmdInfo()"))
|
|
|
|
{
|
|
|
|
StringList *argList = strLstNew();
|
2021-06-28 13:28:28 -04:00
|
|
|
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH "/repo");
|
2021-06-01 09:03:44 -04:00
|
|
|
HRN_CFG_LOAD(cfgCmdInfo, argList);
|
2018-12-13 16:22:34 -05:00
|
|
|
|
2021-06-24 08:55:44 -04:00
|
|
|
HRN_STORAGE_PATH_CREATE(storageRepoWrite(), STORAGE_REPO_ARCHIVE, .comment = "create repo archive path");
|
|
|
|
HRN_STORAGE_PATH_CREATE(storageRepoWrite(), STORAGE_REPO_BACKUP, .comment = "create repo backup path");
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------------------------------
|
|
|
|
TEST_TITLE("no stanza exist");
|
2018-12-13 16:22:34 -05:00
|
|
|
|
|
|
|
// Redirect stdout to a file
|
|
|
|
int stdoutSave = dup(STDOUT_FILENO);
|
2021-05-22 09:30:54 -04:00
|
|
|
const String *stdoutFile = STRDEF(TEST_PATH "/stdout.info");
|
2018-12-13 16:22:34 -05:00
|
|
|
|
2020-07-30 07:49:06 -04:00
|
|
|
THROW_ON_SYS_ERROR(freopen(strZ(stdoutFile), "w", stdout) == NULL, FileWriteError, "unable to reopen stdout");
|
2018-12-13 16:22:34 -05:00
|
|
|
|
|
|
|
// Not in a test wrapper to avoid writing to stdout
|
|
|
|
cmdInfo();
|
|
|
|
|
|
|
|
// Restore normal stdout
|
|
|
|
dup2(stdoutSave, STDOUT_FILENO);
|
|
|
|
|
2021-06-24 08:55:44 -04:00
|
|
|
// Check output of info command stored in file
|
|
|
|
TEST_STORAGE_GET(storageTest, strZ(stdoutFile), "No stanzas exist in the repository.\n", .remove = true);
|
2019-09-30 12:39:38 -04:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------------------------------
|
2021-06-24 08:55:44 -04:00
|
|
|
TEST_TITLE("set option invalid without stanza option");
|
|
|
|
|
|
|
|
hrnCfgArgRawZ(argList, cfgOptSet, "bogus");
|
2019-09-30 12:39:38 -04:00
|
|
|
|
2021-06-01 09:03:44 -04:00
|
|
|
TEST_ERROR(hrnCfgLoadP(cfgCmdInfo, argList), OptionInvalidError, "option 'set' not valid without option 'stanza'");
|
2019-09-30 12:39:38 -04:00
|
|
|
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
//--------------------------------------------------------------------------------------------------------------------------
|
|
|
|
TEST_TITLE("repo-level error");
|
|
|
|
|
2021-06-24 08:55:44 -04:00
|
|
|
HRN_STORAGE_PATH_CREATE(storageTest, TEST_PATH "/repo2", .mode = 0200, .comment = "repo directory with bad permissions");
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
|
|
|
|
argList = strLstNew();
|
2021-05-22 09:30:54 -04:00
|
|
|
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 1, TEST_PATH "/repo2");
|
2021-06-01 09:03:44 -04:00
|
|
|
HRN_CFG_LOAD(cfgCmdInfo, argList);
|
2019-09-30 12:39:38 -04:00
|
|
|
|
2021-05-22 09:30:54 -04:00
|
|
|
TEST_RESULT_STR_Z(
|
|
|
|
infoRender(),
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
"stanza: [invalid]\n"
|
|
|
|
" status: error (other)\n"
|
2021-05-22 09:30:54 -04:00
|
|
|
" [PathOpenError] unable to list file info for path '" TEST_PATH "/repo2/backup': [13] Permission denied\n"
|
|
|
|
" cipher: none\n",
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
"text - invalid stanza");
|
2021-01-21 15:21:50 -05:00
|
|
|
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
hrnCfgArgRawZ(argList, cfgOptOutput, "json");
|
2021-06-01 09:03:44 -04:00
|
|
|
HRN_CFG_LOAD(cfgCmdInfo, argList);
|
2021-01-21 15:21:50 -05:00
|
|
|
|
2021-05-22 09:30:54 -04:00
|
|
|
TEST_RESULT_STR_Z(
|
|
|
|
infoRender(),
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
"["
|
|
|
|
"{"
|
|
|
|
"\"archive\":[],"
|
|
|
|
"\"backup\":[],"
|
|
|
|
"\"cipher\":\"none\","
|
|
|
|
"\"db\":[],"
|
|
|
|
"\"name\":\"[invalid]\","
|
|
|
|
"\"repo\":["
|
|
|
|
"{"
|
|
|
|
"\"cipher\":\"none\","
|
|
|
|
"\"key\":1,"
|
|
|
|
"\"status\":{"
|
|
|
|
"\"code\":99,"
|
2021-05-22 09:30:54 -04:00
|
|
|
"\"message\":\"[PathOpenError] unable to list file info for path '" TEST_PATH "/repo2/backup':"
|
|
|
|
" [13] Permission denied\""
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
"}"
|
|
|
|
"}"
|
|
|
|
"],"
|
|
|
|
"\"status\":{"
|
|
|
|
"\"code\":99,"
|
|
|
|
"\"lock\":{\"backup\":{\"held\":false}},"
|
|
|
|
"\"message\":\"other\""
|
|
|
|
"}"
|
|
|
|
"}"
|
2021-05-22 09:30:54 -04:00
|
|
|
"]",
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
"json - invalid stanza");
|
|
|
|
|
|
|
|
argList = strLstNew();
|
2021-05-22 09:30:54 -04:00
|
|
|
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 1, TEST_PATH "/repo2");
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
hrnCfgArgRawZ(argList, cfgOptStanza, "stanza1");
|
2021-06-01 09:03:44 -04:00
|
|
|
HRN_CFG_LOAD(cfgCmdInfo, argList);
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
|
2021-05-22 09:30:54 -04:00
|
|
|
TEST_RESULT_STR_Z(
|
|
|
|
infoRender(),
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
"stanza: stanza1\n"
|
|
|
|
" status: error (other)\n"
|
2021-05-22 09:30:54 -04:00
|
|
|
" [PathOpenError] unable to list file info for path '" TEST_PATH "/repo2/backup': [13] Permission denied\n"
|
|
|
|
" cipher: none\n",
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
"text - stanza requested");
|
|
|
|
|
2021-05-22 09:30:54 -04:00
|
|
|
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 2, TEST_PATH "/repo");
|
2021-06-01 09:03:44 -04:00
|
|
|
HRN_CFG_LOAD(cfgCmdInfo, argList);
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
|
2021-05-22 09:30:54 -04:00
|
|
|
TEST_RESULT_STR_Z(
|
|
|
|
infoRender(),
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
"stanza: stanza1\n"
|
|
|
|
" status: mixed\n"
|
|
|
|
" repo1: error (other)\n"
|
2021-05-22 09:30:54 -04:00
|
|
|
" [PathOpenError] unable to list file info for path '" TEST_PATH "/repo2/backup':"
|
|
|
|
" [13] Permission denied\n"
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
" repo2: error (missing stanza path)\n"
|
2021-05-22 09:30:54 -04:00
|
|
|
" cipher: none\n",
|
Improve info command fault tolerance.
This improvement reduces the number of errors thrown; these errors will now be reported as a status for the stanza or repo as appropriate. Invalid option configurations are still thrown but all other errors are caught, formatted and reported. This was necessary for multiple repositories so that the command can complete gathering information from each repository and report the results rather than immediately aborting when an error occurs.
Two new error codes were introduced:
6 = requested backup not found
99 = other, which is used to indicate an error has occurred that requires more details to be provided
A new stanza name of "[invalid]" was created for instances where a stanza was not specified and no stanza can be found.
If there is only one repository configured the error will move up to the stanza level with the standard error formatting of 'error (message)' where the message will be "other" and the details of the error will be listed on the next line(s):
stanza: stanza1
status: error (other)
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
cipher: aes-256-cbc
If a backup set is requested but is not found on any repo, a stanza-level status error of 'requested backup not found' is reported when there are no other errors:
pgbackrest info --stanza=demo --set=bogus
stanza: demo
status: error (requested backup not found)
cipher: mixed
repo1: aes-256-cbc
repo2: none
If there are multiple repositories configured and a single repo is in error but the other repos are ok or have a different error:
pgbackrest info --stanza=demo --set=20210322-171211F
stanza: demo
status: mixed
repo1: error
[CryptoError] unable to load info file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info' or '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy':
CryptoError: cipher header invalid
HINT: is or was the repo encrypted?
FileMissingError: unable to open missing file '/var/lib/pgbackrest/repo/backup/stanza1/backup.info.copy' for read
HINT: backup.info cannot be opened and is required to perform a backup.
HINT: has a stanza-create been performed?
HINT: use option --stanza if encryption settings are different for the stanza than the global
repo2: ok
cipher: mixed
repo1: aes-256-cbc
repo2: none
db (current)
wal archive min/max (12): 000000010000000000000001/000000010000000000000003
full backup: 20210322-171211F
timestamp start/stop: 2021-03-22 17:12:11 / 2021-03-22 17:12:28
wal start/stop: 000000010000000000000002 / 000000010000000000000002
database size: 23.4MB, database backup size: 23.4MB
repo2: backup set size: 2.8MB, backup size: 2.8MB
database list: postgres (13359)
Json output will include the repository information and any error information. If no stanzas are found, then [invalid] will be set as the name:
[
{
"archive":[],
"backup":[],
"cipher":"none",
"db":[],
"name":"[invalid]",
"repo":[
{
"cipher":"none",
"key":1,
"status":{
"code":99,
"message":"[PathOpenError] unable to list file info for path '/var/lib/pgbackrest/repo2/backup': [13] Permission denied"
}
}
],
"status":{
"code":99,
"lock":{"backup":{"held":false}},
"message":"other"
}
}
]
2021-03-25 12:29:36 -04:00
|
|
|
"text - stanza repo structure exists");
|
2018-12-13 16:22:34 -05:00
|
|
|
}
|
|
|
|
|
2021-03-10 18:42:22 -05:00
|
|
|
FUNCTION_HARNESS_RETURN_VOID();
|
2018-12-13 16:22:34 -05:00
|
|
|
}
|