Merge pull request #28207 from taosdata/fix/3.0/TD-32422

add dropped count while open vnodes
This commit is contained in:
Hongze Cheng 2024-09-30 16:51:52 +08:00 committed by GitHub
commit 38b01e9e06
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 5 deletions

View File

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

View File

@ -77,6 +77,7 @@ typedef struct {
typedef struct { typedef struct {
int32_t vnodeNum; int32_t vnodeNum;
int32_t opened; int32_t opened;
int32_t dropped;
int32_t failed; int32_t failed;
bool updateVnodesList; bool updateVnodesList;
int32_t threadIndex; 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); snprintf(path, TSDB_FILENAME_LEN, "vnode%svnode%d", TD_DIRSEP, pCfg->vgId);
vnodeDestroy(pCfg->vgId, path, pMgmt->pTfs, 0); vnodeDestroy(pCfg->vgId, path, pMgmt->pTfs, 0);
pThread->updateVnodesList = true; pThread->updateVnodesList = true;
pThread->dropped++;
(void)atomic_add_fetch_32(&pMgmt->state.dropVnodes, 1);
continue; continue;
} }
@ -352,8 +354,8 @@ static void *vmOpenVnodeInThread(void *param) {
(void)atomic_add_fetch_32(&pMgmt->state.openVnodes, 1); (void)atomic_add_fetch_32(&pMgmt->state.openVnodes, 1);
} }
dInfo("thread:%d, numOfVnodes:%d, opened:%d failed:%d", pThread->threadIndex, pThread->vnodeNum, pThread->opened, dInfo("thread:%d, numOfVnodes:%d, opened:%d dropped:%d failed:%d", pThread->threadIndex, pThread->vnodeNum,
pThread->failed); pThread->opened, pThread->dropped, pThread->failed);
return NULL; return NULL;
} }
@ -427,7 +429,7 @@ static int32_t vmOpenVnodes(SVnodeMgmt *pMgmt) {
taosMemoryFree(threads); taosMemoryFree(threads);
taosMemoryFree(pCfgs); 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); dError("there are total vnodes:%d, opened:%d", pMgmt->state.totalVnodes, pMgmt->state.openVnodes);
terrno = TSDB_CODE_VND_INIT_FAILED; terrno = TSDB_CODE_VND_INIT_FAILED;
return -1; return -1;
@ -774,6 +776,7 @@ static int32_t vmStartVnodes(SVnodeMgmt *pMgmt) {
} }
pMgmt->state.openVnodes = 0; pMgmt->state.openVnodes = 0;
pMgmt->state.dropVnodes = 0;
dInfo("restore %d vnodes with %d threads", numOfVnodes, threadNum); dInfo("restore %d vnodes with %d threads", numOfVnodes, threadNum);
for (int32_t t = 0; t < threadNum; ++t) { for (int32_t t = 0; t < threadNum; ++t) {