提交 862e8ee0 编写于 作者: S slguan

[TBASE-1128]

上级 87ab6854
......@@ -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;
}
......
......@@ -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;
......
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册