From 9b644fcb8eee9aae01bf3587a398ac6ebce96836 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Tue, 7 Mar 2023 19:40:06 +0800 Subject: [PATCH] fix: add debug log --- src/client/src/tscSubquery.c | 7 +++++++ src/client/src/tscUtil.c | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/client/src/tscSubquery.c b/src/client/src/tscSubquery.c index 6852103a17..e813f5b899 100644 --- a/src/client/src/tscSubquery.c +++ b/src/client/src/tscSubquery.c @@ -1631,6 +1631,8 @@ static void joinRetrieveFinalResCallback(void* param, TAOS_RES* tres, int numOfR SJoinSupporter* pSupporter = (SJoinSupporter*)param; int64_t handle = pSupporter->pObj; + tscDebug("***enter joinRetrieveFinalResCallback"); + SSqlObj* pParentSql = (SSqlObj*)taosAcquireRef(tscObjRef, handle); if (pParentSql == NULL) return; @@ -1750,6 +1752,7 @@ void tscFetchDatablockForSubquery(SSqlObj* pSql) { bool hasData = true; bool reachLimit = false; + tscDebug("***enter tscFetchDatablockForSubquery"); { pthread_mutex_lock(&pSql->subState.mutex); assert(pSql->subState.numOfSub >= 1); @@ -1788,6 +1791,7 @@ void tscFetchDatablockForSubquery(SSqlObj* pSql) { // has data remains in client side, and continue to return data to app if (hasData) { + tscDebug("*hasData"); tscBuildResFromSubqueries(pSql); return; } @@ -1795,6 +1799,7 @@ void tscFetchDatablockForSubquery(SSqlObj* pSql) { // If at least one subquery is completed in current vnode, try the next vnode in case of multi-vnode // super table projection query. if (reachLimit) { + tscDebug("*reachLimit"); pSql->res.completed = true; freeJoinSubqueryObj(pSql); @@ -3808,6 +3813,7 @@ static void doBuildResFromSubqueries(SSqlObj* pSql) { pthread_mutex_unlock(&pSql->subState.mutex); } if (numOfRes == 0) { // no result any more, free all subquery objects + tscDebug("*******query complete"); pSql->res.completed = true; freeJoinSubqueryObj(pSql); return; @@ -3892,6 +3898,7 @@ static void doBuildResFromSubqueries(SSqlObj* pSql) { void tscBuildResFromSubqueries(SSqlObj *pSql) { SSqlRes* pRes = &pSql->res; + tscDebug("*enter tscBuildResFromSubqueries"); if (pRes->code != TSDB_CODE_SUCCESS) { tscAsyncResultOnError(pSql); return; diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index 7b890e15be..f4a9b559e0 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -4561,7 +4561,9 @@ int32_t tscErrorMsgWithCode(int32_t code, char* dstBuffer, const char* errMsg, c bool tscHasReachLimitation(SQueryInfo* pQueryInfo, SSqlRes* pRes) { assert(pQueryInfo != NULL && pQueryInfo->clauseLimit != 0); - return (pQueryInfo->clauseLimit > 0 && pRes->numOfClauseTotal >= pQueryInfo->clauseLimit); + bool reachLimit = (pQueryInfo->clauseLimit > 0 && pRes->numOfClauseTotal >= pQueryInfo->clauseLimit); + tscDebug("reachLimit:%d", reachLimit); + return reachLimit; } char* tscGetErrorMsgPayload(SSqlCmd* pCmd) { return pCmd->payload; } -- GitLab