1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-11-06 08:49:29 +02:00

Remove repo option.

This option was added in advance of the multi-repo functionality but it has no purpose and it is not clear what the validity rules should be.

The option will be added back when multi-repo functionality is committed.
This commit is contained in:
David Steele
2020-12-31 08:12:35 -05:00
parent e3762945c2
commit 951cfa9e90
9 changed files with 17 additions and 142 deletions

View File

@@ -222,9 +222,6 @@ use constant CFGDEF_INDEX_REPO => 1;
# Prefix that must be used by all repo options that allow multiple configurations
use constant CFGDEF_PREFIX_REPO => 'repo';
# Set default repository
use constant CFGOPT_REPO => CFGDEF_PREFIX_REPO;
# Repository General
use constant CFGOPT_REPO_CIPHER_TYPE => CFGDEF_PREFIX_REPO . '-cipher-type';
use constant CFGOPT_REPO_CIPHER_PASS => CFGDEF_PREFIX_REPO . '-cipher-pass';
@@ -1695,18 +1692,6 @@ my %hConfigDefine =
}
},
# Repository selector
#-------------------------------------------------------------------------------------------------------------------------------
&CFGOPT_REPO =>
{
&CFGDEF_SECTION => CFGDEF_SECTION_GLOBAL,
&CFGDEF_TYPE => CFGDEF_TYPE_INTEGER,
&CFGDEF_INTERNAL => true,
&CFGDEF_REQUIRED => false,
&CFGDEF_ALLOW_RANGE => [1, CFGDEF_INDEX_REPO],
&CFGDEF_COMMAND => CFGOPT_REPO_TYPE,
},
# Repository options
#-------------------------------------------------------------------------------------------------------------------------------
&CFGOPT_REPO_CIPHER_PASS =>

View File

@@ -481,19 +481,6 @@
<example>y</example>
</config-key>
<!-- ======================================================================================================= -->
<config-key id="repo" name="Set Repository">
<summary>Set default repository.</summary>
<text>Set the repository for a command to operate on.
For example, this option may be used to perform a restore from a specific repository, rather than letting <backrest/> choose.
Note that some commands, e.g. <cmd>archive-push</cmd>, are intended to operate on all repositories and will ignore this option.</text>
<example>1</example>
</config-key>
<!-- CONFIG - REPO SECTION - REPO-PATH KEY -->
<config-key id="repo-path" name="Repository Path">
<summary>Path where backups and archive are stored.</summary>

View File

@@ -2158,10 +2158,6 @@ static const unsigned char helpDataPack[] =
// -------------------------------------------------------------------------------------------------------------------------
pckTypeBool << 4 | 0x08, // Internal
// repo option
// -------------------------------------------------------------------------------------------------------------------------
pckTypeBool << 4 | 0x0D, 0x01, // Internal
// repo-azure-account option
// -------------------------------------------------------------------------------------------------------------------------
pckTypeStr << 4 | 0x0E, 0x01, 0x0A, // Section

View File

@@ -308,7 +308,6 @@ STRING_EXTERN(CFGOPT_RAW_STR, CFGOPT_RAW);
STRING_EXTERN(CFGOPT_RECOVERY_OPTION_STR, CFGOPT_RECOVERY_OPTION);
STRING_EXTERN(CFGOPT_RECURSE_STR, CFGOPT_RECURSE);
STRING_EXTERN(CFGOPT_REMOTE_TYPE_STR, CFGOPT_REMOTE_TYPE);
STRING_EXTERN(CFGOPT_REPO_STR, CFGOPT_REPO);
STRING_EXTERN(CFGOPT_RESUME_STR, CFGOPT_RESUME);
STRING_EXTERN(CFGOPT_SCK_BLOCK_STR, CFGOPT_SCK_BLOCK);
STRING_EXTERN(CFGOPT_SCK_KEEP_ALIVE_STR, CFGOPT_SCK_KEEP_ALIVE);

View File

