From 1e8ed64ed03b5d44876a9e558c89fa07884da8b5 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 30 Jul 2010 16:44:29 +0000 Subject: [PATCH 1/8] Remove a test from sqlite3PagerCommitPhaseOne which is now always true after the multi-file transaction fix. FossilOrigin-Name: 6758f6a8ec97941e09847b309812b3194eb57f19 --- manifest | 24 +++++++++++++++++------- manifest.uuid | 2 +- src/pager.c | 4 ++-- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index 0c611181fb..f3536c77ad 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,8 @@ -C Changes\sto\sthe\scomments\sdescribing\sthe\sPager.setMaster\svariable\sin\spager.c.\sAdd\san\sassert()\sstatement\sto\sverify\sthat\stwo\smaster\sjournal\spointers\sare\snot\swritten\sto\sa\ssingle\sjournal\sfile. -D 2010-07-30T11:31:13 +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA1 + +C Remove\sa\stest\sfrom\ssqlite3PagerCommitPhaseOne\swhich\sis\snow\salways\strue\nafter\sthe\smulti-file\stransaction\sfix. +D 2010-07-30T16:44:30 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in ec08dc838fd8110fe24c92e5130bcd91cbb1ff2e F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -156,7 +159,7 @@ F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f F src/os_os2.c 72d0b2e562952a2464308c4ce5f7913ac10bef3e F src/os_unix.c 3109e0e5a0d5551bab2e8c7322b20a3b8b171248 F src/os_win.c 1f8b0a1a5bcf6289e7754d0d3c16cec16d4c93ab -F src/pager.c 3f2373792cb5c23043cef31878a13b37b0ade1f6 +F src/pager.c 202e3dcb3f36c858d4339c0f6fa3d04d67258127 F src/pager.h 80726162dc3942f59ab27b738fb667b9ba0a89d5 F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58 F src/pcache.c 1e9aa2dbc0845b52e1b51cc39753b6d1e041cb07 @@ -840,7 +843,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P 40f7f0a583e6bba66cd006253a0ef4623ea74f17 -R 9a1109c31f7ded9ef1e129e63eeacbd6 -U dan -Z 55381d586c03f9b763a259356223e4c4 +P ad78ccacb00e2f8a5ca93e2c9006266d9477fe48 +R ab9c5083b94a38201583f7f7d962aec2 +U drh +Z 731cac3ef7411b3c0b31c9abc868e228 +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.6 (GNU/Linux) + +iD8DBQFMUwFzoxKgR168RlERAs0AAJ4r8+wS17WmbvJdavU0h3g2I0y8FwCfRtkq +kzxM3lMJD9/oWhUWCEVKnVw= +=ua+E +-----END PGP SIGNATURE----- diff --git a/manifest.uuid b/manifest.uuid index 3917952cf1..a3166c1391 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ad78ccacb00e2f8a5ca93e2c9006266d9477fe48 \ No newline at end of file +6758f6a8ec97941e09847b309812b3194eb57f19 \ No newline at end of file diff --git a/src/pager.c b/src/pager.c index ed7a8d2c74..5f8a90c58a 100644 --- a/src/pager.c +++ b/src/pager.c @@ -1082,7 +1082,6 @@ static int writeMasterJournal(Pager *pPager, const char *zMaster){ u32 cksum = 0; /* Checksum of string zMaster */ assert( pPager->setMaster==0 ); - if( !zMaster || pPager->journalMode==PAGER_JOURNALMODE_MEMORY || pPager->journalMode==PAGER_JOURNALMODE_OFF @@ -5139,7 +5138,7 @@ int sqlite3PagerCommitPhaseOne( ** backup in progress needs to be restarted. */ sqlite3BackupRestart(pPager->pBackup); - }else if( pPager->state!=PAGER_SYNCED && pPager->dbModified ){ + }else if( pPager->dbModified ){ if( pagerUseWal(pPager) ){ PgHdr *pList = sqlite3PcacheDirtyList(pPager->pPCache); if( pList ){ @@ -5277,6 +5276,7 @@ int sqlite3PagerCommitPhaseOne( IOTRACE(("DBSYNC %p\n", pPager)) } + assert( pPager->state!=PAGER_SYNCED ); pPager->state = PAGER_SYNCED; } From a3388cc5b0f7c3760083839750625fd4d6dee49f Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 30 Jul 2010 16:54:25 +0000 Subject: [PATCH 2/8] Fix typos in comments. No code or logic changes. FossilOrigin-Name: 15c294ca051ed8b5078e7ac9a969b0f9358d9184 --- manifest | 20 ++++++++++---------- manifest.uuid | 2 +- src/update.c | 2 +- src/vdbemem.c | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/manifest b/manifest index f3536c77ad..f4c1e82410 100644 --- a/manifest +++ b/manifest @@ -1,8 +1,8 @@ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 -C Remove\sa\stest\sfrom\ssqlite3PagerCommitPhaseOne\swhich\sis\snow\salways\strue\nafter\sthe\smulti-file\stransaction\sfix. -D 2010-07-30T16:44:30 +C Fix\stypos\sin\scomments.\s\sNo\scode\sor\slogic\schanges. +D 2010-07-30T16:54:25 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in ec08dc838fd8110fe24c92e5130bcd91cbb1ff2e F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -217,7 +217,7 @@ F src/test_vfs.c 7e291f85256516ebde6633bc381ff7eedfa30234 F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9 F src/tokenize.c 604607d6813e9551cf5189d899e0a25c12681080 F src/trigger.c b8bedb9c0084ceb51a40f54fcca2ce048c8de852 -F src/update.c 19c899c23cd29fd102c9068e0b0ff5b087204beb +F src/update.c 1521162d20c2994af1fdc8833e1a88dae09052c8 F src/utf.c 1baeeac91707a4df97ccc6141ec0f808278af685 F src/util.c 32aebf04c10e51ad3977a928b7416bed671b620b F src/vacuum.c 241a8386727c1497eba4955933356dfba6ff8c9f @@ -227,7 +227,7 @@ F src/vdbeInt.h ffd68c4d4229227a5089bec53a1c635146177abc F src/vdbeapi.c d0f4407e465f261780ad725c1caece7d66a6aa35 F src/vdbeaux.c 8a443e73760ca65ffdfda3e26df4c8c90eeefa11 F src/vdbeblob.c 258a6010ba7a82b72b327fb24c55790655689256 -F src/vdbemem.c 5e579abf6532001dfbee0e640dc34eae897a9807 +F src/vdbemem.c e5673f81a2381b35c60e73ef0a8502be2ab1041e F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2 F src/vtab.c 82200af3881fa4e1c9cf07cf31d98c09d437e3ab F src/wal.c 0925601f3299c2941a67c9cfff41ee710f70ca82 @@ -843,14 +843,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P ad78ccacb00e2f8a5ca93e2c9006266d9477fe48 -R ab9c5083b94a38201583f7f7d962aec2 +P 6758f6a8ec97941e09847b309812b3194eb57f19 +R ac740eb62d9494600aa4fed42f2a1b74 U drh -Z 731cac3ef7411b3c0b31c9abc868e228 +Z 84adaeb91a66675447d0e577f5b22205 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) -iD8DBQFMUwFzoxKgR168RlERAs0AAJ4r8+wS17WmbvJdavU0h3g2I0y8FwCfRtkq -kzxM3lMJD9/oWhUWCEVKnVw= -=ua+E +iD8DBQFMUwPEoxKgR168RlERApBcAJ0QiVUigby9jkqMoirXpeoWGfBM9gCbBiAk +y6uzCEydAktZnuJxiYQi1OU= +=wXzG -----END PGP SIGNATURE----- diff --git a/manifest.uuid b/manifest.uuid index a3166c1391..a80f1251bc 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6758f6a8ec97941e09847b309812b3194eb57f19 \ No newline at end of file +15c294ca051ed8b5078e7ac9a969b0f9358d9184 \ No newline at end of file diff --git a/src/update.c b/src/update.c index fe8344ca27..44f047b488 100644 --- a/src/update.c +++ b/src/update.c @@ -8,7 +8,7 @@ ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** -sqlite************************************************************************* +************************************************************************* ** This file contains C code routines that are called by the parser ** to handle UPDATE statements. */ diff --git a/src/vdbemem.c b/src/vdbemem.c index 622b617ac1..e376a65627 100644 --- a/src/vdbemem.c +++ b/src/vdbemem.c @@ -1016,7 +1016,7 @@ int sqlite3ValueFromExpr( } op = pExpr->op; - /* op can only be TK_REGISTER is we have compiled with SQLITE_ENABLE_STAT2. + /* op can only be TK_REGISTER if we have compiled with SQLITE_ENABLE_STAT2. ** The ifdef here is to enable us to achieve 100% branch test coverage even ** when SQLITE_ENABLE_STAT2 is omitted. */ From be0b237e6a547544d9bb34382b231b385278acfb Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 30 Jul 2010 18:40:55 +0000 Subject: [PATCH 3/8] If a database becomes corrupted such that an index is out of sync with its table, make sure the corruption is detected and reported back. Do not assume that indices always contain rowids for valid table rows. FossilOrigin-Name: 83395a3d24f18170fc068d9e644291678694c3f0 --- manifest | 18 +++++++++--------- manifest.uuid | 2 +- src/vdbeaux.c | 7 ++----- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/manifest b/manifest index f4c1e82410..049f9f5b2a 100644 --- a/manifest +++ b/manifest @@ -1,8 +1,8 @@ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 -C Fix\stypos\sin\scomments.\s\sNo\scode\sor\slogic\schanges. -D 2010-07-30T16:54:25 +C If\sa\sdatabase\sbecomes\scorrupted\ssuch\sthat\san\sindex\sis\sout\sof\ssync\swith\sits\ntable,\smake\ssure\sthe\scorruption\sis\sdetected\sand\sreported\sback.\s\sDo\snot\sassume\nthat\sindices\salways\scontain\srowids\sfor\svalid\stable\srows. +D 2010-07-30T18:40:55 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in ec08dc838fd8110fe24c92e5130bcd91cbb1ff2e F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -225,7 +225,7 @@ F src/vdbe.c cefff41564b68a412e65e6a1013ec1b1c1ece6c4 F src/vdbe.h 4de0efb4b0fdaaa900cf419b35c458933ef1c6d2 F src/vdbeInt.h ffd68c4d4229227a5089bec53a1c635146177abc F src/vdbeapi.c d0f4407e465f261780ad725c1caece7d66a6aa35 -F src/vdbeaux.c 8a443e73760ca65ffdfda3e26df4c8c90eeefa11 +F src/vdbeaux.c e18a42d0bdac405565f2d258a82457fd10db133d F src/vdbeblob.c 258a6010ba7a82b72b327fb24c55790655689256 F src/vdbemem.c e5673f81a2381b35c60e73ef0a8502be2ab1041e F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2 @@ -843,14 +843,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P 6758f6a8ec97941e09847b309812b3194eb57f19 -R ac740eb62d9494600aa4fed42f2a1b74 +P 15c294ca051ed8b5078e7ac9a969b0f9358d9184 +R da192c1b3eb6d24627da3d8e846fd5c4 U drh -Z 84adaeb91a66675447d0e577f5b22205 +Z 0f8b248fb2e8c5c8333c7907bb68e233 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) -iD8DBQFMUwPEoxKgR168RlERApBcAJ0QiVUigby9jkqMoirXpeoWGfBM9gCbBiAk -y6uzCEydAktZnuJxiYQi1OU= -=wXzG +iD8DBQFMUxy6oxKgR168RlERAmAgAJ9doS44VIifgo0Uhs0eLiDf12dnMgCeOBB1 +2ly4IN6mhS73wXbwSCh2iW0= +=HByC -----END PGP SIGNATURE----- diff --git a/manifest.uuid b/manifest.uuid index a80f1251bc..cfecd4a143 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -15c294ca051ed8b5078e7ac9a969b0f9358d9184 \ No newline at end of file +83395a3d24f18170fc068d9e644291678694c3f0 \ No newline at end of file diff --git a/src/vdbeaux.c b/src/vdbeaux.c index 295a8c3a8d..7729a85d45 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -2400,11 +2400,8 @@ int sqlite3VdbeCursorMoveto(VdbeCursor *p){ rc = sqlite3BtreeMovetoUnpacked(p->pCursor, 0, p->movetoTarget, 0, &res); if( rc ) return rc; p->lastRowid = p->movetoTarget; - p->rowidIsValid = ALWAYS(res==0) ?1:0; - if( NEVER(res<0) ){ - rc = sqlite3BtreeNext(p->pCursor, &res); - if( rc ) return rc; - } + if( res!=0 ) return SQLITE_CORRUPT_BKPT; + p->rowidIsValid = 1; #ifdef SQLITE_TEST sqlite3_search_count++; #endif From 1c320a4366c9a1da926de879fc14f0838021b044 Mon Sep 17 00:00:00 2001 From: drh Date: Sun, 1 Aug 2010 22:41:32 +0000 Subject: [PATCH 4/8] Fix a typo in an error message of the TCL interface. FossilOrigin-Name: 8eadd7b87bfe8786e0352ca14b29d1451998c02c --- manifest | 18 +++++++++--------- manifest.uuid | 2 +- src/tclsqlite.c | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index 049f9f5b2a..f39b0eebd2 100644 --- a/manifest +++ b/manifest @@ -1,8 +1,8 @@ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 -C If\sa\sdatabase\sbecomes\scorrupted\ssuch\sthat\san\sindex\sis\sout\sof\ssync\swith\sits\ntable,\smake\ssure\sthe\scorruption\sis\sdetected\sand\sreported\sback.\s\sDo\snot\sassume\nthat\sindices\salways\scontain\srowids\sfor\svalid\stable\srows. -D 2010-07-30T18:40:55 +C Fix\sa\stypo\sin\san\serror\smessage\sof\sthe\sTCL\sinterface. +D 2010-08-01T22:41:33 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in ec08dc838fd8110fe24c92e5130bcd91cbb1ff2e F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -179,7 +179,7 @@ F src/sqliteInt.h a9be6badc6cd6a3c1ae54475a98661cf351ecad5 F src/sqliteLimit.h 196e2f83c3b444c4548fc1874f52f84fdbda40f3 F src/status.c 496913d4e8441195f6f2a75b1c95993a45b9b30b F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e -F src/tclsqlite.c ae1e4fb653c91ddad7e2534d209711a12604ccc4 +F src/tclsqlite.c 5cd96419fb6c771006f064196ccc70c29d01bec7 F src/test1.c ff3b4533fc4d78d1bff2ef831a5791db55096ed3 F src/test2.c e3f564ab1e9fd0b47b0c9e23e7054e38bf0836cf F src/test3.c 4c21700c73a890a47fc685c1097bfb661346ac94 @@ -843,14 +843,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P 15c294ca051ed8b5078e7ac9a969b0f9358d9184 -R da192c1b3eb6d24627da3d8e846fd5c4 +P 83395a3d24f18170fc068d9e644291678694c3f0 +R f92e6db0a39655cd68bcc5f2c50bf7a0 U drh -Z 0f8b248fb2e8c5c8333c7907bb68e233 +Z 96b88b49422a23bacf04ccec86ee4d52 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) -iD8DBQFMUxy6oxKgR168RlERAmAgAJ9doS44VIifgo0Uhs0eLiDf12dnMgCeOBB1 -2ly4IN6mhS73wXbwSCh2iW0= -=HByC +iD8DBQFMVfghoxKgR168RlERAhFwAJ9pUD0NJCUWOUwGS01mnwnvqODQagCeM58z +x49wm+oddVpJJ0N9H8UCG4k= +=ka8W -----END PGP SIGNATURE----- diff --git a/manifest.uuid b/manifest.uuid index cfecd4a143..8b286a0052 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -83395a3d24f18170fc068d9e644291678694c3f0 \ No newline at end of file +8eadd7b87bfe8786e0352ca14b29d1451998c02c \ No newline at end of file diff --git a/src/tclsqlite.c b/src/tclsqlite.c index a2d352c3bc..68a44c510d 100644 --- a/src/tclsqlite.c +++ b/src/tclsqlite.c @@ -2571,7 +2571,7 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ int v; const char *zOp; if( objc!=3 ){ - Tcl_WrongNumArgs(interp, 2, objv, "(step|sort)"); + Tcl_WrongNumArgs(interp, 2, objv, "(step|sort|autoindex)"); return TCL_ERROR; } zOp = Tcl_GetString(objv[2]); From a550f2decd6c9a7d4fa309d2272b4ea0ec195a3c Mon Sep 17 00:00:00 2001 From: dan Date: Mon, 2 Aug 2010 10:47:05 +0000 Subject: [PATCH 5/8] In shared-cache mode, do not allow one connection to checkpoint a database while a second connection is reading or writing the same shared-cache. FossilOrigin-Name: e75b52d156905ce16bedb94f65c01a4640bdfa75 --- manifest | 29 ++++++++-------------- manifest.uuid | 2 +- src/btree.c | 23 +++++++++++++++++ src/btree.h | 4 +++ src/main.c | 11 +-------- test/walshared.test | 60 +++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 99 insertions(+), 30 deletions(-) create mode 100644 test/walshared.test diff --git a/manifest b/manifest index f39b0eebd2..f9a9bac429 100644 --- a/manifest +++ b/manifest @@ -1,8 +1,5 @@ ------BEGIN PGP SIGNED MESSAGE----- -Hash: SHA1 - -C Fix\sa\stypo\sin\san\serror\smessage\sof\sthe\sTCL\sinterface. -D 2010-08-01T22:41:33 +C In\sshared-cache\smode,\sdo\snot\sallow\sone\sconnection\sto\scheckpoint\sa\sdatabase\swhile\sa\ssecond\sconnection\sis\sreading\sor\swriting\sthe\ssame\sshared-cache. +D 2010-08-02T10:47:06 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in ec08dc838fd8110fe24c92e5130bcd91cbb1ff2e F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -116,8 +113,8 @@ F src/auth.c 523da7fb4979469955d822ff9298352d6b31de34 F src/backup.c 51d83300fe0baee39405c416ceb19a58ed30a8ed F src/bitvec.c 06ad2c36a9c3819c0b9cbffec7b15f58d5d834e0 F src/btmutex.c 96a12f50f7a17475155971a241d85ec5171573ff -F src/btree.c ed454f53f7bf7fb89c7a89f93fa93c5cd35e7aae -F src/btree.h dd83041eda10c17daf023257c1fc883b5f71f85a +F src/btree.c 2b122b7d7dec94670ecaa70f92397406100036aa +F src/btree.h b4ba2fdf6b64c7c376bdfffa826af6b786b151d9 F src/btreeInt.h b0c87f6725b06a0aa194a6d25d54b16ce9d6e291 F src/build.c 0018d49629fc4807100c988dd191dd95e185bb38 F src/callback.c da3c38d0ef5d7f04fae371e519bda61aa9cb1704 @@ -138,7 +135,7 @@ F src/journal.c 552839e54d1bf76fb8f7abe51868b66acacf6a0e F src/legacy.c a199d7683d60cef73089e892409113e69c23a99f F src/lempar.c 7f026423f4d71d989e719a743f98a1cbd4e6d99e F src/loadext.c 6d422ea91cf3d2d00408c5a8f2391cd458da85f8 -F src/main.c a487fe90aecaccb142e4a6b738c7e26e99145bcd +F src/main.c 99622181f36d68e9f2a851c7b34263b3dcd03470 F src/malloc.c 19a468460c7df72de245f10c06bd0625777b7c83 F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c 89d4ea8d5cdd55635cbaa48ad53132af6294cbb2 @@ -796,6 +793,7 @@ F test/walcrash2.test 019d60b89d96c1937adb2b30b850ac7e86e5a142 F test/walfault.test 05c470688d742688e455dd56816bd6bcffa298f8 F test/walhook.test ed00a40ba7255da22d6b66433ab61fab16a63483 F test/walmode.test 5dc3008ef71988ecdd949ea16e5750e325b92b54 +F test/walshared.test 985b4a3406b2b2dace1d52a42d26a11dd6900981 F test/walslow.test d21625e2e99e11c032ce949e8a94661576548933 F test/walthread.test a25a393c068a2b42b44333fa3fdaae9072f1617c F test/where.test de337a3fe0a459ec7c93db16a519657a90552330 @@ -843,14 +841,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P 83395a3d24f18170fc068d9e644291678694c3f0 -R f92e6db0a39655cd68bcc5f2c50bf7a0 -U drh -Z 96b88b49422a23bacf04ccec86ee4d52 ------BEGIN PGP SIGNATURE----- -Version: GnuPG v1.4.6 (GNU/Linux) - -iD8DBQFMVfghoxKgR168RlERAhFwAJ9pUD0NJCUWOUwGS01mnwnvqODQagCeM58z -x49wm+oddVpJJ0N9H8UCG4k= -=ka8W ------END PGP SIGNATURE----- +P 8eadd7b87bfe8786e0352ca14b29d1451998c02c +R a67fb210b5d7dd1a4ef9d58317971625 +U dan +Z 5d06583ec8d1edb28c3029d4562549b8 diff --git a/manifest.uuid b/manifest.uuid index 8b286a0052..c41b79e53a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -8eadd7b87bfe8786e0352ca14b29d1451998c02c \ No newline at end of file +e75b52d156905ce16bedb94f65c01a4640bdfa75 \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index d07e4c3d68..c03d3c92b8 100644 --- a/src/btree.c +++ b/src/btree.c @@ -7848,6 +7848,29 @@ int sqlite3BtreeIsInTrans(Btree *p){ return (p && (p->inTrans==TRANS_WRITE)); } +#ifndef SQLITE_OMIT_WAL +/* +** Run a checkpoint on the Btree passed as the first argument. +** +** Return SQLITE_LOCKED if this or any other connection has an open +** transaction on the shared-cache the argument Btree is connected to. +*/ +int sqlite3BtreeCheckpoint(Btree *p){ + int rc = SQLITE_OK; + if( p ){ + BtShared *pBt = p->pBt; + sqlite3BtreeEnter(p); + if( pBt->inTransaction!=TRANS_NONE ){ + rc = SQLITE_LOCKED; + }else{ + rc = sqlite3PagerCheckpoint(pBt->pPager); + } + sqlite3BtreeLeave(p); + } + return rc; +} +#endif + /* ** Return non-zero if a read (or write) transaction is active. */ diff --git a/src/btree.h b/src/btree.h index 584b463384..c989307aad 100644 --- a/src/btree.h +++ b/src/btree.h @@ -201,6 +201,10 @@ int sqlite3BtreeCursorInfo(BtCursor*, int*, int); void sqlite3BtreeCursorList(Btree*); #endif +#ifndef SQLITE_OMIT_WAL + int sqlite3BtreeCheckpoint(Btree*); +#endif + /* ** If we are not using shared cache, then there is no need to ** use mutexes to access the BtShared structures. So make the diff --git a/src/main.c b/src/main.c index c3828d5d9f..b233c8473d 100644 --- a/src/main.c +++ b/src/main.c @@ -1308,16 +1308,7 @@ int sqlite3Checkpoint(sqlite3 *db, int iDb){ for(i=0; inDb && rc==SQLITE_OK; i++){ if( i==iDb || iDb==SQLITE_MAX_ATTACHED ){ - Btree *pBt = db->aDb[i].pBt; - if( pBt ){ - if( sqlite3BtreeIsInReadTrans(pBt) ){ - rc = SQLITE_LOCKED; - }else{ - sqlite3BtreeEnter(pBt); - rc = sqlite3PagerCheckpoint(sqlite3BtreePager(pBt)); - sqlite3BtreeLeave(pBt); - } - } + rc = sqlite3BtreeCheckpoint(db->aDb[i].pBt); } } diff --git a/test/walshared.test b/test/walshared.test new file mode 100644 index 0000000000..658a25f9e1 --- /dev/null +++ b/test/walshared.test @@ -0,0 +1,60 @@ +# 2010 August 2 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#*********************************************************************** +# This file implements regression tests for SQLite library. The +# focus of this file is testing the operation of the library in +# "PRAGMA journal_mode=WAL" mode with shared-cache turned on. +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl +db close +set ::enable_shared_cache [sqlite3_enable_shared_cache 1] + +sqlite3 db test.db +sqlite3 db2 test.db + +do_test walshared-1.0 { + execsql { + PRAGMA cache_size = 10; + PRAGMA journal_mode = WAL; + CREATE TABLE t1(a PRIMARY KEY, b UNIQUE); + INSERT INTO t1 VALUES(randomblob(100), randomblob(200)); + } +} {wal} + +do_test walshared-1.1 { + execsql { + BEGIN; + INSERT INTO t1 VALUES(randomblob(100), randomblob(200)); + INSERT INTO t1 SELECT randomblob(100), randomblob(200) FROM t1; + INSERT INTO t1 SELECT randomblob(100), randomblob(200) FROM t1; + INSERT INTO t1 SELECT randomblob(100), randomblob(200) FROM t1; + } +} {} + +do_test walshared-1.2 { + catchsql { PRAGMA wal_checkpoint } +} {1 {database table is locked}} + +do_test walshared-1.3 { + catchsql { PRAGMA wal_checkpoint } db2 +} {1 {database table is locked}} + +do_test walshared-1.4 { + execsql { COMMIT } + execsql { PRAGMA integrity_check } db2 +} {ok} + + + +sqlite3_enable_shared_cache $::enable_shared_cache +finish_test + From 9e5f10743df1743d32a4dc7146f1c6764842694f Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 2 Aug 2010 10:59:13 +0000 Subject: [PATCH 6/8] Modify wal2.test to disable tests requiring TCL 8.5 if the test harness is compiled using TCL 8.4. FossilOrigin-Name: 016486c7d544dcf9b7422cb0fb9804aa1c418f68 --- manifest | 24 +++++++++++++++++------- manifest.uuid | 2 +- test/wal2.test | 49 +++++++++++++++++++++++++------------------------ 3 files changed, 43 insertions(+), 32 deletions(-) diff --git a/manifest b/manifest index f9a9bac429..ae902b3ab1 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,8 @@ -C In\sshared-cache\smode,\sdo\snot\sallow\sone\sconnection\sto\scheckpoint\sa\sdatabase\swhile\sa\ssecond\sconnection\sis\sreading\sor\swriting\sthe\ssame\sshared-cache. -D 2010-08-02T10:47:06 +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA1 + +C Modify\swal2.test\sto\sdisable\stests\srequiring\sTCL\s8.5\sif\sthe\stest\sharness\sis\ncompiled\susing\sTCL\s8.4. +D 2010-08-02T10:59:14 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in ec08dc838fd8110fe24c92e5130bcd91cbb1ff2e F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -781,7 +784,7 @@ F test/vtab_alter.test 9e374885248f69e251bdaacf480b04a197f125e5 F test/vtab_err.test 0d4d8eb4def1d053ac7c5050df3024fd47a3fbd8 F test/vtab_shared.test 0eff9ce4f19facbe0a3e693f6c14b80711a4222d F test/wal.test 1891e6f72dd437a1c2a48091aa9182ba17a8f780 -F test/wal2.test fa6dc4457b46988f46cf6c68ea51ebe341765f4a +F test/wal2.test 8dcebda41587e0b2b57194d03fd8700e01e85656 F test/wal3.test d2ae7e66f973bd6b58ce49e546b2c00f44fe0485 F test/wal4.test 3404b048fa5e10605facaf70384e6d2943412e30 F test/wal_common.tcl 895d76138043b86bdccf36494054bdabcf65837b @@ -841,7 +844,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P 8eadd7b87bfe8786e0352ca14b29d1451998c02c -R a67fb210b5d7dd1a4ef9d58317971625 -U dan -Z 5d06583ec8d1edb28c3029d4562549b8 +P e75b52d156905ce16bedb94f65c01a4640bdfa75 +R 4bcc255fd245f0aefdffbbd0dcd527e2 +U drh +Z 73dcbb237530d4b99c645ee151eb2169 +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.6 (GNU/Linux) + +iD8DBQFMVqUFoxKgR168RlERAr7YAJ4i7F11zp1UnFfAGpxICAppvxfFxwCfRCKv +nCovMTlO5dRRYoRobLXqmLk= +=2tPU +-----END PGP SIGNATURE----- diff --git a/manifest.uuid b/manifest.uuid index c41b79e53a..2f4c7c497f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e75b52d156905ce16bedb94f65c01a4640bdfa75 \ No newline at end of file +016486c7d544dcf9b7422cb0fb9804aa1c418f68 \ No newline at end of file diff --git a/test/wal2.test b/test/wal2.test index c4d7fa7bc5..1aad19ab23 100644 --- a/test/wal2.test +++ b/test/wal2.test @@ -980,30 +980,32 @@ do_test wal2-11.1.1 { execsql { SELECT name FROM sqlite_master } db2 } {t1} -# Set all zeroed slots in the first hash table to invalid values. -# -set blob [string range [tvfs shm $::filename] 0 16383] -set I [string range [tvfs shm $::filename] 16384 end] -binary scan $I t* L -set I [list] -foreach p $L { - lappend I [expr $p ? $p : 400] +if {$::tcl_version>=8.5} { + # Set all zeroed slots in the first hash table to invalid values. + # + set blob [string range [tvfs shm $::filename] 0 16383] + set I [string range [tvfs shm $::filename] 16384 end] + binary scan $I t* L + set I [list] + foreach p $L { + lappend I [expr $p ? $p : 400] + } + append blob [binary format t* $I] + tvfs shm $::filename $blob + do_test wal2-11.2 { + catchsql { INSERT INTO t1 VALUES(10, 11, 12) } + } {1 {database disk image is malformed}} + + # Fill up the hash table on the first page of shared memory with 0x55 bytes. + # + set blob [string range [tvfs shm $::filename] 0 16383] + append blob [string repeat [binary format c 55] 16384] + tvfs shm $::filename $blob + do_test wal2-11.3 { + catchsql { SELECT * FROM t1 } db2 + } {1 {database disk image is malformed}} } -append blob [binary format t* $I] -tvfs shm $::filename $blob -do_test wal2-11.2 { - catchsql { INSERT INTO t1 VALUES(10, 11, 12) } -} {1 {database disk image is malformed}} - -# Fill up the hash table on the first page of shared memory with 0x55 bytes. -# -set blob [string range [tvfs shm $::filename] 0 16383] -append blob [string repeat [binary format c 55] 16384] -tvfs shm $::filename $blob -do_test wal2-11.3 { - catchsql { SELECT * FROM t1 } db2 -} {1 {database disk image is malformed}} - + db close db2 close tvfs delete @@ -1148,4 +1150,3 @@ if {$::tcl_platform(platform) == "unix"} { } finish_test - From 6dc84902320f2a95db97b6007d6ef838d2845f30 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 3 Aug 2010 13:08:54 +0000 Subject: [PATCH 7/8] Fix the REPLACE conflict resolution so that it falls back to ABORT when a CHECK constraint fails. Ticket [c38baa3d969eab794]. FossilOrigin-Name: 4e157b774764b8bafc9fabb88decf54f178b5ff5 --- manifest | 20 ++++++++++---------- manifest.uuid | 2 +- src/insert.c | 1 + test/conflict.test | 22 ++++++++++++++++++++++ 4 files changed, 34 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index ae902b3ab1..239547c2e6 100644 --- a/manifest +++ b/manifest @@ -1,8 +1,8 @@ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 -C Modify\swal2.test\sto\sdisable\stests\srequiring\sTCL\s8.5\sif\sthe\stest\sharness\sis\ncompiled\susing\sTCL\s8.4. -D 2010-08-02T10:59:14 +C Fix\sthe\sREPLACE\sconflict\sresolution\sso\sthat\sit\sfalls\sback\sto\sABORT\swhen\na\sCHECK\sconstraint\sfails.\s\sTicket\s[c38baa3d969eab794]. +D 2010-08-03T13:08:55 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in ec08dc838fd8110fe24c92e5130bcd91cbb1ff2e F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -133,7 +133,7 @@ F src/global.c 02335177cf6946fe5525c6f0755cf181140debf3 F src/hash.c 458488dcc159c301b8e7686280ab209f1fb915af F src/hash.h 2894c932d84d9f892d4b4023a75e501f83050970 F src/hwtime.h d32741c8f4df852c7d959236615444e2b1063b08 -F src/insert.c ba455ebb100283ccc5da03da3498fcbca48ce6bb +F src/insert.c a4995747c062256582a90b4f87f716e11b067050 F src/journal.c 552839e54d1bf76fb8f7abe51868b66acacf6a0e F src/legacy.c a199d7683d60cef73089e892409113e69c23a99f F src/lempar.c 7f026423f4d71d989e719a743f98a1cbd4e6d99e @@ -304,7 +304,7 @@ F test/collate9.test 3adcc799229545940df2f25308dd1ad65869145a F test/collateA.test b8218ab90d1fa5c59dcf156efabb1b2599c580d6 F test/colmeta.test 087c42997754b8c648819832241daf724f813322 F test/colname.test 08948a4809d22817e0e5de89c7c0a8bd90cb551b -F test/conflict.test 0ed68b11f22721052d880ee80bd528a0e0828236 +F test/conflict.test f2f2b2950730a9532e11e468070cebf389f5c375 F test/corrupt.test 1a5bef8b2d178859af69814ecedcd37219a89968 F test/corrupt2.test 808a28d0ca3b97e9aa8c91cd2b485ea2700b76d1 F test/corrupt3.test a399dacccb91c732f6b071c913e70d195af8c058 @@ -844,14 +844,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P e75b52d156905ce16bedb94f65c01a4640bdfa75 -R 4bcc255fd245f0aefdffbbd0dcd527e2 +P 016486c7d544dcf9b7422cb0fb9804aa1c418f68 +R 3325483e922777e07054f0cb49438593 U drh -Z 73dcbb237530d4b99c645ee151eb2169 +Z d4d184e312b9a6c1d14017f77666543c -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) -iD8DBQFMVqUFoxKgR168RlERAr7YAJ4i7F11zp1UnFfAGpxICAppvxfFxwCfRCKv -nCovMTlO5dRRYoRobLXqmLk= -=2tPU +iD8DBQFMWBTroxKgR168RlERAs2pAJ9ife269/S3Uo4Ju+ipuIdk7AK4VwCeNuGn +CUQtoV3bUC+VGAu/OWy/3UA= +=m2KU -----END PGP SIGNATURE----- diff --git a/manifest.uuid b/manifest.uuid index 2f4c7c497f..84f1cf5c84 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -016486c7d544dcf9b7422cb0fb9804aa1c418f68 \ No newline at end of file +4e157b774764b8bafc9fabb88decf54f178b5ff5 \ No newline at end of file diff --git a/src/insert.c b/src/insert.c index b8aa91b873..adf6ef2ed4 100644 --- a/src/insert.c +++ b/src/insert.c @@ -1220,6 +1220,7 @@ void sqlite3GenerateConstraintChecks( if( onError==OE_Ignore ){ sqlite3VdbeAddOp2(v, OP_Goto, 0, ignoreDest); }else{ + if( onError==OE_Replace ) onError = OE_Abort; /* IMP: R-15569-63625 */ sqlite3HaltConstraint(pParse, onError, 0, 0); } sqlite3VdbeResolveLabel(v, allOk); diff --git a/test/conflict.test b/test/conflict.test index 44390d20f2..c612e3b3fe 100644 --- a/test/conflict.test +++ b/test/conflict.test @@ -789,4 +789,26 @@ do_test conflict-12.4 { } {2 one} +# Ticket [c38baa3d969eab7946dc50ba9d9b4f0057a19437] +# REPLACE works like ABORT on a CHECK constraint. +# +do_test conflict-13.1 { + execsql { + CREATE TABLE t13(a CHECK(a!=2)); + BEGIN; + REPLACE INTO t13 VALUES(1); + } + catchsql { + REPLACE INTO t13 VALUES(2); + } +} {1 {constraint failed}} +do_test conflict-13.2 { + execsql { + REPLACE INTO t13 VALUES(3); + COMMIT; + SELECT * FROM t13; + } +} {1 3} + + finish_test From a3e414cd4827402b7d877a9c368a0afdb9fbe637 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 3 Aug 2010 18:06:25 +0000 Subject: [PATCH 8/8] Fix disabled implementation-mark comments in func.c. FossilOrigin-Name: 57c0960038b8ce97f9d6665f15e7f6ec310c681f --- manifest | 18 +++++++++--------- manifest.uuid | 2 +- src/func.c | 11 +++++++---- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/manifest b/manifest index 239547c2e6..40213f1639 100644 --- a/manifest +++ b/manifest @@ -1,8 +1,8 @@ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 -C Fix\sthe\sREPLACE\sconflict\sresolution\sso\sthat\sit\sfalls\sback\sto\sABORT\swhen\na\sCHECK\sconstraint\sfails.\s\sTicket\s[c38baa3d969eab794]. -D 2010-08-03T13:08:55 +C Fix\sdisabled\simplementation-mark\scomments\sin\sfunc.c. +D 2010-08-03T18:06:25 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in ec08dc838fd8110fe24c92e5130bcd91cbb1ff2e F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -128,7 +128,7 @@ F src/delete.c 7ed8a8c8b5f748ece92df173d7e0f7810c899ebd F src/expr.c a0fd9c5e248229851077de92f2e9346f2c43ed46 F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb F src/fkey.c 58bbf52c6ddd3f64ca40a3230f9e548a83a5cb16 -F src/func.c 75dc1fd91e5692cadb80d257bab68d7343060467 +F src/func.c 464b0dc70618b896c402c574eb04bc5eacf35341 F src/global.c 02335177cf6946fe5525c6f0755cf181140debf3 F src/hash.c 458488dcc159c301b8e7686280ab209f1fb915af F src/hash.h 2894c932d84d9f892d4b4023a75e501f83050970 @@ -844,14 +844,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P 016486c7d544dcf9b7422cb0fb9804aa1c418f68 -R 3325483e922777e07054f0cb49438593 +P 4e157b774764b8bafc9fabb88decf54f178b5ff5 +R 2ffda3ab686430275e530bf434e41e4c U drh -Z d4d184e312b9a6c1d14017f77666543c +Z 636446afbb2581f1ac8c757ae258a4e0 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) -iD8DBQFMWBTroxKgR168RlERAs2pAJ9ife269/S3Uo4Ju+ipuIdk7AK4VwCeNuGn -CUQtoV3bUC+VGAu/OWy/3UA= -=m2KU +iD8DBQFMWFqkoxKgR168RlERAoOBAKCD0AqnZ6ZzbybLHgm4lZfoGX3cfgCfa6ef +C79lcWSk6pzbtaW4+fqCLFQ= +=jbsY -----END PGP SIGNATURE----- diff --git a/manifest.uuid b/manifest.uuid index 84f1cf5c84..fce696df96 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4e157b774764b8bafc9fabb88decf54f178b5ff5 \ No newline at end of file +57c0960038b8ce97f9d6665f15e7f6ec310c681f \ No newline at end of file diff --git a/src/func.c b/src/func.c index 15d7a5bd60..d461412725 100644 --- a/src/func.c +++ b/src/func.c @@ -788,8 +788,10 @@ static void compileoptionusedFunc( const char *zOptName; assert( argc==1 ); UNUSED_PARAMETER(argc); - /* IMP: R-xxxx This function is an SQL wrapper around the - ** sqlite3_compileoption_used() C interface. */ + /* IMP: R-39564-36305 The sqlite_compileoption_used() SQL + ** function is a wrapper around the sqlite3_compileoption_used() C/C++ + ** function. + */ if( (zOptName = (const char*)sqlite3_value_text(argv[0]))!=0 ){ sqlite3_result_int(context, sqlite3_compileoption_used(zOptName)); } @@ -810,8 +812,9 @@ static void compileoptiongetFunc( int n; assert( argc==1 ); UNUSED_PARAMETER(argc); - /* IMP: R-xxxx This function is an SQL wrapper around the - ** sqlite3_compileoption_get() C interface. */ + /* IMP: R-04922-24076 The sqlite_compileoption_get() SQL function + ** is a wrapper around the sqlite3_compileoption_get() C/C++ function. + */ n = sqlite3_value_int(argv[0]); sqlite3_result_text(context, sqlite3_compileoption_get(n), -1, SQLITE_STATIC); }