From 859019f2efcd15ea3a0ec6c685f6df3ce76307ac Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Sat, 23 May 2020 14:11:26 +0800 Subject: [PATCH] [TD-390] process muli table meta msg --- src/mnode/src/mgmtTable.c | 34 ++++++++++++--------- tests/script/jenkins/sync.txt | 56 +++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 14 deletions(-) diff --git a/src/mnode/src/mgmtTable.c b/src/mnode/src/mgmtTable.c index f0c55449a3..abd226e568 100644 --- a/src/mnode/src/mgmtTable.c +++ b/src/mnode/src/mgmtTable.c @@ -2024,7 +2024,7 @@ static void mgmtProcessMultiTableMetaMsg(SQueuedMsg *pMsg) { SCMMultiTableInfoMsg *pInfo = pMsg->pCont; pInfo->numOfTables = htonl(pInfo->numOfTables); - int32_t totalMallocLen = 4*1024*1024; // first malloc 4 MB, subsequent reallocation as twice + int32_t totalMallocLen = 4 * 1024 * 1024; // first malloc 4 MB, subsequent reallocation as twice SMultiTableMeta *pMultiMeta = rpcMallocCont(totalMallocLen); if (pMultiMeta == NULL) { mgmtSendSimpleResp(pMsg->thandle, TSDB_CODE_SERV_OUT_OF_MEMORY); @@ -2034,26 +2034,30 @@ static void mgmtProcessMultiTableMetaMsg(SQueuedMsg *pMsg) { pMultiMeta->contLen = sizeof(SMultiTableMeta); pMultiMeta->numOfTables = 0; - for (int t = 0; t < pInfo->numOfTables; ++t) { - char *tableId = (char*)(pInfo->tableIds + t * TSDB_TABLE_ID_LEN); + for (int32_t t = 0; t < pInfo->numOfTables; ++t) { + char * tableId = (char *)(pInfo->tableIds + t * TSDB_TABLE_ID_LEN + 1); SChildTableObj *pTable = mgmtGetChildTable(tableId); if (pTable == NULL) continue; if (pMsg->pDb == NULL) pMsg->pDb = mgmtGetDbByTableId(tableId); - if (pMsg->pDb == NULL) continue; + if (pMsg->pDb == NULL) { + mgmtDecTableRef(pTable); + continue; + } int availLen = totalMallocLen - pMultiMeta->contLen; if (availLen <= sizeof(STableMetaMsg) + sizeof(SSchema) * (TSDB_MAX_TAGS + TSDB_MAX_COLUMNS + 16)) { - //TODO realloc - //totalMallocLen *= 2; - //pMultiMeta = rpcReMalloc(pMultiMeta, totalMallocLen); - //if (pMultiMeta == NULL) { - /// rpcSendResponse(ahandle, TSDB_CODE_SERV_OUT_OF_MEMORY, NULL, 0); - // return TSDB_CODE_SERV_OUT_OF_MEMORY; - //} else { - // t--; - // continue; - //} + totalMallocLen *= 2; + pMultiMeta = rpcReallocCont(pMultiMeta, totalMallocLen); + if (pMultiMeta == NULL) { + mgmtSendSimpleResp(pMsg->thandle, TSDB_CODE_SERV_OUT_OF_MEMORY); + mgmtDecTableRef(pTable); + return; + } else { + t--; + mgmtDecTableRef(pTable); + continue; + } } STableMetaMsg *pMeta = (STableMetaMsg *)(pMultiMeta->metas + pMultiMeta->contLen); @@ -2062,6 +2066,8 @@ static void mgmtProcessMultiTableMetaMsg(SQueuedMsg *pMsg) { pMultiMeta->numOfTables ++; pMultiMeta->contLen += pMeta->contLen; } + + mgmtDecTableRef(pTable); } SRpcMsg rpcRsp = {0}; diff --git a/tests/script/jenkins/sync.txt b/tests/script/jenkins/sync.txt index 15685f99e9..934680b7c0 100644 --- a/tests/script/jenkins/sync.txt +++ b/tests/script/jenkins/sync.txt @@ -3,15 +3,64 @@ cd ../../debug; make cd ../../../debug; cmake .. cd ../../../debug; make +./test.sh -u -f unique/account/account_create.sim +./test.sh -u -f unique/account/account_delete.sim +./test.sh -u -f unique/account/account_len.sim +./test.sh -u -f unique/account/authority.sim +./test.sh -u -f unique/account/basic.sim +./test.sh -u -f unique/account/paras.sim +./test.sh -u -f unique/account/pass_alter.sim +./test.sh -u -f unique/account/pass_len.sim +./test.sh -u -f unique/account/usage.sim +./test.sh -u -f unique/account/user_create.sim +./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 +./test.sh -u -f unique/big/tcp.sim + ./test.sh -u -f unique/cluster/balance1.sim ./test.sh -u -f unique/cluster/balance2.sim ./test.sh -u -f unique/cluster/balance3.sim ./test.sh -u -f unique/cluster/cache.sim +./test.sh -u -f unique/column/replica3.sim + +./test.sh -u -f unique/db/commit.sim +./test.sh -u -f unique/db/delete.sim +./test.sh -u -f unique/db/delete_part.sim +./test.sh -u -f unique/db/replica_add12.sim +./test.sh -u -f unique/db/replica_add13.sim +./test.sh -u -f unique/db/replica_add23.sim +./test.sh -u -f unique/db/replica_reduce21.sim +./test.sh -u -f unique/db/replica_reduce32.sim +./test.sh -u -f unique/db/replica_reduce31.sim +./test.sh -u -f unique/db/replica_part.sim + ./test.sh -u -f unique/dnode/balance1.sim ./test.sh -u -f unique/dnode/balance2.sim ./test.sh -u -f unique/dnode/balance3.sim ./test.sh -u -f unique/dnode/balancex.sim +./test.sh -u -f unique/dnode/offline1.sim +./test.sh -u -f unique/dnode/offline2.sim +./test.sh -u -f unique/dnode/remove1.sim +./test.sh -u -f unique/dnode/remove2.sim +./test.sh -u -f unique/dnode/vnode_clean.sim + +./test.sh -u -f unique/http/admin.sim +./test.sh -u -f unique/http/opentsdb.sim + +./test.sh -u -f unique/import/replica2.sim +./test.sh -u -f unique/import/replica3.sim + +./test.sh -u -f unique/stable/balance_replica1.sim +./test.sh -u -f unique/stable/dnode2_stop.sim +./test.sh -u -f unique/stable/dnode2.sim +./test.sh -u -f unique/stable/dnode3.sim +./test.sh -u -f unique/stable/replica2_dnode4.sim +./test.sh -u -f unique/stable/replica2_vnode3.sim +./test.sh -u -f unique/stable/replica3_dnode6.sim +./test.sh -u -f unique/stable/replica3_vnode3.sim ./test.sh -u -f unique/mnode/mgmt22.sim ./test.sh -u -f unique/mnode/mgmt23.sim @@ -21,3 +70,10 @@ cd ../../../debug; make ./test.sh -u -f unique/mnode/mgmt33.sim ./test.sh -u -f unique/mnode/mgmt34.sim ./test.sh -u -f unique/mnode/mgmtr2.sim + +./test.sh -u -f unique/vnode/many.sim +./test.sh -u -f unique/vnode/replica2_basic2.sim +./test.sh -u -f unique/vnode/replica2_repeat.sim +./test.sh -u -f unique/vnode/replica3_basic.sim +./test.sh -u -f unique/vnode/replica3_repeat.sim +./test.sh -u -f unique/vnode/replica3_vgroup.sim -- GitLab