minor changes

This commit is contained in:
Shengliang Guan 2022-01-10 01:48:39 -08:00
parent 731c18fefb
commit 0d484a1023
4 changed files with 17 additions and 9 deletions

View File

@ -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);

View File

@ -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) {
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) {

View File

@ -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) {
} }
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) {
} }
dndCloseVnode(pDnode, pVnode); dndCloseVnode(pDnode, pVnode);
vnodeClose(pVnode->pImpl);
vnodeDestroy(pVnode->path);
dndWriteVnodesToFile(pDnode); dndWriteVnodesToFile(pDnode);
return 0; return 0;

View File

@ -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) {
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();