forked from huawei/openGauss-server
Change unique_sql_clean_ratio to SIGHUP level.
This commit is contained in:
parent
942963ce99
commit
7f68b9106d
|
|
@ -661,6 +661,7 @@ sync_config_strategy|enum|all_node,only_sync_node,none_node|NULL|Synchronization
|
|||
time_to_target_rpo|int|0,3600|NULL|NULL|
|
||||
disable_memory_protect|bool|0,0|NULL|NULL|
|
||||
unique_sql_clean_ratio|real|0,0.2|NULL|NULL|
|
||||
enable_auto_clean_unique_sql|bool|0,0|NULL|NULL|
|
||||
[cmserver]
|
||||
log_dir|string|0,0|NULL|NULL|
|
||||
log_file_size|int|0,2047|MB|NULL|
|
||||
|
|
|
|||
|
|
@ -1778,7 +1778,6 @@ char* get_AZ_value(const char* value, const char* data_dir)
|
|||
char delims[] = ",";
|
||||
char* vptr = NULL;
|
||||
char emptyvalue[] = "''";
|
||||
int resultStatus = 0;
|
||||
bool isNodeName = false;
|
||||
|
||||
if (az1 != NULL) {
|
||||
|
|
|
|||
|
|
@ -174,6 +174,8 @@
|
|||
#define CONFIG_EXEC_PARAMS_NEW "global/config_exec_params.new"
|
||||
#endif
|
||||
|
||||
#define DEFAULT_CLEAN_RATIO 0.1
|
||||
|
||||
/* upper limit for GUC variables measured in kilobytes of memory */
|
||||
/* note that various places assume the byte size fits in a "long" variable */
|
||||
#if SIZEOF_SIZE_T > 4 && SIZEOF_LONG > 4
|
||||
|
|
@ -548,6 +550,10 @@ static bool logging_module_check(char** newval, void** extra, GucSource source);
|
|||
static void logging_module_guc_assign(const char* newval, void* extra);
|
||||
static void plog_merge_age_assign(int newval, void* extra);
|
||||
|
||||
#ifndef ENABLE_MULTIPLE_NODES
|
||||
static bool CheckUniqueSqlCleanRatio(double* newval, void** extra, GucSource source);
|
||||
#endif
|
||||
|
||||
/* Inplace Upgrade GUC hooks */
|
||||
static bool check_is_upgrade(bool* newval, void** extra, GucSource source);
|
||||
static void assign_is_inplace_upgrade(const bool newval, void* extra);
|
||||
|
|
@ -3278,6 +3284,17 @@ static void InitConfigureNamesBool()
|
|||
NULL,
|
||||
NULL,
|
||||
NULL},
|
||||
|
||||
{{"enable_auto_clean_unique_sql",
|
||||
PGC_POSTMASTER,
|
||||
INSTRUMENTS_OPTIONS,
|
||||
gettext_noop("Enable auto clean unique sql entry when the UniquesQl hash table is full."),
|
||||
NULL},
|
||||
&g_instance.attr.attr_common.enable_auto_clean_unique_sql,
|
||||
false,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL},
|
||||
#endif
|
||||
|
||||
{{"enable_partition_opfusion", PGC_USERSET, QUERY_TUNING_METHOD,
|
||||
|
|
@ -6936,17 +6953,17 @@ static void InitConfigureNamesReal()
|
|||
{
|
||||
#ifndef ENABLE_MULTIPLE_NODES
|
||||
{{"unique_sql_clean_ratio",
|
||||
PGC_POSTMASTER,
|
||||
PGC_SIGHUP,
|
||||
INSTRUMENTS_OPTIONS,
|
||||
gettext_noop("The percentage of the UniquesQl hash table that will be "
|
||||
"automatically eliminated when the UniquesQl hash table "
|
||||
"is full. 0 means that auto-eliminate is not enabled."),
|
||||
"is full."),
|
||||
NULL},
|
||||
&g_instance.attr.attr_common.unique_sql_clean_ratio,
|
||||
0,
|
||||
&u_sess->attr.attr_common.unique_sql_clean_ratio,
|
||||
DEFAULT_CLEAN_RATIO,
|
||||
0,
|
||||
0.2,
|
||||
NULL,
|
||||
CheckUniqueSqlCleanRatio,
|
||||
NULL,
|
||||
NULL},
|
||||
#endif
|
||||
|
|
@ -19154,6 +19171,21 @@ static void plog_merge_age_assign(int newval, void* extra)
|
|||
t_thrd.log_cxt.plog_msg_switch_tm.tv_usec = (newval - MS_PER_S * t_thrd.log_cxt.plog_msg_switch_tm.tv_sec) * 1000;
|
||||
}
|
||||
|
||||
#ifndef ENABLE_MULTIPLE_NODES
|
||||
static bool CheckUniqueSqlCleanRatio(double* newval, void** extra, GucSource source)
|
||||
{
|
||||
if (g_instance.attr.attr_common.enable_auto_clean_unique_sql && *newval == 0) {
|
||||
ereport(WARNING,
|
||||
(errmsg("Can't set unique_sql_clean_ratio to 0 when enable_auto_clean_unique_sql is true. "
|
||||
"Reset it's value to default(%lf). If you want to disable auto clean unique sql, "
|
||||
"please set enable_auto_clean_unique_sql to false.",
|
||||
DEFAULT_CLEAN_RATIO)));
|
||||
*newval = DEFAULT_CLEAN_RATIO;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/* GUC hooks for inplace/grey upgrade */
|
||||
/* ------------------------------------------------------------ */
|
||||
|
|
|
|||
|
|
@ -679,7 +679,7 @@ void UpdateUniqueSQLStat(Query* query, const char* sql, int64 elapse_start_time,
|
|||
/* control unique sql number by instr_unique_sql_count. */
|
||||
long totalCount = hash_get_num_entries(g_instance.stat_cxt.UniqueSQLHashtbl);
|
||||
if (totalCount >= u_sess->attr.attr_common.instr_unique_sql_count) {
|
||||
if (g_instance.attr.attr_common.unique_sql_clean_ratio != 0) {
|
||||
if (g_instance.attr.attr_common.enable_auto_clean_unique_sql) {
|
||||
if (!AutoRecycleUniqueSQLEntry()) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -1809,7 +1809,7 @@ static void SetLocalUniqueSQLId(List* query_list)
|
|||
/* store the normalized uniquesq text into u_sess->Unique_sql_cxt in stage B
|
||||
* or E of PBE, only if auto-cleanup is enabled
|
||||
*/
|
||||
if (g_instance.attr.attr_common.unique_sql_clean_ratio != 0) {
|
||||
if (g_instance.attr.attr_common.enable_auto_clean_unique_sql) {
|
||||
u_sess->unique_sql_cxt.unique_sql_text = query->unique_sql_text;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -2497,7 +2497,7 @@ static bool AutoRecycleUniqueSQLEntry()
|
|||
(errmodule(MOD_INSTR), errcode(ERRCODE_LOG), errmsg("[UniqueSQL] instr_unique_sql_count is too large, uniquesql auto-clean will not happen.")));
|
||||
return false;
|
||||
}
|
||||
double ratio = g_instance.attr.attr_common.unique_sql_clean_ratio;
|
||||
double ratio = u_sess->attr.attr_common.unique_sql_clean_ratio;
|
||||
int cleanCount = Max(int(ratio * instr_unique_sql_count + totalCount - instr_unique_sql_count), 1);
|
||||
/* get remove entry list */
|
||||
KeyUpdatedtime* removeList = GetSortedEntryList();
|
||||
|
|
|
|||
|
|
@ -3373,7 +3373,7 @@ static void exec_parse_message(const char* query_string, /* string to execute */
|
|||
|
||||
#ifndef ENABLE_MULTIPLE_NODES
|
||||
/* store normalized uniquesQl text into Query in P phase of PBE, only if auto-cleanup is enabled */
|
||||
if (is_unique_sql_enabled() && g_instance.attr.attr_common.unique_sql_clean_ratio != 0) {
|
||||
if (is_unique_sql_enabled() && g_instance.attr.attr_common.enable_auto_clean_unique_sql) {
|
||||
query->unique_sql_text = FindCurrentUniqueSQL();
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ typedef struct knl_instance_attr_common {
|
|||
#endif
|
||||
#ifndef ENABLE_MULTIPLE_NODES
|
||||
int sync_config_strategy;
|
||||
double unique_sql_clean_ratio;
|
||||
bool enable_auto_clean_unique_sql;
|
||||
#endif
|
||||
} knl_instance_attr_common;
|
||||
|
||||
|
|
|
|||
|
|
@ -172,6 +172,9 @@ typedef struct knl_session_attr_common {
|
|||
|
||||
/* instrumentation guc parameters */
|
||||
int instr_unique_sql_count;
|
||||
#ifndef ENABLE_MULTIPLE_NODES
|
||||
double unique_sql_clean_ratio;
|
||||
#endif
|
||||
bool enable_instr_cpu_timer;
|
||||
int unique_sql_track_type;
|
||||
bool enable_instr_track_wait;
|
||||
|
|
|
|||
Loading…
Reference in New Issue