!677 fix bug about gs_guc reload for the parameter without assigning value

Merge pull request !677 from shirley_zhengx/1_1_0_dev
This commit is contained in:
opengauss-bot 2021-02-02 15:40:35 +08:00 committed by Gitee
commit 0dd12ebd85
4 changed files with 54 additions and 4 deletions

View File

@ -1129,16 +1129,17 @@ do_gucset(const char *action_type, const char *data_dir)
to_generatenewline(optconf_line, newconf_line, config_param[i], config_value[i], optvalue_len);
} else {
/*
* if parameter as value is NULL; consider it as UNSET (i.e to default value)
* which means comment the configuration parameter
* if parameter value is NULL, not consider it as UNSET,
* which means maintain the configuration parameter, and
* there will be prompts telling the user to assign a value.
*/
//line is commented
if (isOptLineCommented(optconf_line)) {
rc = strncpy_s(newconf_line, MAX_PARAM_LEN*2, optconf_line, (size_t)Min(line_len, MAX_PARAM_LEN*2 - 1));
securec_check_c(rc, "\0", "\0");
} else {
nRet = snprintf_s(newconf_line, MAX_PARAM_LEN*2, MAX_PARAM_LEN*2 - 1, "#%s", optconf_line);
securec_check_ss_c(nRet, "\0", "\0");
write_stderr(_("ERROR: %s parameters value is expected\n"), config_param[i]);
return FAILURE;
}
}
updateoradd = UPDATE_PARAMETER;

View File

@ -0,0 +1,9 @@
-----gs_guc_reload(GUC) set default value of lockwait_timeout by gs_guc reload
--set new value
\! @abs_bindir@/gs_guc reload -D @abs_srcdir@/tmp_check/datanode1/ -c "lockwait_timeout=1s"
\! sleep 10s
show lockwait_timeout;
--set default value
\! @abs_bindir@/gs_guc reload -D @abs_srcdir@/tmp_check/datanode1/ -c "lockwait_timeout"
\! sleep 10s
show lockwait_timeout;

View File

@ -0,0 +1,39 @@
-----gs_guc_reload(GUC) set default value of lockwait_timeout by gs_guc reload
--set new value
\! @abs_bindir@/gs_guc reload -D @abs_srcdir@/tmp_check/datanode1/ -c "lockwait_timeout=1s"
The gs_guc run with the following arguments: [@abs_bindir@/gs_guc -D @abs_srcdir@/tmp_check/datanode1/ -c lockwait_timeout=1s reload ].
realpath(@abs_bindir@/..//bin/cluster_static_config) failed : No such file or directory!
expected instance path: [@abs_srcdir@/tmp_check/datanode1/postgresql.conf]
gs_guc reload: lockwait_timeout=1s: [@abs_srcdir@/tmp_check/datanode1/postgresql.conf]
server signaled
Total instances: 1. Failed instances: 0.
Success to perform gs_guc!
\! sleep 10s
show lockwait_timeout;
lockwait_timeout
------------------
1s
(1 row)
--set default value
\! @abs_bindir@/gs_guc reload -D @abs_srcdir@/tmp_check/datanode1/ -c "lockwait_timeout"
The gs_guc run with the following arguments: [@abs_bindir@/gs_guc -D @abs_srcdir@/tmp_check/datanode1/ -c lockwait_timeout reload ].
realpath(@abs_bindir@/..//bin/cluster_static_config) failed : No such file or directory!
expected instance path: [@abs_srcdir@/tmp_check/datanode1/postgresql.conf]
ERROR: lockwait_timeout parameters value is expected
Total instances: 1. Failed instances: 1.
Failed instance information:
--?.*
Failure to perform gs_guc!
\! sleep 10s
show lockwait_timeout;
lockwait_timeout
------------------
1s
(1 row)

View File

@ -748,3 +748,4 @@ test: rule_test
# gs_guc test
# ----------
#test: gs_guc
test: gs_guc_reload