diff --git a/src/client/src/tscAsync.c b/src/client/src/tscAsync.c index 610027151f73044ba9c30eafe5a44aaa316d3823..01ab5e8ff46f556cf46a5cc3c7b9994ca624139b 100644 --- a/src/client/src/tscAsync.c +++ b/src/client/src/tscAsync.c @@ -45,9 +45,10 @@ void doAsyncQuery(STscObj* pObj, SSqlObj* pSql, void (*fp)(), void* param, const SSqlRes *pRes = &pSql->res; pSql->signature = pSql; + pSql->param = param; pSql->pTscObj = pObj; + pSql->maxRetry = TSDB_VNODES_SUPPORT; pSql->fp = fp; - pSql->param = param; if (TSDB_CODE_SUCCESS != tscAllocPayload(pCmd, TSDB_DEFAULT_PAYLOAD_SIZE)) { tscError("failed to malloc payload"); diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index 84850dd42c563ec8ff90f0555e040516a41551c1..2b60355d6e48e96734027d3f1c8c1b9410757452 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -269,8 +269,7 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg) { return; } else { tscWarn("%p it shall renew table meta, code:%s, retry:%d", pSql, tstrerror(rpcMsg->code), ++pSql->retry); - - pSql->maxRetry = TSDB_VNODES_SUPPORT * 2; // todo move away + pSql->res.code = rpcMsg->code; // keep the previous error code if (pSql->retry > pSql->maxRetry) { tscError("%p max retry %d reached, give up", pSql, pSql->maxRetry); @@ -327,7 +326,7 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg) { * There is not response callback function for submit response. * The actual inserted number of points is the first number. */ - if (rpcMsg->msgType == TSDB_MSG_TYPE_SUBMIT_RSP) { + if (rpcMsg->msgType == TSDB_MSG_TYPE_SUBMIT_RSP && pRes->pRsp != NULL) { SShellSubmitRspMsg *pMsg = (SShellSubmitRspMsg*)pRes->pRsp; pMsg->code = htonl(pMsg->code); pMsg->numOfRows = htonl(pMsg->numOfRows); diff --git a/src/client/src/tscSql.c b/src/client/src/tscSql.c index 641d0b449c39835be358aa9fc02538b5b3ba2fce..a5e18a6b8df1449e52c2fde1b60d4b6caf583872 100644 --- a/src/client/src/tscSql.c +++ b/src/client/src/tscSql.c @@ -129,6 +129,8 @@ STscObj *taosConnectImpl(const char *ip, const char *user, const char *pass, con pSql->pTscObj = pObj; pSql->signature = pSql; + pSql->maxRetry = TSDB_VNODES_SUPPORT; + tsem_init(&pSql->rspSem, 0, 0); pObj->pSql = pSql;