From 2e6f7f15d5934ab67f6ee2cb1f2e7bb435bccb9e Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Mon, 21 Mar 2022 07:59:37 +0000 Subject: [PATCH] more TDB --- source/libs/tdb/src/db/tdbBtree.c | 6 ------ source/libs/tdb/src/page/tdbPage.c | 7 ++++++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index 9e6ea91a4c..5f56b2f1e7 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -482,12 +482,6 @@ static int tdbBtreeBalanceDeeper(SBTree *pBt, SPage *pRoot, SPage **ppChild) { // Copy the root page content to the child page tdbPageCopy(pRoot, pChild); - pChild->nOverflow = pRoot->nOverflow; - for (int i = 0; i < pChild->nOverflow; i++) { - pChild->apOvfl[i] = pRoot->apOvfl[i]; - pChild->aiOvfl[i] = pRoot->aiOvfl[i]; - } - // Reinitialize the root page zArg.flags = TDB_BTREE_ROOT; zArg.pBt = pBt; diff --git a/source/libs/tdb/src/page/tdbPage.c b/source/libs/tdb/src/page/tdbPage.c index 803bf168cf..2f6d4101a5 100644 --- a/source/libs/tdb/src/page/tdbPage.c +++ b/source/libs/tdb/src/page/tdbPage.c @@ -226,7 +226,12 @@ void tdbPageCopy(SPage *pFromPage, SPage *pToPage) { TDB_PAGE_NFREE_SET(pToPage, nFree - delta); } - // TODO: do we need to copy the overflow part ??? + // Copy the overflow cells + for (int iOvfl = 0; iOvfl < pFromPage->nOverflow; iOvfl++) { + pToPage->aiOvfl[iOvfl] = pFromPage->aiOvfl[iOvfl]; + pToPage->apOvfl[iOvfl] = pFromPage->apOvfl[iOvfl]; + } + pToPage->nOverflow = pFromPage->nOverflow; } static int tdbPageAllocate(SPage *pPage, int szCell, SCell **ppCell) {