From 8ae440e9d782d705a1718cc10a6675a909a707f2 Mon Sep 17 00:00:00 2001 From: zhengxue Date: Tue, 24 Nov 2020 15:13:06 +0800 Subject: [PATCH] modify the value range for guc --- src/bin/gs_guc/cluster_guc.cpp | 491 ++++++++++++------ .../regress/input/gs_guc_value_range.source | 27 + .../regress/output/gs_guc_value_range.source | 127 +++++ src/test/regress/parallel_schedule10 | 3 +- 4 files changed, 485 insertions(+), 163 deletions(-) create mode 100644 src/test/regress/input/gs_guc_value_range.source create mode 100644 src/test/regress/output/gs_guc_value_range.source diff --git a/src/bin/gs_guc/cluster_guc.cpp b/src/bin/gs_guc/cluster_guc.cpp index b685f75c8..e6b6f6d95 100755 --- a/src/bin/gs_guc/cluster_guc.cpp +++ b/src/bin/gs_guc/cluster_guc.cpp @@ -36,6 +36,7 @@ #include "common/config/cm_config.h" #include #include +#include const int CLUSTER_CONFIG_SUCCESS = 0; const int CLUSTER_CONFIG_ERROR = 1; @@ -174,6 +175,23 @@ const int MB_PER_GB = 1024; #define MIN_PER_D (60 * 24) #define H_PER_D 24 +/* the number of the unit type */ +const int UNIT_TYPE = 8; +/* + * transform unit matrix + * Elements in each line represent the transform value between this unit and another unit when a unit is basic unit. +*/ +const int g_unit_transform[UNIT_TYPE][UNIT_TYPE] = { + {1, KB_PER_MB, KB_PER_GB, 0, 0, 0, 0, 0}, /* the transform value based on KB */ + {0, 1, MB_PER_GB, 0, 0, 0, 0, 0}, /* the transform value based on MB */ + {0, 0, 1, 0, 0, 0, 0, 0}, /* the transform value based on GB */ + {0, 0, 0, 1, MS_PER_S, MS_PER_MIN, MS_PER_H, MS_PER_D}, /* the transform value based on ms */ + {0, 0, 0, 0, 1, S_PER_MIN, S_PER_H, S_PER_D}, /* the transform value based on s */ + {0, 0, 0, 0, 0, 1, MIN_PER_H, MIN_PER_D}, /* the transform value based on min */ + {0, 0, 0, 0, 0, 0, 1, H_PER_D}, /* the transform value based on h */ + {0, 0, 0, 0, 0, 0, 0, 1} /* the transform value based on d */ + }; + /* execute result */ #define SUCCESS 0 #define FAILURE 1 @@ -266,7 +284,10 @@ void get_instance_configfile(const char* datadir); char* get_ctl_command_type(); void* pg_malloc(size_t size); void* pg_malloc_zero(size_t size); -#ifdef __cplusplus +template +static int parse_value( + const char* paraname, const UnitType unitval, const UnitType new_unitval, const char* endptr, T* tmp_val); +#ifdef __cplusplus extern "C" { #endif /* __cplusplus */ @@ -326,8 +347,12 @@ int check_parameter_value( const char* paraname, GucParaType type, char* guc_list_value, const char* guc_list_unit, const char* value); int check_parameter_name(char** guc_opt, int type); bool check_parameter_is_valid(int type); -int parse_value(const char* paraname, const char* value, const char* guc_list_unit, int64* result_int, - double* result_double, bool isInt); +static int check_int_overflow( + const char* paraname, const UnitType unitval, const UnitType tmp_unitval, int64 tmp_int_val); +static int check_double_overflow( + const char* paraname, const double val, const bool inf_is_valid, const bool zero_is_valid); +int parse_int_value(const char* paraname, const char* value, const char* guc_list_unit, int64* result_int); +int parse_double_value(const char* paraname, const char* value, const char* guc_list_unit, double* result_double); int get_guc_minmax_value(const char* guc_list_val, struct guc_minmax_value& value_list); int check_int_real_type_value( const char* paraname, const char* guc_list_value, const char* guc_list_unit, const char* value, bool isInt); @@ -3739,8 +3764,8 @@ int check_int_value(const char* paraname, const struct guc_minmax_value& value_l bool is_in_list = false; bool is_exists_alpha = false; /* makesure the min/max value from guc config list file is correct */ - if ((FAILURE == parse_value(paraname, value_list.min_val_str, NULL, &int_min_val, NULL, true)) || - (FAILURE == parse_value(paraname, value_list.max_val_str, NULL, &int_max_val, NULL, true))) { + if ((FAILURE == parse_int_value(paraname, value_list.min_val_str, NULL, &int_min_val)) || + (FAILURE == parse_int_value(paraname, value_list.max_val_str, NULL, &int_max_val))) { (void)write_stderr("ERROR: The minmax value of parameter \"%s\" requires an integer value.\n", paraname); return FAILURE; } @@ -3797,8 +3822,8 @@ int check_real_value(const char* paraname, const struct guc_minmax_value& value_ double double_min_val, double double_max_val) { /* makesure the min/max value from guc config list file is correct */ - if ((FAILURE == parse_value(paraname, value_list.min_val_str, NULL, NULL, &double_min_val, false)) || - (FAILURE == parse_value(paraname, value_list.max_val_str, NULL, NULL, &double_max_val, false))) { + if ((FAILURE == parse_double_value(paraname, value_list.min_val_str, NULL, &double_min_val)) || + (FAILURE == parse_double_value(paraname, value_list.max_val_str, NULL, &double_max_val))) { (void)write_stderr("ERROR: The minmax value of parameter \"%s\" requires a numeric value.\n", paraname); return FAILURE; } @@ -3846,12 +3871,16 @@ int check_int_real_type_value( securec_check_c(nRet, "\0", "\0"); /* parse int_newval/double_newval value*/ - if (FAILURE == parse_value(paraname, value, guc_list_unit, &int_newval, &double_newval, isInt)) { - if (isInt) + if (isInt) { + if (FAILURE == parse_int_value(paraname, value, guc_list_unit, &int_newval)) { (void)write_stderr("ERROR: The parameter \"%s\" requires an integer value.\n", paraname); - else + return FAILURE; + } + } else { + if (FAILURE == parse_double_value(paraname, value, guc_list_unit, &double_newval)) { (void)write_stderr("ERROR: The parameter \"%s\" requires a numeric value.\n", paraname); - return FAILURE; + return FAILURE; + } } /* get min/max value from guc config file */ @@ -3873,55 +3902,94 @@ int check_int_real_type_value( /* ************************************************************************************ - Function: parse_value - Desc : parese value from guc config file. + Function: check_int_overflow + Desc : check to see if a int val has underflowed or overflowed for parameter. paraname parameter name - value parameter value - guc_list_unit the unit of parameter from guc config file - result_int the parse result about int - result_double the parse result about double - isInt true is int, false is real + unitval the unit of parameter from guc config file + new_unitval the unit of parameter + new_int_val the value of parameter Return : SUCCESS FAILURE ************************************************************************************ */ -int parse_value(const char* paraname, const char* value, const char* guc_list_unit, int64* result_int, - double* result_double, bool isInt) +static int check_int_overflow( + const char* paraname, const UnitType unitval, const UnitType new_unitval, int64 new_int_val) +{ + int per_unit_transfer = INT_MIN; + + /* the transformation value */ + per_unit_transfer = g_unit_transform[unitval][new_unitval]; + + if (new_int_val > (LLONG_MAX / per_unit_transfer) || new_int_val < (LLONG_MIN / per_unit_transfer)) { + (void)write_stderr("ERROR: An overflow occurs for this parameter \"%s\".\n", paraname); + return FAILURE; + } + + return SUCCESS; +} + +/* + ************************************************************************************ + Function: check_double_overflow + Desc : check to see if a double val has underflowed or overflowed for parameter. + paraname parameter name + val the value of parameter after calculation + inf_is_valid infinity is valid + zero_is_valid zero is valid + Return : SUCCESS + FAILURE + ************************************************************************************ +*/ +static int check_double_overflow( + const char* paraname, const double val, const bool inf_is_valid, const bool zero_is_valid) +{ + if (isinf(val) && !(inf_is_valid)) { + (void)write_stderr("ERROR: An overflow occurs for this parameter \"%s\".\n", paraname); + return FAILURE; + } + + if ((val) == 0.0 && !(zero_is_valid)) { + (void)write_stderr("ERROR: An overflow occurs for this parameter \"%s\".\n", paraname); + return FAILURE; + } + + return SUCCESS; +} + +/* + ************************************************************************************ + Function: parse_int_value + Desc : parese int value from guc config file. + paraname parameter name + value parameter value + guc_list_unit the unit of parameter from guc config file + result_int the parse result about int + Return : SUCCESS + FAILURE + ************************************************************************************ +*/ +int parse_int_value(const char* paraname, const char* value, const char* guc_list_unit, int64* result_int) { int64 int_val = INT_MIN; - double double_val; - double tmp_double_val; + int64 tmp_int_val; char* endptr = NULL; - UnitType unitval = UNIT_ERROR; bool contain_space = false; + UnitType int_unitval = UNIT_ERROR; + UnitType new_int_unitval = UNIT_ERROR; + if (NULL != result_int) { *result_int = 0; } - - if (NULL != result_double) { - *result_double = 0; - } - + errno = 0; - if (isInt) { - /* transform value into long int */ - int_val = strtoll(value, &endptr, 0); - if (endptr == value || errno == ERANGE) { - return FAILURE; - } - - tmp_double_val = (double)int_val; - } else { - /* transform value into double */ - double_val = strtod(value, &endptr); - if (endptr == value || errno == ERANGE) { - return FAILURE; - } - - tmp_double_val = double_val; + /* transform value into long int */ + int_val = strtoll(value, &endptr, 0); + if (endptr == value || errno == ERANGE) { + return FAILURE; } - + + tmp_int_val = int_val; /* skill the blank */ while (isspace((unsigned char)*endptr)) { endptr++; @@ -3939,137 +4007,103 @@ int parse_value(const char* paraname, const char* value, const char* guc_list_un return FAILURE; } - unitval = get_guc_unit(guc_list_unit); - if (UNIT_ERROR == unitval) { - (void)write_stderr("ERROR: Invalid units for this parameter \"%s\".\n", paraname); + /* the unit of parameter from guc config file */ + int_unitval = get_guc_unit(guc_list_unit); + /* the unit of real parameter */ + new_int_unitval = get_guc_unit(endptr); + + /* get_guc_unit */ + if (FAILURE == parse_value(paraname, int_unitval, new_int_unitval, endptr, &int_val)) { return FAILURE; - } else if (UNIT_KB == unitval) { - if (strncmp(endptr, "kB", 2) == 0) { - endptr += 2; - } else if (strncmp(endptr, "MB", 2) == 0) { - endptr += 2; - tmp_double_val *= KB_PER_MB; - } else if (strncmp(endptr, "GB", 2) == 0) { - endptr += 2; - tmp_double_val *= KB_PER_GB; - } else { - (void)write_stderr( - "ERROR: Valid units for this parameter \"%s\" are \"kB\", \"MB\" and \"GB\".\n", paraname); - return FAILURE; - } - } else if (UNIT_MB == unitval) { - if (strncmp(endptr, "MB", 2) == 0) { - endptr += 2; - } else if (strncmp(endptr, "GB", 2) == 0) { - endptr += 2; - tmp_double_val *= MB_PER_GB; - } else { - (void)write_stderr("ERROR: Valid units for this parameter \"%s\" are \"MB\" and \"GB\".\n", paraname); - return FAILURE; - } - } else if (UNIT_GB == unitval) { - if (strncmp(endptr, "GB", 2) == 0) { - endptr += 2; - } else { - (void)write_stderr("ERROR: Valid units for this parameter \"%s\" is \"GB\".\n", paraname); - return FAILURE; - } - } else if (UNIT_MS == unitval) { - if (strncmp(endptr, "ms", 2) == 0) { - endptr += 2; - } else if (strncmp(endptr, "s", 1) == 0) { - endptr += 1; - tmp_double_val *= MS_PER_S; - } else if (strncmp(endptr, "min", 3) == 0) { - endptr += 3; - tmp_double_val *= MS_PER_MIN; - } else if (strncmp(endptr, "h", 1) == 0) { - endptr += 1; - tmp_double_val *= MS_PER_H; - } else if (strncmp(endptr, "d", 1) == 0) { - endptr += 1; - tmp_double_val *= MS_PER_D; - } else { - (void)write_stderr( - "ERROR: Valid units for this parameter \"%s\" are \"ms\", \"s\", \"min\", \"h\", and \"d\".\n", - paraname); - return FAILURE; - } - } else if (UNIT_S == unitval) { - if (strncmp(endptr, "s", 1) == 0) { - endptr += 1; - } else if (strncmp(endptr, "min", 3) == 0) { - endptr += 3; - tmp_double_val *= S_PER_MIN; - } else if (strncmp(endptr, "h", 1) == 0) { - endptr += 1; - tmp_double_val *= S_PER_H; - } else if (strncmp(endptr, "d", 1) == 0) { - endptr += 1; - tmp_double_val *= S_PER_D; - } else { - (void)write_stderr( - "ERROR: Valid units for this parameter \"%s\" are \"s\", \"min\", \"h\", and \"d\".\n", paraname); - return FAILURE; - } - } else if (UNIT_MIN == unitval) { - if (strncmp(endptr, "min", 3) == 0) { - endptr += 3; - } else if (strncmp(endptr, "h", 1) == 0) { - endptr += 1; - tmp_double_val *= MIN_PER_H; - } else if (strncmp(endptr, "d", 1) == 0) { - endptr += 1; - tmp_double_val *= MIN_PER_D; - } else { - (void)write_stderr( - "ERROR: Valid units for this parameter \"%s\" are \"min\", \"h\", and \"d\".\n", paraname); - return FAILURE; - } - } else if (UNIT_H == unitval) { - if (strncmp(endptr, "h", 1) == 0) { - endptr += 1; - } else if (strncmp(endptr, "d", 1) == 0) { - endptr += 1; - tmp_double_val *= H_PER_D; - } else { - (void)write_stderr( - "ERROR: Valid units for this parameter \"%s\" are \"min\", \"h\", and \"d\".\n", paraname); - return FAILURE; - } - } else if (UNIT_D == unitval) { - if (strncmp(endptr, "d", 1) == 0) { - endptr += 1; - } else { - (void)write_stderr("ERROR: Valid units for this parameter \"%s\" is \"d\".\n", paraname); - return FAILURE; - } - } else { + } + + /* overflow processing */ + if (FAILURE == check_int_overflow(paraname, int_unitval, new_int_unitval, tmp_int_val)) { return FAILURE; } } - while (isspace((unsigned char)*endptr)) - endptr++; + if (NULL != result_int) { + *result_int = int_val; + } - if (*endptr != '\0') { + return SUCCESS; +} + +/* + ************************************************************************************ + Function: parse_double_value + Desc : parese double value from guc config file. + paraname parameter name + value parameter value + guc_list_unit the unit of parameter from guc config file + result_double the parse result about double + Return : SUCCESS + FAILURE + ************************************************************************************ +*/ +int parse_double_value(const char* paraname, const char* value, const char* guc_list_unit, double* result_double) +{ + double double_val; + double tmp_double_val; + char* endptr = NULL; + bool contain_space = false; + UnitType double_unitval = UNIT_ERROR; + UnitType new_double_unitval = UNIT_ERROR; + int per_unit_transfer = INT_MIN; + + if (NULL != result_double) { + *result_double = 0; + } + + errno = 0; + /* transform value into double */ + double_val = strtod(value, &endptr); + if (endptr == value || errno == ERANGE) { return FAILURE; - } + } - if (isInt) { - if (tmp_double_val > LLONG_MAX || tmp_double_val < LLONG_MIN) { + tmp_double_val = double_val; + /* skill the blank */ + while (isspace((unsigned char)*endptr)) { + endptr++; + contain_space = true; + } + + if ('\0' != *endptr) { + /* if unit is NULL, it means the value is incorrect */ + if (NULL == guc_list_unit || '\0' == guc_list_unit[0]) { + return FAILURE; + } + + if (contain_space) { + (void)write_stderr("ERROR: There should not hava space between value and unit.\n"); return FAILURE; } - if (NULL != result_int) { - *result_int = (int64)tmp_double_val; + /* the unit of parameter from guc config file */ + double_unitval = get_guc_unit(guc_list_unit); + /* the unit of real parameter */ + new_double_unitval = get_guc_unit(endptr); + /* the transformation value */ + per_unit_transfer = g_unit_transform[double_unitval][new_double_unitval]; + + /* get_guc_unit */ + if (FAILURE == parse_value(paraname, double_unitval, new_double_unitval, endptr, &double_val)) { + return FAILURE; + } + + /* overflow processing */ + if (FAILURE == check_double_overflow(paraname, double_val, isinf(tmp_double_val) || + isinf((double)per_unit_transfer), tmp_double_val == 0 || (double)per_unit_transfer == 0)) { + return FAILURE; } - } else { - if (NULL != result_double) { - *result_double = tmp_double_val; - } } + if (NULL != result_double) { + *result_double = double_val; + } + return SUCCESS; } @@ -4214,3 +4248,136 @@ static char* GetEnvStr(const char* env) #ifdef __cplusplus } #endif /* __cplusplus */ + +/* + ************************************************************************************ + Function: parse_value + Desc : parese value from guc config file. + paraname parameter name + unitval the unit of parameter from guc config file + new_unitval the unit of parameter + endptr the address of parameter value + tmp_val the temporary value of parameter value + Return : SUCCESS + FAILURE + ************************************************************************************ +*/ +template +static int parse_value( + const char* paraname, const UnitType unitval, const UnitType new_unitval, const char* endptr, T* tmp_val) +{ + switch (unitval) { + case UNIT_ERROR: { + (void)write_stderr("ERROR: Invalid units for this parameter \"%s\".\n", paraname); + return FAILURE; + } + case UNIT_KB: { + if (new_unitval == UNIT_KB || new_unitval == UNIT_MB || new_unitval == UNIT_GB) { + endptr += 2; + *tmp_val *= g_unit_transform[UNIT_KB][new_unitval]; + } else { + (void)write_stderr( + "ERROR: Valid units for this parameter \"%s\" are \"kB\", \"MB\" and \"GB\".\n", paraname); + return FAILURE; + } + break; + } + case UNIT_MB: { + if (new_unitval == UNIT_MB || new_unitval == UNIT_GB) { + endptr += 2; + *tmp_val *= g_unit_transform[UNIT_MB][new_unitval]; + } else { + (void)write_stderr( + "ERROR: Valid units for this parameter \"%s\" are \"MB\" and \"GB\".\n", paraname); + return FAILURE; + } + break; + } + case UNIT_GB: { + if (new_unitval == UNIT_GB) { + endptr += 2; + } else { + (void)write_stderr("ERROR: Valid units for this parameter \"%s\" is \"GB\".\n", paraname); + return FAILURE; + } + break; + } + case UNIT_MS: { + if (new_unitval == UNIT_MS) { + endptr += 2; + } else if (new_unitval == UNIT_S || new_unitval == UNIT_H || new_unitval == UNIT_D) { + endptr += 1; + *tmp_val *= g_unit_transform[UNIT_MS][new_unitval]; + } else if (new_unitval == UNIT_MIN) { + endptr += 3; + *tmp_val *= g_unit_transform[UNIT_MS][new_unitval]; + } else { + (void)write_stderr( + "ERROR: Valid units for this parameter \"%s\" are \"ms\", \"s\", \"min\", \"h\", and \"d\".\n", + paraname); + return FAILURE; + } + break; + } + case UNIT_S: { + if (new_unitval == UNIT_S || new_unitval == UNIT_H || new_unitval == UNIT_D) { + endptr += 1; + *tmp_val *= g_unit_transform[UNIT_S][new_unitval]; + } else if (new_unitval == UNIT_MIN) { + endptr += 3; + *tmp_val *= g_unit_transform[UNIT_S][new_unitval]; + } else { + (void)write_stderr( + "ERROR: Valid units for this parameter \"%s\" are \"s\", \"min\", \"h\", and \"d\".\n", + paraname); + return FAILURE; + } + break; + } + case UNIT_MIN: { + if (new_unitval == UNIT_H || new_unitval == UNIT_D) { + endptr += 1; + *tmp_val *= g_unit_transform[UNIT_MIN][new_unitval]; + } else if (new_unitval == UNIT_MIN) { + endptr += 3; + } else { + (void)write_stderr( + "ERROR: Valid units for this parameter \"%s\" are \"min\", \"h\", and \"d\".\n", paraname); + return FAILURE; + } + break; + } + case UNIT_H:{ + if (new_unitval == UNIT_H || new_unitval == UNIT_D) { + endptr += 1; + *tmp_val *= g_unit_transform[UNIT_H][new_unitval]; + } else { + (void)write_stderr( + "ERROR: Valid units for this parameter \"%s\" are \"min\", \"h\", and \"d\".\n", paraname); + return FAILURE; + } + break; + } + case UNIT_D:{ + if (new_unitval == UNIT_D) { + endptr += 1; + } else { + (void)write_stderr("ERROR: Valid units for this parameter \"%s\" is \"d\".\n", paraname); + return FAILURE; + } + break; + } + default: { + return FAILURE; + } + } + + while (isspace((unsigned char)*endptr)) + endptr++; + + if (*endptr != '\0') { + return FAILURE; + } + + return SUCCESS; +} diff --git a/src/test/regress/input/gs_guc_value_range.source b/src/test/regress/input/gs_guc_value_range.source new file mode 100644 index 000000000..aeab68267 --- /dev/null +++ b/src/test/regress/input/gs_guc_value_range.source @@ -0,0 +1,27 @@ +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "autovacuum_freeze_max_age=8888" +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "autovacuum_freeze_max_age=8000000" +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "autovacuum_freeze_max_age=576460752303423488" + +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "bulk_write_ring_size=254789435kB" +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "bulk_write_ring_size=23546435kN" +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "bulk_write_ring_size=900MB" +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "bulk_write_ring_size=2791353MB" +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "bulk_write_ring_size=9007199254900000MB" +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "bulk_write_ring_size=87GB" +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "bulk_write_ring_size=8791GB" +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "bulk_write_ring_size=8796093022900GB" + +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "autovacuum_naptime=15372286s" +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "autovacuum_naptime=254mi" +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "autovacuum_naptime=153min" +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "autovacuum_naptime=254857min" +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "autovacuum_naptime=1537228672000000000min" +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "autovacuum_naptime=65h" +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "autovacuum_naptime=25645h" +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "autovacuum_naptime=2562047788015216h" +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "autovacuum_naptime=5d" +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "autovacuum_naptime=256d" +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "autovacuum_naptime=114841866167300d" + +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "bgwriter_lru_multiplier=6.6" +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "bgwriter_lru_multiplier=11.2" \ No newline at end of file diff --git a/src/test/regress/output/gs_guc_value_range.source b/src/test/regress/output/gs_guc_value_range.source new file mode 100644 index 000000000..4772af335 --- /dev/null +++ b/src/test/regress/output/gs_guc_value_range.source @@ -0,0 +1,127 @@ +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "autovacuum_freeze_max_age=8888" +ERROR: The value 8888 is outside the valid range for parameter "autovacuum_freeze_max_age" (100000 .. 576460752303423487). +ERROR: The value "8888" for parameter "autovacuum_freeze_max_age" is incorrect. +Try "gs_guc --help" for more information. +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "autovacuum_freeze_max_age=8000000" +expected instance path: [@abs_srcdir@/tmp_check/datanode1/postgresql.conf] +gs_guc set: autovacuum_freeze_max_age=8000000: [@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 "autovacuum_freeze_max_age=576460752303423488" +ERROR: The value 576460752303423488 is outside the valid range for parameter "autovacuum_freeze_max_age" (100000 .. 576460752303423487). +ERROR: The value "576460752303423488" for parameter "autovacuum_freeze_max_age" is incorrect. +Try "gs_guc --help" for more information. +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "bulk_write_ring_size=254789435kB" +expected instance path: [@abs_srcdir@/tmp_check/datanode1/postgresql.conf] +gs_guc set: bulk_write_ring_size=254789435kB: [@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 "bulk_write_ring_size=23546435kN" +ERROR: Valid units for this parameter "bulk_write_ring_size" are "kB", "MB" and "GB". +ERROR: The parameter "bulk_write_ring_size" requires an integer value. +ERROR: The value "23546435kN" for parameter "bulk_write_ring_size" is incorrect. +Try "gs_guc --help" for more information. +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "bulk_write_ring_size=900MB" +expected instance path: [@abs_srcdir@/tmp_check/datanode1/postgresql.conf] +gs_guc set: bulk_write_ring_size=900MB: [@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 "bulk_write_ring_size=2791353MB" +ERROR: The value 2858345472 is outside the valid range for parameter "bulk_write_ring_size" (16384 .. 2147483647). +ERROR: The value "2791353MB" for parameter "bulk_write_ring_size" is incorrect. +Try "gs_guc --help" for more information. +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "bulk_write_ring_size=9007199254900000MB" +ERROR: An overflow occurs for this parameter "bulk_write_ring_size". +ERROR: The parameter "bulk_write_ring_size" requires an integer value. +ERROR: The value "9007199254900000MB" for parameter "bulk_write_ring_size" is incorrect. +Try "gs_guc --help" for more information. +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "bulk_write_ring_size=87GB" +expected instance path: [@abs_srcdir@/tmp_check/datanode1/postgresql.conf] +gs_guc set: bulk_write_ring_size=87GB: [@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 "bulk_write_ring_size=8791GB" +ERROR: The value 9218031616 is outside the valid range for parameter "bulk_write_ring_size" (16384 .. 2147483647). +ERROR: The value "8791GB" for parameter "bulk_write_ring_size" is incorrect. +Try "gs_guc --help" for more information. +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "bulk_write_ring_size=8796093022900GB" +ERROR: An overflow occurs for this parameter "bulk_write_ring_size". +ERROR: The parameter "bulk_write_ring_size" requires an integer value. +ERROR: The value "8796093022900GB" for parameter "bulk_write_ring_size" is incorrect. +Try "gs_guc --help" for more information. +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "autovacuum_naptime=15372286s" +ERROR: The value 15372286 is outside the valid range for parameter "autovacuum_naptime" (1 .. 2147483). +ERROR: The value "15372286s" for parameter "autovacuum_naptime" is incorrect. +Try "gs_guc --help" for more information. +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "autovacuum_naptime=254mi" +ERROR: Valid units for this parameter "autovacuum_naptime" are "s", "min", "h", and "d". +ERROR: The parameter "autovacuum_naptime" requires an integer value. +ERROR: The value "254mi" for parameter "autovacuum_naptime" is incorrect. +Try "gs_guc --help" for more information. +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "autovacuum_naptime=153min" +expected instance path: [@abs_srcdir@/tmp_check/datanode1/postgresql.conf] +gs_guc set: autovacuum_naptime=153min: [@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 "autovacuum_naptime=254857min" +ERROR: The value 15291420 is outside the valid range for parameter "autovacuum_naptime" (1 .. 2147483). +ERROR: The value "254857min" for parameter "autovacuum_naptime" is incorrect. +Try "gs_guc --help" for more information. +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "autovacuum_naptime=1537228672000000000min" +ERROR: An overflow occurs for this parameter "autovacuum_naptime". +ERROR: The parameter "autovacuum_naptime" requires an integer value. +ERROR: The value "1537228672000000000min" for parameter "autovacuum_naptime" is incorrect. +Try "gs_guc --help" for more information. +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "autovacuum_naptime=65h" +expected instance path: [@abs_srcdir@/tmp_check/datanode1/postgresql.conf] +gs_guc set: autovacuum_naptime=65h: [@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 "autovacuum_naptime=25645h" +ERROR: The value 92322000 is outside the valid range for parameter "autovacuum_naptime" (1 .. 2147483). +ERROR: The value "25645h" for parameter "autovacuum_naptime" is incorrect. +Try "gs_guc --help" for more information. +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "autovacuum_naptime=2562047788015216h" +ERROR: An overflow occurs for this parameter "autovacuum_naptime". +ERROR: The parameter "autovacuum_naptime" requires an integer value. +ERROR: The value "2562047788015216h" for parameter "autovacuum_naptime" is incorrect. +Try "gs_guc --help" for more information. +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "autovacuum_naptime=5d" +expected instance path: [@abs_srcdir@/tmp_check/datanode1/postgresql.conf] +gs_guc set: autovacuum_naptime=5d: [@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 "autovacuum_naptime=256d" +ERROR: The value 22118400 is outside the valid range for parameter "autovacuum_naptime" (1 .. 2147483). +ERROR: The value "256d" for parameter "autovacuum_naptime" is incorrect. +Try "gs_guc --help" for more information. +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "autovacuum_naptime=114841866167300d" +ERROR: An overflow occurs for this parameter "autovacuum_naptime". +ERROR: The parameter "autovacuum_naptime" requires an integer value. +ERROR: The value "114841866167300d" for parameter "autovacuum_naptime" is incorrect. +Try "gs_guc --help" for more information. +\! @abs_bindir@/gs_guc set -D @abs_srcdir@/tmp_check/datanode1/ -c "bgwriter_lru_multiplier=6.6" +expected instance path: [@abs_srcdir@/tmp_check/datanode1/postgresql.conf] +gs_guc set: bgwriter_lru_multiplier=6.6: [@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 "bgwriter_lru_multiplier=11.2" +ERROR: The value 11.2 is outside the valid range for parameter "bgwriter_lru_multiplier" (0 .. 10). +ERROR: The value "11.2" for parameter "bgwriter_lru_multiplier" is incorrect. +Try "gs_guc --help" for more information. \ No newline at end of file diff --git a/src/test/regress/parallel_schedule10 b/src/test/regress/parallel_schedule10 index d6134c3a2..dd1d218ce 100644 --- a/src/test/regress/parallel_schedule10 +++ b/src/test/regress/parallel_schedule10 @@ -82,4 +82,5 @@ test: initdb test: explain_gather test: gs_guc_show_error test: line_operator -test: synchronous_commit_test \ No newline at end of file +test: synchronous_commit_test +test: gs_guc_value_range