From cfa288674a59865853684ccf4b744a97a152cfe4 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 2 Jun 2020 12:14:04 +0800 Subject: [PATCH] [td-225] --- src/client/src/tscServer.c | 9 --------- src/client/src/tscUtil.c | 9 +++------ 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index 5b7009f958..4f81af62c2 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -335,15 +335,6 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcIpSet *pIpSet) { rpcMsg->code = pRes->code ? pRes->code : pRes->numOfRows; tscTrace("%p SQL result:%s res:%p", pSql, tstrerror(pRes->code), pSql); - - /* - * Whether to free sqlObj or not should be decided before call the user defined function, since this SqlObj - * may be freed in UDF, and reused by other threads before tscShouldBeFreed called, in which case - * tscShouldBeFreed checks an object which is actually allocated by other threads. - * - * If this block of memory is re-allocated for an insert thread, in which tscKeepConn[command] equals to 0, - * the tscShouldBeFreed will success and tscFreeSqlObj free it immediately. - */ bool shouldFree = tscShouldBeFreed(pSql); (*pSql->fp)(pSql->param, pSql, rpcMsg->code); diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index 2dba0c350e..3e7e0b9ed8 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -1475,15 +1475,12 @@ bool tscShouldBeFreed(SSqlObj* pSql) { return false; } + // only the table meta and super table vgroup query will free resource automatically int32_t command = pSql->cmd.command; - if (command == TSDB_SQL_META || command == TSDB_SQL_STABLEVGROUP) {//TODO subquery should be freed here + if (command == TSDB_SQL_META || command == TSDB_SQL_STABLEVGROUP) { return true; } - - // all subqueries should be automatically freed -// if (pSql->cmd.pQueryInfo != NULL && pSql->cmd.pQueryInfo[0]->type & TSDB_QUERY_TYPE_SUBQUERY) { -// return true; -// } + return false; }