fix: close wal ref
This commit is contained in:
parent
5b8cc2234b
commit
a6fff95795
|
@ -725,10 +725,16 @@ int32_t tqProcessDeleteSubReq(STQ* pTq, int64_t version, char* msg, int32_t msgL
|
|||
}
|
||||
taosWUnLockLatch(&pTq->pushLock);
|
||||
|
||||
STqHandle* pHandle = taosHashGet(pTq->pHandle, pReq->subKey, strlen(pReq->subKey));
|
||||
if (pHandle) {
|
||||
if (pHandle->pRef) {
|
||||
walCloseRef(pTq->pVnode->pWal, pHandle->pRef->refId);
|
||||
}
|
||||
code = taosHashRemove(pTq->pHandle, pReq->subKey, strlen(pReq->subKey));
|
||||
if (code != 0) {
|
||||
tqError("cannot process tq delete req %s, since no such handle", pReq->subKey);
|
||||
}
|
||||
}
|
||||
|
||||
code = tqOffsetDelete(pTq->pOffsetStore, pReq->subKey);
|
||||
if (code != 0) {
|
||||
|
@ -736,7 +742,7 @@ int32_t tqProcessDeleteSubReq(STQ* pTq, int64_t version, char* msg, int32_t msgL
|
|||
}
|
||||
|
||||
if (tqMetaDeleteHandle(pTq, pReq->subKey) < 0) {
|
||||
ASSERT(0);
|
||||
tqError("cannot process tq delete req %s, since no such offset in tdb", pReq->subKey);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -223,6 +223,7 @@ void walClose(SWal *pWal) {
|
|||
taosMemoryFree(pRef);
|
||||
}
|
||||
taosHashCleanup(pWal->pRefHash);
|
||||
pWal->pRefHash = NULL;
|
||||
taosThreadMutexUnlock(&pWal->mutex);
|
||||
|
||||
taosRemoveRef(tsWal.refSetId, pWal->refId);
|
||||
|
|
|
@ -32,15 +32,18 @@ SWalRef *walOpenRef(SWal *pWal) {
|
|||
return pRef;
|
||||
}
|
||||
|
||||
#if 1
|
||||
void walCloseRef(SWal *pWal, int64_t refId) {
|
||||
SWalRef **ppRef = taosHashGet(pWal->pRefHash, &refId, sizeof(int64_t));
|
||||
if (ppRef == NULL) return;
|
||||
SWalRef *pRef = *ppRef;
|
||||
if (pRef) {
|
||||
wDebug("vgId:%d, wal close ref %" PRId64 ", refId %" PRId64, pWal->cfg.vgId, pRef->refVer, pRef->refId);
|
||||
} else {
|
||||
wDebug("vgId:%d, wal close ref null, refId %" PRId64, pWal->cfg.vgId, refId);
|
||||
}
|
||||
taosHashRemove(pWal->pRefHash, &refId, sizeof(int64_t));
|
||||
taosMemoryFree(pRef);
|
||||
}
|
||||
#endif
|
||||
|
||||
int32_t walRefVer(SWalRef *pRef, int64_t ver) {
|
||||
SWal *pWal = pRef->pWal;
|
||||
|
|
Loading…
Reference in New Issue