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

more TDB

上级 09833d22
...@@ -685,6 +685,7 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx) { ...@@ -685,6 +685,7 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx) {
int szCell; int szCell;
SBtreeInitPageArg iarg; SBtreeInitPageArg iarg;
int iNew, nNewCells; int iNew, nNewCells;
SCellDecoder cd;
iarg.pBt = pBt; iarg.pBt = pBt;
iarg.flags = TDB_BTREE_PAGE_GET_FLAGS(pOlds[0]); iarg.flags = TDB_BTREE_PAGE_GET_FLAGS(pOlds[0]);
...@@ -718,10 +719,15 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx) { ...@@ -718,10 +719,15 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx) {
if (iNew == nNews - 1 && pIntHdr->pgno == 0) { if (iNew == nNews - 1 && pIntHdr->pgno == 0) {
pIntHdr->pgno = TDB_PAGE_PGNO(pNews[iNew]); pIntHdr->pgno = TDB_PAGE_PGNO(pNews[iNew]);
} else { } else {
// TODO: tdbBtreeDecodeCell(pPage, pCell, &cd);
((SPgno *)pCell)[0] = TDB_PAGE_PGNO(pNews[iNew]);
// TODO: pCell here may be inserted as an overflow cell, handle it // TODO: pCell here may be inserted as an overflow cell, handle it
tdbPageInsertCell(pParent, sIdx++, pCell, szCell, 0); SCell *pNewCell = malloc(cd.kLen + 9);
int szNewCell;
SPgno pgno;
pgno = TDB_PAGE_PGNO(pNews[iNew]);
tdbBtreeEncodeCell(pPage, cd.pKey, cd.kLen, (void *)&pgno, sizeof(SPgno), pNewCell, &szNewCell);
tdbPageInsertCell(pParent, sIdx++, pNewCell, szNewCell, 0);
} }
// move to next new page // move to next new page
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册