From aac2a25eb04749a81b8b40c03dea819d96490a89 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 11 May 2020 23:03:04 +0800 Subject: [PATCH] scripts --- src/mnode/src/mgmtTable.c | 28 +++++++++++++--------------- tests/script/general/db/vnodes.sim | 2 +- tests/script/jenkins/basic.txt | 4 ++-- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/mnode/src/mgmtTable.c b/src/mnode/src/mgmtTable.c index 5f1069026f..49311b0112 100644 --- a/src/mnode/src/mgmtTable.c +++ b/src/mnode/src/mgmtTable.c @@ -1241,9 +1241,8 @@ static void mgmtProcessSuperTableVgroupMsg(SQueuedMsg *pMsg) { SCMSTableVgroupMsg *pInfo = pMsg->pCont; int32_t numOfTable = htonl(pInfo->numOfTables); - SCMSTableVgroupRspMsg *pRsp = NULL; + // reserve space int32_t contLen = sizeof(SCMSTableVgroupRspMsg) + 32 * sizeof(SCMVgroupInfo) + sizeof(SVgroupsInfo); - //reserve space for (int32_t i = 0; i < numOfTable; ++i) { char *stableName = (char*)pInfo + sizeof(SCMSTableVgroupMsg) + (TSDB_TABLE_ID_LEN) * i; SSuperTableObj *pTable = mgmtGetSuperTable(stableName); @@ -1253,7 +1252,7 @@ static void mgmtProcessSuperTableVgroupMsg(SQueuedMsg *pMsg) { mgmtDecTableRef(pTable); } - pRsp = rpcMallocCont(contLen); + SCMSTableVgroupRspMsg *pRsp = rpcMallocCont(contLen); if (pRsp == NULL) { mgmtSendSimpleResp(pMsg->thandle, TSDB_CODE_SERV_OUT_OF_MEMORY); return; @@ -1265,32 +1264,31 @@ static void mgmtProcessSuperTableVgroupMsg(SQueuedMsg *pMsg) { for (int32_t i = 0; i < numOfTable; ++i) { char *stableName = (char*)pInfo + sizeof(SCMSTableVgroupMsg) + (TSDB_TABLE_ID_LEN) * i; SSuperTableObj *pTable = mgmtGetSuperTable(stableName); - SVgroupsInfo *pVgroup = (SVgroupsInfo *)msg; + SVgroupsInfo *pVgroupInfo = (SVgroupsInfo *)msg; SHashMutableIterator *pIter = taosHashCreateIter(pTable->vgHash); int32_t vgSize = 0; while (taosHashIterNext(pIter)) { int32_t *pVgId = taosHashIterGet(pIter); - SVgObj * pVgItem = mgmtGetVgroup(*pVgId - ); - if (pVgItem == NULL) continue; + SVgObj * pVgroup = mgmtGetVgroup(*pVgId); + if (pVgroup == NULL) continue; - pVgroup->vgroups[vgSize].vgId = htonl(pVgItem->vgId); - for (int32_t vn = 0; vn < pVgItem->numOfVnodes; ++vn) { - SDnodeObj *pDnode = pVgItem->vnodeGid[vn].pDnode; + pVgroupInfo->vgroups[vgSize].vgId = htonl(pVgroup->vgId); + for (int32_t vn = 0; vn < pVgroup->numOfVnodes; ++vn) { + SDnodeObj *pDnode = pVgroup->vnodeGid[vn].pDnode; if (pDnode == NULL) break; - strncpy(pVgroup->vgroups[vgSize].ipAddr[vn].fqdn, pDnode->dnodeFqdn, tListLen(pDnode->dnodeFqdn)); - pVgroup->vgroups[vgSize].ipAddr[vn].port = htons(tsDnodeShellPort); + strncpy(pVgroupInfo->vgroups[vgSize].ipAddr[vn].fqdn, pDnode->dnodeFqdn, tListLen(pDnode->dnodeFqdn)); + pVgroupInfo->vgroups[vgSize].ipAddr[vn].port = htons(tsDnodeShellPort); - pVgroup->vgroups[vgSize].numOfIps++; + pVgroupInfo->vgroups[vgSize].numOfIps++; } vgSize++; - mgmtDecVgroupRef(pVgItem); + mgmtDecVgroupRef(pVgroup); } - pVgroup->numOfVgroups = htonl(vgSize); + pVgroupInfo->numOfVgroups = htonl(vgSize); // one table is done, try the next table msg += sizeof(SVgroupsInfo) + vgSize * sizeof(SCMVgroupInfo); diff --git a/tests/script/general/db/vnodes.sim b/tests/script/general/db/vnodes.sim index 87e821fde3..684910884b 100644 --- a/tests/script/general/db/vnodes.sim +++ b/tests/script/general/db/vnodes.sim @@ -1,6 +1,6 @@ system sh/stop_dnodes.sh -$totalVnodes = 100 +$totalVnodes = 10 $maxTables = 4 $totalRows = $totalVnodes * $maxTables diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 005d2db032..62bae1c2a5 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -156,7 +156,7 @@ cd ../../../debug; make #./test.sh -f general/stable/disk.sim #./test.sh -f general/stable/metrics.sim #./test.sh -f general/stable/values.sim -#./test.sh -f general/stable/vnode3.sim +./test.sh -f general/stable/vnode3.sim ./test.sh -f general/table/autocreate.sim ./test.sh -f general/table/basic1.sim @@ -244,7 +244,7 @@ cd ../../../debug; make ./test.sh -u -f unique/account/user_len.sim #./test.sh -u -f unique/big/balance.sim -#./test.sh -u -f unique/big/maxvnodes.sim +#slguan ./test.sh -u -f unique/big/maxvnodes.sim ./test.sh -u -f unique/big/tcp.sim ##./test.sh -u -f unique/cluster/balance1.sim -- GitLab