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

Allow any non-boolean, non-command-line option to be negated.

This allows specific options in pgbackrest.conf to be ignored (and set to default) which reduces the need to write new configuration files for specific needs.

Note that boolean, non-command-line options are already negatable.
This commit is contained in:
David Steele 2017-12-05 15:23:32 -05:00
parent c5fc88d340
commit 99a0721631
7 changed files with 563 additions and 59 deletions

View File

@ -1892,9 +1892,8 @@ foreach my $strKey (sort(keys(%hConfigDefine)))
$hConfigDefine{$strKey}{&CFGDEF_INDEX_TOTAL} = 1;
}
# All boolean config options can be negated. Boolean command-line options must be marked for negation individually.
if ($hConfigDefine{$strKey}{&CFGDEF_TYPE} eq CFGDEF_TYPE_BOOLEAN &&
defined($hConfigDefine{$strKey}{&CFGDEF_SECTION}))
# All config options can be negated. Boolean command-line options must be marked for negation individually.
if (defined($hConfigDefine{$strKey}{&CFGDEF_SECTION}))
{
$hConfigDefine{$strKey}{&CFGDEF_NEGATE} = true;
}

View File

@ -22,6 +22,12 @@
</release-item>
</release-bug-list>
<release-feature-list>
<release-item>
<p>Allow any non-boolean, non-command-line option to be negated. This allows specific options in <file>pgbackrest.conf</file> to be ignored (and set to default) which reduces the need to write new configuration files for specific needs. Note that boolean, non-command-line options are already negatable.</p>
</release-item>
</release-feature-list>
<release-improvement-list>
<release-item>
<p>The C library is now required. This eliminates conditional loading and eases development of new library features.</p>

View File

@ -403,18 +403,18 @@ sub optionValidate
my $strValue = optionValueGet($strOption, $oOptionTest);
# Check to see if an option can be negated. Make sure that it is not set and negated at the same time.
my $bNegate = false;
$oOption{$strOption}{negate} = false;
if (cfgDefOptionNegate($iOptionId))
{
$bNegate = defined($$oOptionTest{'no-' . $strOption});
$oOption{$strOption}{negate} = defined($$oOptionTest{'no-' . $strOption});
if ($bNegate && defined($strValue))
if ($oOption{$strOption}{negate} && defined($strValue))
{
confess &log(ERROR, "option '${strOption}' cannot be both set and negated", ERROR_OPTION_NEGATE);
}
if ($bNegate && cfgDefOptionType($iOptionId) eq CFGDEF_TYPE_BOOLEAN)
if ($oOption{$strOption}{negate} && cfgDefOptionType($iOptionId) eq CFGDEF_TYPE_BOOLEAN)
{
$strValue = false;
}
@ -464,7 +464,7 @@ sub optionValidate
}
# If the option value is undefined and not negated, see if it can be loaded from the config file
if (!defined($strValue) && !$bNegate && $strOption ne cfgOptionName(CFGOPT_CONFIG) &&
if (!defined($strValue) && !$oOption{$strOption}{negate} && $strOption ne cfgOptionName(CFGOPT_CONFIG) &&
defined(cfgDefOptionSection($iOptionId)) && $bDependResolved)
{
# If the config option has not been resolved yet then continue processing
@ -762,7 +762,7 @@ sub optionValidate
if (defined($strDefault))
{
# Only set default if dependency is resolved
$oOption{$strOption}{value} = $strDefault if !$bNegate;
$oOption{$strOption}{value} = $strDefault if !$oOption{$strOption}{negate};
}
# Else check required
elsif (cfgDefOptionRequired($iCommandId, $iOptionId) && !$bHelp)
@ -1200,6 +1200,12 @@ sub cfgCommandWrite
$strExeString .= cfgCommandWriteOptionFormat($strOption, $bMulti, $bSecure, $oValue);
}
# Else is negated and is not a boolean (which is handled above)
elsif (cfgDefOptionValid($iNewCommandId, $iOptionId) && $oOption{$strOption}{negate} &&
cfgDefOptionType($iOptionId) ne CFGDEF_TYPE_BOOLEAN)
{
$strExeString .= " --no-${strOption}";
}
}
if ($bIncludeCommand)

