提交 f8c9ae50 编写于 作者: H Hongze Cheng

more code

上级 2e443c39
......@@ -109,7 +109,7 @@ void vnodeBufPoolUnRef(SVBufPool* pPool);
int vnodeDecodeInfo(uint8_t* pData, SVnodeInfo* pInfo);
int32_t vnodeBufPoolRegisterQuery(SVBufPool* pPool, void* pQHandle, _query_reseek_func_t reseekFn);
int32_t vnodeBufPoolDeregisterQuery(SVBufPool* pPool);
int32_t vnodeBufPoolDeregisterQuery(SVBufPool* pPool, SQueryNode* pQNode);
// meta
typedef struct SMCtbCursor SMCtbCursor;
......
......@@ -765,18 +765,9 @@ int32_t tsdbUnrefMemTable(SMemTable *pMemTable, SQueryNode *pNode) {
int32_t code = 0;
if (pNode) {
vnodeBufPoolDeregisterQuery(pMemTable->pPool);
vnodeBufPoolDeregisterQuery(pMemTable->pPool, pNode);
}
#if 0
// unregister handle (todo: take concurrency in consideration)
if (pNode) {
pNode->pNext->ppNext = pNode->ppNext;
*pNode->ppNext = pNode->pNext;
taosMemoryFree(pNode);
}
#endif
int32_t nRef = atomic_sub_fetch_32(&pMemTable->nRef, 1);
if (nRef == 0) {
tsdbMemTableDestroy(pMemTable);
......
......@@ -290,12 +290,14 @@ _exit:
return code;
}
int32_t vnodeBufPoolDeregisterQuery(SVBufPool *pPool) {
int32_t vnodeBufPoolDeregisterQuery(SVBufPool *pPool, SQueryNode *pQNode) {
int32_t code = 0;
taosThreadMutexLock(&pPool->mutex);
ASSERT(0);
pQNode->pNext->ppNext = pQNode->ppNext;
*pQNode->ppNext = pQNode->pNext;
pPool->nQuery--;
taosThreadMutexUnlock(&pPool->mutex);
......
......@@ -45,10 +45,19 @@ static int32_t vnodeTryRecycleBufPool(SVnode *pVnode) {
}
pVnode->onRecycle->recycleNext = pVnode->onRecycle->recyclePrev = NULL;
{
// TODO: do recycle the buffer pool
ASSERT(0);
// do recycle the buffer pool
SVBufPool *pPool = pVnode->onRecycle;
taosThreadMutexLock(&pPool->mutex);
SQueryNode *pNode = pPool->qList.pNext;
while (pNode != &pPool->qList) {
// TODO: refact/finish here
pNode->reseek(pNode->pQHandle);
pNode = pNode->pNext;
}
taosThreadMutexUnlock(&pPool->mutex);
} else {
vDebug("vgId:%d no recyclable buffer pool", TD_VID(pVnode));
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册