]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Misc fixes for test cases failing due to the new locking model. (CVS 1561)
authordanielk1977 <danielk1977@noemail.net>
Thu, 10 Jun 2004 05:59:24 +0000 (05:59 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Thu, 10 Jun 2004 05:59:24 +0000 (05:59 +0000)
FossilOrigin-Name: 71e98d0d089576433c4b06dcba1c57063bd366f5

manifest
manifest.uuid
src/pager.c
test/delete.test
test/enc2.test
test/misc1.test
test/thread1.test

index 482d27f90f61dcb31c5a47c446242f1e79da0e9a..81e9c986944b466bfe71900076fb5627339d56d2 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C When\sin\sPAGER_RESERVED\sstate,\sdon't\swrite\sto\sthe\smain\sfile\swhen\srolling\nback\sa\sstatement\stransaction.\s(CVS\s1560)
-D 2004-06-10T04:32:17
+C Misc\sfixes\sfor\stest\scases\sfailing\sdue\sto\sthe\snew\slocking\smodel.\s(CVS\s1561)
+D 2004-06-10T05:59:25
 F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a
 F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@@ -47,7 +47,7 @@ F src/os_unix.c 1d6f3d1a87d4aa0e4490bcc47b3f0ff9b2e37e7a
 F src/os_unix.h 1cd6133cf66dea704b8646b70b2dfdcbdd9b3738
 F src/os_win.c 6b8f9fcc683bb888e07fc485372803baa68faadb
 F src/os_win.h 004eec47b1780fcaf07420ddc2072294b698d48c
-F src/pager.c 778379c031daa20d134a934d5753c19b606c10db
+F src/pager.c d852730901441babf6cd16fc528dd6eecc2b2eab
 F src/pager.h ca8f293e1d623a7c628a1c5e0c6cf43d5bbb80bf
 F src/parse.y 097438674976355a10cf177bd97326c548820b86
 F src/pragma.c 6ab13748a415bf8e8f2dd79e5f713fbe72dfd3f4
@@ -100,9 +100,9 @@ F test/collate4.test a8f2d58bd6943ed1746639c11b12896ccfe8f646
 F test/conflict.test 45ce1e44ea748944aed233df8c278a9e1c4c87cc
 F test/crashtest1.c 09c1c7d728ccf4feb9e481671e29dda5669bbcc2
 F test/date.test aed5030482ebc02bd8d386c6c86a29f694ab068d
-F test/delete.test ddb1d4e172a01c0165804f82f81df556fb48a856
+F test/delete.test ac14bd6df5f1581d646eebc013d6b844a885dcf6
 F test/enc.test a55481d45ff493804e8d88357feb4642fc50a6b2
-F test/enc2.test fb00c4954b4f3eca1e8ec9c26671c68f6170226d
+F test/enc2.test 28b61a098dd571b06147fe9f857489edba4e405d
 F test/expr.test 521588701dae8cf5aa2b8a18c5c897711f754332
 F test/fkey1.test d65c824459916249bee501532d6154ddab0b5db7
 F test/func.test 9816fbed0a5e87e00f4fc88b4cdcd638abc524c4
@@ -125,7 +125,7 @@ F test/malloc.test 4e19b96d9cd7d61f4826e6fce03849ad5ad526dd
 F test/memdb.test befe8f26d430d07ba65692243a893a0e82a0b866
 F test/memleak.test 4d5d374c8ea1fc5ac634aed58cac1047848ce65e
 F test/minmax.test 9dcf52f713b1b9e61d0a88a51eb8bb2e3c52d0ab
-F test/misc1.test 06e92b613615d38919bf6fea85536bc685a3da4b
+F test/misc1.test 8472d2133c33efa29d514b464c4129f638b9cd31
 F test/misc2.test 10c2ce26407d37411b96273e552d5095393732be
 F test/misc3.test eb488314990bfc0959221a1acc465013238bf168
 F test/misuse.test 1095f26d1aed406c65e1d2eba651c4bb7c38cbff
@@ -152,7 +152,7 @@ F test/tableapi.test e0c4cce61e58343caa84dab33fa6823cb35fe1e1
 F test/tclsqlite.test ab5e5c5a00b592c48c38fec8095cde74186c3fc2
 F test/temptable.test a770ba6308d7f7332fce985086b8e06bed6430c2
 F test/tester.tcl fc10520db0d3ce4ef6a8b5ab91bd102fc3f4280a
-F test/thread1.test 2fd5c10e82434f6b03be77b61fde5a050668abf2
+F test/thread1.test 52ab8d963691d5a34a7f998d364371c8c725a253
 F test/threadtest1.c f7f896e62ed46feae1dc411114a48c15a0f82ee2
 F test/threadtest2.c d94ca4114fd1504f7e0ae724bcd83d4b40931d86
 F test/trans.test 4a26c6fa3639202c334521954c17d8abe8a1c8e8
@@ -218,7 +218,7 @@ F www/support.tcl 1801397edd271cc39a2aadd54e701184b5181248
 F www/tclsqlite.tcl 19191cf2a1010eaeff74c51d83fd5f5a4d899075
 F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9
 F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
-P b8aaa3a29e0ddef357ab1b3b0b9f87ed390f2f36
-R ad810f31dbb79cebb57b3882d1073a25
+P adb2bd61436927d37b23bae857089d62e12397af
+R e8b127567100f827cb21e845b744b7ae
 U danielk1977
-Z 5213c6eb04cd03f6a07cc2df587564de
+Z 7c95f2d087a4836fb9faba67d8f7b64b
index 52315fbf253379e3ba7d487412ce81259b53103a..cb65bce093ac308c7c14e0bceafe8c2f84623448 100644 (file)
@@ -1 +1 @@
-adb2bd61436927d37b23bae857089d62e12397af
\ No newline at end of file
+71e98d0d089576433c4b06dcba1c57063bd366f5
\ No newline at end of file
index fc15afcc5a151abcb094de764ff30ad6529f7d63..94a59c9fafc916615af9788b88c2796cf71d9ee9 100644 (file)
@@ -18,7 +18,7 @@
 ** file simultaneously, or one process from reading the database while
 ** another is writing.
 **
-** @(#) $Id: pager.c,v 1.121 2004/06/10 04:32:17 danielk1977 Exp $
+** @(#) $Id: pager.c,v 1.122 2004/06/10 05:59:25 danielk1977 Exp $
 */
 #include "os.h"         /* Must be first to enable large file support */
 #include "sqliteInt.h"
@@ -521,7 +521,11 @@ static int pager_playback_one_page(Pager *pPager, OsFile *jfd, int useCksum){
 
   /* If the pager is in RESERVED state, then there must be a copy of this
   ** page in the pager cache. In this case just update the pager cache,
-  ** not the database file.
+  ** not the database file. The page is left marked dirty in this case.
+  **
+  ** FIX ME: Ideally the page would only be left marked dirty when the
+  ** pager is in RESERVED state if it was dirty when this statement
+  ** transaction was started. 
   **
   ** If in EXCLUSIVE state, then we update the pager cache if it exists
   ** and the main file. The page is then marked not dirty.
@@ -545,8 +549,11 @@ static int pager_playback_one_page(Pager *pPager, OsFile *jfd, int useCksum){
     if( pPager->xDestructor ){
       pPager->xDestructor(pData, pPager->pageSize);
     }
-    pPg->dirty = 0;
-    pPg->needSync = 0;
+    if( pPager->state==PAGER_EXCLUSIVE ){
+      pPg->dirty = 0;
+      pPg->needSync = 0;
+    }
+
     CODEC(pPager, pData, pPg->pgno, 3);
   }
   return rc;
index 142e330731c476ada5512d0628077028e0091322..c22091b362eac1d797c4a49728dca4608943ba44 100644 (file)
@@ -11,7 +11,7 @@
 # This file implements regression tests for SQLite library.  The
 # focus of this file is testing the DELETE FROM statement.
 #
-# $Id: delete.test,v 1.14 2004/05/27 17:22:56 drh Exp $
+# $Id: delete.test,v 1.15 2004/06/10 05:59:25 danielk1977 Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -277,11 +277,16 @@ do_test delete-8.3 {
 do_test delete-8.4 {
   execsql {SELECT * FROM t3} 
 } {123}
+
+# Update for v3: In v2 the DELETE statement would succeed because no
+# database writes actually occur. Version 3 refuses to open a transaction
+# on a read-only file, so the statement fails.
 do_test delete-8.5 {
   catchsql {
     DELETE FROM t3 WHERE a<100;
   }
-} {0 {}}
+# v2 result: {0 {}}
+} {1 {attempt to write a readonly database}}
 do_test delete-8.6 {
   execsql {SELECT * FROM t3}
 } {123}
index 33e4fc9a97302e90aad30c623badfd846cea5567..e21234d98e3eb531b13651be0cca7c0f6ec8c6e4 100644 (file)
@@ -13,7 +13,7 @@
 # various suported unicode encodings (UTF-8, UTF-16, UTF-16le and
 # UTF-16be).
 #
-# $Id: enc2.test,v 1.6 2004/06/09 12:30:06 danielk1977 Exp $
+# $Id: enc2.test,v 1.7 2004/06/10 05:59:25 danielk1977 Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -142,4 +142,6 @@ do_test enc2-4.3 {
   }
 } {1 {attached databases must use the same text encoding as main database}}
 
+db2 close
+
 finish_test
index 3862113257f0b17388754cf899b4314efbff7ebf..a4e82477c070082b371d0a95c73b700562a80636 100644 (file)
@@ -13,7 +13,7 @@
 # This file implements tests for miscellanous features that were
 # left out of other test files.
 #
-# $Id: misc1.test,v 1.26 2004/06/09 09:55:20 danielk1977 Exp $
+# $Id: misc1.test,v 1.27 2004/06/10 05:59:25 danielk1977 Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -323,13 +323,16 @@ do_test misc1-10.10 {
 # Make sure the initialization works even if a database is opened while
 # another process has the database locked.
 #
+# Update for v3: The BEGIN doesn't lock the database so the schema is read
+# and the SELECT returns successfully.
 do_test misc1-11.1 {
   execsql {BEGIN}
   execsql {UPDATE t1 SET a=0 WHERE 0}
   sqlite db2 test.db
   set rc [catch {db2 eval {SELECT count(*) FROM t1}} msg]
   lappend rc $msg
-} {1 {database is locked}}
+# v2 result: {1 {database is locked}}
+} {0 3}
 do_test misc1-11.2 {
   execsql {COMMIT}
   set rc [catch {db2 eval {SELECT count(*) FROM t1}} msg]
index 59f79a7409210a57e8874c22c0c487d45911c2d4..24c497df9c0490867a9620daaf77391f95d6cf0e 100644 (file)
@@ -11,7 +11,7 @@
 # This file implements regression tests for SQLite library.  The
 # focus of this script is multithreading behavior
 #
-# $Id: thread1.test,v 1.4 2004/06/02 06:30:18 danielk1977 Exp $
+# $Id: thread1.test,v 1.5 2004/06/10 05:59:25 danielk1977 Exp $
 
 
 set testdir [file dirname $argv0]
@@ -123,17 +123,24 @@ do_test thread1-2.3 {
   thread_compile C {INSERT INTO t2 VALUES(98,99)}
   thread_step C
   thread_result C
+  thread_finalize C
+  thread_result C
 } SQLITE_BUSY
+
 do_test thread1-2.4 {
   execsql {SELECT * FROM t2}
 } {}
+
 do_test thread1-2.5 {
   thread_finalize A
   thread_result A
 } SQLITE_OK
 do_test thread1-2.6 {
+  thread_compile C {INSERT INTO t2 VALUES(98,99)}
   thread_step C
   thread_result C
+  thread_finalize C
+  thread_result C
 } SQLITE_BUSY
 do_test thread1-2.7 {
   execsql {SELECT * FROM t2}
@@ -143,6 +150,7 @@ do_test thread1-2.8 {
   thread_result B
 } SQLITE_OK
 do_test thread1-2.9 {
+  thread_compile C {INSERT INTO t2 VALUES(98,99)}
   thread_step C
   thread_result C
 } SQLITE_DONE