/ Check-in [630e669b]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:When the asynchronous IO backend opens a file with the EXCLUSIVE flag set, make sure only a single file-descriptor is opened (not one for reading and one for writing). This change fixes #3978. (CVS 6905)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 630e669b97a81f9125d4bdc18517738b74eecdec
User & Date: danielk1977 2009-07-18 11:52:04
Context
2009-07-18
14:36
Add some code to sqlite3VdbeMemSetZeroBlob() so that it works (less efficiently) even when OMIT_INCRBLOB is defined. Ticket #3977. (CVS 6906) check-in: f5f7259d user: danielk1977 tags: trunk
11:52
When the asynchronous IO backend opens a file with the EXCLUSIVE flag set, make sure only a single file-descriptor is opened (not one for reading and one for writing). This change fixes #3978. (CVS 6905) check-in: 630e669b user: danielk1977 tags: trunk
08:30
Changes to test scripts so that (make test) works when OMIT_INCRBLOB is defined. (CVS 6904) check-in: 1dd834a3 user: danielk1977 tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/async/sqlite3async.c.

     6      6   **
     7      7   **    May you do good and not evil.
     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   **
    13         -** $Id: sqlite3async.c,v 1.6 2009/04/30 17:45:34 shane Exp $
           13  +** $Id: sqlite3async.c,v 1.7 2009/07/18 11:52:04 danielk1977 Exp $
    14     14   **
    15     15   ** This file contains the implementation of an asynchronous IO backend 
    16     16   ** for SQLite.
    17     17   */
    18     18   
    19     19   #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_ASYNCIO)
    20     20   
................................................................................
  1061   1061       pData->nName = nName;
  1062   1062       memcpy(pData->zName, zName, nName);
  1063   1063     }
  1064   1064   
  1065   1065     if( !isAsyncOpen ){
  1066   1066       int flagsout;
  1067   1067       rc = pVfs->xOpen(pVfs, pData->zName, pData->pBaseRead, flags, &flagsout);
  1068         -    if( rc==SQLITE_OK && (flagsout&SQLITE_OPEN_READWRITE) ){
         1068  +    if( rc==SQLITE_OK 
         1069  +     && (flagsout&SQLITE_OPEN_READWRITE) 
         1070  +     && (flags&SQLITE_OPEN_EXCLUSIVE)==0
         1071  +    ){
  1069   1072         rc = pVfs->xOpen(pVfs, pData->zName, pData->pBaseWrite, flags, 0);
  1070   1073       }
  1071   1074       if( pOutFlags ){
  1072   1075         *pOutFlags = flagsout;
  1073   1076       }
  1074   1077     }
  1075   1078   

Added test/async5.test.

            1  +# 2009 July 19
            2  +#
            3  +#    May you do good and not evil.
            4  +#    May you find forgiveness for yourself and forgive others.
            5  +#    May you share freely, never taking more than you give.
            6  +#
            7  +#***********************************************************************
            8  +# This file tests that asynchronous IO is compatible with multi-file
            9  +# transactions.
           10  +#
           11  +# $Id: async5.test,v 1.1 2009/07/18 11:52:04 danielk1977 Exp $
           12  +
           13  +set testdir [file dirname $argv0]
           14  +source $testdir/tester.tcl
           15  +
           16  +if {[info commands sqlite3async_initialize] eq ""} {
           17  +  # The async logic is not built into this system
           18  +  finish_test
           19  +  return
           20  +}
           21  +
           22  +db close
           23  +file delete -force test2.db
           24  +sqlite3async_initialize "" 1
           25  +sqlite3async_control halt never
           26  +sqlite3 db test.db
           27  +
           28  +do_test async5-1.1 {
           29  +  execsql {
           30  +    ATTACH 'test2.db' AS next;
           31  +    CREATE TABLE main.t1(a, b);
           32  +    CREATE TABLE next.t2(a, b);
           33  +    BEGIN;
           34  +      INSERT INTO t1 VALUES(1, 2);
           35  +      INSERT INTO t2 VALUES(3, 4);
           36  +    COMMIT;
           37  +  }
           38  +} {}
           39  +do_test async5-1.2 {
           40  +  execsql { SELECT * FROM t1 }
           41  +} {1 2}
           42  +do_test async5-1.3 {
           43  +  execsql { SELECT * FROM t2 }
           44  +} {3 4}
           45  +do_test async5-1.4 {
           46  +  execsql {
           47  +    BEGIN;
           48  +      INSERT INTO t1 VALUES('a', 'b');
           49  +      INSERT INTO t2 VALUES('c', 'd');
           50  +    COMMIT;
           51  +  }
           52  +} {}
           53  +do_test async5-1.5 {
           54  +  execsql { SELECT * FROM t1 }
           55  +} {1 2 a b}
           56  +do_test async5-1.6 {
           57  +  execsql { SELECT * FROM t2 }
           58  +} {3 4 c d}
           59  +
           60  +db close
           61  +
           62  +sqlite3async_control halt idle
           63  +sqlite3async_start
           64  +sqlite3async_wait
           65  +sqlite3async_control halt never
           66  +sqlite3async_shutdown
           67  +set sqlite3async_trace 0
           68  +finish_test
           69  +