This commit is contained in:
l00584793 2020-12-30 16:56:44 +08:00 committed by zhaowenhao
parent a0d7b33693
commit a8c75f8830
14 changed files with 208 additions and 25 deletions

View File

@ -505,6 +505,8 @@ stream_multiple|real|0,1.79769e+308|NULL|NULL|
string_hash_compatible|bool|0,0|NULL|NULL|
enable_slow_query_log|bool|0,0|NULL|NULL|
support_batch_bind|bool|0,0|NULL|NULL|
enable_beta_opfusion|bool|0,0|NULL|NULL|
enable_beta_nestloop_fusion|bool|0,0|NULL|NULL|
support_extended_features|bool|0,0|NULL|NULL|
lastval_supported|bool|0,0|NULL|NULL|
enable_beta_features|bool|0,0|NULL|NULL|

View File

@ -4290,15 +4290,6 @@ int parse_double_value(const char* paraname, const char* value, const char* guc_
return SUCCESS;
}
/*************************************************************************************
Function: check_enum_type_value
Desc : check the parameter value of enum type.
Input : paraname parameter name
guc_list_value the string from config file
value parameter value
Return : SUCCESS
FAILURE
*************************************************************************************/
int is_value_in_range(const char* guc_list_value, const char* value)
{
char* ptr = NULL;
@ -4322,6 +4313,17 @@ int is_value_in_range(const char* guc_list_value, const char* value)
return FAILURE;
}
/*
************************************************************************************
Function: check_enum_type_value
Desc : check the parameter value of enum type.
Input : paraname parameter name
guc_list_value the string from config file
value parameter value
Return : SUCCESS
FAILURE
************************************************************************************
*/
int check_enum_type_value(const char* paraname, char* guc_list_value, const char* value)
{
char guc_val[MAX_VALUE_LEN] = {0};
@ -4345,7 +4347,11 @@ int check_enum_type_value(const char* paraname, char* guc_list_value, const char
}
make_string_tolower(value, tmp_paraname, sizeof(tmp_paraname) / sizeof(char));
vptr = strtok_r(tmp_paraname, delims, &vouter_ptr);
if (tmp_paraname != NULL && strlen(tmp_paraname) > 0) {
vptr = strtok_r(tmp_paraname, delims, &vouter_ptr);
} else {
vptr = "";
}
while (NULL != vptr) {
p = vptr;
while (isspace((unsigned char)*p))

View File

@ -7845,7 +7845,7 @@ static void InitConfigureNamesString()
NULL,
GUC_SUPERUSER_ONLY},
&g_instance.attr.attr_common.Alarm_component,
"/opt/huawei/snas/bin/snas_cm_cmd",
"/opt/snas/bin/snas_cm_cmd",
NULL,
NULL,
NULL},
@ -14180,7 +14180,7 @@ char* GetConfigOptionByName(const char* name, const char** varname)
ereport(
ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), errmsg("unrecognized configuration parameter \"%s\"", name)));
if ((record->flags & GUC_SUPERUSER_ONLY) && (GetUserId() != BOOTSTRAP_SUPERUSERID))
if ((record->flags & GUC_SUPERUSER_ONLY) && !superuser())
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), errmsg("must be initial account to examine \"%s\"", name)));
@ -14207,7 +14207,7 @@ void GetConfigOptionByNum(int varnum, const char** values, bool* noshow)
if (noshow != NULL) {
if ((conf->flags & GUC_NO_SHOW_ALL) ||
((conf->flags & GUC_SUPERUSER_ONLY) && (GetUserId() != BOOTSTRAP_SUPERUSERID)))
((conf->flags & GUC_SUPERUSER_ONLY) && !superuser()))
*noshow = true;
else
*noshow = false;

View File

@ -502,7 +502,7 @@ log_line_prefix = '%m %u %d %h %p %S ' # special values:
enable_alarm = on
connection_alarm_rate = 0.9
alarm_report_interval = 10
alarm_component = '/opt/huawei/snas/bin/snas_cm_cmd'
alarm_component = '/opt/snas/bin/snas_cm_cmd'
#------------------------------------------------------------------------------
# RUNTIME STATISTICS

View File

@ -0,0 +1,6 @@
show alarm_component;
alarm_component
---------------------------
/opt/snas/bin/snas_cm_cmd
(1 row)

