You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-11-06 08:49:29 +02:00
Fix option warnings breaking async archive-get/archive-push.
Option warnings will cause the async process to fail because a warning is logged but stdout is closed so the process aborts.
This bug has existed for quite some time, but it was made worse by abb8ebe because now the async role can have different valid options than the default role. Previously at least a warning would be emitted before the async process died.
Fix this by only allowing warnings for the default role. Warnings were already suppressed for local and remote roles so the logic already exists.
This commit is contained in:
@@ -15,6 +15,16 @@
|
||||
<release date="XXXX-XX-XX" version="2.33dev" title="UNDER DEVELOPMENT">
|
||||
<release-core-list>
|
||||
<release-bug-list>
|
||||
<release-item>
|
||||
<release-item-contributor-list>
|
||||
<release-item-ideator id="lev.kokotov"/>
|
||||
<release-item-contributor id="david.steele"/>
|
||||
<release-item-reviewer id="cynthia.shang"/>
|
||||
</release-item-contributor-list>
|
||||
|
||||
<p>Fix option warnings breaking async <cmd>archive-get</cmd>/<cmd>archive-push</cmd>.</p>
|
||||
</release-item>
|
||||
|
||||
<release-item>
|
||||
<release-item-contributor-list>
|
||||
<release-item-ideator id="bsiara"/>
|
||||
@@ -9404,6 +9414,11 @@
|
||||
<contributor-id type="github">L30Bola</contributor-id>
|
||||
</contributor>
|
||||
|
||||
<contributor id="lev.kokotov">
|
||||
<contributor-name-display>Lev Kokotov</contributor-name-display>
|
||||
<contributor-id type="github">levkk</contributor-id>
|
||||
</contributor>
|
||||
|
||||
<contributor id="loop-evgeny">
|
||||
<contributor-name-display>loop-evgeny</contributor-name-display>
|
||||
<contributor-id type="github">loop-evgeny</contributor-id>
|
||||
|
||||
@@ -1108,8 +1108,8 @@ configParse(const Storage *storage, unsigned int argListSize, const char *argLis
|
||||
if (config->paramList != NULL && !config->help && !parseRuleCommand[config->command].parameterAllowed)
|
||||
THROW(ParamInvalidError, "command does not allow parameters");
|
||||
|
||||
// Enable logging (except for local and remote commands) so config file warnings will be output
|
||||
if (resetLogLevel && config->commandRole != cfgCmdRoleLocal && config->commandRole != cfgCmdRoleRemote)
|
||||
// Enable logging for default role so config file warnings will be output
|
||||
if (resetLogLevel && config->commandRole == cfgCmdRoleDefault)
|
||||
logInit(logLevelWarn, logLevelWarn, logLevelOff, false, 0, 1, false);
|
||||
|
||||
// Only continue if command options need to be validated, i.e. a real command is running or we are getting help for a
|
||||
|
||||
@@ -777,7 +777,7 @@ testRun(void)
|
||||
"'/path1/path2//' cannot contain // for 'pg1-path' option");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("local/remote roles should not modify log levels");
|
||||
TEST_TITLE("non-default roles should not modify log levels");
|
||||
|
||||
argList = strLstNew();
|
||||
strLstAdd(argList, strNew("pgbackrest"));
|
||||
@@ -816,6 +816,21 @@ testRun(void)
|
||||
TEST_RESULT_STR_Z(cfgCommandRoleStr(cfgCmdRoleRemote), "remote", " remote role name");
|
||||
TEST_RESULT_INT(logLevelStdOut, logLevelError, "console logging is error");
|
||||
TEST_RESULT_INT(logLevelStdErr, logLevelError, "stderr logging is error");
|
||||
|
||||
argList = strLstNew();
|
||||
strLstAdd(argList, strNew("pgbackrest"));
|
||||
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to");
|
||||
strLstAdd(argList, strNew("--stanza=db"));
|
||||
strLstAdd(argList, strNew("--log-level-stderr=info"));
|
||||
strLstAddZ(argList, CFGCMD_ARCHIVE_GET ":" CONFIG_COMMAND_ROLE_ASYNC);
|
||||
|
||||
logLevelStdOut = logLevelError;
|
||||
logLevelStdErr = logLevelError;
|
||||
TEST_RESULT_VOID(configParse(storageTest, strLstSize(argList), strLstPtr(argList), true), "load async config");
|
||||
TEST_RESULT_INT(cfgCommandRole(), cfgCmdRoleAsync, " command role is async");
|
||||
TEST_RESULT_INT(logLevelStdOut, logLevelError, "console logging is error");
|
||||
TEST_RESULT_INT(logLevelStdErr, logLevelError, "stderr logging is error");
|
||||
|
||||
harnessLogLevelReset();
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user