From 104a7bba8cae6ca5410d6b0ce3c72a552a1bdde8 Mon Sep 17 00:00:00 2001 From: drh Date: Sat, 15 Jan 2011 17:12:59 +0000 Subject: [PATCH] Increment the change counter and update the SQLite version number whenever page 1 is added to the WAL. Ticket [5d863f876ee9561b9] FossilOrigin-Name: c1e0d09cd3f5feae123468a35f147021d839641c --- manifest | 28 +++++++++++++++++++--------- manifest.uuid | 2 +- src/pager.c | 28 ++++++++++++++++++++++++---- test/progress.test | 0 tool/mkopts.tcl | 0 5 files changed, 44 insertions(+), 14 deletions(-) mode change 100755 => 100644 test/progress.test mode change 100755 => 100644 tool/mkopts.tcl diff --git a/manifest b/manifest index e6ffd13c90..86cf2f03fd 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,8 @@ -C Add\sa\stest\scase\sdemonstrating\sthe\sproblem\sdescribed\sby\sticket\s[5d863f876e]. -D 2011-01-15T16:52:11 +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA1 + +C Increment\sthe\schange\scounter\sand\supdate\sthe\sSQLite\sversion\snumber\swhenever\npage\s1\sis\sadded\sto\sthe\sWAL.\s\sTicket\s[5d863f876ee9561b9] +D 2011-01-15T17:12:59.482 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in de6498556d536ae60bb8bb10e8c1ba011448658c F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -162,7 +165,7 @@ F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f F src/os_os2.c 72d0b2e562952a2464308c4ce5f7913ac10bef3e F src/os_unix.c aeaf65d261219ad96c021cfd0672509d83c005e4 F src/os_win.c 2f90f7bdec714fad51cd31b4ecad3cc1b4bb5aad -F src/pager.c ceceb5e20d8772cd6a1e3d6eb030fbcb1c052f61 +F src/pager.c 737025a2e7457ae7cfd4fe1f0cc69f69d88b29b4 F src/pager.h 0ea59db2a33bc6c2c02cae34de33367e1effdf76 F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58 F src/pcache.c 09d38c44ab275db581f7a2f6ff8b9bc7f8c0faaa @@ -589,7 +592,7 @@ F test/permutations.test c0ce0f3b741dd92a6d4c2671dbacba4b92dd81eb F test/pragma.test fdfc09067ea104a0c247a1a79d8093b56656f850 F test/pragma2.test 5364893491b9231dd170e3459bfc2e2342658b47 F test/printf.test 05970cde31b1a9f54bd75af60597be75a5c54fea -F test/progress.test 5b075c3c790c7b2a61419bc199db87aaf48b8301 x +F test/progress.test 5b075c3c790c7b2a61419bc199db87aaf48b8301 F test/ptrchng.test ef1aa72d6cf35a2bbd0869a649b744e9d84977fc F test/quick.test 1681febc928d686362d50057c642f77a02c62e57 F test/quota.test ddafe133653093eb9a99ccd6264884ae43f9c9b8 @@ -871,7 +874,7 @@ F tool/genfkey.test 4196a8928b78f51d54ef58e99e99401ab2f0a7e5 F tool/lemon.c dfd81a51b6e27e469ba21d01a75ddf092d429027 F tool/lempar.c 01ca97f87610d1dac6d8cd96ab109ab1130e76dc F tool/mkkeywordhash.c d2e6b4a5965e23afb80fbe74bb54648cd371f309 -F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e x +F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97 F tool/mksqlite3c.tcl e0db70c2c52b0e3d0867ca931229e5b90ffe7837 F tool/mksqlite3h.tcl d76c226a5e8e1f3b5f6593bcabe5e98b3b1ec9ff @@ -896,7 +899,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P 142174640d60e834cae27ccaa78b02ecef8bcfe5 -R d9ef404f44830db11f7a6ed5f8975a1f -U dan -Z 690a7330d2f219663b45235869cf7d49 +P af54963f0fa0afafbc2d0847f30543c041b182ec +R 2e070d9bb52da592e341dbace3cf5d95 +U drh +Z 2f025605b789f039118b3a16146dfc2d +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.6 (GNU/Linux) + +iD8DBQFNMdWfoxKgR168RlERAmfoAJ9Y78wB/3baCsxKX+NyeGTMQLqGDACeOyQw +/EmrRAxlTmynxXA/PJ4j5Yo= +=dp+d +-----END PGP SIGNATURE----- diff --git a/manifest.uuid b/manifest.uuid index de402f1acc..e4f2521d70 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -af54963f0fa0afafbc2d0847f30543c041b182ec \ No newline at end of file +c1e0d09cd3f5feae123468a35f147021d839641c \ No newline at end of file diff --git a/src/pager.c b/src/pager.c index d65c460afa..297ac99596 100644 --- a/src/pager.c +++ b/src/pager.c @@ -2915,11 +2915,17 @@ static int pagerRollbackWal(Pager *pPager){ return rc; } +/* Forward declaration */ +static int pager_incr_changecounter(Pager*,int); + /* ** This function is a wrapper around sqlite3WalFrames(). As well as logging ** the contents of the list of pages headed by pList (connected by pDirty), ** this function notifies any active backup processes that the pages have -** changed. +** changed. +** +** The list of pages passed into this routine is always sorted by page number. +** Hence, if page 1 appears anywhere on the list, it will be the first page. */ static int pagerWalFrames( Pager *pPager, /* Pager object */ @@ -2929,8 +2935,23 @@ static int pagerWalFrames( int syncFlags /* Flags to pass to OsSync() (or 0) */ ){ int rc; /* Return code */ +#if defined(SQLITE_DEBUG) || defined(SQLITE_CHECK_PAGES) + PgHdr *p; /* For looping over pages */ +#endif assert( pPager->pWal ); +#ifdef SQLITE_DEBUG + /* Verify that the page list is in accending order */ + for(p=pList; p && p->pDirty; p=p->pDirty){ + assert( p->pgno < p->pDirty->pgno ); + } +#endif + + if( pList->pgno==1 ){ + pPager->changeCountDone = 0; + pager_incr_changecounter(pPager,0); + pPager->changeCountDone = 0; + } rc = sqlite3WalFrames(pPager->pWal, pPager->pageSize, pList, nTruncate, isCommit, syncFlags ); @@ -2942,9 +2963,8 @@ static int pagerWalFrames( } #ifdef SQLITE_CHECK_PAGES - { - PgHdr *p; - for(p=pList; p; p=p->pDirty) pager_set_pagehash(p); + for(p=pList; p; p=p->pDirty){ + pager_set_pagehash(p); } #endif diff --git a/test/progress.test b/test/progress.test old mode 100755 new mode 100644 diff --git a/tool/mkopts.tcl b/tool/mkopts.tcl old mode 100755 new mode 100644