[td-1641]
This commit is contained in:
parent
6f9a5ae42e
commit
47a0bc2c71
|
@ -107,12 +107,14 @@ static FORCE_INLINE void taosCacheReleaseNode(SCacheObj *pCacheObj, SCacheDataNo
|
||||||
free(pNode);
|
free(pNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
static FORCE_INLINE void doRemoveElemInTrashcan(SCacheObj* pCacheObj, STrashElem *pElem) {
|
static FORCE_INLINE STrashElem* doRemoveElemInTrashcan(SCacheObj* pCacheObj, STrashElem *pElem) {
|
||||||
if (pElem->pData->signature != (uint64_t) pElem->pData) {
|
if (pElem->pData->signature != (uint64_t) pElem->pData) {
|
||||||
uWarn("key:sig:0x%" PRIx64 " %p data has been released, ignore", pElem->pData->signature, pElem->pData);
|
uWarn("key:sig:0x%" PRIx64 " %p data has been released, ignore", pElem->pData->signature, pElem->pData);
|
||||||
return;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
STrashElem* next = pElem->next;
|
||||||
|
|
||||||
pCacheObj->numOfElemsInTrash--;
|
pCacheObj->numOfElemsInTrash--;
|
||||||
if (pElem->prev) {
|
if (pElem->prev) {
|
||||||
pElem->prev->next = pElem->next;
|
pElem->prev->next = pElem->next;
|
||||||
|
@ -120,9 +122,15 @@ static FORCE_INLINE void doRemoveElemInTrashcan(SCacheObj* pCacheObj, STrashElem
|
||||||
pCacheObj->pTrash = pElem->next;
|
pCacheObj->pTrash = pElem->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pElem->next) {
|
if (next) {
|
||||||
pElem->next->prev = pElem->prev;
|
next->prev = pElem->prev;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pCacheObj->numOfElemsInTrash == 0) {
|
||||||
|
assert(pCacheObj->pTrash == NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
return next;
|
||||||
}
|
}
|
||||||
|
|
||||||
static FORCE_INLINE void doDestroyTrashcanElem(SCacheObj* pCacheObj, STrashElem *pElem) {
|
static FORCE_INLINE void doDestroyTrashcanElem(SCacheObj* pCacheObj, STrashElem *pElem) {
|
||||||
|
@ -580,9 +588,7 @@ void taosTrashcanEmpty(SCacheObj *pCacheObj, bool force) {
|
||||||
pCacheObj->numOfElemsInTrash - 1);
|
pCacheObj->numOfElemsInTrash - 1);
|
||||||
|
|
||||||
STrashElem *p = pElem;
|
STrashElem *p = pElem;
|
||||||
pElem = pElem->next;
|
pElem = doRemoveElemInTrashcan(pCacheObj, p);
|
||||||
|
|
||||||
doRemoveElemInTrashcan(pCacheObj, p);
|
|
||||||
doDestroyTrashcanElem(pCacheObj, p);
|
doDestroyTrashcanElem(pCacheObj, p);
|
||||||
} else {
|
} else {
|
||||||
pElem = pElem->next;
|
pElem = pElem->next;
|
||||||
|
|
Loading…
Reference in New Issue