Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix a leaked page reference that could occur after an IO error in auto-vacuum databases. Also modify incrvacuum.test to work with DEFAULT_AUTOVACUUM=1 builds. (CVS 4031) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
e691f2fa3d8c1bbb66d27eea299ae2fb |
User & Date: | danielk1977 2007-05-23 13:34:32.000 |
Context
2007-05-23
| ||
13:50 | Make sure the database schema has been read before compiling an incrmental_vacuum pragma. (CVS 4032) (check-in: efd7bcb34c user: danielk1977 tags: trunk) | |
13:34 | Fix a leaked page reference that could occur after an IO error in auto-vacuum databases. Also modify incrvacuum.test to work with DEFAULT_AUTOVACUUM=1 builds. (CVS 4031) (check-in: e691f2fa3d user: danielk1977 tags: trunk) | |
09:52 | Fix a database corrupting bug in the optimistic overflow chain. Exposed by running bigrow.test with auto-vacuum enabled. (CVS 4030) (check-in: 10ee2d50cb user: danielk1977 tags: trunk) | |
Changes
Changes to src/btree.c.
1 2 3 4 5 6 7 8 9 10 11 | /* ** 2004 April 6 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /* ** 2004 April 6 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** $Id: btree.c,v 1.385 2007/05/23 13:34:32 danielk1977 Exp $ ** ** This file implements a external (disk-based) database using BTrees. ** See the header comment on "btreeInt.h" for additional information. ** Including a description of file format and an overview of operation. */ #include "btreeInt.h" |
︙ | ︙ | |||
3804 3805 3806 3807 3808 3809 3810 | MemPage *pToRelease = 0; unsigned char *pPrior; unsigned char *pPayload; BtShared *pBt = pPage->pBt; Pgno pgnoOvfl = 0; int nHeader; CellInfo info; | < | 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 | MemPage *pToRelease = 0; unsigned char *pPrior; unsigned char *pPayload; BtShared *pBt = pPage->pBt; Pgno pgnoOvfl = 0; int nHeader; CellInfo info; /* Fill in the header. */ nHeader = 0; if( !pPage->leaf ){ nHeader += 4; } if( pPage->hasData ){ |
︙ | ︙ | |||
3849 3850 3851 3852 3853 3854 3855 | Pgno pgnoPtrmap = pgnoOvfl; /* Overflow page pointer-map entry page */ if( pBt->autoVacuum ){ do{ pgnoOvfl++; } while( PTRMAP_ISPAGE(pBt, pgnoOvfl) || pgnoOvfl==PENDING_BYTE_PAGE(pBt) ); | | < > | > | 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 | Pgno pgnoPtrmap = pgnoOvfl; /* Overflow page pointer-map entry page */ if( pBt->autoVacuum ){ do{ pgnoOvfl++; } while( PTRMAP_ISPAGE(pBt, pgnoOvfl) || pgnoOvfl==PENDING_BYTE_PAGE(pBt) ); if( pgnoOvfl>1 ){ /* isExact = 1; */ } } #endif rc = allocateBtreePage(pBt, &pOvfl, &pgnoOvfl, pgnoOvfl, isExact); #ifndef SQLITE_OMIT_AUTOVACUUM /* If the database supports auto-vacuum, and the second or subsequent ** overflow page is being allocated, add an entry to the pointer-map ** for that page now. ** ** If this is the first overflow page, then write a partial entry ** to the pointer-map. If we write nothing to this pointer-map slot, ** then the optimistic overflow chain processing in clearCell() ** may misinterpret the uninitialised values and delete the ** wrong pages from the database. */ if( pBt->autoVacuum && rc==SQLITE_OK ){ u8 eType = (pgnoPtrmap?PTRMAP_OVERFLOW2:PTRMAP_OVERFLOW1); rc = ptrmapPut(pBt, pgnoOvfl, eType, pgnoPtrmap); if( rc ){ releasePage(pOvfl); } } #endif if( rc ){ releasePage(pToRelease); return rc; } put4byte(pPrior, pgnoOvfl); |
︙ | ︙ |
Changes to test/incrvacuum.test.
︙ | ︙ | |||
10 11 12 13 14 15 16 | #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the incremental vacuum feature. # # Note: There are also some tests for incremental vacuum and IO # errors in incrvacuum_ioerr.test. # | | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the incremental vacuum feature. # # Note: There are also some tests for incremental vacuum and IO # errors in incrvacuum_ioerr.test. # # $Id: incrvacuum.test,v 1.7 2007/05/23 13:34:32 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # If this build of the library does not support auto-vacuum, omit this # whole file. ifcapable {!autovacuum || !pragma} { finish_test return } #--------------------------------------------------------------------- # Test the pragma on an empty database. # do_test incrvacuum-1.1 { execsql { pragma auto_vacuum; } } $sqlite_options(default_autovacuum) do_test incrvacuum-1.2 { execsql { pragma auto_vacuum = 'full'; pragma auto_vacuum; } } {1} do_test incrvacuum-1.3 { |
︙ | ︙ |