From 0d4618ce1b9dbfd7a4d7cb1786983b2b3af06ffc Mon Sep 17 00:00:00 2001 From: slguan Date: Thu, 5 Mar 2020 10:12:10 +0800 Subject: [PATCH] fix compile errors in cluster module --- src/dnode/inc/dnodeMgmt.h | 4 +--- src/dnode/src/dnodeMgmt.c | 4 ++-- src/inc/dnode.h | 2 -- src/inc/mnode.h | 1 + src/mnode/inc/mgmtDnode.h | 2 ++ src/mnode/src/mgmtDnode.c | 14 ++++++++++++++ 6 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/dnode/inc/dnodeMgmt.h b/src/dnode/inc/dnodeMgmt.h index 399b4b9920..7a67d7dbf2 100644 --- a/src/dnode/inc/dnodeMgmt.h +++ b/src/dnode/inc/dnodeMgmt.h @@ -26,15 +26,13 @@ extern "C" { int32_t dnodeInitMgmt(); void dnodeInitMgmtIp(); -void dnodeProcessMsgFromMgmt(int8_t msgType, void *pCont, int32_t contLen, void *pConn, int32_t code); +void dnodeProcessMsgFromMgmt(char msgType, void *pCont, int32_t contLen, void *pConn, int32_t code); void dnodeSendMsgToMnode(int8_t msgType, void *pCont, int32_t contLen); void dnodeSendRspToMnode(void *pConn, int8_t msgType, int32_t code, void *pCont, int32_t contLen); void dnodeSendVnodeCfgMsg(int32_t vnode); void dnodeSendTableCfgMsg(int32_t vnode, int32_t sid); - - #ifdef __cplusplus } #endif diff --git a/src/dnode/src/dnodeMgmt.c b/src/dnode/src/dnodeMgmt.c index d0cb0a39af..1e7af8d094 100644 --- a/src/dnode/src/dnodeMgmt.c +++ b/src/dnode/src/dnodeMgmt.c @@ -171,13 +171,13 @@ void dnodeCleanUpMgmt() { } } -void dnodeProcessMsgFromMgmt(int8_t msgType, void *pCont, int32_t contLen, void *pConn, int32_t code) { +void dnodeProcessMsgFromMgmt(char msgType, void *pCont, int32_t contLen, void *pConn, int32_t code) { if (msgType < 0 || msgType >= TSDB_MSG_TYPE_MAX) { dError("invalid msg type:%d", msgType); return; } - dTrace("msg:%d:%s is received from mgmt, pConn:%p", msgType, taosMsg[msgType], pConn); + dTrace("msg:%d:%s is received from mgmt, pConn:%p", msgType, taosMsg[(int8_t)msgType], pConn); if (msgType == TSDB_MSG_TYPE_STATUS_RSP && dnodeProcessStatusRspFp != NULL) { dnodeProcessStatusRspFp(pCont, contLen, msgType, pConn); diff --git a/src/inc/dnode.h b/src/inc/dnode.h index 15a6096826..ff893acd38 100644 --- a/src/inc/dnode.h +++ b/src/inc/dnode.h @@ -49,8 +49,6 @@ extern int32_t (*dnodeCheckSystem)(); extern void *tsDnodeMgmtQhandle; void dnodeCheckDataDirOpenned(const char* dir); -void dnodeProcessMsgFromMgmt(int8_t msgType, void *pCont, int32_t contLen, void *pConn, int32_t code); - // dnodeModule extern void (*dnodeStartModules)(); diff --git a/src/inc/mnode.h b/src/inc/mnode.h index 34c8b8c77e..12a3fefe66 100644 --- a/src/inc/mnode.h +++ b/src/inc/mnode.h @@ -264,6 +264,7 @@ void mgmtCleanUpSystem(); void mgmtStopSystem(); void mgmtProcessMsgFromDnode(char msgType, void *pCont, int32_t contLen, void *pConn, int32_t code); +void dnodeProcessMsgFromMgmt(char msgType, void *pCont, int32_t contLen, void *pConn, int32_t code); #ifdef __cplusplus } diff --git a/src/mnode/inc/mgmtDnode.h b/src/mnode/inc/mgmtDnode.h index aafe45be5c..193d4544a1 100644 --- a/src/mnode/inc/mgmtDnode.h +++ b/src/mnode/inc/mgmtDnode.h @@ -50,6 +50,8 @@ int32_t mgmtGetDnodesNum(); int32_t mgmtUpdateDnode(SDnodeObj *pDnode); void* mgmtGetNextDnode(SShowObj *pShow, SDnodeObj **pDnode); bool mgmtCheckConfigShow(SGlobalConfig *cfg); +bool mgmtCheckDnodeInRemoveState(SDnodeObj *pDnode); +bool mgmtCheckDnodeInOfflineState(SDnodeObj *pDnode); void mgmtSetDnodeUnRemove(SDnodeObj *pDnode); SDnodeObj* mgmtGetDnode(uint32_t ip); diff --git a/src/mnode/src/mgmtDnode.c b/src/mnode/src/mgmtDnode.c index a28f337f69..8fea669ea0 100644 --- a/src/mnode/src/mgmtDnode.c +++ b/src/mnode/src/mgmtDnode.c @@ -636,3 +636,17 @@ bool mgmtCheckConfigShow(SGlobalConfig *cfg) { return false; return true; } + +/** + * check if a dnode in remove state + **/ +bool mgmtCheckDnodeInRemoveState(SDnodeObj *pDnode) { + return pDnode->lbStatus == TSDB_DN_LB_STATUS_OFFLINE_REMOVING || pDnode->lbStatus == TSDB_DN_LB_STATE_SHELL_REMOVING; +} + +/** + * check if a dnode in offline state + **/ +bool mgmtCheckDnodeInOfflineState(SDnodeObj *pDnode) { + return pDnode->status == TSDB_DN_STATUS_OFFLINE; +} -- GitLab