diff --git a/src/bin/gs_guc/pg_guc.cpp b/src/bin/gs_guc/pg_guc.cpp index 4bc1a2bb..3eba29f2 100644 --- a/src/bin/gs_guc/pg_guc.cpp +++ b/src/bin/gs_guc/pg_guc.cpp @@ -172,7 +172,7 @@ const int EQUAL_MARK_LEN = 3; #define ADDPOINTER_SIZE 2 #define MAX_HOST_NAME_LENGTH 255 -#define TEMP_PGCONF_FILE "postgresql.conf.bak" +#define TEMP_PGCONF_FILE "postgresql.conf.guc.bak" #define TEMP_CMAGENTCONF_FILE "cm_agent.conf.bak" #define TEMP_CMSERVERCONF_FILE "cm_server.conf.bak" #define TEMP_GTMCONF_FILE "gtm.conf.bak" diff --git a/src/common/backend/utils/misc/guc.cpp b/src/common/backend/utils/misc/guc.cpp index 483be1d5..129aeeaf 100644 --- a/src/common/backend/utils/misc/guc.cpp +++ b/src/common/backend/utils/misc/guc.cpp @@ -4037,7 +4037,7 @@ static void InitConfigureNamesInt() gettext_noop("Sets the maximum threshold for cleaning cache."), NULL, GUC_UNIT_KB}, - &g_instance.attr.attr_memory.local_syscache_threshold, + &u_sess->attr.attr_memory.local_syscache_threshold, 256 * 1024, 1 * 1024, 512 * 1024, @@ -16158,11 +16158,11 @@ static bool check_gpc_syscache_threshold(bool* newval, void** extra, GucSource s if (*newval) { /* in case local_syscache_threshold is too low cause gpc does not take effect, we set local_syscache_threshold at least 16MB if gpc is on. */ - if (g_instance.attr.attr_memory.local_syscache_threshold < 16 * 1024) { + if (u_sess->attr.attr_memory.local_syscache_threshold < 16 * 1024) { ereport(WARNING, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("set local_syscache_threshold from %dMB to 16MB in case gpc is on but not valid.", - g_instance.attr.attr_memory.local_syscache_threshold / 1024))); - g_instance.attr.attr_memory.local_syscache_threshold = 16 * 1024; + u_sess->attr.attr_memory.local_syscache_threshold / 1024))); + u_sess->attr.attr_memory.local_syscache_threshold = 16 * 1024; } } return true; @@ -16176,7 +16176,7 @@ static bool check_syscache_threshold_gpc(int* newval, void** extra, GucSource so ereport(WARNING, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("cannot set local_syscache_threshold to %dMB in case gpc is on but not valid." "Set local_syscache_threshold to 16MB default.", *newval / 1024))); - g_instance.attr.attr_memory.local_syscache_threshold = 16 * 1024; + u_sess->attr.attr_memory.local_syscache_threshold = 16 * 1024; } return true; diff --git a/src/gausskernel/process/postmaster/postmaster.cpp b/src/gausskernel/process/postmaster/postmaster.cpp index ea2c611f..b7419c48 100755 --- a/src/gausskernel/process/postmaster/postmaster.cpp +++ b/src/gausskernel/process/postmaster/postmaster.cpp @@ -9563,12 +9563,12 @@ void CleanSystemCaches(bool is_in_read_command) usedSize = ((AllocSet)u_sess->cache_mem_cxt)->totalSpace - ((AllocSet)u_sess->cache_mem_cxt)->freeSpace; /* Over threshold, need to clean cache. */ - if (usedSize > g_instance.attr.attr_memory.local_syscache_threshold*1024) { + if (usedSize > u_sess->attr.attr_memory.local_syscache_threshold*1024) { ereport(DEBUG1, (errmsg("CleanSystemCaches due to " "SystemCache(%ld) greater than (%d),in_read_command(%d).", usedSize, - g_instance.attr.attr_memory.local_syscache_threshold*1024, + u_sess->attr.attr_memory.local_syscache_threshold*1024, (is_in_read_command ? 1 : 0)))); if (IsTransactionOrTransactionBlock() || !is_in_read_command) { diff --git a/src/gausskernel/storage/replication/walreceiver.cpp b/src/gausskernel/storage/replication/walreceiver.cpp index 2af32113..5efb9d1c 100644 --- a/src/gausskernel/storage/replication/walreceiver.cpp +++ b/src/gausskernel/storage/replication/walreceiver.cpp @@ -81,7 +81,7 @@ bool wal_catchup = false; #define NAPTIME_PER_CYCLE 1 /* max sleep time between cycles (1ms) */ -#define CONFIG_BAK_FILENAME "postgresql.conf.bak" +#define CONFIG_BAK_FILENAME_WAL "postgresql.conf.wal" #define WAL_DATA_LEN ((sizeof(uint32) + 1 + sizeof(XLogRecPtr))) @@ -2550,7 +2550,7 @@ static bool ProcessConfigFileMessage(char *buf, Size len) int ret = 0; char **reserve_item = NULL; - ret = snprintf_s(conf_bak, MAXPGPATH, MAXPGPATH - 1, "%s/%s", t_thrd.proc_cxt.DataDir, CONFIG_BAK_FILENAME); + ret = snprintf_s(conf_bak, MAXPGPATH, MAXPGPATH - 1, "%s/%s", t_thrd.proc_cxt.DataDir, CONFIG_BAK_FILENAME_WAL); securec_check_ss(ret, "\0", "\0"); if (lstat(t_thrd.walreceiver_cxt.gucconf_file, &statbuf) != 0) { diff --git a/src/include/knl/knl_guc/knl_instance_attr_memory.h b/src/include/knl/knl_guc/knl_instance_attr_memory.h index d262925f..e0398b82 100644 --- a/src/include/knl/knl_guc/knl_instance_attr_memory.h +++ b/src/include/knl/knl_guc/knl_instance_attr_memory.h @@ -45,7 +45,6 @@ typedef struct knl_instance_attr_memory { bool enable_memory_limit; int memorypool_size; int max_process_memory; - int local_syscache_threshold; } knl_instance_attr_memory; #endif /* SRC_INCLUDE_KNL_KNL_INSTANCE_ATTR_MEMORY_H_ */ diff --git a/src/include/knl/knl_guc/knl_session_attr_memory.h b/src/include/knl/knl_guc/knl_session_attr_memory.h index 59984eba..a712483d 100644 --- a/src/include/knl/knl_guc/knl_session_attr_memory.h +++ b/src/include/knl/knl_guc/knl_session_attr_memory.h @@ -51,6 +51,7 @@ typedef struct knl_session_attr_memory { char* uncontrolled_memory_context; int memory_tracking_mode; int min_dynamic_memory; + int local_syscache_threshold; } knl_session_attr_memory; #endif /* SRC_INCLUDE_KNL_KNL_SESSION_ATTR_MEMORY_H_ */