more TDB
This commit is contained in:
parent
09833d2244
commit
d5a1c7a31f
|
@ -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) {
|
||||||
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
|
||||||
|
|
Loading…
Reference in New Issue