diff --git a/src/inc/tsdb.h b/src/inc/tsdb.h index de4e430a462f851b3b34ff32fc8acc738a40ad8b..4c43171283b5341fd8aff41c3c8c9637803c1f1d 100644 --- a/src/inc/tsdb.h +++ b/src/inc/tsdb.h @@ -221,20 +221,20 @@ enum _syncstatus { #define TSDB_MAX_RPC_THREADS 5 #define TSDB_QUERY_TYPE_QUERY 0 // normal query -#define TSDB_QUERY_TYPE_FREE_RESOURCE 0x1 // free qhandle at vnode +#define TSDB_QUERY_TYPE_FREE_RESOURCE 0x01U // free qhandle at vnode /* * 1. ordinary sub query for select * from super_table * 2. all sqlobj generated by createSubqueryObj with this flag */ -#define TSDB_QUERY_TYPE_SUBQUERY 0x2 -#define TSDB_QUERY_TYPE_STABLE_SUBQUERY 0x4 // two-stage subquery for super table - -#define TSDB_QUERY_TYPE_TABLE_QUERY 0x8 // query ordinary table; below only apply to client side -#define TSDB_QUERY_TYPE_STABLE_QUERY 0x10 // query on super table -#define TSDB_QUERY_TYPE_JOIN_QUERY 0x20 // join query -#define TSDB_QUERY_TYPE_PROJECTION_QUERY 0x40 // select *,columns... query -#define TSDB_QUERY_TYPE_JOIN_SEC_STAGE 0x80 // join sub query at the second stage +#define TSDB_QUERY_TYPE_SUBQUERY 0x02U +#define TSDB_QUERY_TYPE_STABLE_SUBQUERY 0x04U // two-stage subquery for super table + +#define TSDB_QUERY_TYPE_TABLE_QUERY 0x08U // query ordinary table; below only apply to client side +#define TSDB_QUERY_TYPE_STABLE_QUERY 0x10U // query on super table +#define TSDB_QUERY_TYPE_JOIN_QUERY 0x20U // join query +#define TSDB_QUERY_TYPE_PROJECTION_QUERY 0x40U // select *,columns... query +#define TSDB_QUERY_TYPE_JOIN_SEC_STAGE 0x80U // join sub query at the second stage #ifdef __cplusplus } diff --git a/src/system/detail/src/vnodeShell.c b/src/system/detail/src/vnodeShell.c index 353b2668ee94c1da31b005f84beb63e5036b6341..bbe2f60274c5e17a884b842322cd9e6ca4f756df 100644 --- a/src/system/detail/src/vnodeShell.c +++ b/src/system/detail/src/vnodeShell.c @@ -385,14 +385,21 @@ void vnodeExecuteRetrieveReq(SSchedMsg *pSched) { pRetrieve = (SRetrieveMeterMsg *)pMsg; pRetrieve->free = htons(pRetrieve->free); + if ((pRetrieve->free & TSDB_QUERY_TYPE_FREE_RESOURCE) != TSDB_QUERY_TYPE_FREE_RESOURCE) { + dTrace("retrieve msg, handle:%p, free:%d", pRetrieve->qhandle, pRetrieve->free); + } else { + dTrace("retrieve msg to free resource from client, handle:%p, free:%d", pRetrieve->qhandle, pRetrieve->free); + } + /* * in case of server restart, apps may hold qhandle created by server before restart, * which is actually invalid, therefore, signature check is required. */ if (pRetrieve->qhandle == (uint64_t)pObj->qhandle) { // if free flag is set, client wants to clean the resources - if ((pRetrieve->free & TSDB_QUERY_TYPE_FREE_RESOURCE) != TSDB_QUERY_TYPE_FREE_RESOURCE) + if ((pRetrieve->free & TSDB_QUERY_TYPE_FREE_RESOURCE) != TSDB_QUERY_TYPE_FREE_RESOURCE) { code = vnodeRetrieveQueryInfo((void *)(pRetrieve->qhandle), &numOfRows, &rowSize, &timePrec); + } } else { dError("QInfo:%p, qhandle:%p is not matched with saved:%p", pObj->qhandle, pRetrieve->qhandle, pObj->qhandle); code = TSDB_CODE_INVALID_QHANDLE;