From 71c8b91059211c053324707c04c3d5d9bbb66f0c Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Thu, 31 Mar 2022 07:52:35 +0000 Subject: [PATCH] more --- source/libs/tdb/src/db/tdbBtree.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index 81aa591808..51cd5fbffc 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -312,7 +312,8 @@ static int tdbBtreeOpenImpl(SBTree *pBt) { return -1; } - // TODO: Unref the page + // TODO: here still has problem + tdbPagerReturnPage(pBt->pPager, pPage); ASSERT(pgno != 0); pBt->root = pgno; @@ -763,6 +764,15 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx) { } } + // TODO: here is not corrent for drop case + for (int i = 0; i < nNews; i++) { + if (i < nOlds) { + tdbPagerReturnPage(pBt->pPager, pOlds[i]); + } else { + tdbPagerReturnPage(pBt->pPager, pNews[i]); + } + } + return 0; } @@ -814,6 +824,8 @@ static int tdbBtreeBalance(SBTC *pBtc) { return -1; } + tdbPagerReturnPage(pBtc->pBt->pPager, pBtc->pPage); + pBtc->iPage--; pBtc->pPage = pBtc->pgStack[pBtc->iPage]; } -- GitLab