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:
17
src/btree.c
17
src/btree.c
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user