distinguish cmagent backend from noraml backend for dms

This commit is contained in:
dongning12
2023-03-22 20:15:16 +08:00
parent 490edec3ee
commit 4c93dd91f0
3 changed files with 8 additions and 1 deletions

View File

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

View File

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

View File

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