[TBASE-1112], and refactor some code.
This commit is contained in:
parent
ce863c00f6
commit
cf1ae56ebb
|
@ -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 {
|
||||
|
|
|
@ -673,7 +673,7 @@ typedef struct {
|
|||
|
||||
typedef struct {
|
||||
uint64_t qhandle;
|
||||
int16_t free;
|
||||
uint16_t free;
|
||||
} SRetrieveMeterMsg;
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue