Merge pull request #23614 from taosdata/FIX/TD-27230-3.0
fix: close vnode in the failed mode properly in vmCloseVnode
This commit is contained in:
commit
c0c665d785
|
@ -144,6 +144,10 @@ void vmCloseVnode(SVnodeMgmt *pMgmt, SVnodeObj *pVnode, bool commitAndRemoveWal)
|
||||||
char path[TSDB_FILENAME_LEN] = {0};
|
char path[TSDB_FILENAME_LEN] = {0};
|
||||||
bool atExit = true;
|
bool atExit = true;
|
||||||
|
|
||||||
|
if (pVnode->failed) {
|
||||||
|
ASSERT(pVnode->pImpl == NULL);
|
||||||
|
goto _closed;
|
||||||
|
}
|
||||||
if (vnodeIsLeader(pVnode->pImpl)) {
|
if (vnodeIsLeader(pVnode->pImpl)) {
|
||||||
vnodeProposeCommitOnNeed(pVnode->pImpl, atExit);
|
vnodeProposeCommitOnNeed(pVnode->pImpl, atExit);
|
||||||
}
|
}
|
||||||
|
@ -202,6 +206,8 @@ void vmCloseVnode(SVnodeMgmt *pMgmt, SVnodeObj *pVnode, bool commitAndRemoveWal)
|
||||||
|
|
||||||
vnodeClose(pVnode->pImpl);
|
vnodeClose(pVnode->pImpl);
|
||||||
pVnode->pImpl = NULL;
|
pVnode->pImpl = NULL;
|
||||||
|
|
||||||
|
_closed:
|
||||||
dInfo("vgId:%d, vnode is closed", pVnode->vgId);
|
dInfo("vgId:%d, vnode is closed", pVnode->vgId);
|
||||||
|
|
||||||
if (commitAndRemoveWal) {
|
if (commitAndRemoveWal) {
|
||||||
|
@ -386,7 +392,6 @@ static void *vmCloseVnodeInThread(void *param) {
|
||||||
|
|
||||||
for (int32_t v = 0; v < pThread->vnodeNum; ++v) {
|
for (int32_t v = 0; v < pThread->vnodeNum; ++v) {
|
||||||
SVnodeObj *pVnode = pThread->ppVnodes[v];
|
SVnodeObj *pVnode = pThread->ppVnodes[v];
|
||||||
if (pVnode->failed) continue;
|
|
||||||
|
|
||||||
char stepDesc[TSDB_STEP_DESC_LEN] = {0};
|
char stepDesc[TSDB_STEP_DESC_LEN] = {0};
|
||||||
snprintf(stepDesc, TSDB_STEP_DESC_LEN, "vgId:%d, start to close, %d of %d have been closed", pVnode->vgId,
|
snprintf(stepDesc, TSDB_STEP_DESC_LEN, "vgId:%d, start to close, %d of %d have been closed", pVnode->vgId,
|
||||||
|
|
|
@ -89,6 +89,8 @@ int tsdbOpen(SVnode *pVnode, STsdb **ppTsdb, const char *dir, STsdbKeepCfg *pKee
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
_err:
|
_err:
|
||||||
|
tsdbCloseFS(&pTsdb->pFS);
|
||||||
|
taosThreadMutexDestroy(&pTsdb->mutex);
|
||||||
taosMemoryFree(pTsdb);
|
taosMemoryFree(pTsdb);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue