add dropped count while open vnodes

This commit is contained in:
xiao-77 2024-09-30 12:34:13 +08:00
parent 975eec8cf0
commit 01a648bcc9
3 changed files with 9 additions and 5 deletions

View File

@ -1684,6 +1684,7 @@ typedef struct {
typedef struct {
int32_t openVnodes;
int32_t dropVnodes;
int32_t totalVnodes;
int32_t masterNum;
int64_t numOfSelectReqs;

View File

@ -77,6 +77,7 @@ typedef struct {
typedef struct {
int32_t vnodeNum;
int32_t opened;
int32_t dropped;
int32_t failed;
bool updateVnodesList;
int32_t threadIndex;

View File

@ -311,6 +311,8 @@ static void *vmOpenVnodeInThread(void *param) {
snprintf(path, TSDB_FILENAME_LEN, "vnode%svnode%d", TD_DIRSEP, pCfg->vgId);
vnodeDestroy(pCfg->vgId, path, pMgmt->pTfs, 0);
pThread->updateVnodesList = true;
pThread->dropped++;
(void)atomic_add_fetch_32(&pMgmt->state.dropVnodes, 1);
continue;
}
@ -352,8 +354,8 @@ static void *vmOpenVnodeInThread(void *param) {
(void)atomic_add_fetch_32(&pMgmt->state.openVnodes, 1);
}
dInfo("thread:%d, numOfVnodes:%d, opened:%d failed:%d", pThread->threadIndex, pThread->vnodeNum, pThread->opened,
pThread->failed);
dInfo("thread:%d, numOfVnodes:%d, opened:%d dropped:%d failed:%d", pThread->threadIndex, pThread->vnodeNum,
pThread->opened, pThread->dropped, pThread->failed);
return NULL;
}
@ -427,7 +429,7 @@ static int32_t vmOpenVnodes(SVnodeMgmt *pMgmt) {
taosMemoryFree(threads);
taosMemoryFree(pCfgs);
if (pMgmt->state.openVnodes != pMgmt->state.totalVnodes) {
if ((pMgmt->state.openVnodes + pMgmt->state.dropVnodes) != pMgmt->state.totalVnodes) {
dError("there are total vnodes:%d, opened:%d", pMgmt->state.totalVnodes, pMgmt->state.openVnodes);
terrno = TSDB_CODE_VND_INIT_FAILED;
return -1;