This commit is contained in:
Shengliang Guan 2022-03-15 11:34:42 +08:00
parent 33fe9fa25e
commit bd660a5b2d
5 changed files with 10 additions and 9 deletions

View File

@ -56,7 +56,7 @@ extern "C" {
#define dDebug(...) { if (dDebugFlag & DEBUG_DEBUG) { taosPrintLog("DND ", DEBUG_DEBUG, dDebugFlag, __VA_ARGS__); }} #define dDebug(...) { if (dDebugFlag & DEBUG_DEBUG) { taosPrintLog("DND ", DEBUG_DEBUG, dDebugFlag, __VA_ARGS__); }}
#define dTrace(...) { if (dDebugFlag & DEBUG_TRACE) { taosPrintLog("DND ", DEBUG_TRACE, dDebugFlag, __VA_ARGS__); }} #define dTrace(...) { if (dDebugFlag & DEBUG_TRACE) { taosPrintLog("DND ", DEBUG_TRACE, dDebugFlag, __VA_ARGS__); }}
typedef enum { DNODE, MNODE, NODE_MAX, VNODES, QNODE, SNODE, BNODE } ENodeType; typedef enum { MNODE, VNODES, QNODE, SNODE, BNODE, DNODE, NODE_MAX } ENodeType;
typedef enum { PROC_SINGLE, PROC_CHILD, PROC_PARENT } EProcType; typedef enum { PROC_SINGLE, PROC_CHILD, PROC_PARENT } EProcType;
typedef enum { DND_STAT_INIT, DND_STAT_RUNNING, DND_STAT_STOPPED } EDndStatus; typedef enum { DND_STAT_INIT, DND_STAT_RUNNING, DND_STAT_STOPPED } EDndStatus;
typedef enum { DND_WORKER_SINGLE, DND_WORKER_MULTI } EWorkerType; typedef enum { DND_WORKER_SINGLE, DND_WORKER_MULTI } EWorkerType;

View File

@ -36,9 +36,9 @@ static void dndResetLog(SMgmtWrapper *pMgmt) {
static bool dndRequireNode(SMgmtWrapper *pMgmt) { static bool dndRequireNode(SMgmtWrapper *pMgmt) {
bool required = (*pMgmt->fp.requiredFp)(pMgmt); bool required = (*pMgmt->fp.requiredFp)(pMgmt);
if (!required) { if (!required) {
dDebug("node:%s, no need to start on this dnode", pMgmt->name); dDebug("node:%s, no need to start", pMgmt->name);
} else { } else {
dDebug("node:%s, need to start on this dnode", pMgmt->name); dDebug("node:%s, need to start", pMgmt->name);
} }
return required; return required;
} }
@ -242,7 +242,7 @@ int32_t dndRun(SDnode *pDnode) {
} }
while (1) { while (1) {
if (pDnode->event != DND_EVENT_STOP) { if (pDnode->event == DND_EVENT_STOP) {
dInfo("dnode object receive stop event"); dInfo("dnode object receive stop event");
break; break;
} }

View File

@ -16,7 +16,7 @@
#define _DEFAULT_SOURCE #define _DEFAULT_SOURCE
#include "dmInt.h" #include "dmInt.h"
#include "dmFile.h" #include "dmFile.h"
#include "dmHandle.h" #include "dmMsg.h"
#include "dmWorker.h" #include "dmWorker.h"
int32_t dmGetDnodeId(SDnode *pDnode) { int32_t dmGetDnodeId(SDnode *pDnode) {
@ -140,6 +140,7 @@ int32_t dmInit(SMgmtWrapper *pWrapper) {
return -1; return -1;
} }
pWrapper->pMgmt = pMgmt;
dndSetStatus(pDnode, DND_STAT_RUNNING); dndSetStatus(pDnode, DND_STAT_RUNNING);
dmSendStatusReq(pMgmt); dmSendStatusReq(pMgmt);
dndReportStartup(pDnode, "TDengine", "initialized successfully"); dndReportStartup(pDnode, "TDengine", "initialized successfully");

View File

@ -14,7 +14,7 @@
*/ */
#define _DEFAULT_SOURCE #define _DEFAULT_SOURCE
#include "dmHandle.h" #include "dmMsg.h"
#include "dmFile.h" #include "dmFile.h"
#include "dmWorker.h" #include "dmWorker.h"
#include "vmInt.h" #include "vmInt.h"

View File

@ -15,7 +15,7 @@
#define _DEFAULT_SOURCE #define _DEFAULT_SOURCE
#include "dmWorker.h" #include "dmWorker.h"
#include "dmHandle.h" #include "dmMsg.h"
#include "bmInt.h" #include "bmInt.h"
#include "mmInt.h" #include "mmInt.h"
@ -131,12 +131,12 @@ static void dndProcessMgmtQueue(SDnode *pDnode, SRpcMsg *pMsg) {
} }
int32_t dmStartWorker(SDnodeMgmt *pMgmt) { int32_t dmStartWorker(SDnodeMgmt *pMgmt) {
if (dndInitWorker(NULL, &pMgmt->mgmtWorker, DND_WORKER_SINGLE, "dnode-mgmt", 1, 1, dndProcessMgmtQueue) != 0) { if (dndInitWorker(pMgmt->pDnode, &pMgmt->mgmtWorker, DND_WORKER_SINGLE, "dnode-mgmt", 1, 1, dndProcessMgmtQueue) != 0) {
dError("failed to start dnode mgmt worker since %s", terrstr()); dError("failed to start dnode mgmt worker since %s", terrstr());
return -1; return -1;
} }
if (dndInitWorker(NULL, &pMgmt->statusWorker, DND_WORKER_SINGLE, "dnode-status", 1, 1, dndProcessMgmtQueue) != 0) { if (dndInitWorker(pMgmt->pDnode, &pMgmt->statusWorker, DND_WORKER_SINGLE, "dnode-status", 1, 1, dndProcessMgmtQueue) != 0) {
dError("failed to start dnode mgmt worker since %s", terrstr()); dError("failed to start dnode mgmt worker since %s", terrstr());
return -1; return -1;
} }