tdb/pcache: not free page if already on free list

This commit is contained in:
Minglei Jin 2023-09-08 09:28:08 +08:00
parent 5007087e19
commit 3524ef32eb
1 changed files with 8 additions and 2 deletions

View File

@ -229,9 +229,15 @@ void tdbPCacheInvalidatePage(SPCache *pCache, SPager *pPager, SPgno pgno) {
} }
if (pPage) { if (pPage) {
tdbPCachePinPage(pCache, pPage); bool moveToFreeList = false;
if (pPage->pLruNext) {
tdbPCachePinPage(pCache, pPage);
moveToFreeList = true;
}
tdbPCacheRemovePageFromHash(pCache, pPage); tdbPCacheRemovePageFromHash(pCache, pPage);
tdbPCacheFreePage(pCache, pPage); if (moveToFreeList) {
tdbPCacheFreePage(pCache, pPage);
}
} }
} }