-C Do\snot\srun\svacuum.test\sas\spart\sof\sthe\s"exclusive"\spermutation\stest.\s(CVS\s5749)
-D 2008-09-29T14:27:41
+C Remove\sthe\sMemPage.idxShift\svariable.\sIt\sis\sno\slonger\srequired.\s(CVS\s5750)
+D 2008-09-29T15:53:26
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in e4ab842f9a64ef61d57093539a8aab76b12810db
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F src/auth.c c8b2ab5c8bad4bd90ed7c294694f48269162c627
F src/bitvec.c 95c86bd18d8fedf0533f5af196192546e10a7e7d
F src/btmutex.c 709cad2cdca0afd013f0f612363810e53f59ec53
-F src/btree.c 8fc7c0bd577e0e8850d95b0f8d927c983e53deab
+F src/btree.c 002084e207070d17e29863a7453409fd8717dd73
F src/btree.h 6371c5e599fab391a150c96afbc10062b276d107
-F src/btreeInt.h a9388a5e5998cec0b79c2024e6740d12d094ad17
+F src/btreeInt.h 3e93c0a6f363bbf68fdd975620f4d3671b6cf7bc
F src/build.c 160c71acca8f643f436ed6c1ee2f684c88df4dfe
F src/callback.c 7a40fd44da3eb89e7f6eff30aa6f940c45d73a97
F src/complete.c cb14e06dbe79dee031031f0d9e686ff306afe07c
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 292acaf7c4e68b532cc8d1763e02aa79d90ea20c
-R 2e374347a03a1d74809c97c540cb28f9
+P 2fb15ae9e9af716a5684a21826814bc4c332a596
+R 45649b03c1be1592a9f04aa95ab9d358
U danielk1977
-Z c73cbb2539399e32cc6d96320e7fb756
+Z 44ecc5d9fa4059a6de64d456c7327e83
** May you share freely, never taking more than you give.
**
*************************************************************************
-** $Id: btree.c,v 1.518 2008/09/29 11:49:48 danielk1977 Exp $
+** $Id: btree.c,v 1.519 2008/09/29 15:53:26 danielk1977 Exp $
**
** This file implements a external (disk-based) database using BTrees.
** See the header comment on "btreeInt.h" for additional information.
assert( pBt->pageSize>=512 && pBt->pageSize<=32768 );
pPage->maskPage = pBt->pageSize - 1;
pPage->nOverflow = 0;
- pPage->idxShift = 0;
usableSize = pBt->usableSize;
pPage->cellOffset = cellOffset = hdr + 12 - 4*pPage->leaf;
top = get2byte(&data[hdr+5]);
pPage->nOverflow = 0;
assert( pBt->pageSize>=512 && pBt->pageSize<=32768 );
pPage->maskPage = pBt->pageSize - 1;
- pPage->idxShift = 0;
pPage->nCell = 0;
pPage->isInit = 1;
}
}
rc = getAndInitPage(pBt, newPgno, &pNewPage);
if( rc ) return rc;
- pCur->apPage[i]->idxShift = 0;
pCur->apPage[i+1] = pNewPage;
pCur->aiIdx[i+1] = 0;
pCur->iPage++;
return SQLITE_OK;
}
+#ifndef NDEBUG
+/*
+** Page pParent is an internal (non-leaf) tree page. This function
+** asserts that page number iChild is the left-child if the iIdx'th
+** cell in page pParent. Or, if iIdx is equal to the total number of
+** cells in pParent, that page number iChild is the right-child of
+** the page.
+*/
+static void assertParentIndex(MemPage *pParent, int iIdx, Pgno iChild){
+ assert( iIdx<=pParent->nCell );
+ if( iIdx==pParent->nCell ){
+ assert( get4byte(&pParent->aData[pParent->hdrOffset+8])==iChild );
+ }else{
+ assert( get4byte(findCell(pParent, iIdx))==iChild );
+ }
+}
+#else
+# define assertParentIndex(x,y,z)
+#endif
+
/*
** Move the cursor up to the parent page.
**
assert( pCur->eState==CURSOR_VALID );
assert( pCur->iPage>0 );
assert( pCur->apPage[pCur->iPage] );
-
+ assertParentIndex(
+ pCur->apPage[pCur->iPage-1],
+ pCur->aiIdx[pCur->iPage-1],
+ pCur->apPage[pCur->iPage]->pgno
+ );
releasePage(pCur->apPage[pCur->iPage]);
pCur->iPage--;
pCur->info.nSize = 0;
pCur->validNKey = 0;
- assert( pCur->apPage[pCur->iPage]->idxShift==0 );
}
/*
if( rc!=SQLITE_OK ) return rc;
}
rc = reparentPage(pBt, iRight, pPage, i, updatePtrmap);
- pPage->idxShift = 0;
}
return rc;
}
pPage->nCell--;
put2byte(&data[pPage->hdrOffset+3], pPage->nCell);
pPage->nFree += 2;
- pPage->idxShift = 1;
}
/*
}
put2byte(&data[ins], idx);
put2byte(&data[hdr+3], pPage->nCell);
- pPage->idxShift = 1;
#ifndef SQLITE_OMIT_AUTOVACUUM
if( pPage->pBt->autoVacuum ){
/* The cell may contain a pointer to an overflow page. If so, write
assemblePage(pNew, 1, &pCell, &szCell);
pPage->nOverflow = 0;
- /* Set the parent of the newly allocated page to pParent. */
-#if 0
- pNew->pParent = pParent;
- sqlite3PagerRef(pParent->pDbPage);
-#endif
-
/* pPage is currently the right-child of pParent. Change this
** so that the right-child is the new page allocated above and
** pPage is the next-to-right child.
** to pPage. The "idx" variable is the index of that cell. If pPage
** is the rightmost child of pParent then set idx to pParent->nCell
*/
- if( pParent->idxShift ){
- Pgno pgno;
- pgno = pPage->pgno;
- assert( pgno==sqlite3PagerPagenumber(pPage->pDbPage) );
- for(idx=0; idx<pParent->nCell; idx++){
- if( get4byte(findCell(pParent, idx))==pgno ){
- break;
- }
- }
- assert( idx<pParent->nCell
- || get4byte(&pParent->aData[pParent->hdrOffset+8])==pgno );
- }else{
- idx = pCur->aiIdx[pCur->iPage-1];
- }
+ idx = pCur->aiIdx[pCur->iPage-1];
+ assertParentIndex(pParent, idx, pPage->pgno);
/*
** Initialize variables so that it will be safe to jump
** directly to balance_cleanup at any moment.
*/
nOld = nNew = 0;
- /* sqlite3PagerRef(pParent->pDbPage); */
/*
** Find sibling pages to pPage and the cells in pParent that divide
if( rc==SQLITE_OK ){
pCur->iPage++;
pCur->apPage[1] = pChild;
+ pCur->aiIdx[0] = 0;
rc = balance_nonroot(pCur);
}else{
releasePage(pChild);