From 223f78d86459e372f82dd4d2c8cab7eed4e3132c Mon Sep 17 00:00:00 2001 From: hjxilinx Date: Thu, 16 Apr 2020 11:52:16 +0800 Subject: [PATCH] [td-98] fix empty rsp cause submit failure [td-98] fix empty rsp cause submit failure --- src/client/src/tscAsync.c | 3 ++- src/client/src/tscServer.c | 5 ++--- src/client/src/tscSql.c | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/client/src/tscAsync.c b/src/client/src/tscAsync.c index 610027151f..01ab5e8ff4 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 84850dd42c..2b60355d6e 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 641d0b449c..a5e18a6b8d 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; -- GitLab