drop vnode

This commit is contained in:
dmchen 2023-08-16 18:48:12 +08:00
parent fee4b875d1
commit d85d698074
1 changed files with 12 additions and 4 deletions

View File

@ -305,11 +305,18 @@ static int32_t vmOpenVnodes(SVnodeMgmt *pMgmt) {
return -1;
}
pMgmt->state.totalVnodes = numOfVnodes;
int32_t numOfDropped = 0;
for (int32_t v = 0; v < numOfVnodes; ++v){
if(pCfgs[v].dropped == 1) numOfDropped++;
}
dInfo("there are %d dropped vnodes", numOfDropped);
pMgmt->state.totalVnodes = numOfVnodes - numOfDropped;
int32_t threadNum = tsNumOfCores / 2;
if (threadNum < 1) threadNum = 1;
int32_t vnodesPerThread = numOfVnodes / threadNum + 1;
int32_t vnodesPerThread = (numOfVnodes - numOfDropped) / threadNum + 1;
SVnodeThread *threads = taosMemoryCalloc(threadNum, sizeof(SVnodeThread));
for (int32_t t = 0; t < threadNum; ++t) {
@ -319,12 +326,13 @@ static int32_t vmOpenVnodes(SVnodeMgmt *pMgmt) {
}
for (int32_t v = 0; v < numOfVnodes; ++v) {
if(pCfgs[v].dropped == 1) continue;
int32_t t = v % threadNum;
SVnodeThread *pThread = &threads[t];
pThread->pCfgs[pThread->vnodeNum++] = pCfgs[v];
}
dInfo("open %d vnodes with %d threads", numOfVnodes, threadNum);
dInfo("open %d vnodes with %d threads", numOfVnodes - numOfDropped, threadNum);
for (int32_t t = 0; t < threadNum; ++t) {
SVnodeThread *pThread = &threads[t];
@ -365,7 +373,7 @@ static int32_t vmOpenVnodes(SVnodeMgmt *pMgmt) {
return -1;
}
dInfo("successfully opened %d vnodes", pMgmt->state.totalVnodes);
dInfo("successfully opened %d vnodes, %d dropped vnodes", pMgmt->state.totalVnodes, numOfDropped);
return 0;
}