This commit is contained in:
Hongze Cheng 2022-03-22 02:39:12 +00:00
parent e2f1434bf2
commit d5afc7240a
1 changed files with 21 additions and 5 deletions

View File

@ -745,13 +745,29 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx) {
} }
} }
} }
int k = 0;
} }
SPage *pNews[5]; SPage *pNews[5] = {0};
{ { // Allocate new pages, reuse the old page when possible
// Allocate the new pages
SPgno pgno;
SBtreeInitPageArg iarg;
u8 flags;
flags = TDB_BTREE_PAGE_GET_FLAGS(pOlds[0]);
for (int iNew = 0; iNew < nNews; iNew++) {
if (iNew < nOlds) {
pNews[iNew] = pOlds[iNew];
} else {
iarg.pBt = pBt;
iarg.flags = flags;
ret = tdbPagerNewPage(pBt->pPager, &pgno, pNews + iNew, tdbBtreeZeroPage, &iarg);
if (ret < 0) {
ASSERT(0);
}
}
}
} }
{ {