aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--manifest15
-rw-r--r--manifest.uuid2
-rw-r--r--src/main.c8
-rw-r--r--src/where.c1
-rw-r--r--test/sharedB.test60
5 files changed, 78 insertions, 8 deletions
diff --git a/manifest b/manifest
index fdd0b729e..4b4242ebe 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Import\sfrom\strunk\sthe\sfix\sthe\s"test"\starget\son\sthe\sautoconf\sand\sMSVC\smakefiles\nand\ssome\sminor\scompiler\swarning\sfixes.
-D 2014-12-05T00:41:17.266
+C Merge\sthe\sfix\sfor\sthe\sshared-cache\sKeyInfo\scache\sbug\sfrom\strunk.
+D 2014-12-05T20:05:10.426
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 0869fe2a3b7853f048a945fd9cdf671a329b7351
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -212,7 +212,7 @@ F src/journal.c b4124532212b6952f42eb2c12fa3c25701d8ba8d
F src/legacy.c ba1863ea58c4c840335a84ec276fc2b25e22bc4e
F src/lempar.c 7274c97d24bb46631e504332ccd3bd1b37841770
F src/loadext.c de741e66e5ddc1598d904d7289239696e40ed994
-F src/main.c 962eac230ec5c619ebccafa498bcfb617af0cc79
+F src/main.c d13290bb1592cd7651a3b416a99850c652337e32
F src/malloc.c 740db54387204c9a2eb67c6d98e68b08e9ef4eab
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
F src/mem1.c faf615aafd8be74a71494dfa027c113ea5c6615f
@@ -321,7 +321,7 @@ F src/vtab.c c08ec66f45919eaa726bf88aa53eb08379d607f9
F src/wal.c 847692349eb6e1fb8543dbc97e69ddbfa4cc7ea7
F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4
F src/walker.c c253b95b4ee44b21c406e2a1052636c31ea27804
-F src/where.c d67fe69dd1bb32ad3d488a8c5bc803a29814f357
+F src/where.c 8877b55e6803eaa856254875bca8d12fff3681cf
F src/whereInt.h d3633e9b592103241b74b0ec76185f3e5b8b62e0
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
@@ -864,6 +864,7 @@ F test/shared7.test a81e99f83e6c51b02ac99c96fb3a2a7b5978c956
F test/shared8.test 00a07bf5e1337ecf72e94542bdefdc330d7a2538
F test/shared9.test 5f2a8f79b4d6c7d107a01ffa1ed05ae7e6333e21
F test/sharedA.test 0cdf1a76dfa00e6beee66af5b534b1e8df2720f5
+F test/sharedB.test 16cc7178e20965d75278f410943109b77b2e645e
F test/shared_err.test 2f2aee20db294b9924e81f6ccbe60f19e21e8506
F test/sharedlock.test 5ede3c37439067c43b0198f580fd374ebf15d304
F test/shell1.test ab6025d941f9c84c5b83412c6b4d8b57f78dfa3a
@@ -1241,7 +1242,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 34ffa3b3c002b0e87d8382ad76e87dbaec0b2bc6 e9955c0e14d13ba1411f013acb4979958dae2516
-R 4ae9fe307118343dad082c4eb733ef9c
+P c9f20eb2fbba0868df85ebb98877f9bb969be8a4 fdb667335c2250239a66143aec4235325dec8274
+R 5f307fe542c2e256cd3ca2580b7cd173
U drh
-Z 9623b2dce920052ac42bbb47ec4723c7
+Z d2fac6b276a39da7118e93eb39e0e62a
diff --git a/manifest.uuid b/manifest.uuid
index 5ae151d72..708a694e4 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-c9f20eb2fbba0868df85ebb98877f9bb969be8a4 \ No newline at end of file
+5a73da6a3083926a3dafd28c0604122296dc9184 \ No newline at end of file
diff --git a/src/main.c b/src/main.c
index 47f96ac64..8f850fb65 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1032,6 +1032,14 @@ void sqlite3LeaveMutexAndCloseZombie(sqlite3 *db){
for(j=0; j<db->nDb; j++){
struct Db *pDb = &db->aDb[j];
if( pDb->pBt ){
+ if( pDb->pSchema ){
+ /* Must clear the KeyInfo cache. See ticket [e4a18565a36884b00edf] */
+ for(i=sqliteHashFirst(&pDb->pSchema->idxHash); i; i=sqliteHashNext(i)){
+ Index *pIdx = sqliteHashData(i);
+ sqlite3KeyInfoUnref(pIdx->pKeyInfo);
+ pIdx->pKeyInfo = 0;
+ }
+ }
sqlite3BtreeClose(pDb->pBt);
pDb->pBt = 0;
if( j!=1 ){
diff --git a/src/where.c b/src/where.c
index bda2a801e..8ec6018bc 100644
--- a/src/where.c
+++ b/src/where.c
@@ -222,6 +222,7 @@ static int whereClauseInsert(WhereClause *pWC, Expr *p, u8 wtFlags){
sqlite3DbFree(db, pOld);
}
pWC->nSlot = sqlite3DbMallocSize(db, pWC->a)/sizeof(pWC->a[0]);
+ memset(&pWC->a[pWC->nTerm], 0, sizeof(pWC->a[0])*(pWC->nSlot-pWC->nTerm));
}
pTerm = &pWC->a[idx = pWC->nTerm++];
if( p && ExprHasProperty(p, EP_Unlikely) ){
diff --git a/test/sharedB.test b/test/sharedB.test
new file mode 100644
index 000000000..1b1575507
--- /dev/null
+++ b/test/sharedB.test
@@ -0,0 +1,60 @@
+# 2014-12-05
+#
+# The author disclaims copyright to this source code. In place of
+# a legal notice, here is a blessing:
+#
+# 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.
+#
+#***********************************************************************
+#
+# Open two database connections on the same database in shared cache
+# mode. Hold one open while repeatedly closing, reopening, and using
+# the second.
+#
+# This test is designed to demostrate that the fix for ticket
+# [e4a18565a36884b00edf66541f38c693827968ab] works.
+#
+
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+if {[run_thread_tests]==0} { finish_test ; return }
+db close
+set ::testprefix sharedB
+
+set ::enable_shared_cache [sqlite3_enable_shared_cache 1]
+
+#-------------------------------------------------------------------------
+#
+do_test 1.1 {
+ sqlite3 db1 test.db
+ sqlite3 db2 test.db
+
+ db1 eval {
+ CREATE TABLE t1(x,y TEXT COLLATE nocase);
+ WITH RECURSIVE
+ c(i) AS (VALUES(1) UNION ALL SELECT i+1 FROM c WHERE i<100)
+ INSERT INTO t1(x,y) SELECT i, printf('x%03dy',i) FROM c;
+ CREATE INDEX t1yx ON t1(y,x);
+ }
+ db2 eval {
+ SELECT x FROM t1 WHERE y='X014Y';
+ }
+} {14}
+
+for {set j 1} {$j<=100} {incr j} {
+ do_test 1.2.$j {
+ db2 close
+ sqlite3 db2 test.db
+ db2 eval {
+ SELECT x FROM t1 WHERE y='X014Y';
+ }
+ } {14}
+}
+
+db1 close
+db2 close
+sqlite3_enable_shared_cache $::enable_shared_cache
+finish_test