View File

@ -0,0 +1,3 @@
\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "wal_level=hot_standby"
\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "wal_level=on"
\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "wal_level=''"

View File

@ -6,5 +6,8 @@
-----Set(GUC)
\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "cstore_buffers=10GB"
\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "intervalstyle=a"
\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "enable_beta_opfusion=on"
\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "enable_beta_nestloop_fusion=on"
-----Reload(GUC)
\! @abs_bindir@/gs_guc reload -D @abs_srcdir@/tmp_check/datanode1/ -c "cstore_buffers=10GB"
\! @abs_bindir@/gs_guc reload -D @abs_srcdir@/tmp_check/datanode1/ -c "cstore_buffers=10GB"

View File

@ -0,0 +1,35 @@
create user grant_all with password 'openGauss@123';
grant all privileges to grant_all;
create user standard_user with password 'openGauss@123';
-- sighup
\! @gsqldir@/gsql -d postgres -p @portstring@ -U grant_all -W openGauss@123 -c "show password_reuse_max;";
\! @gsqldir@/gsql -d postgres -p @portstring@ -U grant_all -W openGauss@123 -c "alter system set password_reuse_max=1;";
\! @gsqldir@/gsql -d postgres -p @portstring@ -U grant_all -W openGauss@123 -c "show password_reuse_max;";
\! @gsqldir@/gsql -d postgres -p @portstring@ -U grant_all -W openGauss@123 -c "alter system set password_reuse_max=0;"
\! @gsqldir@/gsql -d postgres -p @portstring@ -U standard_user -W openGauss@123 -c "show password_reuse_max;";
\! @gsqldir@/gsql -d postgres -p @portstring@ -U standard_user -W openGauss@123 -c "alter system set password_reuse_max=1;";
\! @gsqldir@/gsql -d postgres -p @portstring@ -U standard_user -W openGauss@123 -c "show password_reuse_max;";
\! @gsqldir@/gsql -d postgres -p @portstring@ -U standard_user -W openGauss@123 -c "alter system set password_reuse_max=0;"
show password_reuse_max;
alter system set password_reuse_max=1;
show password_reuse_max;
alter system set password_reuse_max=0;
-- suset
\! @gsqldir@/gsql -d postgres -p @portstring@ -U grant_all -W openGauss@123 -c "show pljava_vmoptions;";
\! @gsqldir@/gsql -d postgres -p @portstring@ -U grant_all -W openGauss@123 -c "set pljava_vmoptions='aaa';";
\! @gsqldir@/gsql -d postgres -p @portstring@ -U grant_all -W openGauss@123 -c "show pljava_vmoptions;";
\! @gsqldir@/gsql -d postgres -p @portstring@ -U grant_all -W openGauss@123 -c "set pljava_vmoptions='';"
\! @gsqldir@/gsql -d postgres -p @portstring@ -U standard_user -W openGauss@123 -c "show pljava_vmoptions;";
\! @gsqldir@/gsql -d postgres -p @portstring@ -U standard_user -W openGauss@123 -c "set pljava_vmoptions='aaa';";
\! @gsqldir@/gsql -d postgres -p @portstring@ -U standard_user -W openGauss@123 -c "show pljava_vmoptions;";
\! @gsqldir@/gsql -d postgres -p @portstring@ -U standard_user -W openGauss@123 -c "set pljava_vmoptions='';"
show pljava_vmoptions;
set pljava_vmoptions='aaa';
show pljava_vmoptions;
set pljava_vmoptions='';

View File

