提交 2ce6142c 编写于 作者: J Jeff Tao

a wrong pointer in vnodeWriteToQueue

refCount shall be increased by one
上级 f4a4610b
......@@ -92,7 +92,7 @@ void *taosAllocateQitem(int size) {
void taosFreeQitem(void *param) {
if (param == NULL) return;
//pTrace("item:%p is freed", param);
pTrace("item:%p is freed", param);
char *temp = (char *)param;
temp -= sizeof(STaosQnode);
......@@ -117,7 +117,7 @@ int taosWriteQitem(taos_queue param, int type, void *item) {
queue->numOfItems++;
if (queue->qset) atomic_add_fetch_32(&queue->qset->numOfItems, 1);
//pTrace("item:%p is put into queue, type:%d items:%d", item, type, queue->numOfItems);
pTrace("item:%p is put into queue, type:%d items:%d", item, type, queue->numOfItems);
pthread_mutex_unlock(&queue->mutex);
......@@ -197,7 +197,7 @@ int taosGetQitem(taos_qall param, int *type, void **pitem) {
*pitem = pNode->item;
*type = pNode->type;
num = 1;
// pTrace("item:%p is fetched, type:%d", *pitem, *type);
pTrace("item:%p is fetched, type:%d", *pitem, *type);
}
return num;
......
......@@ -165,7 +165,10 @@ void vnodeRelease(void *pVnodeRaw) {
int32_t refCount = atomic_sub_fetch_32(&pVnode->refCount, 1);
if (refCount > 0) return;
if (refCount > 0) {
dTrace("pVnode:%p vgId:%d, release vnode, refCount:%d", pVnode, pVnode->vgId, refCount);
return;
}
// remove read queue
dnodeFreeRqueue(pVnode->rqueue);
......
......@@ -255,7 +255,8 @@ int vnodeWriteToQueue(void *param, SWalHead *pHead, int type) {
SWalHead *pWal = (SWalHead *)taosAllocateQitem(size);
memcpy(pWal, pHead, size);
taosWriteQitem(pVnode->wqueue, type, pHead);
atomic_add_fetch_32(&pVnode->refCount, 1);
taosWriteQitem(pVnode->wqueue, type, pWal);
return 0;
}
......
......@@ -287,6 +287,8 @@ static int walRestoreWalFile(char *name, void *pVnode, int (*writeFp)(void *, SW
(*writeFp)(pVnode, pHead, TAOS_QTYPE_WAL);
}
free(buffer);
return code;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册