]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add a test to walthread.test for changing between WAL and rollback modes.
authordan <dan@noemail.net>
Wed, 28 Apr 2010 18:17:23 +0000 (18:17 +0000)
committerdan <dan@noemail.net>
Wed, 28 Apr 2010 18:17:23 +0000 (18:17 +0000)
FossilOrigin-Name: da229e44bd4a5d512261da05958d560808c9889f

manifest
manifest.uuid
test/walthread.test

index 23a34d1f78facc74fb793917f8e63893d8c6a4ea..8d7772b612c56721a3daa0c5558fca26eaf8fc77 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Merge\stwo\s"wal"\nleaves.
-D 2010-04-28T17:49:57
+C Add\sa\stest\sto\swalthread.test\sfor\schanging\sbetween\sWAL\sand\srollback\smodes.
+D 2010-04-28T18:17:23
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in d83a0ffef3dcbfb08b410a6c6dd6c009ec9167fb
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -764,7 +764,7 @@ F test/walcrash.test f022cee7eb7baa5fb898726120a6a4073dd831d1
 F test/walhook.test 287a69d662939604f2e0452dace2cec8ef634d5e
 F test/walmode.test 40119078da084e6a7403ba57485d5a86ee0e2646
 F test/walslow.test 38076d5fad49e3678027be0f8110e6a32d531dc2
-F test/walthread.test 871aeecc5b89133b094bcc00c4fcfa040749c726
+F test/walthread.test ce1d0fc9905cf8a7cf1a61dbcafcbd3434166236
 F test/where.test de337a3fe0a459ec7c93db16a519657a90552330
 F test/where2.test 45eacc126aabb37959a387aa83e59ce1f1f03820
 F test/where3.test aa44a9b29e8c9f3d7bb94a3bb3a95b31627d520d
@@ -808,7 +808,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P 25f85f68723e56c18e44b094d85f67b99912dc86 348409de26eafe12f5cb1236e8e167a4183d4051
-R 39134c2ac17dc2dba6c744dfce94f1bb
+P 13d2d5a66e9eaa81aa6314354201ee1fbd2b3824
+R 03ea219fce1817690b6cb9bee0a76d8a
 U dan
-Z 83204dbbb275bd731c15521fddcf192e
+Z e37b4277b60d879edbf1e6cb6d434b3c
index 6103307f91bf3121709c98f1a5d8e8b4bfe9232d..c424e5c417c1fd2166ebd4133e11623721c7f315 100644 (file)
@@ -1 +1 @@
-13d2d5a66e9eaa81aa6314354201ee1fbd2b3824
\ No newline at end of file
+da229e44bd4a5d512261da05958d560808c9889f
\ No newline at end of file
index 8e20d96dfb5a50276f539f927c4f12b5c57c97a1..057ba2396f2ccbe58ee550fb62a0f93609741b20 100644 (file)
@@ -61,6 +61,9 @@ proc lshift {lvar} {
 #   -processes BOOLEAN                True to use processes instead of threads.
 #
 proc do_thread_test {args} {
+
+  #if {[string match walthread-2* [lindex $args 0]]==0} return
+
   set A $args
 
   set P(testname) [lshift A]
@@ -131,11 +134,11 @@ proc do_thread_test {args} {
 
         set ::finished 0
         after [expr %SECONDS% * 1000] {set ::finished 1}
-        proc tt_continue {} { expr ($::finished==0) }
+        proc tt_continue {} { update ; expr ($::finished==0) }
 
         set rc [catch { %TEST% } msg]
 
-        db close
+        catch { db close }
         list $rc $msg
       }]
 
@@ -184,7 +187,7 @@ proc do_thread_test {args} {
 # Each of the N threads runs N read transactions followed by a single write
 # transaction in a loop as fast as possible.
 #
-# Ther is also a single checkpointer thread. It runs the following loop:
+# There is also a single checkpointer thread. It runs the following loop:
 #
 #   1) Execute "PRAGMA checkpoint"
 #   2) Sleep for 500 ms.
@@ -238,7 +241,6 @@ foreach {mode name} {
     while {[tt_continue]} {
       read_transaction
       write_transaction 
-      usleep 1
       incr nRun
     }
     set nRun
@@ -254,5 +256,62 @@ foreach {mode name} {
   }
 }
 
+#--------------------------------------------------------------------------
+#
+foreach {mode name} {
+      0 walthread-2-threads 
+      1 walthread-2-processes
+} {
+  do_thread_test $name -processes $mode -seconds $SECONDS -init {
+    execsql { CREATE TABLE t1(x INTEGER PRIMARY KEY, y UNIQUE) }
+  } -thread RB 2 {
+
+    db close
+    set nRun 0
+    set nDel 0
+    while {[tt_continue]} {
+      sqlite3 db test.db
+      db busy busyhandler
+      db eval { SELECT * FROM sqlite_master }
+      catch { db eval { PRAGMA journal_mode = DELETE } }
+      db eval {
+        BEGIN;
+        INSERT INTO t1 VALUES(NULL, randomblob(100+$tid));
+      }
+      incr nRun 1
+      incr nDel [file exists test.db-journal]
+      db eval COMMIT
+
+      set ic [db eval {PRAGMA integrity_check}]
+      if {$ic != "ok"} { error $ic }
+      db close
+    }
+    list $nRun $nDel
+
+  } -thread WAL 2 {
+    db close
+    set nRun 0
+    set nWal 0
+    while {[tt_continue]} {
+      sqlite3 db test.db
+      db busy busyhandler
+      db eval { SELECT * FROM sqlite_master }
+      catch { db eval { PRAGMA journal_mode = WAL } }
+      db eval {
+        BEGIN;
+        INSERT INTO t1 VALUES(NULL, randomblob(110+$tid));
+      }
+      incr nRun 1
+      incr nWal [file exists test.db-wal]
+      db eval COMMIT
+
+      set ic [db eval {PRAGMA integrity_check}]
+      if {$ic != "ok"} { error $ic }
+      db close
+    }
+    list $nRun $nWal
+  }
+}
+
 finish_test