From dd41425f3797f146d56aaad995ffa63ecd547dd1 Mon Sep 17 00:00:00 2001 From: hjxilinx Date: Mon, 6 Jan 2020 12:11:59 +0800 Subject: [PATCH] refactor some codes --- src/client/inc/tsclient.h | 8 -------- src/client/src/tscJoinProcess.c | 11 +++++++++-- src/client/src/tscSql.c | 4 +--- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/client/inc/tsclient.h b/src/client/inc/tsclient.h index a3e1e624c1..773924c110 100644 --- a/src/client/inc/tsclient.h +++ b/src/client/inc/tsclient.h @@ -20,14 +20,6 @@ extern "C" { #endif -#include -#include -#include -#include -#include -#include -#include - #include "os.h" #include "taos.h" #include "taosmsg.h" diff --git a/src/client/src/tscJoinProcess.c b/src/client/src/tscJoinProcess.c index 1f26e2a0e5..bd9a782d8c 100644 --- a/src/client/src/tscJoinProcess.c +++ b/src/client/src/tscJoinProcess.c @@ -396,7 +396,10 @@ static void joinRetrieveCallback(void* param, TAOS_RES* tres, int numOfRows) { SSqlObj* pParentSql = pSupporter->pObj; SSqlObj* pSql = (SSqlObj*)tres; - SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(&pSql->cmd, 0); + SSqlCmd* pCmd = &pSql->cmd; + SSqlRes* pRes = &pSql->res; + + SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex); if ((pQueryInfo->type & TSDB_QUERY_TYPE_JOIN_SEC_STAGE) == 0) { if (pSupporter->pState->code != TSDB_CODE_SUCCESS) { @@ -443,7 +446,11 @@ static void joinRetrieveCallback(void* param, TAOS_RES* tres, int numOfRows) { assert(pQueryInfo->numOfTables == 1); // for projection query, need to try next vnode - if ((++pMeterMetaInfo->vnodeIndex) < pMeterMetaInfo->pMetricMeta->numOfVnodes) { + int32_t totalVnode = pMeterMetaInfo->pMetricMeta->numOfVnodes; + if ((++pMeterMetaInfo->vnodeIndex) < totalVnode) { + tscTrace("%p current vnode:%d exhausted, try next:%d. total vnode:%d. current numOfRes:%d", pSql, + pMeterMetaInfo->vnodeIndex - 1, pMeterMetaInfo->vnodeIndex, totalVnode, pRes->numOfTotal); + pSql->cmd.command = TSDB_SQL_SELECT; pSql->fp = tscJoinQueryCallback; tscProcessSql(pSql); diff --git a/src/client/src/tscSql.c b/src/client/src/tscSql.c index 2175d017ad..2cfe0f949f 100644 --- a/src/client/src/tscSql.c +++ b/src/client/src/tscSql.c @@ -450,7 +450,7 @@ static bool tscHashRemainDataInSubqueryResultSet(SSqlObj *pSql) { SQueryInfo * pQueryInfo1 = tscGetQueryInfoDetail(pCmd1, pCmd1->clauseIndex); SMeterMetaInfo *pMetaInfo = tscGetMeterMetaInfoFromQueryInfo(pQueryInfo1, 0); - assert(pQueryInfo->numOfTables == 1); + assert(pQueryInfo1->numOfTables == 1); /* * if the global limitation is not reached, and current result has not exhausted, or next more vnodes are @@ -675,8 +675,6 @@ TAOS_ROW taos_fetch_row_impl(TAOS_RES *res) { TAOS_ROW taos_fetch_row(TAOS_RES *res) { SSqlObj *pSql = (SSqlObj *)res; -// SSqlCmd *pCmd = &pSql->cmd; -// SSqlRes *pRes = &pSql->res; if (pSql == NULL || pSql->signature != pSql) { globalCode = TSDB_CODE_DISCONNECTED;