You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-15 01:04:37 +02:00
Add jobRetry parameter to HRN_CFG_LOAD().
Allow the default of 0 to be overridden to test retry behavior for commands.
This commit is contained in:
@ -27,6 +27,11 @@ hrnCfgLoad(ConfigCommand commandId, const StringList *argListParam, const HrnCfg
|
|||||||
FUNCTION_HARNESS_PARAM(ENUM, commandId);
|
FUNCTION_HARNESS_PARAM(ENUM, commandId);
|
||||||
FUNCTION_HARNESS_PARAM(STRING_LIST, argListParam);
|
FUNCTION_HARNESS_PARAM(STRING_LIST, argListParam);
|
||||||
FUNCTION_HARNESS_PARAM(ENUM, param.role);
|
FUNCTION_HARNESS_PARAM(ENUM, param.role);
|
||||||
|
FUNCTION_HARNESS_PARAM(BOOL, param.exeBogus);
|
||||||
|
FUNCTION_HARNESS_PARAM(BOOL, param.noStd);
|
||||||
|
FUNCTION_HARNESS_PARAM(BOOL, param.log);
|
||||||
|
FUNCTION_HARNESS_PARAM(UINT, param.jobRetry);
|
||||||
|
FUNCTION_HARNESS_PARAM(STRINGZ, param.comment);
|
||||||
FUNCTION_HARNESS_END();
|
FUNCTION_HARNESS_END();
|
||||||
|
|
||||||
// Make a copy of the arg list that we can modify
|
// Make a copy of the arg list that we can modify
|
||||||
@ -37,7 +42,7 @@ hrnCfgLoad(ConfigCommand commandId, const StringList *argListParam, const HrnCfg
|
|||||||
{
|
{
|
||||||
// Set job retry to 0 if it is valid
|
// Set job retry to 0 if it is valid
|
||||||
if (cfgParseOptionValid(commandId, param.role, cfgOptJobRetry))
|
if (cfgParseOptionValid(commandId, param.role, cfgOptJobRetry))
|
||||||
strLstInsert(argList, 0, STRDEF("--" CFGOPT_JOB_RETRY "=0"));
|
strLstInsert(argList, 0, strNewFmt("--" CFGOPT_JOB_RETRY "=%u", param.jobRetry));
|
||||||
|
|
||||||
// Set log path if valid
|
// Set log path if valid
|
||||||
if (cfgParseOptionValid(commandId, param.role, cfgOptLogPath))
|
if (cfgParseOptionValid(commandId, param.role, cfgOptLogPath))
|
||||||
|
@ -33,6 +33,7 @@ typedef struct HrnCfgLoadParam
|
|||||||
bool exeBogus; // Use pgbackrest-bogus as exe parameter
|
bool exeBogus; // Use pgbackrest-bogus as exe parameter
|
||||||
bool noStd; // Do not add standard options, e.g. lock-path
|
bool noStd; // Do not add standard options, e.g. lock-path
|
||||||
bool log; // Log parameters? (used internally by HRN_CFG_LOAD())
|
bool log; // Log parameters? (used internally by HRN_CFG_LOAD())
|
||||||
|
unsigned int jobRetry; // Job retries (defaults to 0)
|
||||||
const char *comment; // Comment
|
const char *comment; // Comment
|
||||||
} HrnCfgLoadParam;
|
} HrnCfgLoadParam;
|
||||||
|
|
||||||
|
@ -135,7 +135,8 @@ protocolLocalExec(
|
|||||||
ProtocolServer *server = protocolServerNew(
|
ProtocolServer *server = protocolServerNew(
|
||||||
name, PROTOCOL_SERVICE_LOCAL_STR, ioFdReadNewOpen(name, pipeWrite[0], 5000),
|
name, PROTOCOL_SERVICE_LOCAL_STR, ioFdReadNewOpen(name, pipeWrite[0], 5000),
|
||||||
ioFdWriteNewOpen(name, pipeRead[1], 5000));
|
ioFdWriteNewOpen(name, pipeRead[1], 5000));
|
||||||
protocolServerProcess(server, NULL, hrnProtocolStatic.localHandlerList, hrnProtocolStatic.localHandlerListSize);
|
protocolServerProcess(
|
||||||
|
server, cfgCommandJobRetry(), hrnProtocolStatic.localHandlerList, hrnProtocolStatic.localHandlerListSize);
|
||||||
|
|
||||||
// Exit when done
|
// Exit when done
|
||||||
exit(0);
|
exit(0);
|
||||||
|
@ -517,6 +517,8 @@ testRun(void)
|
|||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_TITLE("error with warnings");
|
TEST_TITLE("error with warnings");
|
||||||
|
|
||||||
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList, .role = cfgCmdRoleAsync, .jobRetry = 1);
|
||||||
|
|
||||||
HRN_STORAGE_PUT_EMPTY(
|
HRN_STORAGE_PUT_EMPTY(
|
||||||
storageRepoIdxWrite(1),
|
storageRepoIdxWrite(1),
|
||||||
STORAGE_REPO_ARCHIVE "/10-1/000000010000000200000000-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.gz");
|
STORAGE_REPO_ARCHIVE "/10-1/000000010000000200000000-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.gz");
|
||||||
|
@ -808,7 +808,7 @@ testRun(void)
|
|||||||
|
|
||||||
// Add repo3
|
// Add repo3
|
||||||
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 3, TEST_PATH "/repo3");
|
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 3, TEST_PATH "/repo3");
|
||||||
HRN_CFG_LOAD(cfgCmdArchivePush, argList, .role = cfgCmdRoleAsync);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argList, .role = cfgCmdRoleAsync, .jobRetry = 1);
|
||||||
|
|
||||||
HRN_INFO_PUT(
|
HRN_INFO_PUT(
|
||||||
storageTest, "repo3/archive/test/archive.info",
|
storageTest, "repo3/archive/test/archive.info",
|
||||||
|
@ -2735,6 +2735,8 @@ testRun(void)
|
|||||||
HRN_STORAGE_REMOVE(storageRepoWrite(), TEST_REPO_PATH PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL, .errorOnMissing = true);
|
HRN_STORAGE_REMOVE(storageRepoWrite(), TEST_REPO_PATH PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL, .errorOnMissing = true);
|
||||||
HRN_STORAGE_REMOVE(storagePgWrite(), PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL, .errorOnMissing = true);
|
HRN_STORAGE_REMOVE(storagePgWrite(), PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL, .errorOnMissing = true);
|
||||||
|
|
||||||
|
HRN_CFG_LOAD(cfgCmdRestore, argList, .jobRetry = 1);
|
||||||
|
|
||||||
// Set log level to warn
|
// Set log level to warn
|
||||||
harnessLogLevelSet(logLevelWarn);
|
harnessLogLevelSet(logLevelWarn);
|
||||||
|
|
||||||
|
@ -1042,7 +1042,7 @@ testRun(void)
|
|||||||
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 2, TEST_PATH "/repo");
|
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 2, TEST_PATH "/repo");
|
||||||
hrnCfgArgRawZ(argList, cfgOptStanza, "db");
|
hrnCfgArgRawZ(argList, cfgOptStanza, "db");
|
||||||
hrnCfgArgRawZ(argList, cfgOptRepo, "2");
|
hrnCfgArgRawZ(argList, cfgOptRepo, "2");
|
||||||
HRN_CFG_LOAD(cfgCmdVerify, argList);
|
HRN_CFG_LOAD(cfgCmdVerify, argList, .jobRetry = 1);
|
||||||
|
|
||||||
HRN_STORAGE_PUT(
|
HRN_STORAGE_PUT(
|
||||||
storageRepoIdxWrite(0),
|
storageRepoIdxWrite(0),
|
||||||
|
Reference in New Issue
Block a user