View File

@ -186,7 +186,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeInteger)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -204,7 +204,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeFloat)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -230,7 +230,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -263,7 +263,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -297,7 +297,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -325,7 +325,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeInteger)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -384,7 +384,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -418,7 +418,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeInteger)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -484,7 +484,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -563,7 +563,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeInteger)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -596,7 +596,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeInteger)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -664,7 +664,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString)
CFGDEFDATA_OPTION_INDEX_TOTAL(8)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -695,7 +695,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString)
CFGDEFDATA_OPTION_INDEX_TOTAL(8)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -727,7 +727,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString)
CFGDEFDATA_OPTION_INDEX_TOTAL(8)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -759,7 +759,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeList)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -777,7 +777,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString)
CFGDEFDATA_OPTION_INDEX_TOTAL(8)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -836,7 +836,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeInteger)
CFGDEFDATA_OPTION_INDEX_TOTAL(8)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -864,7 +864,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString)
CFGDEFDATA_OPTION_INDEX_TOTAL(8)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -892,7 +892,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeInteger)
CFGDEFDATA_OPTION_INDEX_TOTAL(8)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -925,7 +925,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeFloat)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -956,7 +956,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString)
CFGDEFDATA_OPTION_INDEX_TOTAL(8)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -1135,7 +1135,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeHash)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -1153,7 +1153,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -1187,7 +1187,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -1231,7 +1231,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -1275,7 +1275,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -1319,7 +1319,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -1387,7 +1387,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeInteger)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -1540,7 +1540,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeInteger)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -1567,7 +1567,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeFloat)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -1600,7 +1600,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeHash)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -1630,7 +1630,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(true)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -1669,7 +1669,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -1710,7 +1710,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -1745,7 +1745,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -1784,7 +1784,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -1823,7 +1823,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -1862,7 +1862,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -1901,7 +1901,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -1940,7 +1940,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(true)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -1979,7 +1979,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(true)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -2018,7 +2018,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -2098,7 +2098,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -2163,7 +2163,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeInteger)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -2187,7 +2187,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -2218,7 +2218,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeInteger)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -2242,7 +2242,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeInteger)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -2294,7 +2294,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -2430,7 +2430,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeHash)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST
@ -2448,7 +2448,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_NEGATE(false)
CFGDEFDATA_OPTION_NEGATE(true)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_COMMAND_LIST

File diff suppressed because it is too large Load Diff

View File

