Fix some incorrect asserts() in the pager - problems brought to light by

the new soft-heap-limit testing apparatus of check-in (4202). (CVS 4207)

FossilOrigin-Name: 51f3e01b7486f23b67bdfb6bb19fc5297b2c8cec
This commit is contained in:
drh 2007-08-10 23:56:35 +00:00
parent fdd30b0e46
commit 34f5621ff1
3 changed files with 19 additions and 11 deletions

View File

@ -1,5 +1,5 @@
C Fix\sthe\scorruption\sproblem\sof\sticket\s#2565\sas\sdemonstrated\sby\sthe\stest\sadded\nin\s(4204).\s\sThere\smay\syet\sbe\sother\sinstances\sof\ssimilar\sproblems\slurking\sin\nthe\scode.\s(CVS\s4206)
D 2007-08-10T23:54:16
C Fix\ssome\sincorrect\sasserts()\sin\sthe\spager\s-\sproblems\sbrought\sto\slight\sby\nthe\snew\ssoft-heap-limit\stesting\sapparatus\sof\scheck-in\s(4202).\s(CVS\s4207)
D 2007-08-10T23:56:36
F Makefile.in 0c0e53720f658c7a551046442dd7afba0b72bfbe
F Makefile.linux-gcc 65241babba6faf1152bf86574477baab19190499
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@ -99,7 +99,7 @@ F src/os_unix.c 9d2a421acc607262e63ccf31e3fe86e5f2520af6
F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
F src/os_win.c d868d5f9e95ec9c1b9e2a30c54c996053db6dddd
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
F src/pager.c e4fec09c20201eaeca5f6a8fb2d6cdd415d97561
F src/pager.c 7a96ab0dcab56bd5c9828272b5ad5fc14b296c66
F src/pager.h 94110a5570dca30d54a883e880a3633b2e4c05ae
F src/parse.y ad2ce25665be7f7303137f774a4e3e72e0d036ff
F src/pragma.c 7914a6b9ea05f158800116dfcae11e52ab8e39c4
@ -524,7 +524,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
P 16730cb137eaf576b87cdc17913564c9c5c0ed82
R 603090945b8a1fdc30880037c12bb741
P 7ed2f59e70e0d9a8ad0c47c8c12fae0aaddcedce
R 035ac0a060bdc969e9fcae1ee2c83e7d
U drh
Z f116d28be22086d6409bcb0a7433f127
Z 4968e3414a1d697b3f9b9029760dffed

View File

@ -1 +1 @@
7ed2f59e70e0d9a8ad0c47c8c12fae0aaddcedce
51f3e01b7486f23b67bdfb6bb19fc5297b2c8cec

View File

@ -18,7 +18,7 @@
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: pager.c,v 1.353 2007/08/10 23:54:16 drh Exp $
** @(#) $Id: pager.c,v 1.354 2007/08/10 23:56:36 drh Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"
@ -562,7 +562,11 @@ static int write32bits(OsFile *fd, u32 val){
*/
static int pager_error(Pager *pPager, int rc){
int rc2 = rc & 0xff;
assert( pPager->errCode==SQLITE_FULL || pPager->errCode==SQLITE_OK );
assert(
pPager->errCode==SQLITE_FULL ||
pPager->errCode==SQLITE_OK ||
(pPager->errCode & 0xff)==SQLITE_IOERR
);
if(
rc2==SQLITE_FULL ||
rc2==SQLITE_IOERR ||
@ -2755,7 +2759,7 @@ int sqlite3PagerReleaseMemory(int nReq){
pTmp->pNextAll = pPg->pNextAll;
}
nReleased += sqliteAllocSize(pPg);
IOTRACE(("PGFREE %p %d\n", pPager, pPg->pgno));
IOTRACE(("PGFREE %p %d *\n", pPager, pPg->pgno));
PAGER_INCR(sqlite3_pager_pgfree_count);
sqliteFree(pPg);
}
@ -2767,7 +2771,11 @@ int sqlite3PagerReleaseMemory(int nReq){
** The error will be returned to the user (or users, in the case
** of a shared pager cache) of the pager for which the error occured.
*/
assert( (rc&0xff)==SQLITE_IOERR || rc==SQLITE_FULL );
assert(
(rc&0xff)==SQLITE_IOERR ||
rc==SQLITE_FULL ||
rc==SQLITE_BUSY
);
assert( pPager->state>=PAGER_RESERVED );
pager_error(pPager, rc);
}