From 493670d2f0ba7c226af5b00b54c8ef4b0447ee0e Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Thu, 24 Mar 2022 08:11:07 +0000 Subject: [PATCH] more TDB --- source/libs/tdb/src/db/tdbBtree.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index de2ed60ec7..eec75d3a13 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -482,9 +482,11 @@ static int tdbBtreeBalanceDeeper(SBTree *pBt, SPage *pRoot, SPage **ppChild) { u8 flags; SIntHdr *pIntHdr; SBtreeInitPageArg zArg; + u8 leaf; pPager = pRoot->pPager; flags = TDB_BTREE_PAGE_GET_FLAGS(pRoot); + leaf = TDB_BTREE_PAGE_IS_LEAF(flags); // Allocate a new child page zArg.flags = TDB_FLAG_REMOVE(flags, TDB_BTREE_ROOT); @@ -494,6 +496,10 @@ static int tdbBtreeBalanceDeeper(SBTree *pBt, SPage *pRoot, SPage **ppChild) { return -1; } + if (!leaf) { + ((SIntHdr *)pChild->pData)->pgno = ((SIntHdr *)(pRoot->pData))->pgno; + } + // Copy the root page content to the child page tdbPageCopy(pRoot, pChild);