forked from huawei/openGauss-server
!1681 修改gs_guc reload内存越界产生core
Merge pull request !1681 from mujinqiang/guc
This commit is contained in:
commit
91b3e149f9
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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_ */
|
||||
|
|
|
|||
|
|
@ -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_ */
|
||||
|
|
|
|||
Loading…
Reference in New Issue