/ Check-in [ffea3e90]
Login

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

Overview
Comment:Test case demonstrating the problem described by ticket [e4a18565a36884b00edf].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fix-stale-keyinfo-cache
Files: files | file ages | folders
SHA1: ffea3e905adc108d2dc37f5d6da2024f0389f176
User & Date: drh 2014-12-05 14:07:53
Context
2014-12-05
14:34
Improved comment on the sharedB.test test script. Closed-Leaf check-in: 71f589e3 user: drh tags: fix-stale-keyinfo-cache
14:07
Test case demonstrating the problem described by ticket [e4a18565a36884b00edf]. check-in: ffea3e90 user: drh tags: fix-stale-keyinfo-cache
05:38
When closing a (shared-cache) database connection, be sure to clear out all KeyInfo objects cached on Index objects. Proposed fix for ticket [e4a18565a36884b00edf]. check-in: 651ed97d user: drh tags: fix-stale-keyinfo-cache
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Added test/sharedB.test.

            1  +# 2013 May 14
            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  +# Open two database connections on the same database in shared cache
           13  +# mode.  Hold one open while repeatedly closing, reopening, and using
           14  +# the second.
           15  +#
           16  +
           17  +
           18  +set testdir [file dirname $argv0]
           19  +source $testdir/tester.tcl
           20  +if {[run_thread_tests]==0} { finish_test ; return }
           21  +db close
           22  +set ::testprefix sharedB
           23  +
           24  +set ::enable_shared_cache [sqlite3_enable_shared_cache 1]
           25  +
           26  +#-------------------------------------------------------------------------
           27  +#
           28  +do_test 1.1 {
           29  +  sqlite3 db1 test.db
           30  +  sqlite3 db2 test.db
           31  +
           32  +  db1 eval {
           33  +    CREATE TABLE t1(x,y TEXT COLLATE nocase);
           34  +    WITH RECURSIVE
           35  +      c(i) AS (VALUES(1) UNION ALL SELECT i+1 FROM c WHERE i<100)
           36  +    INSERT INTO t1(x,y) SELECT i, printf('x%03dy',i) FROM c;
           37  +    CREATE INDEX t1yx ON t1(y,x);
           38  +  }
           39  +  db2 eval {
           40  +    SELECT x FROM t1 WHERE y='X014Y';
           41  +  }
           42  +} {14}
           43  +
           44  +for {set j 1} {$j<=100} {incr j} {
           45  +  do_test 1.2.$j {
           46  +    db2 close
           47  +    sqlite3 db2 test.db
           48  +    db2 eval {
           49  +      SELECT x FROM t1 WHERE y='X014Y';
           50  +    }
           51  +  } {14}
           52  +}
           53  +
           54  +db1 close
           55  +db2 close
           56  +sqlite3_enable_shared_cache $::enable_shared_cache
           57  +finish_test