@ -0,0 +1,18 @@
\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "wal_level=hot_standby"
NOTICE: If you need to copy the data stream for WAL log archiving and standby machine. You must be set to the parameter with archive or hot_standby. If this parameter is setted to archive. The hot_standby must be setted to off, otherwise it will cause the database can not be started, at the same time the max_wal_senders must be set at least 1.
expected instance path: [@abs_srcdir@/tmp_check/datanode1/postgresql.conf]
gs_guc set: wal_level=hot_standby: [@abs_srcdir@/tmp_check/datanode1/postgresql.conf]
Total instances: 1. Failed instances: 0.
Success to perform gs_guc!
\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "wal_level=on"
NOTICE: If you need to copy the data stream for WAL log archiving and standby machine. You must be set to the parameter with archive or hot_standby. If this parameter is setted to archive. The hot_standby must be setted to off, otherwise it will cause the database can not be started, at the same time the max_wal_senders must be set at least 1.
ERROR: The value "on" is outside the valid range(minimal,archive,hot_standby,logical) for parameter "wal_level".
ERROR: The value "on" for parameter "wal_level" is incorrect.
Try "gs_guc --help" for more information.
\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "wal_level=''"
NOTICE: If you need to copy the data stream for WAL log archiving and standby machine. You must be set to the parameter with archive or hot_standby. If this parameter is setted to archive. The hot_standby must be setted to off, otherwise it will cause the database can not be started, at the same time the max_wal_senders must be set at least 1.
ERROR: The value "" is outside the valid range(minimal,archive,hot_standby,logical) for parameter "wal_level".
ERROR: The value "''" for parameter "wal_level" is incorrect.
Try "gs_guc --help" for more information.

View File

