From ae244c9e849c71b02c99307b84d7590fedcdad3d Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 30 Jul 2020 17:22:13 +0800 Subject: [PATCH] [td-225] refactor codes. --- src/util/src/tcache.c | 2 +- src/vnode/src/vnodeRead.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/util/src/tcache.c b/src/util/src/tcache.c index 8470eedd0e..dc9128d4a9 100644 --- a/src/util/src/tcache.c +++ b/src/util/src/tcache.c @@ -276,7 +276,7 @@ void *taosCachePut(SCacheObj *pCacheObj, const void *key, size_t keyLen, const v return NULL; } - __cache_rd_lock(pCacheObj); + __cache_wr_lock(pCacheObj); SCacheDataNode **pt = (SCacheDataNode **)taosHashGet(pCacheObj->pHashTable, key, keyLen); SCacheDataNode * pOld = (pt != NULL) ? (*pt) : NULL; diff --git a/src/vnode/src/vnodeRead.c b/src/vnode/src/vnodeRead.c index 3c642b5098..6c05091cec 100644 --- a/src/vnode/src/vnodeRead.c +++ b/src/vnode/src/vnodeRead.c @@ -207,6 +207,7 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SReadMsg *pReadMsg) { vDebug("vgId:%d, QInfo:%p, start to build result rsp after query paused, %p", pVnode->vgId, *handle, pReadMsg->rpcMsg.handle); code = vnodeDumpQueryResult(&pReadMsg->rspRet, pVnode, *handle, &freehandle); + freehandle = false; // todo test the error code case if (code == TSDB_CODE_SUCCESS) { code = TSDB_CODE_QRY_HAS_RSP; @@ -266,6 +267,7 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SReadMsg *pReadMsg) { } code = vnodeDumpQueryResult(pRet, pVnode, *handle, &freeHandle); + freeHandle = false; } qReleaseQInfo(pVnode->qMgmt, (void**) &handle, freeHandle); -- GitLab