1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-14 10:13:05 +02:00

Remove stanza archive spool path on restore.

Remove stanza archive spool path so existing files do not interfere with the new cluster. For instance, old archive-push acknowledgements could cause a new cluster to skip archiving. This should not happen if a new timeline is selected but better to be safe. Missing stanza spool paths are ignored.

Also add new path expression STORAGE_SPOOL_ARCHIVE to easily access this path.
This commit is contained in:
David Steele 2021-05-18 15:49:22 -04:00 committed by GitHub
parent dc0e6645cd
commit 320c6e1aad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 67 additions and 11 deletions

View File

@ -88,6 +88,19 @@
</release-feature-list> </release-feature-list>
<release-improvement-list> <release-improvement-list>
<release-item>
<github-issue id="1357"/>
<github-pull-request id="1386"/>
<release-item-contributor-list>
<release-item-contributor id="david.steele"/>
<release-item-reviewer id="cynthia.shang"/>
<release-item-reviewer id="stefan.fercot"/>
</release-item-contributor-list>
<p>Remove stanza archive spool path on <cmd>restore</cmd>.</p>
</release-item>
<release-item> <release-item>
<github-issue id="1373"/> <github-issue id="1373"/>

View File

@ -862,6 +862,8 @@ option:
option: archive-async option: archive-async
list: list:
- true - true
restore:
internal: true
command-role: command-role:
async: {} async: {}
default: {} default: {}

View File

@ -3944,9 +3944,17 @@ static const unsigned char helpDataPack[] =
0x73, 0x74, 0x65, 0x6D, 0x20, 0x73, 0x75, 0x63, 0x68, 0x20, 0x61, 0x73, 0x20, 0x4E, 0x46, 0x53, 0x20, 0x6F, 0x72, 0x20, 0x73, 0x74, 0x65, 0x6D, 0x20, 0x73, 0x75, 0x63, 0x68, 0x20, 0x61, 0x73, 0x20, 0x4E, 0x46, 0x53, 0x20, 0x6F, 0x72, 0x20,
0x43, 0x49, 0x46, 0x53, 0x2E, 0x43, 0x49, 0x46, 0x53, 0x2E,
pckTypeArray << 4 | 0x01, // Command overrides begin
pckTypeObj << 4 | 0x0C, 0x01, // Command restore override begin
pckTypeBool << 4 | 0x08, // Internal
0x00, // Command restore override end
0x00, // Command overrides end
// stanza option // stanza option
// ------------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------------
pckTypeStr << 4 | 0x0B, 0x07, // Section pckTypeStr << 4 | 0x09, 0x07, // Section
0x67, 0x65, 0x6E, 0x65, 0x72, 0x61, 0x6C, 0x67, 0x65, 0x6E, 0x65, 0x72, 0x61, 0x6C,
pckTypeStr << 4 | 0x08, 0x13, // Summary pckTypeStr << 4 | 0x08, 0x13, // Summary
0x44, 0x65, 0x66, 0x69, 0x6E, 0x65, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x74, 0x61, 0x6E, 0x7A, 0x61, 0x2E, 0x44, 0x65, 0x66, 0x69, 0x6E, 0x65, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x74, 0x61, 0x6E, 0x7A, 0x61, 0x2E,

View File

@ -2196,6 +2196,11 @@ cmdRestore(void)
// Validate restore path // Validate restore path
restorePathValidate(); restorePathValidate();
// Remove stanza archive spool path so existing files do not interfere with the new cluster. For instance, old archive-push
// acknowledgements could cause a new cluster to skip archiving. This should not happen if a new timeline is selected but
// better to be safe. Missing stanza spool paths are ignored.
storagePathRemoveP(storageSpoolWrite(), STORAGE_SPOOL_ARCHIVE_STR, .recurse = true);
// Get the backup set // Get the backup set
RestoreBackupData backupData = restoreBackupSet(); RestoreBackupData backupData = restoreBackupSet();

View File

