diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index 67118b50e2db7994734d7ebb0245b0140f5e21a2..6148aed91bd43495c8e419c4bf59cba821ba83df 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -2460,10 +2460,10 @@ int tscBuildRetrieveFromMgmtMsg(SSqlObj *pSql) { pMsg += sizeof(SMgmtHead); - *((uint64_t *)pMsg) = pSql->res.qhandle; + *((uint64_t *) pMsg) = pSql->res.qhandle; pMsg += sizeof(pSql->res.qhandle); - *pMsg = htons(pCmd->type); + *((uint16_t*) pMsg) = htons(pCmd->type); pMsg += sizeof(pCmd->type); msgLen = pMsg - pStart; @@ -3451,11 +3451,12 @@ int tscProcessRetrieveRspFromVnode(SSqlObj *pSql) { pRes->row = 0; /** - * If the query result is exhausted, the connection will be recycled. - * If current query is to free resource at server side, the connection will be recycle. + * If the query result is exhausted, or current query is to free resource at server side, + * the connection will be recycled. */ if ((pRes->numOfRows == 0 && !(tscProjectionQueryOnMetric(pCmd) && pRes->offset > 0)) || ((pCmd->type & TSDB_QUERY_TYPE_FREE_RESOURCE) == TSDB_QUERY_TYPE_FREE_RESOURCE)) { + tscTrace("%p no result or free resource, recycle connection", pSql); taosAddConnIntoCache(tscConnCache, pSql->thandle, pSql->ip, pSql->vnode, pObj->user); pSql->thandle = NULL; } else { diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h index 1d5e1bb5a5642b18809b60ded817f4aa324a9ab0..4f037a2f07e8edf78c5ea2cb69f7b65ba75e4bdc 100644 --- a/src/inc/taosmsg.h +++ b/src/inc/taosmsg.h @@ -673,7 +673,7 @@ typedef struct { typedef struct { uint64_t qhandle; - int16_t free; + uint16_t free; } SRetrieveMeterMsg; typedef struct { diff --git a/src/kit/shell/src/shellEngine.c b/src/kit/shell/src/shellEngine.c index 12c844d00db8f525a2e52196292d4465984d96ce..0e6519bec00599e48a48eeab6a0bff30a4426ee5 100644 --- a/src/kit/shell/src/shellEngine.c +++ b/src/kit/shell/src/shellEngine.c @@ -846,7 +846,7 @@ void shellGetGrantInfo(void *con) { TAOS_FIELD *fields = taos_fetch_fields(result); TAOS_ROW row = taos_fetch_row(result); if (row == NULL) { - fprintf(stderr, "\nGrant information is empty.\n"); + fprintf(stderr, "\nFailed to grant information from server. Abort.\n"); exit(0); } diff --git a/src/system/detail/src/mgmtShell.c b/src/system/detail/src/mgmtShell.c index 43b002992df2f12ce982e88d8a8822aaab04e70a..2661ec0d3723e36546add584c46d72745d061206 100644 --- a/src/system/detail/src/mgmtShell.c +++ b/src/system/detail/src/mgmtShell.c @@ -873,7 +873,7 @@ int mgmtProcessRetrieveMsg(char *pMsg, int msgLen, SConnObj *pConn) { taosSendSimpleRsp(pConn->thandle, TSDB_MSG_TYPE_RETRIEVE_RSP, TSDB_CODE_MEMORY_CORRUPTED); return -1; } else { - if ((pRetrieve->free & TSDB_QUERY_TYPE_FREE_RESOURCE) == 0) { + if ((pRetrieve->free & TSDB_QUERY_TYPE_FREE_RESOURCE) != TSDB_QUERY_TYPE_FREE_RESOURCE) { rowsToRead = pShow->numOfRows - pShow->numOfReads; } @@ -905,7 +905,7 @@ int mgmtProcessRetrieveMsg(char *pMsg, int msgLen, SConnObj *pConn) { pMsg = pRsp->data; // if free flag is set, client wants to clean the resources - if ((pRetrieve->free & TSDB_QUERY_TYPE_FREE_RESOURCE) == 0) + if ((pRetrieve->free & TSDB_QUERY_TYPE_FREE_RESOURCE) != TSDB_QUERY_TYPE_FREE_RESOURCE) rowsRead = (*mgmtRetrieveFp[pShow->type])(pShow, pRsp->data, rowsToRead, pConn); if (rowsRead < 0) {