From b12e12f8402bfcd8871349e559e539c0e4e75f00 Mon Sep 17 00:00:00 2001 From: hjxilinx Date: Tue, 12 Nov 2019 11:47:47 +0800 Subject: [PATCH] add some logs for release resource at vnode side --- src/inc/tsdb.h | 18 +++++++++--------- src/system/detail/src/vnodeShell.c | 9 ++++++++- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/inc/tsdb.h b/src/inc/tsdb.h index de4e430a46..4c43171283 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 353b2668ee..bbe2f60274 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; -- GitLab