diff options
author | dan <dan@noemail.net> | 2010-08-23 18:19:31 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2010-08-23 18:19:31 +0000 |
commit | 5f848c3a4839126ee17990375a48c172012529db (patch) | |
tree | 991f26d78a50d7afd91aff7dc70dc094e36f9219 | |
parent | b8077be491e6b3b12449a49ad26cc6f62dfd3a65 (diff) | |
download | sqlite-5f848c3a4839126ee17990375a48c172012529db.tar.gz sqlite-5f848c3a4839126ee17990375a48c172012529db.zip |
Fixes for the SQLITE_CHECK_PAGES debugging feature.
FossilOrigin-Name: 21a1e5961bba148fda50cc0b7d472ca74f90808a
-rw-r--r-- | manifest | 26 | ||||
-rw-r--r-- | manifest.uuid | 2 | ||||
-rw-r--r-- | src/pager.c | 42 | ||||
-rw-r--r-- | test/pagerfault.test | 4 |
4 files changed, 37 insertions, 37 deletions
@@ -1,8 +1,5 @@ ------BEGIN PGP SIGNED MESSAGE----- -Hash: SHA1 - -C Update\sthe\sversion\snumber\sin\spreparation\sfor\sthe\s3.7.2\srelease. -D 2010-08-23T17:09:23 +C Fixes\sfor\sthe\sSQLITE_CHECK_PAGES\sdebugging\sfeature. +D 2010-08-23T18:19:31 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 543f91f24cd7fee774ecc0a61c19704c0c3e78fd F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -159,7 +156,7 @@ F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f F src/os_os2.c 72d0b2e562952a2464308c4ce5f7913ac10bef3e F src/os_unix.c 11194cbcf6a57456e58022dc537ab8c3497d9bb9 F src/os_win.c 51cb62f76262d961ea4249489383d714501315a7 -F src/pager.c 3e9815178b2f3ffcf9f5a6b7d40212be77b4f5bf +F src/pager.c a5f5d9787b11dfb0b6082e6f5846d00b459a8e19 F src/pager.h ef8c8f71ab022cc2fff768a1175dd32355be9dcd F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58 F src/pcache.c 1e9aa2dbc0845b52e1b51cc39753b6d1e041cb07 @@ -546,7 +543,7 @@ F test/openv2.test af02ed0a9cbc0d2a61b8f35171d4d117e588e4ec F test/pager1.test 6922029d71a8090169c71a67a141b6b94ad17d50 F test/pager2.test 0fbb6b6dc40ce1fecfe758c555a748ad2e9beaa3 F test/pager3.test 3856d9c80839be0668efee1b74811b1b7f7fc95f -F test/pagerfault.test ddbf04b5e2afafb3ea888e1083239a8000f155d4 +F test/pagerfault.test 84c6a4fcfe1a9e450fc1cec86f5baebfb017e53e F test/pagerfault2.test 1f79ea40d1133b2683a2f811b00f2399f7ec2401 F test/pageropt.test 8146bf448cf09e87bb1867c2217b921fb5857806 F test/pagesize.test 76aa9f23ecb0741a4ed9d2e16c5fa82671f28efb @@ -849,14 +846,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P 255f1eefa373153942c67b18b22177933657911d -R 4efbd792cc303d8f5321a4e7a77b89bf -U drh -Z b7de43c0f1a6ae936b6b0d525ee8c226 ------BEGIN PGP SIGNATURE----- -Version: GnuPG v1.4.6 (GNU/Linux) - -iD8DBQFMcqtGoxKgR168RlERAoFyAKCCDxIuWoL7+zDYyJYgn4ILXRqGNQCdEfYB -1U11ZoOMe7F5D7xXMSND/Nk= -=NV8i ------END PGP SIGNATURE----- +P 77889510fa67268043c604826047af81c8bd1ca7 +R aa9cc30f9dbcb7ea427137065cf4e4be +U dan +Z e09a56feaa9e8e294c4d46e5c8dde804 diff --git a/manifest.uuid b/manifest.uuid index 925fb907a..0e2db756d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -77889510fa67268043c604826047af81c8bd1ca7
\ No newline at end of file +21a1e5961bba148fda50cc0b7d472ca74f90808a
\ No newline at end of file diff --git a/src/pager.c b/src/pager.c index df5150c7a..f0b5b7754 100644 --- a/src/pager.c +++ b/src/pager.c @@ -1161,13 +1161,14 @@ static void pager_set_pagehash(PgHdr *pPage){ #define CHECK_PAGE(x) checkPage(x) static void checkPage(PgHdr *pPg){ Pager *pPager = pPg->pPager; - assert( !pPg->pageHash || pPager->errCode - || (pPg->flags&PGHDR_DIRTY) || pPg->pageHash==pager_pagehash(pPg) ); + assert( pPager->eState!=PAGER_ERROR ); + assert( (pPg->flags&PGHDR_DIRTY) || pPg->pageHash==pager_pagehash(pPg) ); } #else #define pager_datahash(X,Y) 0 #define pager_pagehash(X) 0 +#define pager_set_pagehash(X) #define CHECK_PAGE(x) #endif /* SQLITE_CHECK_PAGES */ @@ -1937,11 +1938,19 @@ static int pager_end_transaction(Pager *pPager, int hasMaster){ rc = sqlite3OsDelete(pPager->pVfs, pPager->zJournal, 0); } } + } #ifdef SQLITE_CHECK_PAGES - sqlite3PcacheIterateDirty(pPager->pPCache, pager_set_pagehash); -#endif + sqlite3PcacheIterateDirty(pPager->pPCache, pager_set_pagehash); + if( pPager->dbSize==0 && sqlite3PcacheRefCount(pPager->pPCache)>0 ){ + PgHdr *p = pager_lookup(pPager, 1); + if( p ){ + p->pageHash = 0; + sqlite3PagerUnref(p); + } } +#endif + sqlite3BitvecDestroy(pPager->pInJournal); pPager->pInJournal = 0; pPager->nRec = 0; @@ -2288,9 +2297,8 @@ static int pager_playback_one_page( assert( !pagerUseWal(pPager) ); sqlite3PcacheMakeClean(pPg); } -#ifdef SQLITE_CHECK_PAGES - pPg->pageHash = pager_pagehash(pPg); -#endif + pager_set_pagehash(pPg); + /* If this was page 1, then restore the value of Pager.dbFileVers. ** Do this before any decoding. */ if( pgno==1 ){ @@ -2929,6 +2937,14 @@ static int pagerWalFrames( sqlite3BackupUpdate(pPager->pBackup, p->pgno, (u8 *)p->pData); } } + +#ifdef SQLITE_CHECK_PAGES + { + PgHdr *p; + for(p=pList; p; p=p->pDirty) pager_set_pagehash(p); + } +#endif + return rc; } @@ -3947,9 +3963,7 @@ static int pager_write_pagelist(Pager *pPager, PgHdr *pList){ }else{ PAGERTRACE(("NOSTORE %d page %d\n", PAGERID(pPager), pgno)); } -#ifdef SQLITE_CHECK_PAGES - pList->pageHash = pager_pagehash(pList); -#endif + pager_set_pagehash(pList); pList = pList->pDirty; } @@ -4937,9 +4951,7 @@ int sqlite3PagerAcquire( goto pager_acquire_err; } } -#ifdef SQLITE_CHECK_PAGES - pPg->pageHash = pager_pagehash(pPg); -#endif + pager_set_pagehash(pPg); } return SQLITE_OK; @@ -5437,9 +5449,7 @@ void sqlite3PagerDontWrite(PgHdr *pPg){ PAGERTRACE(("DONT_WRITE page %d of %d\n", pPg->pgno, PAGERID(pPager))); IOTRACE(("CLEAN %p %d\n", pPager, pPg->pgno)) pPg->flags |= PGHDR_DONT_WRITE; -#ifdef SQLITE_CHECK_PAGES - pPg->pageHash = pager_pagehash(pPg); -#endif + pager_set_pagehash(pPg); } } diff --git a/test/pagerfault.test b/test/pagerfault.test index e51dd20ac..c73bc4225 100644 --- a/test/pagerfault.test +++ b/test/pagerfault.test @@ -1226,9 +1226,9 @@ do_faultsim_test pagerfault-27 -faults ioerr-persistent -prep { puts $::channel [string repeat abc 6000] flush $::channel } -test { - puts [catchsql { UPDATE t2 SET a = a_string(800), b = a_string(800) }] + catchsql { UPDATE t2 SET a = a_string(800), b = a_string(800) } catch { close $::channel } - puts [catchsql { ROLLBACK }] + catchsql { ROLLBACK } faultsim_integrity_check } |