From 851005edf05c631e05ea2d5507cb34a4567521d5 Mon Sep 17 00:00:00 2001 From: zhenjinyang Date: Thu, 21 Mar 2024 17:12:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=86=85=E5=AD=98=E4=B8=8D?= =?UTF-8?q?=E8=B6=B3=E4=BA=A7=E7=94=9Fcore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/backend/utils/mmgr/memprot.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/common/backend/utils/mmgr/memprot.cpp b/src/common/backend/utils/mmgr/memprot.cpp index 8046db5069..731ce37ef0 100755 --- a/src/common/backend/utils/mmgr/memprot.cpp +++ b/src/common/backend/utils/mmgr/memprot.cpp @@ -504,19 +504,21 @@ void gs_memprot_failed(int64 sz, MemType type) /* request 50 chunks (> 50M) for processing error */ t_thrd.utils_cxt.beyondChunk += 50; + uint64 debug_query_id = (u_sess == NULL) ? 0 : u_sess->debug_query_id; + if (flag) { if (type == MEM_THRD) write_stderr( "----debug_query_id=%lu, memory allocation failed due to reaching the database memory limitation." " Current thread is consuming about %u MB, allocating %ld bytes.\n", - u_sess->debug_query_id, + debug_query_id, (uint32)t_thrd.utils_cxt.trackedMemChunks << (chunkSizeInBits - BITS_IN_MB), sz); else write_stderr( "----debug_query_id=%lu, memory allocation failed due to reaching the database memory limitation." " Current session is consuming about %u MB, allocating %ld bytes.\n", - u_sess->debug_query_id, + debug_query_id, (uint32)u_sess->stat_cxt.trackedMemChunks << (chunkSizeInBits - BITS_IN_MB), sz); } else { @@ -524,19 +526,19 @@ void gs_memprot_failed(int64 sz, MemType type) write_stderr( "----debug_query_id=%lu, FATAL: memory allocation failed due to reaching the OS memory limitation." " Current thread is consuming about %u MB, allocating %ld bytes.\n", - u_sess->debug_query_id, + debug_query_id, (uint32)t_thrd.utils_cxt.trackedMemChunks << (chunkSizeInBits - BITS_IN_MB), sz); else write_stderr( "----debug_query_id=%lu, FATAL: memory allocation failed due to reaching the OS memory limitation." " Current session is consuming about %u MB, allocating %ld bytes.\n", - u_sess->debug_query_id, + debug_query_id, (uint32)u_sess->stat_cxt.trackedMemChunks << (chunkSizeInBits - BITS_IN_MB), sz); write_stderr("----debug_query_id=%lu, Please check the sysctl configuration and GUC variable " "g_instance.attr.attr_memory.max_process_memory.\n", - u_sess->debug_query_id); + debug_query_id); } } -- Gitee