1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

All tests now pass. But there are still issues. For example, inserts

are way too slow.  And additional tests are needed for new features. (CVS 243)

FossilOrigin-Name: e7b65e37fd88c4d69c89cfe73ab345b8b645ada6
This commit is contained in:
drh
2001-09-14 03:24:23 +00:00
parent 009d3b72ca
commit 3fc190cc3f
19 changed files with 119 additions and 92 deletions

View File

@@ -21,7 +21,7 @@
** http://www.hwaci.com/drh/
**
*************************************************************************
** $Id: btree.c,v 1.24 2001/09/13 21:53:09 drh Exp $
** $Id: btree.c,v 1.25 2001/09/14 03:24:24 drh Exp $
**
** This file implements a external (disk-based) database using BTrees.
** For a detailed discussion of BTrees, refer to
@@ -1702,7 +1702,7 @@ static int balance(Btree *pBt, MemPage *pPage, BtCursor *pCur){
** underfull.
*/
assert( sqlitepager_iswriteable(pPage) );
if( !pPage->isOverfull && pPage->nFree<SQLITE_PAGE_SIZE/3 ){
if( !pPage->isOverfull && pPage->nFree<SQLITE_PAGE_SIZE/2 && pPage->nCell>=2){
relinkCellList(pPage);
return SQLITE_OK;
}
@@ -1981,9 +1981,14 @@ static int balance(Btree *pBt, MemPage *pPage, BtCursor *pCur){
pParent->apCell[nxDiv]->h.leftChild = pgnoNew[nNew-1];
}
if( pCur ){
assert( pOldCurPage!=0 );
sqlitepager_ref(pCur->pPage);
sqlitepager_unref(pOldCurPage);
if( j<=iCur && pCur->pPage==pParent && pCur->idx>idxDiv[nOld-1] ){
assert( pCur->pPage==pOldCurPage );
pCur->idx += nNew - nOld;
}else{
assert( pOldCurPage!=0 );
sqlitepager_ref(pCur->pPage);
sqlitepager_unref(pOldCurPage);
}
}
/*
@@ -2063,6 +2068,8 @@ int sqliteBtreeInsert(
}
insertCell(pPage, pCur->idx, &newCell, szNew);
rc = balance(pCur->pBt, pPage, pCur);
/* sqliteBtreePageDump(pCur->pBt, pCur->pgnoRoot, 1); */
/* fflush(stdout); */
return rc;
}