consider mix case and fix test case of alter system set
This commit is contained in:
parent
448132fb60
commit
e3accb2ab7
|
@ -540,8 +540,8 @@ static bool check_inlist2joininfo(char** newval, void** extra, GucSource source)
|
|||
static void assign_inlist2joininfo(const char* newval, void* extra);
|
||||
static bool check_replication_type(int* newval, void** extra, GucSource source);
|
||||
static bool isOptLineCommented(char* optLine);
|
||||
static bool isMatchOptionName(
|
||||
char* optLine, const char* paraName, int paraLength, int* paraOffset, int* valueLength, int* valueOffset);
|
||||
static bool isMatchOptionName(char* optLine, const char* paraName,
|
||||
int paraLength, int* paraOffset, int* valueLength, int* valueOffset, bool ignore_case);
|
||||
|
||||
static const char* logging_module_guc_show(void);
|
||||
static bool logging_module_check(char** newval, void** extra, GucSource source);
|
||||
|
@ -586,7 +586,8 @@ static void FinishAlterSystemSet(GucContext context);
|
|||
static void ConfFileNameCat(char* ConfFileName, char* ConfTmpFileName,
|
||||
char* ConfTmpBakFileName, char* ConfLockFileName);
|
||||
static void WriteAlterSystemSetGucFile(char* ConfFileName, char** opt_lines, ConfFileLock* filelock);
|
||||
static char** LockAndReadConfFile(char* ConfFileName, char* ConfLockFileName, ConfFileLock* filelock);
|
||||
static char** LockAndReadConfFile(char* ConfFileName, char* ConfTmpFileName, char* ConfLockFileName,
|
||||
ConfFileLock* filelock);
|
||||
#endif
|
||||
inline void scape_space(char **pp)
|
||||
{
|
||||
|
@ -609,8 +610,8 @@ inline void scape_space(char **pp)
|
|||
* Returns:
|
||||
* True, iff the option name is in the configure file; else false.
|
||||
*/
|
||||
static bool isMatchOptionName(
|
||||
char* optLine, const char* paraName, int paraLength, int* paraOffset, int* valueLength, int* valueOffset)
|
||||
static bool isMatchOptionName(char* optLine, const char* paraName,
|
||||
int paraLength, int* paraOffset, int* valueLength, int* valueOffset, bool ignore_case)
|
||||
{
|
||||
char* p = NULL;
|
||||
char* q = NULL;
|
||||
|
@ -628,7 +629,9 @@ static bool isMatchOptionName(
|
|||
/* Skip all the blanks after '#' and before the paraName */
|
||||
scape_space(&p);
|
||||
|
||||
if (strncmp(p, paraName, paraLength) != 0) {
|
||||
if (ignore_case && strncasecmp(p, paraName, paraLength) != 0) {
|
||||
return false;
|
||||
} else if (!ignore_case && strncmp(p, paraName, paraLength) != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -13126,7 +13129,7 @@ static void replace_config_value(char** optlines, char* name, char* value, confi
|
|||
}
|
||||
securec_check_ss(rc, "\0", "\0");
|
||||
|
||||
index = find_guc_option(optlines, name, NULL, NULL, &optvalue_off, &optvalue_len);
|
||||
index = find_guc_option(optlines, name, NULL, NULL, &optvalue_off, &optvalue_len, true);
|
||||
|
||||
/* add or replace */
|
||||
if (index == INVALID_LINES_IDX) {
|
||||
|
@ -13141,8 +13144,8 @@ static void replace_config_value(char** optlines, char* name, char* value, confi
|
|||
if (optlines[index] != NULL) {
|
||||
pfree(optlines[index]);
|
||||
optlines[index] = NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
optlines[index] = newline;
|
||||
|
@ -13310,17 +13313,31 @@ static void WriteAlterSystemSetGucFile(char* ConfFileName, char** opt_lines, Con
|
|||
}
|
||||
}
|
||||
|
||||
static char** LockAndReadConfFile(char* ConfFileName, char* ConfLockFileName, ConfFileLock* filelock)
|
||||
static char** LockAndReadConfFile(char* ConfFileName, char* ConfTmpFileName, char* ConfLockFileName,
|
||||
ConfFileLock* filelock)
|
||||
{
|
||||
struct stat st;
|
||||
char** opt_lines = NULL;
|
||||
if (stat(ConfFileName, &st) == 0 && get_file_lock(ConfLockFileName, filelock) == CODE_OK) {
|
||||
opt_lines = read_guc_file(ConfFileName);
|
||||
char* file = NULL;
|
||||
|
||||
if (stat(ConfFileName, &st) == 0) {
|
||||
file = ConfFileName;
|
||||
} else if (stat(ConfTmpFileName, &st) == 0) {
|
||||
file = ConfTmpFileName;
|
||||
}
|
||||
|
||||
if (file != NULL && S_ISREG(st.st_mode) && get_file_lock(file, filelock) == CODE_OK) {
|
||||
opt_lines = read_guc_file(file);
|
||||
} else {
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FILE_READ_FAILED),
|
||||
errmsg("File does not exits or it is being used.Can not open file: %s.", ConfFileName)));
|
||||
(errcode(ERRCODE_FILE_READ_FAILED), errmsg("Can not open configure file.")));
|
||||
}
|
||||
|
||||
if (opt_lines == NULL) {
|
||||
release_file_lock(filelock);
|
||||
ereport(ERROR, (errcode(ERRCODE_FILE_READ_FAILED), errmsg("Read configure file falied.")));
|
||||
}
|
||||
|
||||
return opt_lines;
|
||||
}
|
||||
|
||||
|
@ -13333,12 +13350,12 @@ static char** LockAndReadConfFile(char* ConfFileName, char* ConfLockFileName, Co
|
|||
*
|
||||
* The configuration parameters are written to a temporary
|
||||
* file then renamed to the final name. The template for the
|
||||
* temporary file is postgresql.auto.conf.temp.
|
||||
* temporary file is postgresql.conf.bak
|
||||
*
|
||||
* An LWLock is used to serialize writing to the same file.
|
||||
*
|
||||
* In case of an error, we leave the original automatic
|
||||
* configuration file (postgresql.auto.conf) intact.
|
||||
* configuration file (postgresql.conf.bak) intact.
|
||||
*/
|
||||
void AlterSystemSetConfigFile(AlterSystemStmt * altersysstmt)
|
||||
{
|
||||
|
@ -13364,7 +13381,7 @@ void AlterSystemSetConfigFile(AlterSystemStmt * altersysstmt)
|
|||
* temporary file and then rename it to postgresql.auto.conf. In case
|
||||
* there exists a temp file from previous crash, that can be reused.
|
||||
*/
|
||||
opt_lines = LockAndReadConfFile(ConfFileName, ConfLockFileName, &filelock);
|
||||
opt_lines = LockAndReadConfFile(ConfFileName, ConfTmpFileName, ConfLockFileName, &filelock);
|
||||
|
||||
/*
|
||||
* replace with new value if the configuration parameter already
|
||||
|
@ -18053,7 +18070,7 @@ ErrCode copy_guc_lines(char** copy_to_line, char** optlines, const char** opt_na
|
|||
|
||||
if (optlines != NULL) {
|
||||
for (i = 0; i < RESERVE_SIZE; i++) {
|
||||
opt_name_index = find_guc_option(optlines, opt_name[i], NULL, NULL, &optvalue_off, &optvalue_len);
|
||||
opt_name_index = find_guc_option(optlines, opt_name[i], NULL, NULL, &optvalue_off, &optvalue_len, false);
|
||||
if (INVALID_LINES_IDX != opt_name_index) {
|
||||
errno_t errorno = EOK;
|
||||
opt_name_len = strlen(optlines[opt_name_index]) + 1;
|
||||
|
@ -18099,7 +18116,7 @@ void modify_guc_lines(char*** guc_optlines, const char** opt_name, char** copy_f
|
|||
ereport(LOG, (errmsg("configuration file has not data")));
|
||||
} else {
|
||||
for (int i = 0; i < RESERVE_SIZE; i++) {
|
||||
opt_name_index = find_guc_option(optlines, opt_name[i], NULL, NULL, &optvalue_off, &optvalue_len);
|
||||
opt_name_index = find_guc_option(optlines, opt_name[i], NULL, NULL, &optvalue_off, &optvalue_len, false);
|
||||
if (NULL != copy_from_line[i]) {
|
||||
if (INVALID_LINES_IDX != opt_name_index) {
|
||||
pfree(optlines[opt_name_index]);
|
||||
|
@ -18153,7 +18170,7 @@ void comment_guc_lines(char** optlines, const char** opt_name)
|
|||
ereport(LOG, (errmsg("configuration file has not data")));
|
||||
} else {
|
||||
for (int i = 0; i < RESERVE_SIZE; i++) {
|
||||
opt_name_index = find_guc_option(optlines, opt_name[i], NULL, NULL, &optvalue_off, &optvalue_len);
|
||||
opt_name_index = find_guc_option(optlines, opt_name[i], NULL, NULL, &optvalue_off, &optvalue_len, false);
|
||||
if (opt_name_index != INVALID_LINES_IDX) {
|
||||
/* Skip all the blanks at the begin of the optLine */
|
||||
char *p = optlines[opt_name_index];
|
||||
|
@ -18228,8 +18245,8 @@ int add_guc_optlines_to_buffer(char** optlines, char** buffer)
|
|||
* Description : find the line info of the specified parameter in file
|
||||
* Notes :
|
||||
*/
|
||||
int find_guc_option(
|
||||
char** optlines, const char* opt_name, int* name_offset, int* name_len, int* value_offset, int* value_len)
|
||||
int find_guc_option(char** optlines, const char* opt_name,
|
||||
int* name_offset, int* name_len, int* value_offset, int* value_len, bool ignore_case)
|
||||
{
|
||||
bool isMatched = false;
|
||||
int i = 0;
|
||||
|
@ -18247,7 +18264,8 @@ int find_guc_option(
|
|||
/* The first loop is to deal with the lines not commented by '#' */
|
||||
for (i = 0; optlines[i] != NULL; i++) {
|
||||
if (!isOptLineCommented(optlines[i])) {
|
||||
isMatched = isMatchOptionName(optlines[i], opt_name, paramlen, name_offset, value_len, value_offset);
|
||||
isMatched = isMatchOptionName(optlines[i], opt_name, paramlen, name_offset,
|
||||
value_len, value_offset, ignore_case);
|
||||
if (isMatched) {
|
||||
matchtimes++;
|
||||
targetline = i;
|
||||
|
@ -18270,7 +18288,8 @@ int find_guc_option(
|
|||
matchtimes = 0;
|
||||
for (i = 0; optlines[i] != NULL; i++) {
|
||||
if (isOptLineCommented(optlines[i])) {
|
||||
isMatched = isMatchOptionName(optlines[i], opt_name, paramlen, name_offset, value_len, value_offset);
|
||||
isMatched = isMatchOptionName(optlines[i], opt_name, paramlen, name_offset,
|
||||
value_len, value_offset, ignore_case);
|
||||
if (isMatched) {
|
||||
matchtimes++;
|
||||
targetline = i;
|
||||
|
|
|
@ -1638,7 +1638,7 @@ static char *get_application_name(void)
|
|||
securec_check_ss_c(rc, "\0", "\0");
|
||||
|
||||
if ((optlines = (char **)read_guc_file(conf_path)) != NULL) {
|
||||
lines_index = find_guc_option(optlines, config_para_build, NULL, NULL, &optvalue_off, &optvalue_len);
|
||||
lines_index = find_guc_option(optlines, config_para_build, NULL, NULL, &optvalue_off, &optvalue_len, false);
|
||||
if (lines_index != INVALID_LINES_IDX) {
|
||||
rc = strncpy_s(arg_str, NAMEDATALEN, optlines[lines_index] + optvalue_off, optvalue_len);
|
||||
securec_check_c(rc, "\0", "\0");
|
||||
|
|
|
@ -390,8 +390,8 @@ extern char* xstrdup(const char* s);
|
|||
|
||||
extern char** read_guc_file(const char* path);
|
||||
extern ErrCode write_guc_file(const char* path, char** lines);
|
||||
extern int find_guc_option(
|
||||
char** optlines, const char* opt_name, int* name_offset, int* name_len, int* value_offset, int* value_len);
|
||||
extern int find_guc_option(char** optlines, const char* opt_name,
|
||||
int* name_offset, int* name_len, int* value_offset, int* value_len, bool ignore_case);
|
||||
|
||||
extern void modify_guc_lines(char*** optlines, const char** opt_name, char** copy_from_line);
|
||||
extern ErrCode copy_guc_lines(char** copy_to_line, char** optlines, const char** opt_name);
|
||||
|
|
|
@ -17,14 +17,28 @@ show io_limits;
|
|||
\c
|
||||
DROP user alter_system_testuser;
|
||||
|
||||
|
||||
------------------------------------------------------
|
||||
-- there is a black list of guc for sysadmin.
|
||||
------------------------------------------------------
|
||||
DROP ROLE IF EXISTS alter_system_testadmin;
|
||||
CREATE USER alter_system_testadmin with sysadmin PASSWORD 'test@1233';
|
||||
SET SESSION AUTHORIZATION alter_system_testadmin PASSWORD 'test@1233';
|
||||
show modify_initial_password;
|
||||
show enable_copy_server_files;
|
||||
ALTER SYSTEM SET modify_initial_password to on;
|
||||
ALTER SYSTEM SET enable_copy_server_files to on;
|
||||
show modify_initial_password;
|
||||
show enable_copy_server_files;
|
||||
\c
|
||||
DROP user alter_system_testadmin;
|
||||
|
||||
-------------------------------------------------------
|
||||
-- clear pg_query_audit for the last test
|
||||
-- make sure that audit is on.
|
||||
-------------------------------------------------------
|
||||
show audit_enabled;
|
||||
show audit_set_parameter;
|
||||
show audit_user_violation;
|
||||
SELECT pg_delete_audit('2000-01-01 ','9999-01-01');
|
||||
|
||||
|
||||
--------------------------------------------------------
|
||||
-- for POSTMASTER GUC
|
||||
|
@ -45,10 +59,12 @@ SHOW log_destination;
|
|||
ALTER SYSTEM SET log_destination to 'stderr,csvlog';
|
||||
SHOW autovacuum_mode;
|
||||
ALTER SYSTEM SET autovacuum_mode to 'analyze';
|
||||
SHOW parctl_min_cost;
|
||||
ALTER SYSTEM SET parctl_min_cost TO 1000;
|
||||
SHOW io_control_unit;
|
||||
ALTER SYSTEM SET io_control_unit TO 10000;
|
||||
SHOW vacuum_defer_cleanup_age;
|
||||
ALTER SYSTEM SET vacuum_defer_cleanup_age TO 50000;
|
||||
show enable_copy_server_files;
|
||||
ALTER SYSTEM SET enable_copy_server_files to on;
|
||||
|
||||
select pg_sleep(2); -- wait to reload postgres.conf file
|
||||
|
||||
|
@ -62,10 +78,12 @@ SHOW log_destination;
|
|||
ALTER SYSTEM SET log_destination to 'stderr';
|
||||
SHOW autovacuum_mode;
|
||||
ALTER SYSTEM SET autovacuum_mode to mix;
|
||||
SHOW parctl_min_cost;
|
||||
ALTER SYSTEM SET parctl_min_cost TO 100000;
|
||||
SHOW io_control_unit;
|
||||
ALTER SYSTEM SET io_control_unit TO 6000;
|
||||
SHOW vacuum_defer_cleanup_age;
|
||||
ALTER SYSTEM SET vacuum_defer_cleanup_age TO 0;
|
||||
show enable_copy_server_files;
|
||||
ALTER SYSTEM SET enable_copy_server_files to off;
|
||||
|
||||
select pg_sleep(2); -- wait to reload postgres.conf file
|
||||
|
||||
|
@ -73,9 +91,8 @@ SHOW password_lock_time;
|
|||
SHOW autovacuum;
|
||||
SHOW log_destination;
|
||||
SHOW autovacuum_mode;
|
||||
SHOW parctl_min_cost;
|
||||
|
||||
|
||||
SHOW io_control_unit;
|
||||
SHOW enable_copy_server_files;
|
||||
|
||||
-- some err case
|
||||
ALTER SYSTEM SET password_lock_time to true;
|
||||
|
@ -83,8 +100,8 @@ ALTER SYSTEM SET autovacuum to 'lalala';
|
|||
ALTER SYSTEM SET log_destination to 'abcdefg';
|
||||
ALTER SYSTEM SET autovacuum_mode to 123;
|
||||
ALTER SYSTEM SET autovacuum_mode to lalala;
|
||||
ALTER SYSTEM SET parctl_min_cost TO -100;
|
||||
ALTER SYSTEM SET parctl_min_cost TO 1.1;
|
||||
ALTER SYSTEM SET io_control_unit TO -100;
|
||||
ALTER SYSTEM SET io_control_unit TO 1.1;
|
||||
ALTER SYSTEM SET vacuum_defer_cleanup_age TO 5.1;
|
||||
ALTER SYSTEM SET vacuum_defer_cleanup_age TO '8#@da%';
|
||||
|
||||
|
@ -94,7 +111,7 @@ SHOW password_lock_time;
|
|||
SHOW autovacuum;
|
||||
SHOW log_destination;
|
||||
SHOW autovacuum_mode;
|
||||
SHOW parctl_min_cost;
|
||||
SHOW io_control_unit;
|
||||
|
||||
------------------------------------------------------
|
||||
-- FOR BACKEND GUC
|
||||
|
@ -128,13 +145,39 @@ show autoanalyze;
|
|||
|
||||
-----------------------------------------------------
|
||||
-- UNSUPPORT SET TO DEFAULT
|
||||
-- NOTICE: we change io_control_unit here and not recover.
|
||||
-----------------------------------------------------
|
||||
SHOW parctl_min_cost;
|
||||
ALTER SYSTEM SET parctl_min_cost TO 1000;
|
||||
ALTER SYSTEM SET parctl_min_cost TO default;
|
||||
SHOW io_control_unit;
|
||||
ALTER SYSTEM SET io_control_unit TO 10000;
|
||||
ALTER SYSTEM SET io_control_unit TO default;
|
||||
select pg_sleep(1);
|
||||
SHOW parctl_min_cost;
|
||||
ALTER SYSTEM SET parctl_min_cost TO 100000;
|
||||
SHOW io_control_unit;
|
||||
|
||||
------------------------------------------------------
|
||||
-- exception in configure file
|
||||
-- 1.duplicate parameter
|
||||
-- 2.mixed case
|
||||
------------------------------------------------------
|
||||
\! echo "# io_control_Unit = 50000" >> @abs_srcdir@/tmp_check/datanode1/postgresql.conf
|
||||
\! echo "io_control_uNit = 50000" >> @abs_srcdir@/tmp_check/datanode1/postgresql.conf
|
||||
\! echo "io_control_unIt = 60000" >> @abs_srcdir@/tmp_check/datanode1/postgresql.conf
|
||||
\! echo "# io_control_uniT = 80000" >> @abs_srcdir@/tmp_check/datanode1/postgresql.conf
|
||||
ALTER SYSTEM SET "io_control_UNit" TO 90000;
|
||||
\! grep "io_control_" @abs_srcdir@/tmp_check/datanode1/postgresql.conf
|
||||
select pg_sleep(1);
|
||||
SHOW io_control_unit;
|
||||
|
||||
-------------------------------------------------------
|
||||
-- exception: configure file does not exist.
|
||||
-- expect: read bak file.
|
||||
-- NOTICE: we recover io_control_unit here.
|
||||
-------------------------------------------------------
|
||||
\! rm @abs_srcdir@/tmp_check/datanode1/postgresql.conf
|
||||
ALTER SYSTEM SET "io_control_unIT" TO 6000;
|
||||
select pg_sleep(1);
|
||||
SHOW io_control_unit;
|
||||
\! grep "io_control_" @abs_srcdir@/tmp_check/datanode1/postgresql.conf
|
||||
\! grep "io_control_" @abs_srcdir@/tmp_check/datanode1/postgresql.conf.bak
|
||||
|
||||
-------------------------------------------------------
|
||||
-- can not in a transaction
|
||||
|
@ -149,6 +192,5 @@ END;
|
|||
|
||||
-------------------------------------------------------
|
||||
-- shoule be audited.
|
||||
------------------------------------------------------
|
||||
SELECT type,result,userid,database,client_conninfo,object_name,detail_info FROM pg_query_audit('2000-01-01 08:00:00','9999-01-01 08:00:00');
|
||||
|
||||
-------------------------------------------------------
|
||||
SELECT type,result,userid,database,client_conninfo,object_name,detail_info FROM pg_query_audit('2000-01-01 08:00:00','9999-01-01 08:00:00') where detail_info like 'ALTER SYSTEM SET %';
|
|
@ -12,7 +12,7 @@ show use_workload_manager;
|
|||
(1 row)
|
||||
|
||||
ALTER SYSTEM SET use_workload_manager to off;
|
||||
ERROR: must be superuser to execute ALTER SYSTEM SET command
|
||||
ERROR: Permission denied.
|
||||
show io_limits;
|
||||
io_limits
|
||||
-----------
|
||||
|
@ -20,7 +20,7 @@ show io_limits;
|
|||
(1 row)
|
||||
|
||||
ALTER SYSTEM SET io_limits to 100;
|
||||
ERROR: must be superuser to execute ALTER SYSTEM SET command
|
||||
ERROR: Permission denied.
|
||||
select pg_sleep(1); -- wait to reload postgres.conf file
|
||||
pg_sleep
|
||||
----------
|
||||
|
@ -41,8 +41,45 @@ show io_limits;
|
|||
|
||||
\c
|
||||
DROP user alter_system_testuser;
|
||||
------------------------------------------------------
|
||||
-- there is a black list of guc for sysadmin.
|
||||
------------------------------------------------------
|
||||
DROP ROLE IF EXISTS alter_system_testadmin;
|
||||
NOTICE: role "alter_system_testadmin" does not exist, skipping
|
||||
CREATE USER alter_system_testadmin with sysadmin PASSWORD 'test@1233';
|
||||
SET SESSION AUTHORIZATION alter_system_testadmin PASSWORD 'test@1233';
|
||||
show modify_initial_password;
|
||||
modify_initial_password
|
||||
-------------------------
|
||||
off
|
||||
(1 row)
|
||||
|
||||
show enable_copy_server_files;
|
||||
enable_copy_server_files
|
||||
--------------------------
|
||||
off
|
||||
(1 row)
|
||||
|
||||
ALTER SYSTEM SET modify_initial_password to on;
|
||||
ERROR: GUC:modify_initial_password could only be set by initial user.
|
||||
ALTER SYSTEM SET enable_copy_server_files to on;
|
||||
ERROR: GUC:enable_copy_server_files could only be set by initial user.
|
||||
show modify_initial_password;
|
||||
modify_initial_password
|
||||
-------------------------
|
||||
off
|
||||
(1 row)
|
||||
|
||||
show enable_copy_server_files;
|
||||
enable_copy_server_files
|
||||
--------------------------
|
||||
off
|
||||
(1 row)
|
||||
|
||||
\c
|
||||
DROP user alter_system_testadmin;
|
||||
-------------------------------------------------------
|
||||
-- clear pg_query_audit for the last test
|
||||
-- make sure that audit is on.
|
||||
-------------------------------------------------------
|
||||
show audit_enabled;
|
||||
audit_enabled
|
||||
|
@ -62,12 +99,6 @@ show audit_user_violation;
|
|||
1
|
||||
(1 row)
|
||||
|
||||
SELECT pg_delete_audit('2000-01-01 ','9999-01-01');
|
||||
pg_delete_audit
|
||||
-----------------
|
||||
|
||||
(1 row)
|
||||
|
||||
--------------------------------------------------------
|
||||
-- for POSTMASTER GUC
|
||||
--------------------------------------------------------
|
||||
|
@ -113,13 +144,13 @@ SHOW autovacuum_mode;
|
|||
(1 row)
|
||||
|
||||
ALTER SYSTEM SET autovacuum_mode to 'analyze';
|
||||
SHOW parctl_min_cost;
|
||||
parctl_min_cost
|
||||
SHOW io_control_unit;
|
||||
io_control_unit
|
||||
-----------------
|
||||
100000
|
||||
6000
|
||||
(1 row)
|
||||
|
||||
ALTER SYSTEM SET parctl_min_cost TO 1000;
|
||||
ALTER SYSTEM SET io_control_unit TO 10000;
|
||||
SHOW vacuum_defer_cleanup_age;
|
||||
vacuum_defer_cleanup_age
|
||||
--------------------------
|
||||
|
@ -127,6 +158,13 @@ SHOW vacuum_defer_cleanup_age;
|
|||
(1 row)
|
||||
|
||||
ALTER SYSTEM SET vacuum_defer_cleanup_age TO 50000;
|
||||
show enable_copy_server_files;
|
||||
enable_copy_server_files
|
||||
--------------------------
|
||||
off
|
||||
(1 row)
|
||||
|
||||
ALTER SYSTEM SET enable_copy_server_files to on;
|
||||
select pg_sleep(2); -- wait to reload postgres.conf file
|
||||
pg_sleep
|
||||
----------
|
||||
|
@ -162,13 +200,13 @@ SHOW autovacuum_mode;
|
|||
(1 row)
|
||||
|
||||
ALTER SYSTEM SET autovacuum_mode to mix;
|
||||
SHOW parctl_min_cost;
|
||||
parctl_min_cost
|
||||
SHOW io_control_unit;
|
||||
io_control_unit
|
||||
-----------------
|
||||
1000
|
||||
10000
|
||||
(1 row)
|
||||
|
||||
ALTER SYSTEM SET parctl_min_cost TO 100000;
|
||||
ALTER SYSTEM SET io_control_unit TO 6000;
|
||||
SHOW vacuum_defer_cleanup_age;
|
||||
vacuum_defer_cleanup_age
|
||||
--------------------------
|
||||
|
@ -176,6 +214,13 @@ SHOW vacuum_defer_cleanup_age;
|
|||
(1 row)
|
||||
|
||||
ALTER SYSTEM SET vacuum_defer_cleanup_age TO 0;
|
||||
show enable_copy_server_files;
|
||||
enable_copy_server_files
|
||||
--------------------------
|
||||
on
|
||||
(1 row)
|
||||
|
||||
ALTER SYSTEM SET enable_copy_server_files to off;
|
||||
select pg_sleep(2); -- wait to reload postgres.conf file
|
||||
pg_sleep
|
||||
----------
|
||||
|
@ -206,10 +251,16 @@ SHOW autovacuum_mode;
|
|||
mix
|
||||
(1 row)
|
||||
|
||||
SHOW parctl_min_cost;
|
||||
parctl_min_cost
|
||||
SHOW io_control_unit;
|
||||
io_control_unit
|
||||
-----------------
|
||||
100000
|
||||
6000
|
||||
(1 row)
|
||||
|
||||
SHOW enable_copy_server_files;
|
||||
enable_copy_server_files
|
||||
--------------------------
|
||||
off
|
||||
(1 row)
|
||||
|
||||
-- some err case
|
||||
|
@ -226,10 +277,10 @@ HINT: Available values: analyze, vacuum, mix, none.
|
|||
ALTER SYSTEM SET autovacuum_mode to lalala;
|
||||
ERROR: invalid value for parameter "autovacuum_mode": "lalala"
|
||||
HINT: Available values: analyze, vacuum, mix, none.
|
||||
ALTER SYSTEM SET parctl_min_cost TO -100;
|
||||
ERROR: -100 is outside the valid range for parameter "parctl_min_cost" (-1 .. 2147483647)
|
||||
ALTER SYSTEM SET parctl_min_cost TO 1.1;
|
||||
ERROR: invalid value for parameter "parctl_min_cost": "1.1"
|
||||
ALTER SYSTEM SET io_control_unit TO -100;
|
||||
ERROR: -100 is outside the valid range for parameter "io_control_unit" (1000 .. 1000000)
|
||||
ALTER SYSTEM SET io_control_unit TO 1.1;
|
||||
ERROR: invalid value for parameter "io_control_unit": "1.1"
|
||||
ALTER SYSTEM SET vacuum_defer_cleanup_age TO 5.1;
|
||||
ERROR: parameter "vacuum_defer_cleanup_age" requires a numeric value
|
||||
ALTER SYSTEM SET vacuum_defer_cleanup_age TO '8#@da%';
|
||||
|
@ -264,10 +315,10 @@ SHOW autovacuum_mode;
|
|||
mix
|
||||
(1 row)
|
||||
|
||||
SHOW parctl_min_cost;
|
||||
parctl_min_cost
|
||||
SHOW io_control_unit;
|
||||
io_control_unit
|
||||
-----------------
|
||||
100000
|
||||
6000
|
||||
(1 row)
|
||||
|
||||
------------------------------------------------------
|
||||
|
@ -355,15 +406,16 @@ show autoanalyze;
|
|||
|
||||
-----------------------------------------------------
|
||||
-- UNSUPPORT SET TO DEFAULT
|
||||
-- NOTICE: we change io_control_unit here and not recover.
|
||||
-----------------------------------------------------
|
||||
SHOW parctl_min_cost;
|
||||
parctl_min_cost
|
||||
SHOW io_control_unit;
|
||||
io_control_unit
|
||||
-----------------
|
||||
100000
|
||||
6000
|
||||
(1 row)
|
||||
|
||||
ALTER SYSTEM SET parctl_min_cost TO 1000;
|
||||
ALTER SYSTEM SET parctl_min_cost TO default;
|
||||
ALTER SYSTEM SET io_control_unit TO 10000;
|
||||
ALTER SYSTEM SET io_control_unit TO default;
|
||||
ERROR: ALTER SYSTEM SET does not support 'set to default'.
|
||||
select pg_sleep(1);
|
||||
pg_sleep
|
||||
|
@ -371,13 +423,73 @@ select pg_sleep(1);
|
|||
|
||||
(1 row)
|
||||
|
||||
SHOW parctl_min_cost;
|
||||
parctl_min_cost
|
||||
SHOW io_control_unit;
|
||||
io_control_unit
|
||||
-----------------
|
||||
1000
|
||||
10000
|
||||
(1 row)
|
||||
|
||||
ALTER SYSTEM SET parctl_min_cost TO 100000;
|
||||
------------------------------------------------------
|
||||
-- exception in configure file
|
||||
-- 1.duplicate parameter
|
||||
-- 2.mixed case
|
||||
------------------------------------------------------
|
||||
\! echo "# io_control_Unit = 50000" >> @abs_srcdir@/tmp_check/datanode1/postgresql.conf
|
||||
\! echo "io_control_uNit = 50000" >> @abs_srcdir@/tmp_check/datanode1/postgresql.conf
|
||||
\! echo "io_control_unIt = 60000" >> @abs_srcdir@/tmp_check/datanode1/postgresql.conf
|
||||
\! echo "# io_control_uniT = 80000" >> @abs_srcdir@/tmp_check/datanode1/postgresql.conf
|
||||
ALTER SYSTEM SET "io_control_UNit" TO 90000;
|
||||
NOTICE: There are 3 "io_control_UNit" not commented in "postgresql.conf", and only the last one in 916th line will be set and used.
|
||||
\! grep "io_control_" @abs_srcdir@/tmp_check/datanode1/postgresql.conf
|
||||
io_control_unit = 10000
|
||||
# io_control_Unit = 50000
|
||||
io_control_uNit = 50000
|
||||
io_control_UNit = 90000
|
||||
# io_control_uniT = 80000
|
||||
select pg_sleep(1);
|
||||
pg_sleep
|
||||
----------
|
||||
|
||||
(1 row)
|
||||
|
||||
SHOW io_control_unit;
|
||||
io_control_unit
|
||||
-----------------
|
||||
90000
|
||||
(1 row)
|
||||
|
||||
-------------------------------------------------------
|
||||
-- exception: configure file does not exist.
|
||||
-- expect: read bak file.
|
||||
-- NOTICE: we recover io_control_unit here.
|
||||
-------------------------------------------------------
|
||||
\! rm @abs_srcdir@/tmp_check/datanode1/postgresql.conf
|
||||
ALTER SYSTEM SET "io_control_unIT" TO 6000;
|
||||
NOTICE: There are 3 "io_control_unIT" not commented in "postgresql.conf", and only the last one in 916th line will be set and used.
|
||||
select pg_sleep(1);
|
||||
pg_sleep
|
||||
----------
|
||||
|
||||
(1 row)
|
||||
|
||||
SHOW io_control_unit;
|
||||
io_control_unit
|
||||
-----------------
|
||||
6000
|
||||
(1 row)
|
||||
|
||||
\! grep "io_control_" @abs_srcdir@/tmp_check/datanode1/postgresql.conf
|
||||
io_control_unit = 10000
|
||||
# io_control_Unit = 50000
|
||||
io_control_uNit = 50000
|
||||
io_control_unIT = 6000
|
||||
# io_control_uniT = 80000
|
||||
\! grep "io_control_" @abs_srcdir@/tmp_check/datanode1/postgresql.conf.bak
|
||||
io_control_unit = 10000
|
||||
# io_control_Unit = 50000
|
||||
io_control_uNit = 50000
|
||||
io_control_unIT = 6000
|
||||
# io_control_uniT = 80000
|
||||
-------------------------------------------------------
|
||||
-- can not in a transaction
|
||||
-------------------------------------------------------
|
||||
|
@ -391,36 +503,38 @@ SHOW autovacuum;
|
|||
ALTER SYSTEM SET autovacuum to off;
|
||||
ERROR: ALTER SYSTEM SET cannot run inside a transaction block
|
||||
SHOW autovacuum;
|
||||
--?ERROR: current transaction is aborted, commands ignored until end of transaction block.*
|
||||
ERROR: current transaction is aborted, commands ignored until end of transaction block, firstChar[Q]
|
||||
ALTER SYSTEM SET autovacuum to on;
|
||||
--?ERROR: current transaction is aborted, commands ignored until end of transaction block.*
|
||||
ERROR: current transaction is aborted, commands ignored until end of transaction block, firstChar[Q]
|
||||
SHOW autovacuum;
|
||||
--?ERROR: current transaction is aborted, commands ignored until end of transaction block.*
|
||||
ERROR: current transaction is aborted, commands ignored until end of transaction block, firstChar[Q]
|
||||
END;
|
||||
-------------------------------------------------------
|
||||
-- shoule be audited.
|
||||
------------------------------------------------------
|
||||
SELECT type,result,userid,database,client_conninfo,object_name,detail_info FROM pg_query_audit('2000-01-01 08:00:00','9999-01-01 08:00:00');
|
||||
type | result | userid | database | client_conninfo | object_name | detail_info
|
||||
----------------+--------+--------+------------+-----------------+--------------------------+------------------------------------------------------
|
||||
internal_event | ok | 10 | regression | gsql@[local] | null | SELECT pg_delete_audit('2000-01-01 ','9999-01-01');
|
||||
set_parameter | ok | 10 | regression | gsql@[local] | enable_thread_pool | ALTER SYSTEM SET enable_thread_pool to off;
|
||||
set_parameter | ok | 10 | regression | gsql@[local] | enable_thread_pool | ALTER SYSTEM SET enable_thread_pool to on;
|
||||
set_parameter | ok | 10 | regression | gsql@[local] | password_lock_time | ALTER SYSTEM SET password_lock_time to 1.1;
|
||||
set_parameter | ok | 10 | regression | gsql@[local] | autovacuum | ALTER SYSTEM SET autovacuum to off;
|
||||
set_parameter | ok | 10 | regression | gsql@[local] | log_destination | ALTER SYSTEM SET log_destination to 'stderr,csvlog';
|
||||
set_parameter | ok | 10 | regression | gsql@[local] | autovacuum_mode | ALTER SYSTEM SET autovacuum_mode to 'analyze';
|
||||
set_parameter | ok | 10 | regression | gsql@[local] | parctl_min_cost | ALTER SYSTEM SET parctl_min_cost TO 1000;
|
||||
set_parameter | ok | 10 | regression | gsql@[local] | vacuum_defer_cleanup_age | ALTER SYSTEM SET vacuum_defer_cleanup_age TO 50000;
|
||||
set_parameter | ok | 10 | regression | gsql@[local] | password_lock_time | ALTER SYSTEM SET password_lock_time to 1;
|
||||
set_parameter | ok | 10 | regression | gsql@[local] | autovacuum | ALTER SYSTEM SET autovacuum to on;
|
||||
set_parameter | ok | 10 | regression | gsql@[local] | log_destination | ALTER SYSTEM SET log_destination to 'stderr';
|
||||
set_parameter | ok | 10 | regression | gsql@[local] | autovacuum_mode | ALTER SYSTEM SET autovacuum_mode to mix;
|
||||
set_parameter | ok | 10 | regression | gsql@[local] | parctl_min_cost | ALTER SYSTEM SET parctl_min_cost TO 100000;
|
||||
set_parameter | ok | 10 | regression | gsql@[local] | vacuum_defer_cleanup_age | ALTER SYSTEM SET vacuum_defer_cleanup_age TO 0;
|
||||
set_parameter | ok | 10 | regression | gsql@[local] | ignore_system_indexes | ALTER SYSTEM SET ignore_system_indexes TO on;
|
||||
set_parameter | ok | 10 | regression | gsql@[local] | ignore_system_indexes | ALTER SYSTEM SET ignore_system_indexes TO off;
|
||||
set_parameter | ok | 10 | regression | gsql@[local] | parctl_min_cost | ALTER SYSTEM SET parctl_min_cost TO 1000;
|
||||
set_parameter | ok | 10 | regression | gsql@[local] | parctl_min_cost | ALTER SYSTEM SET parctl_min_cost TO 100000;
|
||||
(19 rows)
|
||||
-------------------------------------------------------
|
||||
SELECT type,result,userid,database,client_conninfo,object_name,detail_info FROM pg_query_audit('2000-01-01 08:00:00','9999-01-01 08:00:00') where detail_info like 'ALTER SYSTEM SET %';
|
||||
type | result | userid | database | client_conninfo | object_name | detail_info
|
||||
---------------+--------+--------+------------+-----------------+--------------------------+------------------------------------------------------
|
||||
set_parameter | ok | 10 | regression | gsql@[local] | enable_thread_pool | ALTER SYSTEM SET enable_thread_pool to off;
|
||||
set_parameter | ok | 10 | regression | gsql@[local] | enable_thread_pool | ALTER SYSTEM SET enable_thread_pool to on;
|
||||
set_parameter | ok | 10 | regression | gsql@[local] | password_lock_time | ALTER SYSTEM SET password_lock_time to 1.1;
|
||||
set_parameter | ok | 10 | regression | gsql@[local] | autovacuum | ALTER SYSTEM SET autovacuum to off;
|
||||
set_parameter | ok | 10 | regression | gsql@[local] | log_destination | ALTER SYSTEM SET log_destination to 'stderr,csvlog';
|
||||
set_parameter | ok | 10 | regression | gsql@[local] | autovacuum_mode | ALTER SYSTEM SET autovacuum_mode to 'analyze';
|
||||
set_parameter | ok | 10 | regression | gsql@[local] | io_control_unit | ALTER SYSTEM SET io_control_unit TO 10000;
|
||||
set_parameter | ok | 10 | regression | gsql@[local] | vacuum_defer_cleanup_age | ALTER SYSTEM SET vacuum_defer_cleanup_age TO 50000;
|
||||
set_parameter | ok | 10 | regression | gsql@[local] | enable_copy_server_files | ALTER SYSTEM SET enable_copy_server_files to on;
|
||||
set_parameter | ok | 10 | regression | gsql@[local] | password_lock_time | ALTER SYSTEM SET password_lock_time to 1;
|
||||
set_parameter | ok | 10 | regression | gsql@[local] | autovacuum | ALTER SYSTEM SET autovacuum to on;
|
||||
set_parameter | ok | 10 | regression | gsql@[local] | log_destination | ALTER SYSTEM SET log_destination to 'stderr';
|
||||
set_parameter | ok | 10 | regression | gsql@[local] | autovacuum_mode | ALTER SYSTEM SET autovacuum_mode to mix;
|
||||
set_parameter | ok | 10 | regression | gsql@[local] | io_control_unit | ALTER SYSTEM SET io_control_unit TO 6000;
|
||||
set_parameter | ok | 10 | regression | gsql@[local] | vacuum_defer_cleanup_age | ALTER SYSTEM SET vacuum_defer_cleanup_age TO 0;
|
||||
set_parameter | ok | 10 | regression | gsql@[local] | enable_copy_server_files | ALTER SYSTEM SET enable_copy_server_files to off;
|
||||
set_parameter | ok | 10 | regression | gsql@[local] | ignore_system_indexes | ALTER SYSTEM SET ignore_system_indexes TO on;
|
||||
set_parameter | ok | 10 | regression | gsql@[local] | ignore_system_indexes | ALTER SYSTEM SET ignore_system_indexes TO off;
|
||||
set_parameter | ok | 10 | regression | gsql@[local] | io_control_unit | ALTER SYSTEM SET io_control_unit TO 10000;
|
||||
set_parameter | ok | 10 | regression | gsql@[local] | io_control_UNit | ALTER SYSTEM SET "io_control_UNit" TO 90000;
|
||||
set_parameter | ok | 10 | regression | gsql@[local] | io_control_unIT | ALTER SYSTEM SET "io_control_unIT" TO 6000;
|
||||
(21 rows)
|
||||
|
|
@ -278,7 +278,7 @@ test: create_view1 create_view2 create_view3 create_view4 create_view5
|
|||
#test: select
|
||||
#test: misc
|
||||
#test: stats
|
||||
#test: alter_system_set
|
||||
test: alter_system_set
|
||||
|
||||
#dispatch from 13
|
||||
test: function
|
||||
|
|
Loading…
Reference in New Issue