-C Add\sanother\stest\scase\sto\sverify\sthat\sticket\s#3092\shas\sbeen\sfixed.\s(CVS\s5076)
-D 2008-05-02T02:00:54
+C Add\sa\s\stest\scase\sfor\sticket\s#3093.\s(CVS\s5077)
+D 2008-05-02T14:08:56
F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
F Makefile.in 25b3282a4ac39388632c2fb0e044ff494d490952
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F test/tkt2927.test a473c09eafa83d95579fc2b976f2afc11571ce7e
F test/tkt2942.test c5c87d179799ca6d1fbe83c815510b87cd5ec7ce
F test/tkt3080.test 31a02e87a4c80ed443831c2c5b0e8216ff95ac14
+F test/tkt3093.test 433851feaef6bacb95700355c4811344ef6b851e
F test/trace.test 951cd0f5f571e7f36bf7bfe04be70f90fb16fb00
F test/trans.test 2fd24cd7aa0b879d49a224cbd647d698f1e7ac5c
F test/trigger1.test 7c13f39ca36f529bf856e05c7d004fc0531d48b4
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P 70e708660fec0b6f6c41efc2e29f1d7ae6785b7e
-R 714aac9f8d3137c40cb007c56fa21ea2
+P 1906d2dadcd70053f55e2133af9f838e2d828fa7
+R 753b7a8a009f233c8697dfefcc46a9a8
U drh
-Z b9b04ac723ad1b47b83155a71bbe6504
+Z 13a2787d3df0d75d1a6ce4dedc8ab3e0
--- /dev/null
+# 2008 May 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.
+#
+#***********************************************************************
+#
+# Ticket #3093
+#
+# Verify that a busy callback waiting on a reserved lock resolves
+# once the lock clears.
+#
+# $Id: tkt3093.test,v 1.1 2008/05/02 14:08:56 drh Exp $
+#
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+
+# Set up a test database
+#
+do_test tkt3093.1 {
+ db eval {
+ CREATE TABLE t1(x);
+ INSERT INTO t1 VALUES(1);
+ SELECT * FROM t1
+ }
+} {1}
+
+# Establish a separate, independent connection to that database.
+#
+do_test tkt3093.2 {
+ catch {sqlite3_enable_shared_cache 0}
+ sqlite3 db2 test.db
+ db2 eval {
+ SELECT * FROM t1
+ }
+} {1}
+
+# Make sure that clearing a lock allows a pending request for
+# a reserved lock to continue.
+#
+do_test tkt3093.3 {
+ # This will be the busy callback for connection db2. On the first
+ # busy callback, commit the transaction in db. This should clear
+ # the lock so that there should not be a second callback. If the
+ # busy handler is called a second time, then fail so that we get
+ # timeout.
+ proc busy_callback {cnt} {
+ if {$cnt==0} {
+ db eval COMMIT
+ return 0
+ } else {
+ return 1
+ }
+ }
+ db2 busy ::busy_callback
+
+ # Start a write transaction on db.
+ db eval {
+ BEGIN;
+ INSERT INTO t1 VALUES(2);
+ }
+
+ # Attempt to modify the database on db2
+ catchsql {
+ UPDATE t1 SET x=x+1;
+ } db2
+} {0 {}}
+
+# Verify that everything worked as expected. The db transaction should
+# have gone first and added entry 2. Then the db2 transaction would have
+# run and added one to each entry.
+#
+do_test tkt3093.4 {
+ db eval {SELECT * FROM t1}
+} {2 3}
+do_test tkt3093.5 {
+ db2 eval {SELECT * FROM t1}
+} {2 3}
+db2 close
+
+finish_test