@ -1537,6 +1537,35 @@ restore, backup '[BACKUP-FULL-2]', expect exit 72 - restore errors on backup hos
------------------------------------------------------------------------------------------------------------------------------------
P00 ERROR: [072]: restore command must be run on the db host
restore, backup '[BACKUP-FULL-2]' - on backup host (backup host)
> [CONTAINER-EXEC] backup [BACKREST-BIN] --config=[TEST_PATH]/backup/pgbackrest.conf --set=[BACKUP-FULL-2] --log-level-console=detail --no-db1-host --db-path=[TEST_PATH]/backup/db --stanza=db restore
------------------------------------------------------------------------------------------------------------------------------------
P00 INFO: restore command begin [BACKREST-VERSION]: --no-compress --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/backup/pgbackrest.conf --no-db1-host --db1-path=[TEST_PATH]/backup/db --lock-path=[TEST_PATH]/backup/lock --log-level-console=detail --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/backup/log --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --set=[BACKUP-FULL-2] --stanza=db
P00 INFO: restore backup set [BACKUP-FULL-2]
P00 INFO: remap $PGDATA directory to [TEST_PATH]/backup/db
P00 WARN: contents of directory link pg_stat will be restored in a directory at the same location
P00 WARN: file link postgresql.conf will be restored as a file at the same location
P00 DETAIL: check [TEST_PATH]/backup/db exists
P01 INFO: restore file [TEST_PATH]/backup/db/base/32768/33001 (64KB, 39%) checksum 6bf316f11d28c28914ea9be92c00de9bea6d9a6b
P01 INFO: restore file [TEST_PATH]/backup/db/base/32768/33000.32767 (32KB, 59%) checksum 21e2c7c1a326682c07053b7d6a5a40dbd49c2ec5
P01 INFO: restore file [TEST_PATH]/backup/db/base/32768/33000 (32KB, 79%) checksum 4a383e4fb8b5cd2a4e8fab91ef63dce48e532a2f
P01 INFO: restore file [TEST_PATH]/backup/db/base/16384/17000 (16KB, 89%) checksum e0101dd8ffb910c9c202ca35b5f828bcb9697bed
P01 INFO: restore file [TEST_PATH]/backup/db/global/pg_control.pgbackrest.tmp (8KB, 94%) checksum b4a3adade1e81ebfc7e9a27bca0887a347d81522
P01 INFO: restore file [TEST_PATH]/backup/db/base/1/12000 (8KB, 99%) checksum 22c98d248ff548311eda88559e4a8405ed77c003
P01 INFO: restore file [TEST_PATH]/backup/db/postgresql.conf (21B, 99%) checksum 6721d92c9fcdf4248acff1f9a1377127d9064807
P01 INFO: restore file [TEST_PATH]/backup/db/pg_stat/global.stat (5B, 99%) checksum e350d5ce0153f3e22d5db21cf2a4eff00f3ee877
P01 INFO: restore file [TEST_PATH]/backup/db/base/32768/PG_VERSION (3B, 99%) checksum 184473f470864e067ee3a22e64b47b0a1c356f29
P01 INFO: restore file [TEST_PATH]/backup/db/base/16384/PG_VERSION (3B, 99%) checksum 184473f470864e067ee3a22e64b47b0a1c356f29
P01 INFO: restore file [TEST_PATH]/backup/db/base/1/PG_VERSION (3B, 99%) checksum 184473f470864e067ee3a22e64b47b0a1c356f29
P01 INFO: restore file [TEST_PATH]/backup/db/PG_VERSION (3B, 100%) checksum 184473f470864e067ee3a22e64b47b0a1c356f29
P00 INFO: write [TEST_PATH]/backup/db/recovery.conf
P00 INFO: restore global/pg_control (performed last to ensure aborted restores cannot be started)
P00 INFO: restore command end: completed successfully
+ supplemental file: [TEST_PATH]/db-master/db/base/recovery.conf
----------------------------------------------------------------
restore_command = '[BACKREST-BIN] --compress-level-network=0 --config=[TEST_PATH]/db-master/pgbackrest.conf --log-level-console=detail --stanza=db archive-get %f "%p"'
full backup - backup errors on db host (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --no-online --log-level-console=warn --type=full --stanza=db backup
------------------------------------------------------------------------------------------------------------------------------------

View File

@ -583,6 +583,14 @@ sub run
{rhExpectedManifest => \%oManifest, strUser => TEST_USER, iExpectedExitStatus => ERROR_HOST_INVALID,
strOptionalParam => "--log-level-console=warn"});
my $strBackupHostDbPath = $oHostBackup->testPath() . '/db';
executeTest("mkdir -p ${strBackupHostDbPath}");
$oHostBackup->restore(
'on backup host', $strFullBackup,
{rhExpectedManifest => \%oManifest, strUser => TEST_USER,
strOptionalParam => "${strLogReduced} --no-db1-host --db-path=${strBackupHostDbPath}"});
$oHostDbMaster->backup(
$strType, 'backup errors on db host',
{oExpectedManifest => \%oManifest, iExpectedExitStatus => ERROR_HOST_INVALID,