提交 aee8b603 编写于 作者: H Hongze Cheng

more TDB

上级 238550b0
......@@ -564,7 +564,7 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx) {
if (infoNews[nNews].size + cellBytes > TDB_PAGE_USABLE_SIZE(pPage)) {
// page is full, use a new page
nNews++;
// for a child leaf case, this cell is used as the new divider cell
// for a child leaf case, this cell is used as the new divider cell to parent
if (childLeaf) continue;
}
infoNews[nNews].cnt++;
......@@ -591,10 +591,13 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx) {
for (int iNew = nNews - 1; iNew > 0; iNew--) {
SCell *pCell;
SPage *pPage;
int nCells;
int cellBytes;
pPage = pOlds[infoNews[iNew - 1].oPage];
nCells = TDB_PAGE_TOTAL_CELLS(pPage);
for (;;) {
pPage = pOlds[infoNews[iNew - 1].oPage];
pCell = tdbPageGetCell(pPage, infoNews[iNew - 1].oIdx);
cellBytes = TDB_BYTES_CELL_TAKEN(pPage, pCell);
......@@ -604,7 +607,9 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx) {
infoNews[iNew - 1].size -= cellBytes;
if ((infoNews[iNew - 1].oIdx--) == 0) {
infoNews[iNew - 1].oPage--;
infoNews[iNew - 1].oIdx = TDB_PAGE_TOTAL_CELLS(pOlds[infoNews[iNew - 1].oPage]);
pPage = pOlds[infoNews[iNew - 1].oPage];
nCells = TDB_PAGE_TOTAL_CELLS(pPage);
infoNews[iNew - 1].oIdx = TDB_PAGE_TOTAL_CELLS(pPage);
}
if (infoNews[iNew].size > infoNews[iNew - 1].size) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册