-C Reinitialize\spage\s1\sof\sthe\sdatabase\sfile\sfollowing\sa\sROLLBACK\sTO\sof\sa\ntransactional\sSAVEPOINT\son\san\sinitially\sempty\sdatabase.\s(CVS\s6103)
-D 2009-01-02T21:08:09
+C Memory\sallocation\sfailure\sin\sBitvec\sare\sprobably\sall\sbenign.\s\sStill,\sadd\ncode\sto\scheck\sthis,\sjust\sto\sbe\ssure.\s(CVS\s6104)
+D 2009-01-02T21:39:39
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 05461a9b5803d5ad10c79f989801e9fd2cc3e592
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F src/analyze.c c86fd6a1425b22b3a46ce72ad403e4280026364f
F src/attach.c 1c35f95da3c62d19de75b44cfefd12c81c1791b3
F src/auth.c c8b2ab5c8bad4bd90ed7c294694f48269162c627
-F src/bitvec.c 4300d311b17fb3c1476623fd895a8feac02a0b08
+F src/bitvec.c a97d315fc7c0ec54fabd8859a45bd4e8e0d16b0b
F src/btmutex.c 63c5cc4ad5715690767ffcb741e185d7bc35ec1a
F src/btree.c b0cf3e7273ba20fe280fc7c889f972419562076d
F src/btree.h 4f141cf748d2ee7c6d7fc175f64f87a45cd44113
F src/os_os2.c bed77dc26e3a95ce4a204936b9a1ca6fe612fcc5
F src/os_unix.c e6eacc7ec735ded605fefcbaf250058baa8feb12
F src/os_win.c 496e3ceb499aedc63622a89ef76f7af2dd902709
-F src/pager.c 151cc07325103ac217cd483e2aa67cb128aae1eb
+F src/pager.c e82987578519a149e8bdf7f5c2a330d879914b4e
F src/pager.h 75396879910768a0af03a4af8413e798d84c096f
F src/parse.y 4d0e33a702dc3ea7b69d8ae1914b3fbd32e46057
F src/pcache.c 16dc8da6e6ba6250f8dfd9ee46036db1cbceedc6
F src/shell.c 65d19f8996a160f288087e31810f24025439c62a
F src/sqlite.h.in 6cd2489e40fe97ba58c60044a4ced377e08b6d09
F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17
-F src/sqliteInt.h db087faf9556d61a05baf6f935307b4ce4b8af11
+F src/sqliteInt.h e95ddac4bb83570191c3713dfa31796aeb47cd3a
F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8
F src/status.c 237b193efae0cf6ac3f0817a208de6c6c6ef6d76
F src/table.c 23db1e5f27c03160987c122a078b4bb51ef0b2f8
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 78dd7909da15a9b2cbcdb9cbe86798cfc24f3230
-R 43c17ab6466f886c67eb16e151d17eac
+P 3e9efb763875b20c856d748c19e449080a3ae97c
+R fbb0f228e00217f5f89f33568f0e8c54
U drh
-Z 7692693fe330733d99a3256112d00dbb
+Z 9cf41e60e2f6cdb3d7a7b42a85a7af92
-3e9efb763875b20c856d748c19e449080a3ae97c
\ No newline at end of file
+4688e1c8b1203c3538aa862421ed344888059fe2
\ No newline at end of file
** start of a transaction, and is thus usually less than a few thousand,
** but can be as large as 2 billion for a really big database.
**
-** @(#) $Id: bitvec.c,v 1.9 2008/11/19 18:30:35 shane Exp $
+** @(#) $Id: bitvec.c,v 1.10 2009/01/02 21:39:39 drh Exp $
*/
#include "sqliteInt.h"
u32 bin = i/p->iDivisor;
i = i%p->iDivisor;
if( p->u.apSub[bin]==0 ){
- sqlite3BeginBenignMalloc();
p->u.apSub[bin] = sqlite3BitvecCreate( p->iDivisor );
- sqlite3EndBenignMalloc();
if( p->u.apSub[bin]==0 ) return SQLITE_NOMEM;
}
p = p->u.apSub[bin];
** file simultaneously, or one process from reading the database while
** another is writing.
**
-** @(#) $Id: pager.c,v 1.527 2009/01/02 21:08:09 drh Exp $
+** @(#) $Id: pager.c,v 1.528 2009/01/02 21:39:39 drh Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"
** all open savepoints.
*/
static int addToSavepointBitvecs(Pager *pPager, Pgno pgno){
- int ii;
+ int ii; /* Loop counter */
+ int rc = SQLITE_OK; /* Result code */
+
for(ii=0; ii<pPager->nSavepoint; ii++){
PagerSavepoint *p = &pPager->aSavepoint[ii];
if( pgno<=p->nOrig ){
- /* TODO: malloc() failure handling */
- sqlite3BitvecSet(p->pInSavepoint, pgno);
+ rc |= sqlite3BitvecSet(p->pInSavepoint, pgno);
+ assert( rc==SQLITE_OK || rc==SQLITE_NOMEM );
}
}
- return SQLITE_OK;
+ return rc;
}
/*
pPager->nRec++;
assert( pPager->pInJournal!=0 );
- sqlite3BitvecSet(pPager->pInJournal, pPg->pgno);
- addToSavepointBitvecs(pPager, pPg->pgno);
+ rc = sqlite3BitvecSet(pPager->pInJournal, pPg->pgno);
+ testcase( rc==SQLITE_NOMEM );
+ assert( rc==SQLITE_OK || rc==SQLITE_NOMEM );
+ rc |= addToSavepointBitvecs(pPager, pPg->pgno);
+ if( rc!=SQLITE_OK ){
+ assert( rc==SQLITE_NOMEM );
+ return rc;
+ }
}else{
if( !pPager->journalStarted && !pPager->noSync ){
pPg->flags |= PGHDR_NEED_SYNC;
}
pPager->stmtNRec++;
assert( pPager->nSavepoint>0 );
- addToSavepointBitvecs(pPager, pPg->pgno);
+ rc = addToSavepointBitvecs(pPager, pPg->pgno);
+ if( rc!=SQLITE_OK ){
+ assert( rc==SQLITE_NOMEM );
+ return rc;
+ }
}
}
*/
void sqlite3PagerDontRollback(DbPage *pPg){
Pager *pPager = pPg->pPager;
+ TESTONLY( int rc; ) /* Return value from sqlite3BitvecSet() */
assert( pPager->state>=PAGER_RESERVED );
/* assert( !pPg->inJournal && (int)pPg->pgno <= pPager->dbOrigSize ); */
assert( pPager->pInJournal!=0 );
- sqlite3BitvecSet(pPager->pInJournal, pPg->pgno);
pPg->flags &= ~PGHDR_NEED_READ;
- addToSavepointBitvecs(pPager, pPg->pgno);
+
+ /* Failure to set the bits in the InJournal bit-vectors is benign.
+ ** It merely means that we might do some extra work to journal a page
+ ** that does not need to be journal. Nevertheless, be sure to test the
+ ** case where a malloc error occurs while trying to set a bit in a
+ ** bit vector.
+ */
+ sqlite3BeginBenignMalloc();
+ TESTONLY( rc = ) sqlite3BitvecSet(pPager->pInJournal, pPg->pgno);
+ testcase( rc==SQLITE_NOMEM );
+ TESTONLY( rc = ) addToSavepointBitvecs(pPager, pPg->pgno);
+ testcase( rc==SQLITE_NOMEM );
+ sqlite3EndBenignMalloc();
+
+
PAGERTRACE3("DONT_ROLLBACK page %d of %d\n", pPg->pgno, PAGERID(pPager));
IOTRACE(("GARBAGE %p %d\n", pPager, pPg->pgno))
}
*************************************************************************
** Internal interface definitions for SQLite.
**
-** @(#) $Id: sqliteInt.h,v 1.817 2009/01/02 17:33:46 danielk1977 Exp $
+** @(#) $Id: sqliteInt.h,v 1.818 2009/01/02 21:39:39 drh Exp $
*/
#ifndef _SQLITEINT_H_
#define _SQLITEINT_H_
#ifdef SQLITE_COVERAGE_TEST
void sqlite3Coverage(int);
# define testcase(X) if( X ){ sqlite3Coverage(__LINE__); }
+# define TESTONLY(X) X
#else
# define testcase(X)
+# define TESTONLY(X)
#endif
/*