From aae2368e9b6532bbde0152ecb8aa7edab13a4ca4 Mon Sep 17 00:00:00 2001 From: muyulinzhong Date: Mon, 18 Nov 2024 19:35:34 +0800 Subject: [PATCH] =?UTF-8?q?[Ehance]=E4=BF=AE=E6=94=B9CMA=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E7=9A=84=E9=83=A8=E5=88=86=E4=BB=A3=E7=A0=81=EF=BC=8C=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0ASSERT=E6=96=AD=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/gausskernel/storage/lmgr/proc.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/gausskernel/storage/lmgr/proc.cpp b/src/gausskernel/storage/lmgr/proc.cpp index 7e3929716..ad0db782b 100755 --- a/src/gausskernel/storage/lmgr/proc.cpp +++ b/src/gausskernel/storage/lmgr/proc.cpp @@ -544,7 +544,9 @@ void PgStatCMAThreadStatus() { StringInfoData callStack; initStringInfo(&callStack); - for (int i = 0; i < NUM_CMAGENT_PROCS; i++) { + /* Get the total number of CMA procs. */ + int allCMProcNum = pg_atomic_read_u32(&g_instance.conn_cxt.CurCMAProcCount); + for (int i = 0; i < allCMProcNum; i++) { ThreadId pid = g_instance.proc_base->cmAgentAllProcs[i]->pid; if (pid != 0) { resetStringInfo(&callStack); @@ -554,6 +556,8 @@ void PgStatCMAThreadStatus() pid, callStack.data))); } } + /* It is abnormal that CM Agent proc List is full. */ + Assert(allCMProcNum < NUM_CMAGENT_PROCS); FreeStringInfo(&callStack); } @@ -796,6 +800,8 @@ void InitProcess(void) int rc = sprintf_s(cmaConnNumInfo, CONNINFOLEN, "All CMA proc [%d], uses[%d];", NUM_CMAGENT_PROCS, g_instance.conn_cxt.CurCMAProcCount); securec_check_ss(rc, "\0", "\0"); + /* It is abnormal that CM Agent proc List is full. */ + Assert(g_instance.conn_cxt.CurCMAProcCount < NUM_CMAGENT_PROCS); } ereport(FATAL,