@ -5872,6 +5872,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
( (
PARSE_RULE_OPTION_COMMAND(cfgCmdArchiveGet) PARSE_RULE_OPTION_COMMAND(cfgCmdArchiveGet)
PARSE_RULE_OPTION_COMMAND(cfgCmdArchivePush) PARSE_RULE_OPTION_COMMAND(cfgCmdArchivePush)
PARSE_RULE_OPTION_COMMAND(cfgCmdRestore)
), ),
PARSE_RULE_OPTION_COMMAND_ROLE_ASYNC_VALID_LIST PARSE_RULE_OPTION_COMMAND_ROLE_ASYNC_VALID_LIST
@ -5884,6 +5885,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
( (
PARSE_RULE_OPTION_COMMAND(cfgCmdArchiveGet) PARSE_RULE_OPTION_COMMAND(cfgCmdArchiveGet)
PARSE_RULE_OPTION_COMMAND(cfgCmdArchivePush) PARSE_RULE_OPTION_COMMAND(cfgCmdArchivePush)
PARSE_RULE_OPTION_COMMAND(cfgCmdRestore)
), ),
PARSE_RULE_OPTION_OPTIONAL_LIST PARSE_RULE_OPTION_OPTIONAL_LIST

View File

@ -22,6 +22,7 @@ Storage Helper
/*********************************************************************************************************************************** /***********************************************************************************************************************************
Storage path constants Storage path constants
***********************************************************************************************************************************/ ***********************************************************************************************************************************/
STRING_EXTERN(STORAGE_SPOOL_ARCHIVE_STR, STORAGE_SPOOL_ARCHIVE);
STRING_EXTERN(STORAGE_SPOOL_ARCHIVE_IN_STR, STORAGE_SPOOL_ARCHIVE_IN); STRING_EXTERN(STORAGE_SPOOL_ARCHIVE_IN_STR, STORAGE_SPOOL_ARCHIVE_IN);
STRING_EXTERN(STORAGE_SPOOL_ARCHIVE_OUT_STR, STORAGE_SPOOL_ARCHIVE_OUT); STRING_EXTERN(STORAGE_SPOOL_ARCHIVE_OUT_STR, STORAGE_SPOOL_ARCHIVE_OUT);
@ -529,7 +530,14 @@ storageSpoolPathExpression(const String *expression, const String *path)
String *result = NULL; String *result = NULL;
if (strEqZ(expression, STORAGE_SPOOL_ARCHIVE_IN)) if (strEqZ(expression, STORAGE_SPOOL_ARCHIVE))
{
if (path == NULL)
result = strNewFmt(STORAGE_PATH_ARCHIVE "/%s", strZ(storageHelper.stanza));
else
result = strNewFmt(STORAGE_PATH_ARCHIVE "/%s/%s", strZ(storageHelper.stanza), strZ(path));
}
else if (strEqZ(expression, STORAGE_SPOOL_ARCHIVE_IN))
{ {
if (path == NULL) if (path == NULL)
result = strNewFmt(STORAGE_PATH_ARCHIVE "/%s/in", strZ(storageHelper.stanza)); result = strNewFmt(STORAGE_PATH_ARCHIVE "/%s/in", strZ(storageHelper.stanza));

View File

@ -9,6 +9,8 @@ Storage Helper
/*********************************************************************************************************************************** /***********************************************************************************************************************************
Storage path constants Storage path constants
***********************************************************************************************************************************/ ***********************************************************************************************************************************/
#define STORAGE_SPOOL_ARCHIVE "<SPOOL:ARCHIVE>"
STRING_DECLARE(STORAGE_SPOOL_ARCHIVE_STR);
#define STORAGE_SPOOL_ARCHIVE_IN "<SPOOL:ARCHIVE:IN>" #define STORAGE_SPOOL_ARCHIVE_IN "<SPOOL:ARCHIVE:IN>"
STRING_DECLARE(STORAGE_SPOOL_ARCHIVE_IN_STR); STRING_DECLARE(STORAGE_SPOOL_ARCHIVE_IN_STR);
#define STORAGE_SPOOL_ARCHIVE_OUT "<SPOOL:ARCHIVE:OUT>" #define STORAGE_SPOOL_ARCHIVE_OUT "<SPOOL:ARCHIVE:OUT>"

View File

@ -488,7 +488,7 @@ backrest-checksum="[CHECKSUM]"
restore delta, backup '[BACKUP-FULL-2]' - add and delete files (db-primary host) restore delta, backup '[BACKUP-FULL-2]' - add and delete files (db-primary host)
> [CONTAINER-EXEC] db-primary [BACKREST-BIN] --config=[TEST_PATH]/db-primary/pgbackrest.conf --delta --set=[BACKUP-FULL-2] --link-all --stanza=db restore > [CONTAINER-EXEC] db-primary [BACKREST-BIN] --config=[TEST_PATH]/db-primary/pgbackrest.conf --delta --set=[BACKUP-FULL-2] --link-all --stanza=db restore
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
P00 INFO: restore command begin [BACKREST-VERSION]: --buffer-size=[BUFFER-SIZE] --config=[TEST_PATH]/db-primary/pgbackrest.conf --delta --exec-id=[EXEC-ID] --job-retry=0 --link-all --lock-path=[TEST_PATH]/db-primary/lock --log-level-console=detail --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/db-primary/log[] --no-log-timestamp --pg1-path=[TEST_PATH]/db-primary/db/base --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-primary/repo --set=[BACKUP-FULL-2] --stanza=db P00 INFO: restore command begin [BACKREST-VERSION]: --buffer-size=[BUFFER-SIZE] --config=[TEST_PATH]/db-primary/pgbackrest.conf --delta --exec-id=[EXEC-ID] --job-retry=0 --link-all --lock-path=[TEST_PATH]/db-primary/lock --log-level-console=detail --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/db-primary/log[] --no-log-timestamp --pg1-path=[TEST_PATH]/db-primary/db/base --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-primary/repo --set=[BACKUP-FULL-2] --spool-path=[TEST_PATH]/db-primary/spool --stanza=db
P00 INFO: repo1: restore backup set [BACKUP-FULL-2] P00 INFO: repo1: restore backup set [BACKUP-FULL-2]
P00 WARN: unknown user in backup manifest mapped to '[USER-2]' P00 WARN: unknown user in backup manifest mapped to '[USER-2]'
P00 WARN: unknown group in backup manifest mapped to '[GROUP-2]' P00 WARN: unknown group in backup manifest mapped to '[GROUP-2]'
@ -573,7 +573,7 @@ restore_command = '[BACKREST-BIN] --config=[TEST_PATH]/db-primary/pgbackrest.con
restore delta, backup '[BACKUP-FULL-2]' - fix permissions (db-primary host) restore delta, backup '[BACKUP-FULL-2]' - fix permissions (db-primary host)
> [CONTAINER-EXEC] db-primary [BACKREST-BIN] --config=[TEST_PATH]/db-primary/pgbackrest.conf --delta --set=[BACKUP-FULL-2] --link-all --log-level-console=detail --stanza=db restore > [CONTAINER-EXEC] db-primary [BACKREST-BIN] --config=[TEST_PATH]/db-primary/pgbackrest.conf --delta --set=[BACKUP-FULL-2] --link-all --log-level-console=detail --stanza=db restore
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
P00 INFO: restore command begin [BACKREST-VERSION]: --buffer-size=[BUFFER-SIZE] --config=[TEST_PATH]/db-primary/pgbackrest.conf --delta --exec-id=[EXEC-ID] --job-retry=0 --link-all --lock-path=[TEST_PATH]/db-primary/lock --log-level-console=detail --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/db-primary/log[] --no-log-timestamp --pg1-path=[TEST_PATH]/db-primary/db/base --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-primary/repo --set=[BACKUP-FULL-2] --stanza=db P00 INFO: restore command begin [BACKREST-VERSION]: --buffer-size=[BUFFER-SIZE] --config=[TEST_PATH]/db-primary/pgbackrest.conf --delta --exec-id=[EXEC-ID] --job-retry=0 --link-all --lock-path=[TEST_PATH]/db-primary/lock --log-level-console=detail --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/db-primary/log[] --no-log-timestamp --pg1-path=[TEST_PATH]/db-primary/db/base --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-primary/repo --set=[BACKUP-FULL-2] --spool-path=[TEST_PATH]/db-primary/spool --stanza=db
P00 INFO: repo1: restore backup set [BACKUP-FULL-2] P00 INFO: repo1: restore backup set [BACKUP-FULL-2]
P00 WARN: unknown user in backup manifest mapped to '[USER-1]' P00 WARN: unknown user in backup manifest mapped to '[USER-1]'
P00 WARN: unknown group in backup manifest mapped to '[GROUP-1]' P00 WARN: unknown group in backup manifest mapped to '[GROUP-1]'
@ -634,7 +634,7 @@ restore_command = '[BACKREST-BIN] --config=[TEST_PATH]/db-primary/pgbackrest.con
restore delta, backup '[BACKUP-FULL-2]' - fix broken symlink (db-primary host) restore delta, backup '[BACKUP-FULL-2]' - fix broken symlink (db-primary host)
> [CONTAINER-EXEC] db-primary [BACKREST-BIN] --config=[TEST_PATH]/db-primary/pgbackrest.conf --delta --set=[BACKUP-FULL-2] --link-all --stanza=db restore > [CONTAINER-EXEC] db-primary [BACKREST-BIN] --config=[TEST_PATH]/db-primary/pgbackrest.conf --delta --set=[BACKUP-FULL-2] --link-all --stanza=db restore
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
P00 INFO: restore command begin [BACKREST-VERSION]: --buffer-size=[BUFFER-SIZE] --config=[TEST_PATH]/db-primary/pgbackrest.conf --delta --exec-id=[EXEC-ID] --job-retry=0 --link-all --lock-path=[TEST_PATH]/db-primary/lock --log-level-console=detail --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/db-primary/log[] --no-log-timestamp --pg1-path=[TEST_PATH]/db-primary/db/base --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-primary/repo --set=[BACKUP-FULL-2] --stanza=db P00 INFO: restore command begin [BACKREST-VERSION]: --buffer-size=[BUFFER-SIZE] --config=[TEST_PATH]/db-primary/pgbackrest.conf --delta --exec-id=[EXEC-ID] --job-retry=0 --link-all --lock-path=[TEST_PATH]/db-primary/lock --log-level-console=detail --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/db-primary/log[] --no-log-timestamp --pg1-path=[TEST_PATH]/db-primary/db/base --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-primary/repo --set=[BACKUP-FULL-2] --spool-path=[TEST_PATH]/db-primary/spool --stanza=db
P00 INFO: repo1: restore backup set [BACKUP-FULL-2] P00 INFO: repo1: restore backup set [BACKUP-FULL-2]
P00 WARN: unknown user in backup manifest mapped to current user P00 WARN: unknown user in backup manifest mapped to current user
P00 WARN: unknown group in backup manifest mapped to current group P00 WARN: unknown group in backup manifest mapped to current group
@ -695,7 +695,7 @@ restore_command = '[BACKREST-BIN] --config=[TEST_PATH]/db-primary/pgbackrest.con
restore delta, force, backup '[BACKUP-FULL-2]' - restore links as directories (db-primary host) restore delta, force, backup '[BACKUP-FULL-2]' - restore links as directories (db-primary host)
> [CONTAINER-EXEC] db-primary [BACKREST-BIN] --config=[TEST_PATH]/db-primary/pgbackrest.conf --delta --force --set=[BACKUP-FULL-2] --stanza=db restore > [CONTAINER-EXEC] db-primary [BACKREST-BIN] --config=[TEST_PATH]/db-primary/pgbackrest.conf --delta --force --set=[BACKUP-FULL-2] --stanza=db restore
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
P00 INFO: restore command begin [BACKREST-VERSION]: --buffer-size=[BUFFER-SIZE] --config=[TEST_PATH]/db-primary/pgbackrest.conf --delta --exec-id=[EXEC-ID] --force --job-retry=0 --lock-path=[TEST_PATH]/db-primary/lock --log-level-console=detail --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/db-primary/log[] --no-log-timestamp --pg1-path=[TEST_PATH]/db-primary/db/base --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-primary/repo --set=[BACKUP-FULL-2] --stanza=db P00 INFO: restore command begin [BACKREST-VERSION]: --buffer-size=[BUFFER-SIZE] --config=[TEST_PATH]/db-primary/pgbackrest.conf --delta --exec-id=[EXEC-ID] --force --job-retry=0 --lock-path=[TEST_PATH]/db-primary/lock --log-level-console=detail --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/db-primary/log[] --no-log-timestamp --pg1-path=[TEST_PATH]/db-primary/db/base --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-primary/repo --set=[BACKUP-FULL-2] --spool-path=[TEST_PATH]/db-primary/spool --stanza=db
P00 INFO: repo1: restore backup set [BACKUP-FULL-2] P00 INFO: repo1: restore backup set [BACKUP-FULL-2]
P00 WARN: file link 'pg_hba.conf' will be restored as a file at the same location P00 WARN: file link 'pg_hba.conf' will be restored as a file at the same location
P00 WARN: contents of directory link 'pg_stat' will be restored in a directory at the same location P00 WARN: contents of directory link 'pg_stat' will be restored in a directory at the same location
@ -1391,7 +1391,7 @@ backrest-checksum="[CHECKSUM]"
restore, backup '[BACKUP-DIFF-1]', remap - remap all paths (db-primary host) restore, backup '[BACKUP-DIFF-1]', remap - remap all paths (db-primary host)
> [CONTAINER-EXEC] db-primary [BACKREST-BIN] --config=[TEST_PATH]/db-primary/pgbackrest.conf --set=[BACKUP-DIFF-1] --stanza=db restore > [CONTAINER-EXEC] db-primary [BACKREST-BIN] --config=[TEST_PATH]/db-primary/pgbackrest.conf --set=[BACKUP-DIFF-1] --stanza=db restore
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
P00 INFO: restore command begin [BACKREST-VERSION]: --buffer-size=[BUFFER-SIZE] --config=[TEST_PATH]/db-primary/pgbackrest.conf --exec-id=[EXEC-ID] --job-retry=0 --lock-path=[TEST_PATH]/db-primary/lock --log-level-console=detail --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/db-primary/log[] --no-log-timestamp --pg1-path=[TEST_PATH]/db-primary/db/base-2 --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-primary/repo --set=[BACKUP-DIFF-1] --stanza=db --tablespace-map=1=[TEST_PATH]/db-primary/db/tablespace/ts1-2 --tablespace-map=2=[TEST_PATH]/db-primary/db/tablespace/ts2-2 P00 INFO: restore command begin [BACKREST-VERSION]: --buffer-size=[BUFFER-SIZE] --config=[TEST_PATH]/db-primary/pgbackrest.conf --exec-id=[EXEC-ID] --job-retry=0 --lock-path=[TEST_PATH]/db-primary/lock --log-level-console=detail --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/db-primary/log[] --no-log-timestamp --pg1-path=[TEST_PATH]/db-primary/db/base-2 --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-primary/repo --set=[BACKUP-DIFF-1] --spool-path=[TEST_PATH]/db-primary/spool --stanza=db --tablespace-map=1=[TEST_PATH]/db-primary/db/tablespace/ts1-2 --tablespace-map=2=[TEST_PATH]/db-primary/db/tablespace/ts2-2
P00 INFO: repo1: restore backup set [BACKUP-DIFF-1] P00 INFO: repo1: restore backup set [BACKUP-DIFF-1]
P00 INFO: remap data directory to '[TEST_PATH]/db-primary/db/base-2' P00 INFO: remap data directory to '[TEST_PATH]/db-primary/db/base-2'
P00 INFO: map tablespace 'pg_tblspc/1' to '[TEST_PATH]/db-primary/db/tablespace/ts1-2' P00 INFO: map tablespace 'pg_tblspc/1' to '[TEST_PATH]/db-primary/db/tablespace/ts1-2'
@ -1476,7 +1476,7 @@ restore_command = '[BACKREST-BIN] --config=[TEST_PATH]/db-primary/pgbackrest.con
restore delta, backup '[BACKUP-DIFF-1]', remap - ensure file in tblspc root remains after --delta (db-primary host) restore delta, backup '[BACKUP-DIFF-1]', remap - ensure file in tblspc root remains after --delta (db-primary host)
> [CONTAINER-EXEC] db-primary [BACKREST-BIN] --config=[TEST_PATH]/db-primary/pgbackrest.conf --delta --set=[BACKUP-DIFF-1] --stanza=db restore > [CONTAINER-EXEC] db-primary [BACKREST-BIN] --config=[TEST_PATH]/db-primary/pgbackrest.conf --delta --set=[BACKUP-DIFF-1] --stanza=db restore
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
P00 INFO: restore command begin [BACKREST-VERSION]: --buffer-size=[BUFFER-SIZE] --config=[TEST_PATH]/db-primary/pgbackrest.conf --delta --exec-id=[EXEC-ID] --job-retry=0 --lock-path=[TEST_PATH]/db-primary/lock --log-level-console=detail --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/db-primary/log[] --no-log-timestamp --pg1-path=[TEST_PATH]/db-primary/db/base-2 --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-primary/repo --set=[BACKUP-DIFF-1] --stanza=db --tablespace-map=1=[TEST_PATH]/db-primary/db/tablespace/ts1-2 --tablespace-map=2=[TEST_PATH]/db-primary/db/tablespace/ts2-2 P00 INFO: restore command begin [BACKREST-VERSION]: --buffer-size=[BUFFER-SIZE] --config=[TEST_PATH]/db-primary/pgbackrest.conf --delta --exec-id=[EXEC-ID] --job-retry=0 --lock-path=[TEST_PATH]/db-primary/lock --log-level-console=detail --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/db-primary/log[] --no-log-timestamp --pg1-path=[TEST_PATH]/db-primary/db/base-2 --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-primary/repo --set=[BACKUP-DIFF-1] --spool-path=[TEST_PATH]/db-primary/spool --stanza=db --tablespace-map=1=[TEST_PATH]/db-primary/db/tablespace/ts1-2 --tablespace-map=2=[TEST_PATH]/db-primary/db/tablespace/ts2-2
P00 INFO: repo1: restore backup set [BACKUP-DIFF-1] P00 INFO: repo1: restore backup set [BACKUP-DIFF-1]
P00 INFO: remap data directory to '[TEST_PATH]/db-primary/db/base-2' P00 INFO: remap data directory to '[TEST_PATH]/db-primary/db/base-2'
P00 INFO: map tablespace 'pg_tblspc/1' to '[TEST_PATH]/db-primary/db/tablespace/ts1-2' P00 INFO: map tablespace 'pg_tblspc/1' to '[TEST_PATH]/db-primary/db/tablespace/ts1-2'
@ -2814,7 +2814,7 @@ backrest-checksum="[CHECKSUM]"
restore delta, remap - selective restore 16384 (db-primary host) restore delta, remap - selective restore 16384 (db-primary host)
> [CONTAINER-EXEC] db-primary [BACKREST-BIN] --config=[TEST_PATH]/db-primary/pgbackrest.conf --delta --db-include=16384 --stanza=db restore > [CONTAINER-EXEC] db-primary [BACKREST-BIN] --config=[TEST_PATH]/db-primary/pgbackrest.conf --delta --db-include=16384 --stanza=db restore
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
P00 INFO: restore command begin [BACKREST-VERSION]: --buffer-size=[BUFFER-SIZE] --config=[TEST_PATH]/db-primary/pgbackrest.conf --db-include=16384 --delta --exec-id=[EXEC-ID] --job-retry=0 --lock-path=[TEST_PATH]/db-primary/lock --log-level-console=detail --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/db-primary/log[] --no-log-timestamp --pg1-path=[TEST_PATH]/db-primary/db/base-2 --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-primary/repo --stanza=db --tablespace-map=2=[TEST_PATH]/db-primary/db/tablespace/ts2-2 P00 INFO: restore command begin [BACKREST-VERSION]: --buffer-size=[BUFFER-SIZE] --config=[TEST_PATH]/db-primary/pgbackrest.conf --db-include=16384 --delta --exec-id=[EXEC-ID] --job-retry=0 --lock-path=[TEST_PATH]/db-primary/lock --log-level-console=detail --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/db-primary/log[] --no-log-timestamp --pg1-path=[TEST_PATH]/db-primary/db/base-2 --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-primary/repo --spool-path=[TEST_PATH]/db-primary/spool --stanza=db --tablespace-map=2=[TEST_PATH]/db-primary/db/tablespace/ts2-2
P00 INFO: repo1: restore backup set [BACKUP-DIFF-4] P00 INFO: repo1: restore backup set [BACKUP-DIFF-4]
P00 INFO: map tablespace 'pg_tblspc/2' to '[TEST_PATH]/db-primary/db/tablespace/ts2-2' P00 INFO: map tablespace 'pg_tblspc/2' to '[TEST_PATH]/db-primary/db/tablespace/ts2-2'
P00 DETAIL: databases found for selective restore (1, 16384, 32768) P00 DETAIL: databases found for selective restore (1, 16384, 32768)
@ -2879,7 +2879,7 @@ restore_command = '[BACKREST-BIN] --config=[TEST_PATH]/db-primary/pgbackrest.con
restore delta, remap - selective restore 32768 (db-primary host) restore delta, remap - selective restore 32768 (db-primary host)
> [CONTAINER-EXEC] db-primary [BACKREST-BIN] --config=[TEST_PATH]/db-primary/pgbackrest.conf --delta --db-include=32768 --stanza=db restore > [CONTAINER-EXEC] db-primary [BACKREST-BIN] --config=[TEST_PATH]/db-primary/pgbackrest.conf --delta --db-include=32768 --stanza=db restore
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
P00 INFO: restore command begin [BACKREST-VERSION]: --buffer-size=[BUFFER-SIZE] --config=[TEST_PATH]/db-primary/pgbackrest.conf --db-include=32768 --delta --exec-id=[EXEC-ID] --job-retry=0 --lock-path=[TEST_PATH]/db-primary/lock --log-level-console=detail --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/db-primary/log[] --no-log-timestamp --pg1-path=[TEST_PATH]/db-primary/db/base-2 --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-primary/repo --stanza=db --tablespace-map=2=[TEST_PATH]/db-primary/db/tablespace/ts2-2 P00 INFO: restore command begin [BACKREST-VERSION]: --buffer-size=[BUFFER-SIZE] --config=[TEST_PATH]/db-primary/pgbackrest.conf --db-include=32768 --delta --exec-id=[EXEC-ID] --job-retry=0 --lock-path=[TEST_PATH]/db-primary/lock --log-level-console=detail --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/db-primary/log[] --no-log-timestamp --pg1-path=[TEST_PATH]/db-primary/db/base-2 --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-primary/repo --spool-path=[TEST_PATH]/db-primary/spool --stanza=db --tablespace-map=2=[TEST_PATH]/db-primary/db/tablespace/ts2-2
P00 INFO: repo1: restore backup set [BACKUP-DIFF-4] P00 INFO: repo1: restore backup set [BACKUP-DIFF-4]
P00 INFO: map tablespace 'pg_tblspc/2' to '[TEST_PATH]/db-primary/db/tablespace/ts2-2' P00 INFO: map tablespace 'pg_tblspc/2' to '[TEST_PATH]/db-primary/db/tablespace/ts2-2'
P00 DETAIL: databases found for selective restore (1, 16384, 32768) P00 DETAIL: databases found for selective restore (1, 16384, 32768)
@ -2954,7 +2954,7 @@ P00 ERROR: [081]: system databases (template0, postgres, etc.) are included by
restore, remap - no tablespace remap (db-primary host) restore, remap - no tablespace remap (db-primary host)
> [CONTAINER-EXEC] db-primary [BACKREST-BIN] --config=[TEST_PATH]/db-primary/pgbackrest.conf --tablespace-map-all=../../tablespace --stanza=db restore > [CONTAINER-EXEC] db-primary [BACKREST-BIN] --config=[TEST_PATH]/db-primary/pgbackrest.conf --tablespace-map-all=../../tablespace --stanza=db restore
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
P00 INFO: restore command begin [BACKREST-VERSION]: --buffer-size=[BUFFER-SIZE] --config=[TEST_PATH]/db-primary/pgbackrest.conf --exec-id=[EXEC-ID] --job-retry=0 --lock-path=[TEST_PATH]/db-primary/lock --log-level-console=detail --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/db-primary/log[] --no-log-timestamp --pg1-path=[TEST_PATH]/db-primary/db/base-2/base --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-primary/repo --stanza=db --tablespace-map-all=../../tablespace P00 INFO: restore command begin [BACKREST-VERSION]: --buffer-size=[BUFFER-SIZE] --config=[TEST_PATH]/db-primary/pgbackrest.conf --exec-id=[EXEC-ID] --job-retry=0 --lock-path=[TEST_PATH]/db-primary/lock --log-level-console=detail --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/db-primary/log[] --no-log-timestamp --pg1-path=[TEST_PATH]/db-primary/db/base-2/base --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-primary/repo --spool-path=[TEST_PATH]/db-primary/spool --stanza=db --tablespace-map-all=../../tablespace
P00 INFO: repo1: restore backup set [BACKUP-DIFF-4] P00 INFO: repo1: restore backup set [BACKUP-DIFF-4]
P00 INFO: remap data directory to '[TEST_PATH]/db-primary/db/base-2/base' P00 INFO: remap data directory to '[TEST_PATH]/db-primary/db/base-2/base'
P00 INFO: map tablespace 'pg_tblspc/2' to '../../tablespace/ts2' P00 INFO: map tablespace 'pg_tblspc/2' to '../../tablespace/ts2'

View File

@ -2655,6 +2655,7 @@ testRun(void)
hrnCfgArgKeyRaw(argList, cfgOptRepoPath, 2, repoPath); hrnCfgArgKeyRaw(argList, cfgOptRepoPath, 2, repoPath);
hrnCfgArgRawZ(argList, cfgOptRepo, "2"); hrnCfgArgRawZ(argList, cfgOptRepo, "2");
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath))); strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
hrnCfgArgRawZ(argList, cfgOptSpoolPath, TEST_PATH_SPOOL);
strLstAddZ(argList, "--delta"); strLstAddZ(argList, "--delta");
strLstAddZ(argList, "--type=preserve"); strLstAddZ(argList, "--type=preserve");
strLstAddZ(argList, "--link-map=pg_wal=../wal"); strLstAddZ(argList, "--link-map=pg_wal=../wal");
@ -2668,6 +2669,9 @@ testRun(void)
TEST_SYSTEM_FMT("mv %s %s-data", strZ(pgPath), strZ(pgPath)); TEST_SYSTEM_FMT("mv %s %s-data", strZ(pgPath), strZ(pgPath));
TEST_SYSTEM_FMT("ln -s %s-data %s ", strZ(pgPath), strZ(pgPath)); TEST_SYSTEM_FMT("ln -s %s-data %s ", strZ(pgPath), strZ(pgPath));
// Create the stanza archive pool path to check that it gets removed
HRN_STORAGE_PUT_EMPTY(storageSpoolWrite(), STORAGE_SPOOL_ARCHIVE "/empty.txt");
// Write recovery.conf so we don't get a preserve warning // Write recovery.conf so we don't get a preserve warning
storagePutP(storageNewWriteP(storagePgWrite(), PG_FILE_RECOVERYCONF_STR), BUFSTRDEF("Some Settings")); storagePutP(storageNewWriteP(storagePgWrite(), PG_FILE_RECOVERYCONF_STR), BUFSTRDEF("Some Settings"));
@ -2722,6 +2726,9 @@ testRun(void)
"P00 INFO: restore global/pg_control (performed last to ensure aborted restores cannot be started)\n" "P00 INFO: restore global/pg_control (performed last to ensure aborted restores cannot be started)\n"
"P00 DETAIL: sync path '{[path]}/pg/global'"); "P00 DETAIL: sync path '{[path]}/pg/global'");
// Check stanza archive spool path was removed
TEST_STORAGE_LIST_EMPTY(storageSpool(), STORAGE_PATH_ARCHIVE);
// ------------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------------
// Keep this test at the end since is corrupts the repo // Keep this test at the end since is corrupts the repo
TEST_TITLE("remove a repo file so a restore job errors"); TEST_TITLE("remove a repo file so a restore job errors");

View File

@ -1240,6 +1240,15 @@ testRun(void)
TEST_RESULT_PTR(storageHelper.storageSpool, storage, "storage cached"); TEST_RESULT_PTR(storageHelper.storageSpool, storage, "storage cached");
TEST_RESULT_PTR(storageSpool(), storage, "get cached storage"); TEST_RESULT_PTR(storageSpool(), storage, "get cached storage");
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("STORAGE_SPOOL_ARCHIVE expression");
TEST_RESULT_STR(
storagePathP(storage, strNew(STORAGE_SPOOL_ARCHIVE)), strNewFmt("%s/archive/db", testPath()), "check spool path");
TEST_RESULT_STR(
storagePathP(storage, strNewFmt("%s/%s", STORAGE_SPOOL_ARCHIVE, "file.ext")),
strNewFmt("%s/archive/db/file.ext", testPath()), "check spool file");
// ------------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------------
TEST_RESULT_STR_Z(storagePathP(storage, NULL), testPath(), "check base path"); TEST_RESULT_STR_Z(storagePathP(storage, NULL), testPath(), "check base path");
TEST_RESULT_STR( TEST_RESULT_STR(