From 672b41beaacde22782739495fb5bc2e38290d92e Mon Sep 17 00:00:00 2001 From: dan Date: Mon, 21 Jun 2010 05:40:49 +0000 Subject: [PATCH] Fix jrnlmode2.test so that it works on systems where UNDELETABLE_WHEN_OPEN is defined. FossilOrigin-Name: 59be370e52ec814c45efa6cbac45b6df94661b54 --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/jrnlmode2.test | 34 +++++++++++++++++++++++++++++----- 3 files changed, 36 insertions(+), 12 deletions(-) diff --git a/manifest b/manifest index dc715a7b25..f1ca3e28a6 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\san\sassert()\sfailure\sthat\scould\soccur\sif\scompiling\swith\sOMIT_SHARED_CACHE. -D 2010-06-19T19:06:34 +C Fix\sjrnlmode2.test\sso\sthat\sit\sworks\son\ssystems\swhere\sUNDELETABLE_WHEN_OPEN\sis\sdefined. +D 2010-06-21T05:40:49 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in a5cad1f8f3e021356bfcc6c77dc16f6f1952bbc3 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -468,7 +468,7 @@ F test/join6.test bf82cf3f979e9eade83ad0d056a66c5ed71d1901 F test/journal1.test 36f2d1bb9bf03f790f43fbdb439e44c0657fab19 F test/journal2.test a08ea6545d987385e7cbb1d4e7dc2eaacd83b00b F test/jrnlmode.test 76f94d61528c5ff32102a12f8cf34f4cc36f7849 -F test/jrnlmode2.test fe79ea1f0375c926b8de0362ddf94f34a64135fd +F test/jrnlmode2.test a19e28de1a6ec898067e46a122f1b71c9323bf00 F test/jrnlmode3.test cfcdb12b90e640a23b92785a002d96c0624c8710 F test/keyword1.test a2400977a2e4fde43bf33754c2929fda34dbca05 F test/lastinsert.test 474d519c68cb79d07ecae56a763aa7f322c72f51 @@ -824,7 +824,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P 5a5ff4e3e4c707464f227907d0aefb8ef42180dd -R 0e23e267b3b82742ffd6ce332fce696f +P 3e76a9f2c041a6d36614f540bb89588703d85925 +R b870a455574cea6100e536dd46b8d81b U dan -Z 610fee2a443c81bfcb467b2cb6ae3598 +Z d0b6213f5feedc09ae1f6676dae25d67 diff --git a/manifest.uuid b/manifest.uuid index f0caada5b2..e802654324 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3e76a9f2c041a6d36614f540bb89588703d85925 \ No newline at end of file +59be370e52ec814c45efa6cbac45b6df94661b54 \ No newline at end of file diff --git a/test/jrnlmode2.test b/test/jrnlmode2.test index 9a1fe37c3f..dc3bc270b4 100644 --- a/test/jrnlmode2.test +++ b/test/jrnlmode2.test @@ -9,7 +9,6 @@ # #*********************************************************************** # -# $Id: jrnlmode2.test,v 1.6 2009/06/05 17:09:12 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -20,10 +19,33 @@ ifcapable {!pager_pragmas} { } #------------------------------------------------------------------------- -# Test overview: +# The tests in this file check that the following two bugs (both now fixed) +# do not reappear. # -# jrnlmode2-1.*: Demonstrate bug #3745 -# jrnlmode2-2.*: Demonstrate bug #3751 +# jrnlmode2-1.*: Demonstrate bug #3745: +# +# In persistent journal mode, if: +# +# * There is a persistent journal in the file-system, AND +# * there exists a connection with a shared lock on the db file, +# +# then a second connection cannot open a read-transaction on the database. +# The reason is because while determining that the persistent-journal is +# not a hot-journal, SQLite currently grabs an exclusive lock on the +# database file. If this fails because another connection has a shared +# lock, then SQLITE_BUSY is returned to the user. +# +# jrnlmode2-2.*: Demonstrate bug #3751: +# +# If a connection is opened in SQLITE_OPEN_READONLY mode, the underlying +# unix file descriptor on the database file is opened in O_RDONLY mode. +# +# When SQLite queries the database file for the schema in order to compile +# the SELECT statement, it sees the empty journal in the file system, it +# attempts to obtain an exclusive lock on the database file (this is a +# bug). The attempt to obtain an exclusive (write) lock on a read-only file +# fails at the OS level. Under unix, fcntl() reports an EBADF - "Bad file +# descriptor" - error. # do_test jrnlmode2-1.1 { @@ -46,6 +68,8 @@ do_test jrnlmode2-1.3 { do_test jrnlmode2-1.4 { execsql { INSERT INTO t1 VALUES(3, 4); + } + execsql { BEGIN; SELECT * FROM t1; } @@ -87,9 +111,9 @@ do_test jrnlmode2-2.4 { } {0 {1 2 3 4 5 6}} do_test jrnlmode2-2.5 { + db close file delete test.db-journal } {} - do_test jrnlmode2-2.6 { sqlite3 db2 test.db -readonly 1 catchsql { SELECT * FROM t1 } db2 -- 2.47.2