diff --git a/src/client/inc/tsclient.h b/src/client/inc/tsclient.h index 78544b9b99143fa988304fa04bc104786e6866bf..5f4a46ddadd848d0ec112ad33d1f6313c6796052 100644 --- a/src/client/inc/tsclient.h +++ b/src/client/inc/tsclient.h @@ -348,6 +348,7 @@ typedef struct SSqlObj { void * pStream; void * pSubscription; char * sqlstr; + char parseRetry; char retry; char maxRetry; SRpcEpSet epSet; diff --git a/src/client/src/tscAsync.c b/src/client/src/tscAsync.c index 650f101645e68f3b84ccbd25c82bf6696c041808..d07089539aa39ecc507010bb6c7ce175f31defc8 100644 --- a/src/client/src/tscAsync.c +++ b/src/client/src/tscAsync.c @@ -43,6 +43,7 @@ void doAsyncQuery(STscObj* pObj, SSqlObj* pSql, void (*fp)(), void* param, const pSql->signature = pSql; pSql->param = param; pSql->pTscObj = pObj; + pSql->parseRetry= 0; pSql->maxRetry = TSDB_MAX_REPLICA; pSql->fp = fp; pSql->fetchFp = fp; diff --git a/src/client/src/tscParseInsert.c b/src/client/src/tscParseInsert.c index 7f8fd7f4feaad472db5e06744c7cea742e22c9c7..09eb8f167eb97f829cbcce2db7185956dd329ebf 100644 --- a/src/client/src/tscParseInsert.c +++ b/src/client/src/tscParseInsert.c @@ -1335,13 +1335,13 @@ int tsParseSql(SSqlObj *pSql, bool initial) { // make a backup as tsParseInsertSql may modify the string char* sqlstr = strdup(pSql->sqlstr); ret = tsParseInsertSql(pSql); - if (sqlstr == NULL || pSql->retry >= 1 || ret != TSDB_CODE_TSC_INVALID_SQL) { + if (sqlstr == NULL || pSql->parseRetry >= 1 || ret != TSDB_CODE_TSC_INVALID_SQL) { free(sqlstr); } else { tscResetSqlCmdObj(pCmd, true); free(pSql->sqlstr); pSql->sqlstr = sqlstr; - pSql->retry++; + pSql->parseRetry++; if ((ret = tsInsertInitialCheck(pSql)) == TSDB_CODE_SUCCESS) { ret = tsParseInsertSql(pSql); } @@ -1349,18 +1349,14 @@ int tsParseSql(SSqlObj *pSql, bool initial) { } else { SSqlInfo SQLInfo = qSQLParse(pSql->sqlstr); ret = tscToSQLCmd(pSql, &SQLInfo); - if (ret == TSDB_CODE_TSC_INVALID_SQL && pSql->retry == 0 && SQLInfo.type == TSDB_SQL_NULL) { + if (ret == TSDB_CODE_TSC_INVALID_SQL && pSql->parseRetry == 0 && SQLInfo.type == TSDB_SQL_NULL) { tscResetSqlCmdObj(pCmd, true); - pSql->retry++; + pSql->parseRetry++; ret = tscToSQLCmd(pSql, &SQLInfo); } SQLInfoDestroy(&SQLInfo); } - if (ret == TSDB_CODE_SUCCESS) { - pSql->retry = 0; - } - /* * the pRes->code may be modified or released by another thread in tscTableMetaCallBack function, * so do NOT use pRes->code to determine if the getTableMeta function