@ -90,6 +90,29 @@ gs_guc set: cstore_buffers=10GB: [@abs_srcdir@/tmp_check/datanode1/postgresql.co
Total instances: 1. Failed instances: 0.
Success to perform gs_guc!
\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "enable_beta_opfusion=on"
expected instance path: [@abs_srcdir@/tmp_check/datanode1/postgresql.conf]
gs_guc set: enable_beta_opfusion=on: [@abs_srcdir@/tmp_check/datanode1/postgresql.conf]
Total instances: 1. Failed instances: 0.
Success to perform gs_guc!
\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "enable_beta_nestloop_fusion=on"
expected instance path: [@abs_srcdir@/tmp_check/datanode1/postgresql.conf]
gs_guc set: enable_beta_nestloop_fusion=on: [@abs_srcdir@/tmp_check/datanode1/postgresql.conf]
Total instances: 1. Failed instances: 0.
Success to perform gs_guc!
-----Reload(GUC)
\! @abs_bindir@/gs_guc reload -D @abs_srcdir@/tmp_check/datanode1/ -c "cstore_buffers=10GB"
expected instance path: [@abs_srcdir@/tmp_check/datanode1/postgresql.conf]
gs_guc reload: cstore_buffers=10GB: [@abs_srcdir@/tmp_check/datanode1/postgresql.conf]
server signaled
Total instances: 1. Failed instances: 0.
Success to perform gs_guc!
\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "intervalstyle=a"
--?The gs_guc run with the following arguments: [@abs_bindir@/gs_guc -D @abs_srcdir@/tmp_check/datanode1/ -c intervalstyle=a set ].
--?.*
@ -100,14 +123,12 @@ gs_guc set: intervalstyle=a: [@abs_srcdir@/tmp_check/datanode1/postgresql.conf]
Total instances: 1. Failed instances: 0.
Success to perform gs_guc!
-----Reload(GUC)
\! @abs_bindir@/gs_guc reload -D @abs_srcdir@/tmp_check/datanode1/ -c "cstore_buffers=10GB"
\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "intervalstyle=a"
--?The gs_guc run with the following arguments: [@abs_bindir@/gs_guc -D @abs_srcdir@/tmp_check/datanode1/ -c cstore_buffers=10GB reload ].
--?.*
--?.*
expected instance path: [@abs_srcdir@/tmp_check/datanode1/postgresql.conf]
gs_guc reload: cstore_buffers=10GB: [@abs_srcdir@/tmp_check/datanode1/postgresql.conf]
server signaled
gs_guc set: intervalstyle=a: [@abs_srcdir@/tmp_check/datanode1/postgresql.conf]
Total instances: 1. Failed instances: 0.
Success to perform gs_guc!

View File

@ -320,13 +320,17 @@ ERROR: must be initial account to examine "alarm_component"
CONTEXT: referenced column: current_setting
set role user_guc_sysadmin password 'Ttest@123';
select name, setting, sourcefile from pg_settings where name = 'alarm_component';
name | setting | sourcefile
------+---------+------------
(0 rows)
--?.*
--?.*
alarm_component | /opt/snas/bin/snas_cm_cmd | @abs_srcdir@/./tmp_check/datanode1/postgresql.conf
(1 row)
select current_setting('alarm_component');
ERROR: must be initial account to examine "alarm_component"
CONTEXT: referenced column: current_setting
--?current_setting.*
--?.*
/opt/snas/bin/snas_cm_cmd
(1 row)
reset role;
drop user user_guc_normal;
drop user user_guc_sysadmin;

View File

@ -0,0 +1,81 @@
create user grant_all with password 'openGauss@123';
grant all privileges to grant_all;
create user standard_user with password 'openGauss@123';
-- sighup
\! @gsqldir@/gsql -d postgres -p 25632 -U grant_all -W openGauss@123 -c "show password_reuse_max;";
password_reuse_max
--------------------
0
(1 row)
\! @gsqldir@/gsql -d postgres -p 25632 -U grant_all -W openGauss@123 -c "alter system set password_reuse_max=1;";
ALTER SYSTEM SET
\! @gsqldir@/gsql -d postgres -p 25632 -U grant_all -W openGauss@123 -c "show password_reuse_max;";
password_reuse_max
--------------------
1
(1 row)
\! @gsqldir@/gsql -d postgres -p 25632 -U grant_all -W openGauss@123 -c "alter system set password_reuse_max=0;"
ALTER SYSTEM SET
\! @gsqldir@/gsql -d postgres -p 25632 -U standard_user -W openGauss@123 -c "show password_reuse_max;";
ERROR: must be initial account to examine "password_reuse_max"
\! @gsqldir@/gsql -d postgres -p 25632 -U standard_user -W openGauss@123 -c "alter system set password_reuse_max=1;";
ERROR: must be superuser to execute ALTER SYSTEM SET command
\! @gsqldir@/gsql -d postgres -p 25632 -U standard_user -W openGauss@123 -c "show password_reuse_max;";
ERROR: must be initial account to examine "password_reuse_max"
\! @gsqldir@/gsql -d postgres -p 25632 -U standard_user -W openGauss@123 -c "alter system set password_reuse_max=0;"
ERROR: must be superuser to execute ALTER SYSTEM SET command
show password_reuse_max;
password_reuse_max
--------------------
0
(1 row)
alter system set password_reuse_max=1;
show password_reuse_max;
password_reuse_max
--------------------
0
(1 row)
alter system set password_reuse_max=0;
-- suset
\! @gsqldir@/gsql -d postgres -p 25632 -U grant_all -W openGauss@123 -c "show pljava_vmoptions;";
pljava_vmoptions
------------------
(1 row)
\! @gsqldir@/gsql -d postgres -p 25632 -U grant_all -W openGauss@123 -c "set pljava_vmoptions='aaa';";
SET
\! @gsqldir@/gsql -d postgres -p 25632 -U grant_all -W openGauss@123 -c "show pljava_vmoptions;";
pljava_vmoptions
------------------
(1 row)
\! @gsqldir@/gsql -d postgres -p 25632 -U grant_all -W openGauss@123 -c "set pljava_vmoptions='';"
SET
\! @gsqldir@/gsql -d postgres -p 25632 -U standard_user -W openGauss@123 -c "show pljava_vmoptions;";
ERROR: must be initial account to examine "pljava_vmoptions"
\! @gsqldir@/gsql -d postgres -p 25632 -U standard_user -W openGauss@123 -c "set pljava_vmoptions='aaa';";
ERROR: permission denied to set parameter "pljava_vmoptions"
\! @gsqldir@/gsql -d postgres -p 25632 -U standard_user -W openGauss@123 -c "show pljava_vmoptions;";
ERROR: must be initial account to examine "pljava_vmoptions"
\! @gsqldir@/gsql -d postgres -p 25632 -U standard_user -W openGauss@123 -c "set pljava_vmoptions='';"
ERROR: permission denied to set parameter "pljava_vmoptions"
show pljava_vmoptions;
pljava_vmoptions
------------------
(1 row)
set pljava_vmoptions='aaa';
show pljava_vmoptions;
pljava_vmoptions
------------------
aaa
(1 row)
set pljava_vmoptions='';

View File

@ -81,4 +81,7 @@
test: not_support_nodegroup
test: double_support_unit
test: gs_guc_value_range
test: alter_set_same_parameter
test: alter_set_same_parameter
test: enum_empty_test
test: alarm_component_test
test: unify_definition_superuser

View File

@ -0,0 +1 @@
show alarm_component;