[TBASE-1112], and refactor some code.
This commit is contained in:
parent
ce863c00f6
commit
cf1ae56ebb
|
@ -2463,7 +2463,7 @@ int tscBuildRetrieveFromMgmtMsg(SSqlObj *pSql) {
|
||||||
*((uint64_t *) pMsg) = pSql->res.qhandle;
|
*((uint64_t *) pMsg) = pSql->res.qhandle;
|
||||||
pMsg += sizeof(pSql->res.qhandle);
|
pMsg += sizeof(pSql->res.qhandle);
|
||||||
|
|
||||||
*pMsg = htons(pCmd->type);
|
*((uint16_t*) pMsg) = htons(pCmd->type);
|
||||||
pMsg += sizeof(pCmd->type);
|
pMsg += sizeof(pCmd->type);
|
||||||
|
|
||||||
msgLen = pMsg - pStart;
|
msgLen = pMsg - pStart;
|
||||||
|
@ -3451,11 +3451,12 @@ int tscProcessRetrieveRspFromVnode(SSqlObj *pSql) {
|
||||||
pRes->row = 0;
|
pRes->row = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the query result is exhausted, the connection will be recycled.
|
* If the query result is exhausted, or current query is to free resource at server side,
|
||||||
* If current query is to free resource at server side, the connection will be recycle.
|
* the connection will be recycled.
|
||||||
*/
|
*/
|
||||||
if ((pRes->numOfRows == 0 && !(tscProjectionQueryOnMetric(pCmd) && pRes->offset > 0)) ||
|
if ((pRes->numOfRows == 0 && !(tscProjectionQueryOnMetric(pCmd) && pRes->offset > 0)) ||
|
||||||
((pCmd->type & TSDB_QUERY_TYPE_FREE_RESOURCE) == TSDB_QUERY_TYPE_FREE_RESOURCE)) {
|
((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);
|
taosAddConnIntoCache(tscConnCache, pSql->thandle, pSql->ip, pSql->vnode, pObj->user);
|
||||||
pSql->thandle = NULL;
|
pSql->thandle = NULL;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -673,7 +673,7 @@ typedef struct {
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint64_t qhandle;
|
uint64_t qhandle;
|
||||||
int16_t free;
|
uint16_t free;
|
||||||
} SRetrieveMeterMsg;
|
} SRetrieveMeterMsg;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -846,7 +846,7 @@ void shellGetGrantInfo(void *con) {
|
||||||
TAOS_FIELD *fields = taos_fetch_fields(result);
|
TAOS_FIELD *fields = taos_fetch_fields(result);
|
||||||
TAOS_ROW row = taos_fetch_row(result);
|
TAOS_ROW row = taos_fetch_row(result);
|
||||||
if (row == NULL) {
|
if (row == NULL) {
|
||||||
fprintf(stderr, "\nGrant information is empty.\n");
|
fprintf(stderr, "\nFailed to grant information from server. Abort.\n");
|
||||||
exit(0);
|
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);
|
taosSendSimpleRsp(pConn->thandle, TSDB_MSG_TYPE_RETRIEVE_RSP, TSDB_CODE_MEMORY_CORRUPTED);
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} 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;
|
rowsToRead = pShow->numOfRows - pShow->numOfReads;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -905,7 +905,7 @@ int mgmtProcessRetrieveMsg(char *pMsg, int msgLen, SConnObj *pConn) {
|
||||||
pMsg = pRsp->data;
|
pMsg = pRsp->data;
|
||||||
|
|
||||||
// if free flag is set, client wants to clean the resources
|
// 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);
|
rowsRead = (*mgmtRetrieveFp[pShow->type])(pShow, pRsp->data, rowsToRead, pConn);
|
||||||
|
|
||||||
if (rowsRead < 0) {
|
if (rowsRead < 0) {
|
||||||
|
|
Loading…
Reference in New Issue