Avoid deleting a b-tree "has-content" vector belonging to another shared-cache connection from within sqlite3_close().

FossilOrigin-Name: 93462df78247f5634b9f53752cf80056bbfe9aac
This commit is contained in:
dan 2013-05-14 20:36:31 +00:00
parent cd7b91a7f1
commit bf0e57a7d0
4 changed files with 47 additions and 13 deletions

View File

@ -1,5 +1,5 @@
C Candidate\sfixes\sfor\sproblems\srevealed\sby\snotify2.test.\sNotify2.test\sis\sstill\sfailing\sat\sthis\spoint.
D 2013-05-13T18:23:15.893
C Avoid\sdeleting\sa\sb-tree\s"has-content"\svector\sbelonging\sto\sanother\sshared-cache\sconnection\sfrom\swithin\ssqlite3_close().
D 2013-05-14T20:36:31.591
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in ce81671efd6223d19d4c8c6b88ac2c4134427111
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -137,7 +137,7 @@ F src/auth.c 523da7fb4979469955d822ff9298352d6b31de34
F src/backup.c b266767351ae2d847716c56fcb2a1fea7c761c03
F src/bitvec.c 19a4ba637bd85f8f63fc8c9bae5ade9fb05ec1cb
F src/btmutex.c 976f45a12e37293e32cae0281b15a21d48a8aaa7
F src/btree.c 480a6d255cc4f066029daf23dd54acf152cd0e13
F src/btree.c e42631ac1fe6d0d3a0a5e36330b203f69052be21
F src/btree.h 6fa8a3ff2483d0bb64a9f0105a8cedeac9e00cca
F src/btreeInt.h eecc84f02375b2bb7a44abbcbbe3747dde73edb2
F src/build.c 083da8466fd7e481cb8bd5264398f537507f6176
@ -737,7 +737,7 @@ F test/shared6.test 866bb4982c45ce216c61ded5e8fde4e7e2f3ffa9
F test/shared7.test 960760bc8d03e1419e70dea69cf41db62853616e
F test/shared8.test b27befbefbe7f4517f1d6b7ff8f64a41ec74165d
F test/shared9.test 5f2a8f79b4d6c7d107a01ffa1ed05ae7e6333e21
F test/sharedA.test 2dad757bb388779d6bda8c05ec52e39e9981a135
F test/sharedA.test 113664fa64ab0538c7dc77f4b6fc1ff904561cec
F test/shared_err.test 0079c05c97d88cfa03989b7c20a8b266983087aa
F test/sharedlock.test ffa0a3c4ac192145b310f1254f8afca4d553eabf
F test/shell1.test 4a2f57952719972c6f862134463f8712e953c038
@ -1063,10 +1063,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
P cf5c3642247fdd34d87f0368594cd7b8f081636a
R 9334ad7d318214aee7b701f9959b5d6e
T *branch * shared-cache-fixes
T *sym-shared-cache-fixes *
T -sym-trunk *
P ea0428f9b6e63066e7444a2ba2f8c12a2e3ab7e4
R f68931e6fbc759d31073a5961092df76
U dan
Z 816ab4789f48f56b3bf310736184e47d
Z c980c1bd80d8d5755c03b6b85fccf1ca

View File

@ -1 +1 @@
ea0428f9b6e63066e7444a2ba2f8c12a2e3ab7e4
93462df78247f5634b9f53752cf80056bbfe9aac

View File

@ -3255,7 +3255,6 @@ static void btreeEndTransaction(Btree *p){
#ifndef SQLITE_OMIT_AUTOVACUUM
pBt->bDoTruncate = 0;
#endif
btreeClearHasContent(pBt);
if( p->inTrans>TRANS_NONE && p->db->activeVdbeCnt>1 ){
/* If there are other active statements that belong to this database
** handle, downgrade to a read-only transaction. The other statements
@ -3330,6 +3329,7 @@ int sqlite3BtreeCommitPhaseTwo(Btree *p, int bCleanup){
return rc;
}
pBt->inTransaction = TRANS_READ;
btreeClearHasContent(pBt);
}
btreeEndTransaction(p);
@ -3453,6 +3453,7 @@ int sqlite3BtreeRollback(Btree *p, int tripCode){
}
assert( countWriteCursors(pBt)==0 );
pBt->inTransaction = TRANS_READ;
btreeClearHasContent(pBt);
}
btreeEndTransaction(p);

View File

@ -16,10 +16,46 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
db close
set ::testprefix x
set ::testprefix sharedA
set ::enable_shared_cache [sqlite3_enable_shared_cache 1]
#-------------------------------------------------------------------------
#
do_test 0.1 {
sqlite3 db1 test.db
sqlite3 db2 test.db
db1 eval {
CREATE TABLE t1(x);
INSERT INTO t1 VALUES(randomblob(100));
INSERT INTO t1 SELECT randomblob(100) FROM t1;
INSERT INTO t1 SELECT randomblob(100) FROM t1;
INSERT INTO t1 SELECT randomblob(100) FROM t1;
INSERT INTO t1 SELECT randomblob(100) FROM t1;
INSERT INTO t1 SELECT randomblob(100) FROM t1;
INSERT INTO t1 SELECT randomblob(100) FROM t1;
CREATE INDEX i1 ON t1(x);
}
db1 eval {
BEGIN;
DROP INDEX i1;
}
db2 close
db1 eval {
INSERT INTO t1 SELECT randomblob(100) FROM t1;
ROLLBACK;
PRAGMA integrity_check;
}
} {ok}
db1 close
forcedelete test.db
#-------------------------------------------------------------------------
#
do_test 1.1 {