/ Check-in [cbbaf8e6]
Login

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

Overview
Comment:Add the test cases for bug [f3e5abed55].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | experimental
Files: files | file ages | folders
SHA1: cbbaf8e67a23dc332ce935bc7234246eacba60bf
User & Date: dan 2010-07-30 10:09:12
Context
2010-07-30
14:39
Merge trunk changes into experimental again. check-in: 87e0f4e1 user: dan tags: experimental
10:09
Add the test cases for bug [f3e5abed55]. check-in: cbbaf8e6 user: dan tags: experimental
10:02
Make sure a connection has an exclusive lock on all database files involved in a multi-file transaction before writing the master-journal pointer into any journal files. Fix for [f3e5abed55]. check-in: 50c0f220 user: dan tags: experimental
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbeaux.c.

  1798   1798       for(i=0; rc==SQLITE_OK && i<db->nDb; i++){ 
  1799   1799         Btree *pBt = db->aDb[i].pBt;
  1800   1800         if( pBt ){
  1801   1801           rc = sqlite3BtreeCommitPhaseOne(pBt, zMaster);
  1802   1802         }
  1803   1803       }
  1804   1804       sqlite3OsCloseFree(pMaster);
         1805  +    assert( rc!=SQLITE_BUSY );
  1805   1806       if( rc!=SQLITE_OK ){
  1806   1807         sqlite3DbFree(db, zMaster);
  1807   1808         return rc;
  1808   1809       }
  1809   1810   
  1810   1811       /* Delete the master journal file. This commits the transaction. After
  1811   1812       ** doing this the directory is synced again before any individual

Added test/tkt-f3e5abed55.test.

            1  +# 2010 July 29
            2  +#
            3  +# The author disclaims copyright to this source code.  In place of
            4  +# a legal notice, here is a blessing:
            5  +#
            6  +#    May you do good and not evil.
            7  +#    May you find forgiveness for yourself and forgive others.
            8  +#    May you share freely, never taking more than you give.
            9  +#
           10  +#***********************************************************************
           11  +#
           12  +
           13  +set testdir [file dirname $argv0]
           14  +source $testdir/tester.tcl
           15  +source $testdir/malloc_common.tcl
           16  +
           17  +foreach f [glob -nocomplain test.db*mj*] { file delete -force $f }
           18  +file delete -force test.db2
           19  +
           20  +do_test tkt-f3e5abed55-1.1 {
           21  +  execsql {
           22  +    ATTACH 'test.db2' AS aux;
           23  +    CREATE TABLE main.t1(a, b);
           24  +    CREATE TABLE aux.t2(c, d);
           25  +  }
           26  +} {}
           27  +
           28  +do_test tkt-f3e5abed55-1.2 {
           29  +  glob -nocomplain test.db*mj*
           30  +} {}
           31  +
           32  +do_test tkt-f3e5abed55-1.3 {
           33  +  sqlite3 db2 test.db
           34  +  execsql { BEGIN; SELECT * FROM t1 } db2
           35  +} {}
           36  +
           37  +do_test tkt-f3e5abed55-1.4 {
           38  +  execsql {
           39  +    BEGIN;
           40  +      INSERT INTO t1 VALUES(1, 2);
           41  +      INSERT INTO t2 VALUES(1, 2);
           42  +  }
           43  +  catchsql COMMIT
           44  +} {1 {database is locked}}
           45  +
           46  +do_test tkt-f3e5abed55-1.5 {
           47  +  execsql COMMIT db2
           48  +  execsql COMMIT
           49  +} {}
           50  +
           51  +do_test tkt-f3e5abed55-1.6 {
           52  +  glob -nocomplain test.db*mj*
           53  +} {}
           54  +foreach f [glob -nocomplain test.db*mj*] { file delete -force $f }
           55  +db close
           56  +db2 close
           57  +
           58  +
           59  +
           60  +# Set up a testvfs so that the next time SQLite tries to delete the
           61  +# file "test.db-journal", a snapshot of the current file-system contents
           62  +# is taken.
           63  +#
           64  +testvfs tvfs -default 1
           65  +tvfs script xDelete
           66  +tvfs filter xDelete
           67  +proc xDelete {method file args} {
           68  +  if {[file tail $file] == "test.db-journal"} {
           69  +    faultsim_save
           70  +    tvfs filter {}
           71  +  }
           72  +  return "SQLITE_OK"
           73  +}
           74  +
           75  +sqlite3 db  test.db
           76  +sqlite3 db2 test.db
           77  +do_test tkt-f3e5abed55-2.1 {
           78  +  execsql {
           79  +    ATTACH 'test.db2' AS aux;
           80  +    BEGIN;
           81  +      INSERT INTO t1 VALUES(3, 4);
           82  +      INSERT INTO t2 VALUES(3, 4);
           83  +  }
           84  +} {}
           85  +do_test tkt-f3e5abed55-2.2 {
           86  +  execsql { BEGIN; SELECT * FROM t1 } db2
           87  +} {1 2}
           88  +do_test tkt-f3e5abed55-2.3 {
           89  +  catchsql COMMIT
           90  +} {1 {database is locked}}
           91  +
           92  +do_test tkt-f3e5abed55-2.4 {
           93  +  execsql COMMIT db2
           94  +  execsql {
           95  +    COMMIT;
           96  +    SELECT * FROM t1;
           97  +    SELECT * FROM t2;
           98  +  }
           99  +} {1 2 3 4 1 2 3 4}
          100  +do_test tkt-f3e5abed55-2.5 {
          101  +  db close
          102  +  db2 close
          103  +  faultsim_restore_and_reopen
          104  +  execsql {
          105  +    ATTACH 'test.db2' AS aux;
          106  +    SELECT * FROM t1;
          107  +    SELECT * FROM t2;
          108  +  }
          109  +} {1 2 3 4 1 2 3 4}
          110  +
          111  +
          112  +finish_test
          113  +