@@ -162,8 +162,6 @@ Option constants
STRING_DECLARE(CFGOPT_RECURSE_STR);
#define CFGOPT_REMOTE_TYPE "remote-type"
STRING_DECLARE(CFGOPT_REMOTE_TYPE_STR);
#define CFGOPT_REPO "repo"
STRING_DECLARE(CFGOPT_REPO_STR);
#define CFGOPT_RESUME "resume"
STRING_DECLARE(CFGOPT_RESUME_STR);
#define CFGOPT_SCK_BLOCK "sck-block"
@@ -203,7 +201,7 @@ Option constants
#define CFGOPT_TYPE "type"
STRING_DECLARE(CFGOPT_TYPE_STR);
#define CFG_OPTION_TOTAL 126
#define CFG_OPTION_TOTAL 125
/***********************************************************************************************************************************
Command enum
@@ -311,7 +309,6 @@ typedef enum
cfgOptRecoveryOption,
cfgOptRecurse,
cfgOptRemoteType,
cfgOptRepo,
cfgOptRepoAzureAccount,
cfgOptRepoAzureCaFile,
cfgOptRepoAzureCaPath,

View File

@@ -2888,76 +2888,6 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
),
),
// -----------------------------------------------------------------------------------------------------------------------------
PARSE_RULE_OPTION
(
PARSE_RULE_OPTION_NAME("repo"),
PARSE_RULE_OPTION_TYPE(cfgOptTypeInteger),
PARSE_RULE_OPTION_REQUIRED(false),
PARSE_RULE_OPTION_SECTION(cfgSectionGlobal),
PARSE_RULE_OPTION_COMMAND_ROLE_DEFAULT_VALID_LIST
(
PARSE_RULE_OPTION_COMMAND(cfgCmdArchiveGet)
PARSE_RULE_OPTION_COMMAND(cfgCmdArchivePush)
PARSE_RULE_OPTION_COMMAND(cfgCmdBackup)
PARSE_RULE_OPTION_COMMAND(cfgCmdCheck)
PARSE_RULE_OPTION_COMMAND(cfgCmdExpire)
PARSE_RULE_OPTION_COMMAND(cfgCmdInfo)
PARSE_RULE_OPTION_COMMAND(cfgCmdRepoCreate)
PARSE_RULE_OPTION_COMMAND(cfgCmdRepoGet)
PARSE_RULE_OPTION_COMMAND(cfgCmdRepoLs)
PARSE_RULE_OPTION_COMMAND(cfgCmdRepoPut)
PARSE_RULE_OPTION_COMMAND(cfgCmdRepoRm)
PARSE_RULE_OPTION_COMMAND(cfgCmdRestore)
PARSE_RULE_OPTION_COMMAND(cfgCmdStanzaCreate)
PARSE_RULE_OPTION_COMMAND(cfgCmdStanzaDelete)
PARSE_RULE_OPTION_COMMAND(cfgCmdStanzaUpgrade)
PARSE_RULE_OPTION_COMMAND(cfgCmdStart)
PARSE_RULE_OPTION_COMMAND(cfgCmdStop)
PARSE_RULE_OPTION_COMMAND(cfgCmdVerify)
),
PARSE_RULE_OPTION_COMMAND_ROLE_ASYNC_VALID_LIST
(
PARSE_RULE_OPTION_COMMAND(cfgCmdArchiveGet)
PARSE_RULE_OPTION_COMMAND(cfgCmdArchivePush)
),
PARSE_RULE_OPTION_COMMAND_ROLE_LOCAL_VALID_LIST
(
PARSE_RULE_OPTION_COMMAND(cfgCmdArchiveGet)
PARSE_RULE_OPTION_COMMAND(cfgCmdArchivePush)
PARSE_RULE_OPTION_COMMAND(cfgCmdBackup)
PARSE_RULE_OPTION_COMMAND(cfgCmdRestore)
PARSE_RULE_OPTION_COMMAND(cfgCmdVerify)
),
PARSE_RULE_OPTION_COMMAND_ROLE_REMOTE_VALID_LIST
(
PARSE_RULE_OPTION_COMMAND(cfgCmdArchiveGet)
PARSE_RULE_OPTION_COMMAND(cfgCmdArchivePush)
PARSE_RULE_OPTION_COMMAND(cfgCmdBackup)
PARSE_RULE_OPTION_COMMAND(cfgCmdCheck)
PARSE_RULE_OPTION_COMMAND(cfgCmdInfo)
PARSE_RULE_OPTION_COMMAND(cfgCmdRepoCreate)
PARSE_RULE_OPTION_COMMAND(cfgCmdRepoGet)
PARSE_RULE_OPTION_COMMAND(cfgCmdRepoLs)
PARSE_RULE_OPTION_COMMAND(cfgCmdRepoPut)
PARSE_RULE_OPTION_COMMAND(cfgCmdRepoRm)
PARSE_RULE_OPTION_COMMAND(cfgCmdRestore)
PARSE_RULE_OPTION_COMMAND(cfgCmdStanzaCreate)
PARSE_RULE_OPTION_COMMAND(cfgCmdStanzaDelete)
PARSE_RULE_OPTION_COMMAND(cfgCmdStanzaUpgrade)
PARSE_RULE_OPTION_COMMAND(cfgCmdVerify)
),
PARSE_RULE_OPTION_OPTIONAL_LIST
(
PARSE_RULE_OPTION_OPTIONAL_ALLOW_RANGE(1, 1),
),
),
// -----------------------------------------------------------------------------------------------------------------------------
PARSE_RULE_OPTION
(
@@ -8515,18 +8445,6 @@ static const struct option optionList[] =
.val = PARSE_OPTION_FLAG | cfgOptRemoteType,
},
// repo option
// -----------------------------------------------------------------------------------------------------------------------------
{
.name = "repo",
.has_arg = required_argument,
.val = PARSE_OPTION_FLAG | cfgOptRepo,
},
{
.name = "reset-repo",
.val = PARSE_OPTION_FLAG | PARSE_RESET_FLAG | cfgOptRepo,
},
// repo-azure-account option
// -----------------------------------------------------------------------------------------------------------------------------
{
@@ -9445,7 +9363,6 @@ static const ConfigOption optionResolveOrder[] =
cfgOptRaw,
cfgOptRecurse,
cfgOptRemoteType,
cfgOptRepo,
cfgOptRepoCipherType,
cfgOptRepoHardlink,
cfgOptRepoLocal,

View File

@@ -1857,21 +1857,22 @@ configParse(unsigned int argListSize, const char *argList[], bool resetLogLevel)
// Initialize config
cfgInit(config);
// Set option group default index. The first index in the group is automatically set unless the group option, e.g. repo, is
// Set option group default index. The first index in the group is automatically set unless the group option, e.g. pg, is
// set. For now the group default options are hard-coded but they could be dynamic. An assert has been added to make sure
// the code breaks if a new group is added.
for (unsigned int groupId = 0; groupId < CFG_OPTION_GROUP_TOTAL; groupId++)
{
ASSERT(groupId == cfgOptGrpPg || groupId == cfgOptGrpRepo);
// Get the group default option
unsigned int defaultOptionId = groupId == cfgOptGrpPg ? cfgOptPg : cfgOptRepo;
// The repo default is always key 1 since only one is allowed
if (groupId == cfgOptGrpRepo)
continue;
// Does the group default option exist?
if (cfgOptionTest(defaultOptionId))
if (cfgOptionTest(cfgOptPg))
{
// Search for the key
unsigned int optionKeyIdx = cfgOptionUInt(defaultOptionId) - 1;
unsigned int optionKeyIdx = cfgOptionUInt(cfgOptPg) - 1;
unsigned int index = 0;
for (; index < cfgOptionGroupIdxTotal(groupId); index++)
@@ -1884,8 +1885,8 @@ configParse(unsigned int argListSize, const char *argList[], bool resetLogLevel)
if (index == cfgOptionGroupIdxTotal(groupId))
{
THROW_FMT(
OptionInvalidValueError, "key '%u' is not valid for '%s' option", cfgOptionUInt(defaultOptionId),
cfgOptionName(defaultOptionId));
OptionInvalidValueError, "key '%u' is not valid for '%s' option", cfgOptionUInt(cfgOptPg),
cfgOptionName(cfgOptPg));
}
// Set the default

View File

@@ -137,12 +137,8 @@ protocolLocalParam(ProtocolStorageType protocolStorageType, unsigned int hostIdx
kvPut(optionReplace, VARSTR(CFGOPT_PROCESS_STR), VARUINT(processId));
// Add the group default id
kvPut(
optionReplace,
VARSTRZ(cfgOptionName(protocolStorageType == protocolStorageTypeRepo ? cfgOptRepo : cfgOptPg)),
VARUINT(
cfgOptionGroupIdxToKey(
protocolStorageType == protocolStorageTypeRepo ? cfgOptGrpRepo : cfgOptGrpPg, hostIdx)));
if (protocolStorageType == protocolStorageTypePg)
kvPut(optionReplace, VARSTRDEF(CFGOPT_PG), VARUINT(cfgOptionGroupIdxToKey(cfgOptGrpPg, hostIdx)));
// Add the remote type
kvPut(optionReplace, VARSTR(CFGOPT_REMOTE_TYPE_STR), VARSTR(protocolStorageTypeStr(protocolStorageType)));
@@ -394,10 +390,8 @@ protocolRemoteParam(ProtocolStorageType protocolStorageType, unsigned int hostId
}
// Set default to make it explicit which host will be used on the remote
kvPut(
optionReplace,
VARSTRZ(cfgOptionName(protocolStorageType == protocolStorageTypeRepo ? cfgOptRepo : cfgOptPg)),
VARUINT(protocolStorageType == protocolStorageTypeRepo ? cfgOptionGroupIdxToKey(cfgOptGrpRepo, hostIdx) : 1));
if (protocolStorageType == protocolStorageTypePg)
kvPut(optionReplace, VARSTRDEF(CFGOPT_PG), VARUINT(1));
// Add the process id if not set. This means that the remote is being started from the main process and should always get a
// process id of 0.

View File

@@ -228,7 +228,7 @@ testRun(void)
TEST_RESULT_STR_Z(
strLstJoin(protocolLocalParam(protocolStorageTypeRepo, 0, 0), "|"),
"--exec-id=1-test|--log-level-console=off|--log-level-file=off|--log-level-stderr=error|--pg1-path=/path/to/pg"
"|--process=0|--remote-type=repo|--repo=1|--stanza=test1|archive-get:local",
"|--process=0|--remote-type=repo|--stanza=test1|archive-get:local",
"local repo protocol params");
// -------------------------------------------------------------------------------------------------------------------------
@@ -270,7 +270,7 @@ testRun(void)
strLstJoin(protocolRemoteParam(protocolStorageTypeRepo, 0), "|"),
"-o|LogLevel=error|-o|Compression=no|-o|PasswordAuthentication=no|repo-host-user@repo-host"
"|pgbackrest --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error"
" --pg1-path=/path/to/pg --process=0 --remote-type=repo --repo=1 --stanza=test1 archive-get:remote",
" --pg1-path=/path/to/pg --process=0 --remote-type=repo --stanza=test1 archive-get:remote",
"remote protocol params");
// -------------------------------------------------------------------------------------------------------------------------
@@ -294,7 +294,7 @@ testRun(void)
"-o|LogLevel=error|-o|Compression=no|-o|PasswordAuthentication=no|-p|444|repo-host-user@repo-host"
"|pgbackrest --config=/path/pgbackrest.conf --config-include-path=/path/include --config-path=/path/config"
" --exec-id=1-test --log-level-console=off --log-level-file=info --log-level-stderr=error --log-subprocess"
" --pg1-path=/unused --process=0 --remote-type=repo --repo=1 --stanza=test1 check:remote",
" --pg1-path=/unused --process=0 --remote-type=repo --stanza=test1 check:remote",
"remote protocol params with replacements");
// -------------------------------------------------------------------------------------------------------------------------
@@ -303,7 +303,6 @@ testRun(void)
strLstAddZ(argList, "--stanza=test1");
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
strLstAddZ(argList, "--process=3");
hrnCfgArgRawZ(argList, cfgOptRepo, "1");
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_REPO);
strLstAddZ(argList, "--repo1-host=repo-host");
strLstAddZ(argList, CFGCMD_ARCHIVE_GET ":" CONFIG_COMMAND_ROLE_LOCAL);
@@ -313,7 +312,7 @@ testRun(void)
strLstJoin(protocolRemoteParam(protocolStorageTypeRepo, 0), "|"),
"-o|LogLevel=error|-o|Compression=no|-o|PasswordAuthentication=no|pgbackrest@repo-host"
"|pgbackrest --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error"
" --pg1-path=/path/to/pg --process=3 --remote-type=repo --repo=1 --stanza=test1 archive-get:remote",
" --pg1-path=/path/to/pg --process=3 --remote-type=repo --stanza=test1 archive-get:remote",
"remote protocol params for backup local");
// -------------------------------------------------------------------------------------------------------------------------