提交 859019f2 编写于 作者: S Shengliang Guan

[TD-390] process muli table meta msg

上级 f398488a
...@@ -2024,7 +2024,7 @@ static void mgmtProcessMultiTableMetaMsg(SQueuedMsg *pMsg) { ...@@ -2024,7 +2024,7 @@ static void mgmtProcessMultiTableMetaMsg(SQueuedMsg *pMsg) {
SCMMultiTableInfoMsg *pInfo = pMsg->pCont; SCMMultiTableInfoMsg *pInfo = pMsg->pCont;
pInfo->numOfTables = htonl(pInfo->numOfTables); 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); SMultiTableMeta *pMultiMeta = rpcMallocCont(totalMallocLen);
if (pMultiMeta == NULL) { if (pMultiMeta == NULL) {
mgmtSendSimpleResp(pMsg->thandle, TSDB_CODE_SERV_OUT_OF_MEMORY); mgmtSendSimpleResp(pMsg->thandle, TSDB_CODE_SERV_OUT_OF_MEMORY);
...@@ -2034,26 +2034,30 @@ static void mgmtProcessMultiTableMetaMsg(SQueuedMsg *pMsg) { ...@@ -2034,26 +2034,30 @@ static void mgmtProcessMultiTableMetaMsg(SQueuedMsg *pMsg) {
pMultiMeta->contLen = sizeof(SMultiTableMeta); pMultiMeta->contLen = sizeof(SMultiTableMeta);
pMultiMeta->numOfTables = 0; pMultiMeta->numOfTables = 0;
for (int t = 0; t < pInfo->numOfTables; ++t) { for (int32_t t = 0; t < pInfo->numOfTables; ++t) {
char *tableId = (char*)(pInfo->tableIds + t * TSDB_TABLE_ID_LEN); char * tableId = (char *)(pInfo->tableIds + t * TSDB_TABLE_ID_LEN + 1);
SChildTableObj *pTable = mgmtGetChildTable(tableId); SChildTableObj *pTable = mgmtGetChildTable(tableId);
if (pTable == NULL) continue; if (pTable == NULL) continue;
if (pMsg->pDb == NULL) pMsg->pDb = mgmtGetDbByTableId(tableId); 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; int availLen = totalMallocLen - pMultiMeta->contLen;
if (availLen <= sizeof(STableMetaMsg) + sizeof(SSchema) * (TSDB_MAX_TAGS + TSDB_MAX_COLUMNS + 16)) { if (availLen <= sizeof(STableMetaMsg) + sizeof(SSchema) * (TSDB_MAX_TAGS + TSDB_MAX_COLUMNS + 16)) {
//TODO realloc totalMallocLen *= 2;
//totalMallocLen *= 2; pMultiMeta = rpcReallocCont(pMultiMeta, totalMallocLen);
//pMultiMeta = rpcReMalloc(pMultiMeta, totalMallocLen); if (pMultiMeta == NULL) {
//if (pMultiMeta == NULL) { mgmtSendSimpleResp(pMsg->thandle, TSDB_CODE_SERV_OUT_OF_MEMORY);
/// rpcSendResponse(ahandle, TSDB_CODE_SERV_OUT_OF_MEMORY, NULL, 0); mgmtDecTableRef(pTable);
// return TSDB_CODE_SERV_OUT_OF_MEMORY; return;
//} else { } else {
// t--; t--;
// continue; mgmtDecTableRef(pTable);
//} continue;
}
} }
STableMetaMsg *pMeta = (STableMetaMsg *)(pMultiMeta->metas + pMultiMeta->contLen); STableMetaMsg *pMeta = (STableMetaMsg *)(pMultiMeta->metas + pMultiMeta->contLen);
...@@ -2062,6 +2066,8 @@ static void mgmtProcessMultiTableMetaMsg(SQueuedMsg *pMsg) { ...@@ -2062,6 +2066,8 @@ static void mgmtProcessMultiTableMetaMsg(SQueuedMsg *pMsg) {
pMultiMeta->numOfTables ++; pMultiMeta->numOfTables ++;
pMultiMeta->contLen += pMeta->contLen; pMultiMeta->contLen += pMeta->contLen;
} }
mgmtDecTableRef(pTable);
} }
SRpcMsg rpcRsp = {0}; SRpcMsg rpcRsp = {0};
......
...@@ -3,15 +3,64 @@ cd ../../debug; make ...@@ -3,15 +3,64 @@ cd ../../debug; make
cd ../../../debug; cmake .. cd ../../../debug; cmake ..
cd ../../../debug; make 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/balance1.sim
./test.sh -u -f unique/cluster/balance2.sim ./test.sh -u -f unique/cluster/balance2.sim
./test.sh -u -f unique/cluster/balance3.sim ./test.sh -u -f unique/cluster/balance3.sim
./test.sh -u -f unique/cluster/cache.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/balance1.sim
./test.sh -u -f unique/dnode/balance2.sim ./test.sh -u -f unique/dnode/balance2.sim
./test.sh -u -f unique/dnode/balance3.sim ./test.sh -u -f unique/dnode/balance3.sim
./test.sh -u -f unique/dnode/balancex.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/mgmt22.sim
./test.sh -u -f unique/mnode/mgmt23.sim ./test.sh -u -f unique/mnode/mgmt23.sim
...@@ -21,3 +70,10 @@ cd ../../../debug; make ...@@ -21,3 +70,10 @@ cd ../../../debug; make
./test.sh -u -f unique/mnode/mgmt33.sim ./test.sh -u -f unique/mnode/mgmt33.sim
./test.sh -u -f unique/mnode/mgmt34.sim ./test.sh -u -f unique/mnode/mgmt34.sim
./test.sh -u -f unique/mnode/mgmtr2.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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册