diff --git a/src/bin/gs_guc/cluster_guc.conf b/src/bin/gs_guc/cluster_guc.conf index 4105a2d0b..0a249d265 100755 --- a/src/bin/gs_guc/cluster_guc.conf +++ b/src/bin/gs_guc/cluster_guc.conf @@ -401,6 +401,7 @@ memorypool_enable|bool|0,0|NULL|NULL| memorypool_size|int|131072,1073741823|kB|NULL| memory_detail_tracking|string|0,0|NULL|This parameter memory_detail_tracking only can be used in debug version. If it is set in the release version, it will lead the cluster does not work properly. Therefore, before making the settings, please make sure that the cluster version is debug.| memory_tracking_mode|enum|none,normal,executor,fullexec|NULL|NULL| +min_dynamic_memory|int|-1,2147483647|NULL|NULL| minimum_pool_size|int|1,65535|NULL|NULL| modify_initial_password|bool|0,0|NULL|NULL| most_available_sync|bool|0,0|NULL|NULL| diff --git a/src/common/backend/utils/misc/guc.cpp b/src/common/backend/utils/misc/guc.cpp index 19bd5701a..cefe68296 100644 --- a/src/common/backend/utils/misc/guc.cpp +++ b/src/common/backend/utils/misc/guc.cpp @@ -4018,7 +4018,7 @@ static void InitConfigureNamesInt() gettext_noop("Sets the min number of dynamic memory hold by the process."), NULL, GUC_UNIT_KB}, - &g_instance.attr.attr_memory.min_dynamic_memory, + &u_sess->attr.attr_memory.min_dynamic_memory, -1, -1, INT_MAX, diff --git a/src/common/backend/utils/mmgr/memprot.cpp b/src/common/backend/utils/mmgr/memprot.cpp index 8f8363da3..6346839cc 100644 --- a/src/common/backend/utils/mmgr/memprot.cpp +++ b/src/common/backend/utils/mmgr/memprot.cpp @@ -602,7 +602,7 @@ static bool memTracker_ReserveMemChunks(int32 numChunksToReserve, bool needProte /* Query memory quota is exhausted. Reset the counter then return false. */ if (MemoryIsNotEnough(total, *maxSize, needProtect)) { gs_atomic_add_32(currSize, -numChunksToReserve); - if (g_instance.attr.attr_memory.min_dynamic_memory >= 0) { + if (u_sess && u_sess->attr.attr_memory.min_dynamic_memory >= 0) { int current = pg_atomic_add_fetch_u32(&g_instance.exec_cxt.oomTimes, 1); if (current == 1) { g_instance.exec_cxt.firstTime = GetCurrentTimestamp(); @@ -610,7 +610,7 @@ static bool memTracker_ReserveMemChunks(int32 numChunksToReserve, bool needProte if (current == OOM_TIME_THRESHOLD) { if (!TimestampDifferenceExceeds(g_instance.exec_cxt.firstTime, GetCurrentTimestamp(), OOM_TIME_INTERVAL_MSEC)) { - CleanConnectionByMemory(g_instance.attr.attr_memory.min_dynamic_memory); + CleanConnectionByMemory(u_sess->attr.attr_memory.min_dynamic_memory); } g_instance.exec_cxt.oomTimes = 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 b23075b36..d262925f2 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 min_dynamic_memory; int local_syscache_threshold; } knl_instance_attr_memory; 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 663f83e66..59984ebad 100644 --- a/src/include/knl/knl_guc/knl_session_attr_memory.h +++ b/src/include/knl/knl_guc/knl_session_attr_memory.h @@ -50,6 +50,7 @@ typedef struct knl_session_attr_memory { char* memory_detail_tracking; char* uncontrolled_memory_context; int memory_tracking_mode; + int min_dynamic_memory; } knl_session_attr_memory; #endif /* SRC_INCLUDE_KNL_KNL_SESSION_ATTR_MEMORY_H_ */