From: drh Date: Tue, 26 Feb 2008 14:46:04 +0000 (+0000) Subject: Add an assert() to verify that the dirty-page list in the pager is X-Git-Tag: version-3.6.10~1367 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8f2e9a1a94d5bf03dce6031ec41e9b0d51261cd1;p=thirdparty%2Fsqlite.git Add an assert() to verify that the dirty-page list in the pager is valid before using it. (CVS 4810) FossilOrigin-Name: 942daf94ef1f8ac678988e175ef968a2d3f801e9 --- diff --git a/manifest b/manifest index 3ee4fffc2d..a1b6649871 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Have\ssqlite3PagerPagecount()\sreturn\s-1\swhen\sthe\spager\sis\sin\serror\sstate.\sFix\sfor\s#2961.\s(CVS\s4809) -D 2008-02-26T06:05:31 +C Add\san\sassert()\sto\sverify\sthat\sthe\sdirty-page\slist\sin\sthe\spager\sis\nvalid\sbefore\susing\sit.\s(CVS\s4810) +D 2008-02-26T14:46:05 F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7 F Makefile.in 6be8d7c60afa918807e77ec4459f8aff68c996d9 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -127,7 +127,7 @@ F src/os_unix.c e4daef7628f690fa2b188af3632fb18f96525946 F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e F src/os_win.c aa3f4bbee3b8c182d25a33fbc319f486857c12c1 F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b -F src/pager.c 80d9294a6b359267e02ed6d60613a215d9acc763 +F src/pager.c 1d5d4167f80bc5d487c026aea5fe08753f9a5c78 F src/pager.h 8174615ffd14ccc2cad2b081b919a398fa95e3f9 F src/parse.y 00f2698c8ae84f315be5e3f10b63c94f531fdd6d F src/pragma.c e3f39f8576234887ecd0c1de43dc51af5855930c @@ -621,7 +621,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5 -P c690dd68f20aa2137562dff573031ac041a29a4e -R 84baef0ea27579230067dbd5ae0526da -U danielk1977 -Z 3f476918e04ef03a88fceb0a4aada738 +P 427e7f8b4a54eb6136174af63a467324d6fb051e +R 24a233a27b1c7d161b4f137b2e844c7b +U drh +Z 2c7770a62aa3333221324adf20aa5a18 diff --git a/manifest.uuid b/manifest.uuid index 8f840d1a7d..7c591167fb 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -427e7f8b4a54eb6136174af63a467324d6fb051e \ No newline at end of file +942daf94ef1f8ac678988e175ef968a2d3f801e9 \ No newline at end of file diff --git a/src/pager.c b/src/pager.c index b5ea1d9fa4..c7b34abbe5 100644 --- a/src/pager.c +++ b/src/pager.c @@ -18,7 +18,7 @@ ** file simultaneously, or one process from reading the database while ** another is writing. ** -** @(#) $Id: pager.c,v 1.409 2008/02/26 06:05:31 danielk1977 Exp $ +** @(#) $Id: pager.c,v 1.410 2008/02/26 14:46:05 drh Exp $ */ #ifndef SQLITE_OMIT_DISKIO #include "sqliteInt.h" @@ -3004,6 +3004,19 @@ static int pager_write_pagelist(PgHdr *pList){ ** collected even if they are still in use. */ static PgHdr *pager_get_all_dirty_pages(Pager *pPager){ + +#ifndef NDEBUG + /* Verify the sanity of the dirty list when we are running + ** in debugging mode. This is expensive, so do not + ** do this on a normal build. */ + int n1 = 0; + int n2 = 0; + PgHdr *p; + for(p=pPager->pAll; p; p=p->pNextAll){ if( p->dirty ) n1++; } + for(p=pPager->pDirty; p; p=p->pDirty){ n2++; } + assert( n1==n2 ); +#endif + return pPager->pDirty; }