提交 0d484a10 编写于 作者: S Shengliang Guan

minor changes

上级 731c18fe
...@@ -21,8 +21,9 @@ extern "C" { ...@@ -21,8 +21,9 @@ extern "C" {
#endif #endif
#include "dndInt.h" #include "dndInt.h"
int32_t dndInitDnode(SDnode *pDnode); int32_t dndInitMgmt(SDnode *pDnode);
void dndCleanupDnode(SDnode *pDnode); void dndStopMgmt(SDnode *pDnode);
void dndCleanupMgmt(SDnode *pDnode);
int32_t dndGetDnodeId(SDnode *pDnode); int32_t dndGetDnodeId(SDnode *pDnode);
int64_t dndGetClusterId(SDnode *pDnode); int64_t dndGetClusterId(SDnode *pDnode);
......
...@@ -497,7 +497,7 @@ static void *dnodeThreadRoutine(void *param) { ...@@ -497,7 +497,7 @@ static void *dnodeThreadRoutine(void *param) {
} }
} }
int32_t dndInitDnode(SDnode *pDnode) { int32_t dndInitMgmt(SDnode *pDnode) {
SDnodeMgmt *pMgmt = &pDnode->dmgmt; SDnodeMgmt *pMgmt = &pDnode->dmgmt;
pMgmt->dnodeId = 0; pMgmt->dnodeId = 0;
...@@ -547,16 +547,18 @@ int32_t dndInitDnode(SDnode *pDnode) { ...@@ -547,16 +547,18 @@ int32_t dndInitDnode(SDnode *pDnode) {
return 0; return 0;
} }
void dndCleanupDnode(SDnode *pDnode) { void dndStopMgmt(SDnode *pDnode) {
SDnodeMgmt *pMgmt = &pDnode->dmgmt; SDnodeMgmt *pMgmt = &pDnode->dmgmt;
dndCleanupWorker(&pMgmt->mgmtWorker); dndCleanupWorker(&pMgmt->mgmtWorker);
if (pMgmt->threadId != NULL) { if (pMgmt->threadId != NULL) {
taosDestoryThread(pMgmt->threadId); taosDestoryThread(pMgmt->threadId);
pMgmt->threadId = NULL; pMgmt->threadId = NULL;
} }
}
void dndCleanupMgmt(SDnode *pDnode) {
SDnodeMgmt *pMgmt = &pDnode->dmgmt;
taosWLockLatch(&pMgmt->latch); taosWLockLatch(&pMgmt->latch);
if (pMgmt->dnodeEps != NULL) { if (pMgmt->dnodeEps != NULL) {
......
...@@ -167,6 +167,11 @@ static void dndCloseVnode(SDnode *pDnode, SVnodeObj *pVnode) { ...@@ -167,6 +167,11 @@ static void dndCloseVnode(SDnode *pDnode, SVnodeObj *pVnode) {
dDebug("vgId:%d, vnode is closed", pVnode->vgId); dDebug("vgId:%d, vnode is closed", pVnode->vgId);
if (pVnode->dropped) {
dDebug("vgId:%d, vnode is destroyed for dropped:%d", pVnode->vgId, pVnode->dropped);
vnodeDestroy(pVnode->path);
}
free(pVnode->path); free(pVnode->path);
free(pVnode->db); free(pVnode->db);
free(pVnode); free(pVnode);
...@@ -466,6 +471,7 @@ static int32_t dndOpenVnodes(SDnode *pDnode) { ...@@ -466,6 +471,7 @@ static int32_t dndOpenVnodes(SDnode *pDnode) {
} }
static void dndCloseVnodes(SDnode *pDnode) { static void dndCloseVnodes(SDnode *pDnode) {
dInfo("start to close all vnodes");
SVnodesMgmt *pMgmt = &pDnode->vmgmt; SVnodesMgmt *pMgmt = &pDnode->vmgmt;
int32_t numOfVnodes = 0; int32_t numOfVnodes = 0;
...@@ -658,8 +664,6 @@ int32_t dndProcessDropVnodeReq(SDnode *pDnode, SRpcMsg *pReq) { ...@@ -658,8 +664,6 @@ int32_t dndProcessDropVnodeReq(SDnode *pDnode, SRpcMsg *pReq) {
} }
dndCloseVnode(pDnode, pVnode); dndCloseVnode(pDnode, pVnode);
vnodeClose(pVnode->pImpl);
vnodeDestroy(pVnode->path);
dndWriteVnodesToFile(pDnode); dndWriteVnodesToFile(pDnode);
return 0; return 0;
......
...@@ -202,7 +202,7 @@ SDnode *dndInit(SDnodeOpt *pOption) { ...@@ -202,7 +202,7 @@ SDnode *dndInit(SDnodeOpt *pOption) {
return NULL; return NULL;
} }
if (dndInitDnode(pDnode) != 0) { if (dndInitMgmt(pDnode) != 0) {
dError("failed to init dnode"); dError("failed to init dnode");
dndCleanup(pDnode); dndCleanup(pDnode);
return NULL; return NULL;
...@@ -263,12 +263,13 @@ void dndCleanup(SDnode *pDnode) { ...@@ -263,12 +263,13 @@ void dndCleanup(SDnode *pDnode) {
dInfo("start to cleanup TDengine"); dInfo("start to cleanup TDengine");
dndSetStat(pDnode, DND_STAT_STOPPED); dndSetStat(pDnode, DND_STAT_STOPPED);
dndCleanupTrans(pDnode); dndCleanupTrans(pDnode);
dndStopMgmt(pDnode);
dndCleanupMnode(pDnode); dndCleanupMnode(pDnode);
dndCleanupBnode(pDnode); dndCleanupBnode(pDnode);
dndCleanupSnode(pDnode); dndCleanupSnode(pDnode);
dndCleanupQnode(pDnode); dndCleanupQnode(pDnode);
dndCleanupVnodes(pDnode); dndCleanupVnodes(pDnode);
dndCleanupDnode(pDnode); dndCleanupMgmt(pDnode);
vnodeClear(); vnodeClear();
tfsDestroy(); tfsDestroy();
walCleanUp(); walCleanUp();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册