more TDB
This commit is contained in:
parent
976cf60bdc
commit
3e30e45c04
|
@ -461,22 +461,29 @@ static int tdbBtreeBalanceDeeper(SBTree *pBt, SPage *pRoot, SPage **ppChild) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tdbBtreeBalanceStep1(SBtreeBalanceHelper *pBlh) {
|
static int tdbBtreeBalanceStep1(SBtreeBalanceHelper *pBlh) {
|
||||||
#if 0
|
int i;
|
||||||
// TODO: Find three or less sibling pages on either side
|
SPage *pParent;
|
||||||
|
int nDiv;
|
||||||
|
SPgno pgno;
|
||||||
|
SPage *pPage;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
pParent = pBlh->pParent;
|
||||||
i = pParent->pPageHdr->nCells + pParent->nOverflow;
|
i = pParent->pPageHdr->nCells + pParent->nOverflow;
|
||||||
|
|
||||||
if (i < 1) {
|
if (i < 1) {
|
||||||
nDiv = 0;
|
nDiv = 0;
|
||||||
} else {
|
} else {
|
||||||
if (idx == 0) {
|
if (pBlh->idx == 0) {
|
||||||
nDiv = 0;
|
nDiv = 0;
|
||||||
} else if (idx == i) {
|
} else if (pBlh->idx == i) {
|
||||||
nDiv = i - 2;
|
nDiv = i - 2;
|
||||||
} else {
|
} else {
|
||||||
nDiv = idx - 1;
|
nDiv = pBlh->idx - 1;
|
||||||
}
|
}
|
||||||
i = 2;
|
i = 2;
|
||||||
}
|
}
|
||||||
nOldPages = i + 1;
|
pBlh->nOldPages = i + 1;
|
||||||
|
|
||||||
if (i + nDiv - pParent->nOverflow == pParent->pPageHdr->nCells) {
|
if (i + nDiv - pParent->nOverflow == pParent->pPageHdr->nCells) {
|
||||||
pgno = pParent->pPageHdr->rChild;
|
pgno = pParent->pPageHdr->rChild;
|
||||||
|
@ -486,18 +493,18 @@ static int tdbBtreeBalanceStep1(SBtreeBalanceHelper *pBlh) {
|
||||||
pgno = 0;
|
pgno = 0;
|
||||||
}
|
}
|
||||||
for (;;) {
|
for (;;) {
|
||||||
ret = tdbPagerFetchPage(pBt->pPager, pgno, &pPage, tdbBtreeInitPage, pBt);
|
ret = tdbPagerFetchPage(pBlh->pBt->pPager, pgno, &pPage, tdbBtreeInitPage, pBlh->pBt);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
pOldPages[i] = pPage;
|
pBlh->pOldPages[i] = pPage;
|
||||||
|
|
||||||
if ((i--) == 0) break;
|
if ((i--) == 0) break;
|
||||||
|
|
||||||
if (pParent->nOverflow && i + nDiv == pParent->aiOvfl[0]) {
|
if (pParent->nOverflow && i + nDiv == pParent->aiOvfl[0]) {
|
||||||
pCellDiv[i] = pParent->apOvfl[0];
|
// pCellDiv[i] = pParent->apOvfl[0];
|
||||||
// pgno = 0;
|
// pgno = 0;
|
||||||
// szNew[i] = tdbPageCellSize(pPage, pCell);
|
// szNew[i] = tdbPageCellSize(pPage, pCell);
|
||||||
pParent->nOverflow = 0;
|
pParent->nOverflow = 0;
|
||||||
|
@ -512,10 +519,8 @@ static int tdbBtreeBalanceStep1(SBtreeBalanceHelper *pBlh) {
|
||||||
// return -1;
|
// return -1;
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
/* code */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define TDB_PCACHE_PAGE
|
||||||
|
|
||||||
int tdbPCacheOpen(int pageSize, int cacheSize, int extraSize, SPCache **ppCache);
|
int tdbPCacheOpen(int pageSize, int cacheSize, int extraSize, SPCache **ppCache);
|
||||||
int tdbPCacheClose(SPCache *pCache);
|
int tdbPCacheClose(SPCache *pCache);
|
||||||
SPage *tdbPCacheFetch(SPCache *pCache, const SPgid *pPgid, bool alcNewPage);
|
SPage *tdbPCacheFetch(SPCache *pCache, const SPgid *pPgid, bool alcNewPage);
|
||||||
|
|
Loading…
Reference in New Issue