support min_dynamic_memory in gs_guc

This commit is contained in:
yanghao 2021-09-06 11:32:34 +08:00
parent d1c210cdc0
commit 1b3a1e41a4
5 changed files with 5 additions and 4 deletions

View File

@ -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|

View File

@ -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,

View File

@ -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;
}

View File

@ -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;

View File

@ -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_ */