]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
When the asynchronous IO backend opens a file with the EXCLUSIVE flag set, make sure...
authordanielk1977 <danielk1977@noemail.net>
Sat, 18 Jul 2009 11:52:04 +0000 (11:52 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Sat, 18 Jul 2009 11:52:04 +0000 (11:52 +0000)
FossilOrigin-Name: 630e669b97a81f9125d4bdc18517738b74eecdec

ext/async/sqlite3async.c
manifest
manifest.uuid
test/async5.test [new file with mode: 0644]

index 9d912b18610793f7ff09b1678e62c26380102470..11a4761298cffd4c4c9510a0aecc25bccfd75083 100644 (file)
@@ -10,7 +10,7 @@
 **
 *************************************************************************
 **
-** $Id: sqlite3async.c,v 1.6 2009/04/30 17:45:34 shane Exp $
+** $Id: sqlite3async.c,v 1.7 2009/07/18 11:52:04 danielk1977 Exp $
 **
 ** This file contains the implementation of an asynchronous IO backend 
 ** for SQLite.
@@ -1065,7 +1065,10 @@ static int asyncOpen(
   if( !isAsyncOpen ){
     int flagsout;
     rc = pVfs->xOpen(pVfs, pData->zName, pData->pBaseRead, flags, &flagsout);
-    if( rc==SQLITE_OK && (flagsout&SQLITE_OPEN_READWRITE) ){
+    if( rc==SQLITE_OK 
+     && (flagsout&SQLITE_OPEN_READWRITE) 
+     && (flags&SQLITE_OPEN_EXCLUSIVE)==0
+    ){
       rc = pVfs->xOpen(pVfs, pData->zName, pData->pBaseWrite, flags, 0);
     }
     if( pOutFlags ){
index 2f261346186b184b5c988f1eb303da8d940dcb45..8b88e9bbe80b54d0d7279cd84cbdcc6ea6e2a162 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Changes\sto\stest\sscripts\sso\sthat\s(make\stest)\sworks\swhen\sOMIT_INCRBLOB\sis\sdefined.\s(CVS\s6904)
-D 2009-07-18T08:30:45
+C When\sthe\sasynchronous\sIO\sbackend\sopens\sa\sfile\swith\sthe\sEXCLUSIVE\sflag\sset,\smake\ssure\sonly\sa\ssingle\sfile-descriptor\sis\sopened\s(not\sone\sfor\sreading\sand\sone\sfor\swriting).\sThis\schange\sfixes\s#3978.\s(CVS\s6905)
+D 2009-07-18T11:52:04
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in df9359da7a726ccb67a45db905c5447d5c00c6ef
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -25,7 +25,7 @@ F doc/lemon.html f0f682f50210928c07e562621c3b7e8ab912a538
 F doc/report1.txt a031aaf37b185e4fa540223cb516d3bccec7eeac
 F ext/README.txt 913a7bd3f4837ab14d7e063304181787658b14e1
 F ext/async/README.txt 0c541f418b14b415212264cbaaf51c924ec62e5b
-F ext/async/sqlite3async.c a10dd8add8544c62faf1b6eccb6b1e535b5e7cad
+F ext/async/sqlite3async.c ec97d85cdb56dda9312cce39dd3cd9d62a747ec6
 F ext/async/sqlite3async.h a21e1252deb14a2c211f0e165c4b9122a8f1f344
 F ext/fts1/README.txt 20ac73b006a70bcfd80069bdaf59214b6cf1db5e
 F ext/fts1/ft_hash.c 3927bd880e65329bdc6f506555b228b28924921b
@@ -227,6 +227,7 @@ F test/async.test 8c75d31b8330f8b70cf2571b014d4476a063efdb
 F test/async2.test bf5e2ca2c96763b4cba3d016249ad7259a5603b6
 F test/async3.test 93edaa9122f498e56ea98c36c72abc407f4fb11e
 F test/async4.test aafa6328c559d3e4bb587de770cbdecfca06f0da
+F test/async5.test f3592d79c84d6e83a5f50d3fd500445f7d97dfdf
 F test/attach.test 1d1be27b9e4c654f9bb14d011a4a87753c0b197a
 F test/attach2.test a295d2d7061adcee5884ef4a93c7c96a82765437
 F test/attach3.test 7b92dc8e40c1ebca9732ca6f2d3fefbd46f196df
@@ -740,7 +741,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl 672f81d693a03f80f5ae60bfefacd8a349e76746
-P 910df46e0f570cbffa9ff9b50d75632c091838b6
-R 4cd50c4c4686040777c05866af87abd0
+P 1dd834a3d61496dfa138c36676a5fa6afaa4c817
+R f1aa535d9cd35c3b2f728ff47321f41c
 U danielk1977
-Z b26db41ad205367b39a5d77856350b64
+Z d6beb909178b6d0b9cd42c748ec7d97a
index b4f711f9499e33162a4007bd9fab645b9f74b3e1..2dae0f7ba838657f0775959f7d62694b163d7225 100644 (file)
@@ -1 +1 @@
-1dd834a3d61496dfa138c36676a5fa6afaa4c817
\ No newline at end of file
+630e669b97a81f9125d4bdc18517738b74eecdec
\ No newline at end of file
diff --git a/test/async5.test b/test/async5.test
new file mode 100644 (file)
index 0000000..5ea4c70
--- /dev/null
@@ -0,0 +1,69 @@
+# 2009 July 19
+#
+#    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 tests that asynchronous IO is compatible with multi-file
+# transactions.
+#
+# $Id: async5.test,v 1.1 2009/07/18 11:52:04 danielk1977 Exp $
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+
+if {[info commands sqlite3async_initialize] eq ""} {
+  # The async logic is not built into this system
+  finish_test
+  return
+}
+
+db close
+file delete -force test2.db
+sqlite3async_initialize "" 1
+sqlite3async_control halt never
+sqlite3 db test.db
+
+do_test async5-1.1 {
+  execsql {
+    ATTACH 'test2.db' AS next;
+    CREATE TABLE main.t1(a, b);
+    CREATE TABLE next.t2(a, b);
+    BEGIN;
+      INSERT INTO t1 VALUES(1, 2);
+      INSERT INTO t2 VALUES(3, 4);
+    COMMIT;
+  }
+} {}
+do_test async5-1.2 {
+  execsql { SELECT * FROM t1 }
+} {1 2}
+do_test async5-1.3 {
+  execsql { SELECT * FROM t2 }
+} {3 4}
+do_test async5-1.4 {
+  execsql {
+    BEGIN;
+      INSERT INTO t1 VALUES('a', 'b');
+      INSERT INTO t2 VALUES('c', 'd');
+    COMMIT;
+  }
+} {}
+do_test async5-1.5 {
+  execsql { SELECT * FROM t1 }
+} {1 2 a b}
+do_test async5-1.6 {
+  execsql { SELECT * FROM t2 }
+} {3 4 c d}
+
+db close
+
+sqlite3async_control halt idle
+sqlite3async_start
+sqlite3async_wait
+sqlite3async_control halt never
+sqlite3async_shutdown
+set sqlite3async_trace 0
+finish_test
+