refactor: enable multi-process mode

This commit is contained in:
Shengliang Guan 2022-05-16 09:40:13 +08:00
parent 234325736c
commit 893fb646d5
3 changed files with 5 additions and 5 deletions

View File

@ -34,7 +34,7 @@ typedef struct SMgmtWrapper SMgmtWrapper;
#define OnlyInSingleProc(ptype) (ptype == SINGLE_PROC) #define OnlyInSingleProc(ptype) (ptype == SINGLE_PROC)
#define OnlyInChildProc(ptype) (ptype == CHILD_PROC) #define OnlyInChildProc(ptype) (ptype == CHILD_PROC)
#define OnlyInParentProc(ptype) (ptype == PARENT_PROC) #define OnlyInParentProc(ptype) (ptype == PARENT_PROC)
#define OnlyInTestProc(ptype) (ptype & TEST_PROC) #define OnlyInTestProc(ptype) (ptype == TEST_PROC)
#define InChildProc(ptype) (ptype & CHILD_PROC) #define InChildProc(ptype) (ptype & CHILD_PROC)
#define InParentProc(ptype) (ptype & PARENT_PROC) #define InParentProc(ptype) (ptype & PARENT_PROC)
@ -60,7 +60,7 @@ typedef struct {
TdThread cthread; TdThread cthread;
SShm shm; SShm shm;
int32_t pid; int32_t pid;
int8_t ptype; EDndProcType ptype;
bool stop; bool stop;
} SProc; } SProc;
@ -110,7 +110,7 @@ typedef struct SUdfdData {
} SUdfdData; } SUdfdData;
typedef struct SDnode { typedef struct SDnode {
int8_t ptype; EDndProcType ptype;
EDndNodeType rtype; EDndNodeType rtype;
EDndEvent event; EDndEvent event;
EDndRunStatus status; EDndRunStatus status;

View File

@ -267,7 +267,7 @@ int32_t dmMarkWrapper(SMgmtWrapper *pWrapper) {
int32_t code = 0; int32_t code = 0;
taosRLockLatch(&pWrapper->latch); taosRLockLatch(&pWrapper->latch);
if (pWrapper->deployed /* || (OnlyInParentProc(pWrapper->proc.ptype) && pWrapper->required) */) { if (pWrapper->deployed || (InParentProc(pWrapper->proc.ptype) && pWrapper->required)) {
int32_t refCount = atomic_add_fetch_32(&pWrapper->refCount, 1); int32_t refCount = atomic_add_fetch_32(&pWrapper->refCount, 1);
dTrace("node:%s, is marked, ref:%d", pWrapper->name, refCount); dTrace("node:%s, is marked, ref:%d", pWrapper->name, refCount);
} else { } else {

View File

@ -96,7 +96,7 @@ int32_t dmOpenNode(SMgmtWrapper *pWrapper) {
return -1; return -1;
} }
if (!OnlyInTestProc(pWrapper->proc.ptype)) { if (OnlyInParentProc(pWrapper->proc.ptype)) {
if (dmInitProc(pWrapper) != 0) { if (dmInitProc(pWrapper) != 0) {
dError("node:%s, failed to init proc since %s", pWrapper->name, terrstr()); dError("node:%s, failed to init proc since %s", pWrapper->name, terrstr());
return -1; return -1;