diff --git a/src/gausskernel/process/postmaster/postmaster.cpp b/src/gausskernel/process/postmaster/postmaster.cpp index d0842f5be..8380d4b99 100644 --- a/src/gausskernel/process/postmaster/postmaster.cpp +++ b/src/gausskernel/process/postmaster/postmaster.cpp @@ -450,7 +450,8 @@ bool PMstateIsRun(void); #define BACKEND_TYPE_TEMPBACKEND \ 0x0010 /* temp thread processing cancel signal \ or stream connection */ -#define BACKEND_TYPE_ALL 0x001F /* OR of all the above */ +#define BACKEND_TYPE_CMAGENT 0x0020 /* cmagent process*/ +#define BACKEND_TYPE_ALL 0x002F /* OR of all the above */ #define GTM_LITE_CN (GTM_LITE_MODE && IS_PGXC_COORDINATOR) @@ -10389,6 +10390,8 @@ static int CountChildren(int target) child = BACKEND_TYPE_WALSND; else if (IsPostmasterChildDataSender(bp->child_slot)) child = BACKEND_TYPE_DATASND; + else if (ENABLE_DMS && (bp->backend_type & BACKEND_TYPE_CMAGENT)) + child = BACKEND_TYPE_CMAGENT; else child = BACKEND_TYPE_NORMAL; @@ -11484,6 +11487,7 @@ Backend* AssignFreeBackEnd(int slot) bn->role = t_thrd.role; bn->cancel_key = 0; bn->dead_end = false; + bn->backend_type = 0; return bn; } diff --git a/src/gausskernel/storage/lmgr/proc.cpp b/src/gausskernel/storage/lmgr/proc.cpp index 1016016a0..8247a230a 100755 --- a/src/gausskernel/storage/lmgr/proc.cpp +++ b/src/gausskernel/storage/lmgr/proc.cpp @@ -81,6 +81,7 @@ #endif /* ENABLE_MULTIPLE_NODES */ #define MAX_NUMA_NODE 16 +#define BACKEND_TYPE_CMAGENT 0x0020 extern THR_LOCAL uint32 *g_workingVersionNum; @@ -973,6 +974,7 @@ void InitProcess(void) * g_instance.proc_base->cmAgentFreeProcs if proc_ext happend. */ if (u_sess->libpq_cxt.IsConnFromCmAgent) { + t_thrd.bn->backend_type = BACKEND_TYPE_CMAGENT; CheckCMAReservedProc(); } diff --git a/src/include/threadpool/threadpool_worker.h b/src/include/threadpool/threadpool_worker.h index 0a6564bb7..f2ca99158 100644 --- a/src/include/threadpool/threadpool_worker.h +++ b/src/include/threadpool/threadpool_worker.h @@ -55,6 +55,7 @@ typedef struct Backend { bool is_autovacuum; /* is it an autovacuum process? */ volatile bool dead_end; /* is it going to send an quit? */ volatile int flag; + int backend_type; Dlelem elem; /* list link in BackendList */ } Backend;