From f982f2df5edcd9c7a7421d9cdd19ae766a7fd9da Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 21 Sep 2020 15:17:27 +0800 Subject: [PATCH 1/4] [td-225] fix bugs in regression test. --- src/client/src/tscStream.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/client/src/tscStream.c b/src/client/src/tscStream.c index 4a1f4d9d87..da9497dda5 100644 --- a/src/client/src/tscStream.c +++ b/src/client/src/tscStream.c @@ -615,10 +615,9 @@ void taos_close_stream(TAOS_STREAM *handle) { tscDebug("%p stream:%p is closed", pSql, pStream); // notify CQ to release the pStream object pStream->fp(pStream->param, NULL, NULL); + taos_free_result(pSql); - tscFreeSqlObj(pSql); pStream->pSql = NULL; - taosTFree(pStream); } } From 47d974994c0b8c2199518fc654ae2eb577d5a539 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 21 Sep 2020 15:23:17 +0800 Subject: [PATCH 2/4] [td-225] fix bugs in regression test. --- src/client/src/tscStream.c | 4 ++-- src/client/src/tscSubquery.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/client/src/tscStream.c b/src/client/src/tscStream.c index da9497dda5..88dcfc2bb3 100644 --- a/src/client/src/tscStream.c +++ b/src/client/src/tscStream.c @@ -615,9 +615,9 @@ void taos_close_stream(TAOS_STREAM *handle) { tscDebug("%p stream:%p is closed", pSql, pStream); // notify CQ to release the pStream object pStream->fp(pStream->param, NULL, NULL); - taos_free_result(pSql); - pStream->pSql = NULL; + + taos_free_result(pSql); taosTFree(pStream); } } diff --git a/src/client/src/tscSubquery.c b/src/client/src/tscSubquery.c index f9bb180810..a6304c5ef3 100644 --- a/src/client/src/tscSubquery.c +++ b/src/client/src/tscSubquery.c @@ -1383,7 +1383,7 @@ static void doCleanupSubqueries(SSqlObj *pSql, int32_t numOfSubs, SSubqueryState taosTFree(pSupport->localBuffer); taosTFree(pSupport); - tscFreeSqlObj(pSub); + taos_free_result(pSub); } free(pState); From f91fccd82e53ea7735a608dcaafa439ab9228f05 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 21 Sep 2020 15:41:29 +0800 Subject: [PATCH 3/4] [td-225] fix bugs in regression test. --- src/client/src/tscSubquery.c | 2 +- src/client/src/tscUtil.c | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/client/src/tscSubquery.c b/src/client/src/tscSubquery.c index a6304c5ef3..e66b361191 100644 --- a/src/client/src/tscSubquery.c +++ b/src/client/src/tscSubquery.c @@ -278,7 +278,7 @@ static int32_t tscLaunchRealSubqueries(SSqlObj* pSql) { tscDebug("%p subIndex: %d, no need to launch query, ignore it", pSql, i); tscDestroyJoinSupporter(pSupporter); - tscFreeSqlObj(pPrevSub); + taos_free_result(pPrevSub); pSql->pSubs[i] = NULL; continue; diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index 38fb63f18e..20c3bc2cb6 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -1743,8 +1743,6 @@ SSqlObj* createSimpleSubObj(SSqlObj* pSql, void (*fp)(), void* param, int32_t cm } pNew->pTscObj = pSql->pTscObj; - T_REF_INC(pNew->pTscObj); - pNew->signature = pNew; SSqlCmd* pCmd = &pNew->cmd; @@ -1777,7 +1775,6 @@ SSqlObj* createSimpleSubObj(SSqlObj* pSql, void (*fp)(), void* param, int32_t cm tscAddTableMetaInfo(pQueryInfo, pMasterTableMetaInfo->name, NULL, NULL, NULL); T_REF_INC(pNew->pTscObj); - uint64_t p = (uint64_t) pNew; pNew->self = taosCachePut(tscObjCache, &p, sizeof(uint64_t), &pNew, sizeof(uint64_t), 2 * 600 * 1000); return pNew; From d8a9ead27a3a987adeb10b77a095b28f58afc4d3 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 21 Sep 2020 16:06:55 +0800 Subject: [PATCH 4/4] [td-225] fix bugs in regression test. --- src/client/src/tscStream.c | 3 ++- src/util/src/tcache.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/client/src/tscStream.c b/src/client/src/tscStream.c index 478787671f..fed9caebbe 100644 --- a/src/client/src/tscStream.c +++ b/src/client/src/tscStream.c @@ -572,6 +572,7 @@ TAOS_STREAM *taos_open_stream(TAOS *taos, const char *sqlstr, void (*fp)(void *p pStream->pSql = pSql; pSql->pStream = pStream; pSql->param = pStream; + pSql->maxRetry = TSDB_MAX_REPLICA; pSql->sqlstr = calloc(1, strlen(sqlstr) + 1); if (pSql->sqlstr == NULL) { @@ -579,6 +580,7 @@ TAOS_STREAM *taos_open_stream(TAOS *taos, const char *sqlstr, void (*fp)(void *p tscFreeSqlObj(pSql); return NULL; } + strtolower(pSql->sqlstr, sqlstr); tscDebugL("%p SQL: %s", pSql, pSql->sqlstr); @@ -612,7 +614,6 @@ void taos_close_stream(TAOS_STREAM *handle) { * Here, we need a check before release memory */ if (pSql->signature == pSql) { - T_REF_DEC(pSql->pTscObj); tscRemoveFromStreamList(pStream, pSql); taosTmrStopA(&(pStream->pTimer)); diff --git a/src/util/src/tcache.c b/src/util/src/tcache.c index e1dd521547..a6376e49ad 100644 --- a/src/util/src/tcache.c +++ b/src/util/src/tcache.c @@ -266,7 +266,7 @@ void *taosCacheAcquireByKey(SCacheObj *pCacheObj, const void *key, size_t keyLen if (taosHashGetSize(pCacheObj->pHashTable) == 0) { atomic_add_fetch_32(&pCacheObj->statistics.missCount, 1); - uError("cache:%s, key:%p, not in cache, retrieved failed, reason: empty sqlObj cache", pCacheObj->name, key); + uError("cache:%s, key:%p, not in cache, retrieved failed, reason: empty cache", pCacheObj->name, key); return NULL; }