diff --git a/source/dnode/vnode/src/vnd/vnodeQuery.c b/source/dnode/vnode/src/vnd/vnodeQuery.c index 9390e19523..4012914723 100644 --- a/source/dnode/vnode/src/vnd/vnodeQuery.c +++ b/source/dnode/vnode/src/vnd/vnodeQuery.c @@ -156,6 +156,11 @@ _exit: return 0; } +static void freeItemHelper(void* pItem) { + char* p = *(char**)pItem; + free(p); +} + /** * @param pVnode * @param pMsg @@ -169,17 +174,20 @@ static int32_t vnodeGetTableList(SVnode *pVnode, SRpcMsg *pMsg) { int32_t totalLen = 0; int32_t numOfTables = 0; while ((name = metaTbCursorNext(pCur)) != NULL) { - if (numOfTables < 1000) { // TODO: temp get tables of vnode, and should del when show tables commad ok. + if (numOfTables < 10000) { // TODO: temp get tables of vnode, and should del when show tables commad ok. taosArrayPush(pArray, &name); totalLen += strlen(name); + } else { + tfree(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; + vInfo("====vgId:%d, numOfTables: %d", pVnode->vgId, numOfTables); + if (numOfTables > 10000) { + numOfTables = 10000; } metaCloseTbCursor(pCur); @@ -214,6 +222,6 @@ static int32_t vnodeGetTableList(SVnode *pVnode, SRpcMsg *pMsg) { }; rpcSendResponse(&rpcMsg); - taosArrayDestroy(pArray); + taosArrayDestroyEx(pArray, freeItemHelper); return 0; }