From eb97f122322249580295f57f654f3dbfc4a3d3ae Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Sat, 12 Dec 2020 18:35:20 +0800 Subject: [PATCH] [TD-225] release the ref for tableMeta if insert success. --- src/client/src/tscSubquery.c | 4 ---- src/client/src/tscUtil.c | 6 +++++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/client/src/tscSubquery.c b/src/client/src/tscSubquery.c index d2eb16795f..1e95380096 100644 --- a/src/client/src/tscSubquery.c +++ b/src/client/src/tscSubquery.c @@ -2279,7 +2279,6 @@ static void multiVnodeInsertFinalize(void* param, TAOS_RES* tres, int numOfRows) */ int32_t tscHandleInsertRetry(SSqlObj* pParent, SSqlObj* pSql) { assert(pSql != NULL && pSql->param != NULL); -// SSqlCmd* pCmd = &pSql->cmd; SSqlRes* pRes = &pSql->res; SInsertSupporter* pSupporter = (SInsertSupporter*) pSql->param; @@ -2288,9 +2287,6 @@ int32_t tscHandleInsertRetry(SSqlObj* pParent, SSqlObj* pSql) { STableDataBlocks* pTableDataBlock = taosArrayGetP(pParent->cmd.pDataBlocks, pSupporter->index); int32_t code = tscCopyDataBlockToPayload(pSql, pTableDataBlock); - // free the data block created from insert sql string -// pCmd->pDataBlocks = tscDestroyBlockArrayList(pParent->cmd.pDataBlocks); - if ((pRes->code = code)!= TSDB_CODE_SUCCESS) { tscQueueAsyncRes(pSql); return code; // here the pSql may have been released already. diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index 416e7c2dae..b7fe6aa7b2 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -405,8 +405,12 @@ void tscResetSqlCmdObj(SSqlCmd* pCmd, bool removeFromCache) { pCmd->msgType = 0; pCmd->parseFinished = 0; pCmd->autoCreated = 0; - pCmd->numOfTables = 0; + for(int32_t i = 0; i < pCmd->numOfTables; ++i) { + taosCacheRelease(tscMetaCache, (void**)&(pCmd->pTableMetaList[i]), false); + } + + pCmd->numOfTables = 0; tfree(pCmd->pTableMetaList); pCmd->pTableBlockHashList = tscDestroyBlockHashTable(pCmd->pTableBlockHashList);