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

Add backup type filter to info command.

Support --type option in the info command to display only a specific backup type.
This commit is contained in:
Stefan Fercot 2022-02-09 17:18:39 +01:00 committed by GitHub
parent cb630ffe3b
commit b26097f8d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 92 additions and 1 deletions

View File

@ -34,6 +34,18 @@
<p>Add support for <proper>AWS</proper> <proper>S3</proper> server-side encryption using <proper>KMS</proper>.</p>
</release-item>
<release-item>
<github-issue id="600"/>
<github-pull-request id="1651"/>
<release-item-contributor-list>
<release-item-contributor id="stefan.fercot"/>
<release-item-reviewer id="david.steele"/>
</release-item-contributor-list>
<p>Add backup type filter to <cmd>info</cmd> command.</p>
</release-item>
</release-feature-list>
<release-improvement-list>

View File

@ -429,6 +429,12 @@ option:
- diff
- incr
default: incr
info:
required: false
allow-list:
- full
- diff
- incr
restore:
allow-list:
- lsn

View File

@ -2270,6 +2270,7 @@
<example>json</example>
</option>
<!-- ======================================================================================================= -->
<option id="set" name="Set">
<summary>Backup set to detail.</summary>
@ -2279,6 +2280,17 @@
<example>20150131-153358F_20150131-153401I</example>
</option>
<!-- ======================================================================================================= -->
<option id="type" name="Type">
<summary>Filter on backup type.</summary>
<text>
<p>Filter the output using one of the following backup types: <id>full</id>, <id>incr</id>, <id>diff</id>.</p>
</text>
<example>full</example>
</option>
</option-list>
</command>

View File

@ -623,7 +623,8 @@ backupList(
repoData->backupIdx++;
// Add the backup data to the backup section
backupListAdd(backupSection, &backupData, backupLabel, repoData);
if (!cfgOptionTest(cfgOptType) || cfgOptionStrId(cfgOptType) == backupData.backupType)
backupListAdd(backupSection, &backupData, backupLabel, repoData);
backupTotalProcessed++;
}

View File

@ -8706,6 +8706,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
PARSE_RULE_OPTION_COMMAND_ROLE_MAIN_VALID_LIST
(
PARSE_RULE_OPTION_COMMAND(cfgCmdBackup)
PARSE_RULE_OPTION_COMMAND(cfgCmdInfo)
PARSE_RULE_OPTION_COMMAND(cfgCmdRestore)
),
@ -8732,6 +8733,23 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
),
),
PARSE_RULE_OPTIONAL_GROUP
(
PARSE_RULE_FILTER_CMD
(
PARSE_RULE_VAL_CMD(cfgCmdInfo),
),
PARSE_RULE_OPTIONAL_ALLOW_LIST
(
PARSE_RULE_VAL_STRID(parseRuleValStrIdFull),
PARSE_RULE_VAL_STRID(parseRuleValStrIdDiff),
PARSE_RULE_VAL_STRID(parseRuleValStrIdIncr),
),
PARSE_RULE_OPTIONAL_NOT_REQUIRED(),
),
PARSE_RULE_OPTIONAL_GROUP
(
PARSE_RULE_FILTER_CMD

View File

@ -1606,6 +1606,48 @@ testRun(void)
" error list: base/16384/17000\n",
"text - backup set requested");
//--------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("multi-repo: filter by backup type");
argList2 = strLstDup(argListMultiRepo);
hrnCfgArgRawZ(argList2, cfgOptStanza, "stanza1");
hrnCfgArgRawZ(argList2, cfgOptType, "full");
HRN_CFG_LOAD(cfgCmdInfo, argList2);
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"
" database size: 19.2MB, database backup size: 19.2MB\n"
" repo1: backup set size: 2.3MB, backup size: 2.3MB\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"
" database size: 25.7MB, database backup size: 25.7MB\n"
" repo1: backup set size: 3MB, backup size: 3KB\n"
"\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"
" database size: 25.7MB, database backup size: 25.7MB\n"
" repo2: backup set size: 3MB, backup size: 3KB\n"
" error(s) detected during backup\n",
"text - multi-repo, filter by backup type");
//--------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("multi-repo: read encrypted manifest and confirm requested database found without setting --repo");