From c87ee615f6326b9c39a7c487af1b944d78bcd79f Mon Sep 17 00:00:00 2001 From: yanghao Date: Sat, 27 Mar 2021 16:38:08 +0800 Subject: [PATCH] fix problem that CleanSystemCaches not correct --- src/gausskernel/process/postmaster/postmaster.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gausskernel/process/postmaster/postmaster.cpp b/src/gausskernel/process/postmaster/postmaster.cpp index 66c9a8433..488050520 100755 --- a/src/gausskernel/process/postmaster/postmaster.cpp +++ b/src/gausskernel/process/postmaster/postmaster.cpp @@ -9510,16 +9510,16 @@ void check_backend_env(const char* input_env_value) void CleanSystemCaches(bool is_in_read_command) { - int64 totalsize = 0; + int64 usedSize = 0; - totalsize = ((AllocSet)u_sess->cache_mem_cxt)->totalSpace; + usedSize = ((AllocSet)u_sess->cache_mem_cxt)->totalSpace - ((AllocSet)u_sess->cache_mem_cxt)->freeSpace; /* Over threshold, need to clean cache. */ - if (totalsize > g_instance.attr.attr_memory.local_syscache_threshold*1024) { + if (usedSize > g_instance.attr.attr_memory.local_syscache_threshold*1024) { ereport(DEBUG1, (errmsg("CleanSystemCaches due to " "SystemCache(%ld) greater than (%d),in_read_command(%d).", - totalsize, + usedSize, g_instance.attr.attr_memory.local_syscache_threshold*1024, (is_in_read_command ? 1 : 0))));