diff --git a/src/dnode/inc/dnodeMgmt.h b/src/dnode/inc/dnodeMgmt.h index 399b4b9920625a766f1bead360237673d539b6f0..7a67d7dbf21e952dced6e04e3f54adc451f7555d 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 d0cb0a39af5da2207449dafc946e411775207999..1e7af8d094e9895d37a4affc9d31473faf281dd2 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 15a6096826f2c0e96e6890956856ad783a592fae..ff893acd38a7ea8c80309d43c2499376155c2dda 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 34c8b8c77e4821ebb7a1aab1c4e148ffd3893302..12a3fefe66b757b7f42b9fffa901f236f9455c03 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 aafe45be5c669778d02a8b15d119859117f0f476..193d4544a1bfbb71bae277b851bcdb71270c12e4 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 a28f337f6903d368687d4ec7d3efaed7bfa212a5..8fea669ea042943f8500b3c2c5a2d82e22f5581c 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; +}