diff --git a/src/system/detail/src/mgmtDb.c b/src/system/detail/src/mgmtDb.c index 01b5c00a8336d5ea59edd88d70eed15db51faa54..ba1b966cfb295ce5ea7ad704beb60d2b4a6c37b8 100644 --- a/src/system/detail/src/mgmtDb.c +++ b/src/system/detail/src/mgmtDb.c @@ -142,7 +142,7 @@ int mgmtCheckDbParams(SCreateDbMsg *pCreate) { if (pCreate->cacheNumOfBlocks.fraction < 0) pCreate->cacheNumOfBlocks.fraction = tsAverageCacheBlocks; // //-1 for balance - if (pCreate->replications <= 0 || pCreate->replications > TSDB_REPLICA_MAX_NUM) { + if (pCreate->replications < 0 || pCreate->replications > TSDB_REPLICA_MAX_NUM) { mTrace("invalid db option replications: %d", pCreate->replications); return TSDB_CODE_INVALID_OPTION; } diff --git a/src/system/lite/src/mgmtBalance.spec.c b/src/system/lite/src/mgmtBalance.spec.c index 91a93fd1d91d0b4df1b50a5d45382cbcc7900dfb..3d2f10dcbbc45e21ec0195067797d7dd439e4e94 100644 --- a/src/system/lite/src/mgmtBalance.spec.c +++ b/src/system/lite/src/mgmtBalance.spec.c @@ -26,9 +26,10 @@ void mgmtCleanupBalance() {} int mgmtAllocVnodes(SVgObj *pVgroup) { int selectedVnode = -1; SDnodeObj *pDnode = &dnodeObj; + int lastAllocVode = pDnode->lastAllocVnode; for (int i = 0; i < pDnode->numOfVnodes; i++) { - int vnode = (i + pDnode->lastAllocVnode) % pDnode->numOfVnodes; + int vnode = (i + lastAllocVode) % pDnode->numOfVnodes; if (pDnode->vload[vnode].vgId == 0 && pDnode->vload[vnode].status == TSDB_VN_STATUS_OFFLINE) { selectedVnode = vnode; break; @@ -39,8 +40,7 @@ int mgmtAllocVnodes(SVgObj *pVgroup) { mError("vgroup:%d alloc vnode failed, free vnodes:%d", pVgroup->vgId, pDnode->numOfFreeVnodes); return -1; } else { - mTrace("vgroup:%d allocate vnode:%d, last allocated vnode:%d", pVgroup->vgId, selectedVnode, - pDnode->lastAllocVnode); + mTrace("vgroup:%d allocate vnode:%d, last allocated vnode:%d", pVgroup->vgId, selectedVnode, lastAllocVode); pVgroup->vnodeGid[0].vnode = selectedVnode; pDnode->lastAllocVnode = selectedVnode + 1; if (pDnode->lastAllocVnode >= pDnode->numOfVnodes) pDnode->lastAllocVnode = 0; diff --git a/src/system/lite/src/mgmtDnode.spec.c b/src/system/lite/src/mgmtDnode.spec.c index fa14dc1cb81130f5a4cee8f76db2ce2cc08f959d..dc7dd7d4725e8176daf358feefc14a4467791606 100644 --- a/src/system/lite/src/mgmtDnode.spec.c +++ b/src/system/lite/src/mgmtDnode.spec.c @@ -37,7 +37,7 @@ int mgmtInitDnodes() { dnodeObj.thandle = (void*)(1); //hack way if (dnodeObj.numOfVnodes == TSDB_INVALID_VNODE_NUM) { mgmtSetDnodeMaxVnodes(&dnodeObj); - mPrint("first access, set total vnodes:%d", dnodeObj.numOfVnodes); + mPrint("dnode first access, set total vnodes:%d", dnodeObj.numOfVnodes); } return 0; }