diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index 6072b8312192bbb6109cc7f55672e79f3a202f56..1070f65284305210a9ae81b568e0efe8717d84a2 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -6227,6 +6227,7 @@ static SQInfo *createQInfoImpl(SQueryTableMsg *pQueryMsg, SSqlGroupbyExpr *pGrou // NOTE: pTableCheckInfo need to update the query time range and the lastKey info pQInfo->arrTableIdInfo = taosArrayInit(tableIndex, sizeof(STableIdInfo)); pQInfo->dataReady = QUERY_RESULT_NOT_READY; + pQInfo->rspContext = NULL; pthread_mutex_init(&pQInfo->lock, NULL); pQuery->pos = -1; @@ -6761,6 +6762,7 @@ int32_t qRetrieveQueryResultInfo(qinfo_t qinfo, bool* buildRes, void* pRspContex SQInfo *pQInfo = (SQInfo *)qinfo; if (pQInfo == NULL || !isValidQInfo(pQInfo)) { + qError("QInfo:%p invalid qhandle", pQInfo); return TSDB_CODE_QRY_INVALID_QHANDLE; } @@ -6773,6 +6775,8 @@ int32_t qRetrieveQueryResultInfo(qinfo_t qinfo, bool* buildRes, void* pRspContex int32_t code = TSDB_CODE_SUCCESS; pthread_mutex_lock(&pQInfo->lock); + assert(pQInfo->rspContext == NULL); + if (pQInfo->dataReady == QUERY_RESULT_READY) { *buildRes = true; qDebug("QInfo:%p retrieve result info, rowsize:%d, rows:%"PRId64", code:%d", pQInfo, pQuery->rowSize, pQuery->rec.rows, @@ -6781,6 +6785,7 @@ int32_t qRetrieveQueryResultInfo(qinfo_t qinfo, bool* buildRes, void* pRspContex *buildRes = false; qDebug("QInfo:%p retrieve req set query return result after paused", pQInfo); pQInfo->rspContext = pRspContext; + assert(pQInfo->rspContext != NULL); } code = pQInfo->code; diff --git a/src/vnode/src/vnodeRead.c b/src/vnode/src/vnodeRead.c index 79e69b97a1491b3e4b971ac767b5ccb02e5a8cff..a610a8b0df2e43b11356cb4af9ebba5809ba9c62 100644 --- a/src/vnode/src/vnodeRead.c +++ b/src/vnode/src/vnodeRead.c @@ -295,6 +295,8 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SReadMsg *pReadMsg) { freeHandle = true; } else { // result is not ready, return immediately if (!buildRes) { + assert(pReadMsg->rpcMsg.handle != NULL); + qReleaseQInfo(pVnode->qMgmt, (void **)&handle, false); return TSDB_CODE_QRY_NOT_READY; }