[fix memory leak, and temp get tables of vnode into log]

This commit is contained in:
plum-lihui 2022-01-20 18:14:41 +08:00
parent aa67bb9e14
commit 9fc13dc750
1 changed files with 14 additions and 3 deletions

View File

@ -166,16 +166,26 @@ static int32_t vnodeGetTableList(SVnode *pVnode, SRpcMsg *pMsg) {
char * name = NULL;
int32_t totalLen = 0;
int32_t numOfTables = 0;
while ((name = metaTbCursorNext(pCur)) != NULL) {
taosArrayPush(pArray, &name);
totalLen += strlen(name);
if (numOfTables < 1000) { // TODO: temp get tables of vnode, and should del when show tables commad ok.
taosArrayPush(pArray, &name);
totalLen += strlen(name);
}
numOfTables++;
}
// TODO: temp debug, and should del when show tables command ok
vError("====vgId:%d, numOfTables: %d", pVnode->vgId, numOfTables);
if (numOfTables > 1000) {
numOfTables = 1000;
}
metaCloseTbCursor(pCur);
int32_t rowLen =
(TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE) + 8 + 2 + (TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE) + 8 + 4;
int32_t numOfTables = (int32_t)taosArrayGetSize(pArray);
//int32_t numOfTables = (int32_t)taosArrayGetSize(pArray);
int32_t payloadLen = rowLen * numOfTables;
// SVShowTablesFetchReq *pFetchReq = pMsg->pCont;
@ -203,5 +213,6 @@ static int32_t vnodeGetTableList(SVnode *pVnode, SRpcMsg *pMsg) {
};
rpcSendResponse(&rpcMsg);
taosArrayDestroy(pArray);
return 0;
}