From 938b3a41d5a0252040e340ffc6ef5076637d64bc Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Sat, 26 Mar 2022 11:25:18 +0000 Subject: [PATCH] fix defragment bug --- source/libs/tdb/src/page/tdbPage.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/libs/tdb/src/page/tdbPage.c b/source/libs/tdb/src/page/tdbPage.c index 516330e4e6..f1eee48b0e 100644 --- a/source/libs/tdb/src/page/tdbPage.c +++ b/source/libs/tdb/src/page/tdbPage.c @@ -372,11 +372,11 @@ static int tdbPageDefragment(SPage *pPage) { int idx; int iCell; - ASSERT(pPage->pFreeEnd - pPage->pFreeStart < nFree); - nFree = TDB_PAGE_NFREE(pPage); nCells = TDB_PAGE_NCELLS(pPage); + ASSERT(pPage->pFreeEnd - pPage->pFreeStart < nFree); + // Loop to compact the page content // Here we use an O(n^2) algorithm to do the job since // this is a low frequency job.