From 2b70b54cd4749d198b4f6f01db91325a5303695a Mon Sep 17 00:00:00 2001 From: dapan1121 <89396746@qq.com> Date: Thu, 13 May 2021 15:27:33 +0800 Subject: [PATCH] fix bug --- src/client/src/tscProfile.c | 4 ++-- src/client/src/tscUtil.c | 8 ++++---- src/query/src/qExecutor.c | 2 ++ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/client/src/tscProfile.c b/src/client/src/tscProfile.c index be304632cc..ea2a3d8228 100644 --- a/src/client/src/tscProfile.c +++ b/src/client/src/tscProfile.c @@ -54,14 +54,14 @@ void tscAddIntoSqlList(SSqlObj *pSql) { pSql->next = pObj->sqlList; if (pObj->sqlList) pObj->sqlList->prev = pSql; pObj->sqlList = pSql; - pSql->queryId = queryId++; + pSql->queryId = atomic_fetch_add_32(&queryId, 1); pthread_mutex_unlock(&pObj->mutex); pSql->stime = taosGetTimestampMs(); pSql->listed = 1; - tscDebug("0x%"PRIx64" added into sqlList", pSql->self); + tscDebug("0x%"PRIx64" added into sqlList, queryId:%u", pSql->self, pSql->queryId); } void tscSaveSlowQueryFpCb(void *param, TAOS_RES *result, int code) { diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index 547d66a0f3..3d2cf44560 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -2431,15 +2431,15 @@ void tscDoQuery(SSqlObj* pSql) { return; } - if (pCmd->command == TSDB_SQL_SELECT) { - tscAddIntoSqlList(pSql); - } - if (pCmd->dataSourceType == DATA_FROM_DATA_FILE) { tscImportDataFromFile(pSql); } else { SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex); uint16_t type = pQueryInfo->type; + + if ((pCmd->command == TSDB_SQL_SELECT) && (!TSDB_QUERY_HAS_TYPE(type, TSDB_QUERY_TYPE_SUBQUERY)) && (!TSDB_QUERY_HAS_TYPE(type, TSDB_QUERY_TYPE_STABLE_SUBQUERY))) { + tscAddIntoSqlList(pSql); + } if (TSDB_QUERY_HAS_TYPE(type, TSDB_QUERY_TYPE_INSERT)) { // multi-vnodes insertion tscHandleMultivnodeInsert(pSql); diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index 4cf6d6072e..eca2a25a35 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -124,6 +124,8 @@ int64_t genQueryId(void) { uid |= sid; + qDebug("gen qid:0x%"PRIx64, uid); + return uid; } -- GitLab