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

fix another bug

上级 08a27077
...@@ -516,7 +516,7 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx) { ...@@ -516,7 +516,7 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx) {
int ret; int ret;
int nOlds; int nOlds;
SPage *pOlds[3]; SPage *pOlds[3] = {0};
SCell *pDivCell[3] = {0}; SCell *pDivCell[3] = {0};
int szDivCell[3]; int szDivCell[3];
int sIdx; int sIdx;
...@@ -573,9 +573,9 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx) { ...@@ -573,9 +573,9 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx) {
if (i < nOlds - 1) { if (i < nOlds - 1) {
((SPgno *)pDivCell[i])[0] = ((SIntHdr *)pOlds[i]->pData)->pgno; ((SPgno *)pDivCell[i])[0] = ((SIntHdr *)pOlds[i]->pData)->pgno;
((SIntHdr *)pOlds[i]->pData)->pgno = 0; ((SIntHdr *)pOlds[i]->pData)->pgno = 0;
}
tdbPageInsertCell(pOlds[i], TDB_PAGE_TOTAL_CELLS(pOlds[i]), pDivCell[i], szDivCell[i], 1); tdbPageInsertCell(pOlds[i], TDB_PAGE_TOTAL_CELLS(pOlds[i]), pDivCell[i], szDivCell[i], 1);
} }
}
rPgno = ((SIntHdr *)pOlds[nOlds - 1]->pData)->pgno; rPgno = ((SIntHdr *)pOlds[nOlds - 1]->pData)->pgno;
} }
// drop the cells on parent page // drop the cells on parent page
...@@ -740,7 +740,7 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx) { ...@@ -740,7 +740,7 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx) {
szCell = tdbBtreeCellSize(pPage, pCell); szCell = tdbBtreeCellSize(pPage, pCell);
ASSERT(nNewCells <= infoNews[iNew].cnt); ASSERT(nNewCells <= infoNews[iNew].cnt);
ASSERT(iNew < nNews - 1); ASSERT(iNew < nNews);
if (nNewCells < infoNews[iNew].cnt) { if (nNewCells < infoNews[iNew].cnt) {
tdbPageInsertCell(pNews[iNew], nNewCells, pCell, szCell, 0); tdbPageInsertCell(pNews[iNew], nNewCells, pCell, szCell, 0);
...@@ -791,6 +791,7 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx) { ...@@ -791,6 +791,7 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx) {
} }
} }
} }
}
if (childNotLeaf) { if (childNotLeaf) {
ASSERT(TDB_PAGE_TOTAL_CELLS(pNews[nNews - 1]) == infoNews[nNews - 1].cnt); ASSERT(TDB_PAGE_TOTAL_CELLS(pNews[nNews - 1]) == infoNews[nNews - 1].cnt);
...@@ -804,7 +805,6 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx) { ...@@ -804,7 +805,6 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx) {
tdbPageInsertCell(pParent, sIdx, pDivCell[nOlds - 1], szDivCell[nOlds - 1], 0); tdbPageInsertCell(pParent, sIdx, pDivCell[nOlds - 1], szDivCell[nOlds - 1], 0);
} }
} }
}
for (int i = 0; i < nOlds; i++) { for (int i = 0; i < nOlds; i++) {
tdbPageDestroy(pOldsCopy[i], NULL, NULL); tdbPageDestroy(pOldsCopy[i], NULL, NULL);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册