Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Avoid deleting a b-tree "has-content" vector belonging to another shared-cache connection from within sqlite3_close(). |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | shared-cache-fixes |
Files: | files | file ages | folders |
SHA1: |
93462df78247f5634b9f53752cf80056 |
User & Date: | dan 2013-05-14 20:36:31.591 |
Context
2013-05-14
| ||
23:13 | Merge together the fork in this branch. (check-in: 164e3d4da2 user: drh tags: shared-cache-fixes) | |
20:36 | Avoid deleting a b-tree "has-content" vector belonging to another shared-cache connection from within sqlite3_close(). (check-in: 93462df782 user: dan tags: shared-cache-fixes) | |
2013-05-13
| ||
18:23 | Candidate fixes for problems revealed by notify2.test. Notify2.test is still failing at this point. (check-in: ea0428f9b6 user: dan tags: shared-cache-fixes) | |
Changes
Changes to src/btree.c.
︙ | ︙ | |||
3251 3252 3253 3254 3255 3256 3257 | static void btreeEndTransaction(Btree *p){ BtShared *pBt = p->pBt; assert( sqlite3BtreeHoldsMutex(p) ); #ifndef SQLITE_OMIT_AUTOVACUUM pBt->bDoTruncate = 0; #endif | < | 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 | static void btreeEndTransaction(Btree *p){ BtShared *pBt = p->pBt; assert( sqlite3BtreeHoldsMutex(p) ); #ifndef SQLITE_OMIT_AUTOVACUUM pBt->bDoTruncate = 0; #endif 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 ** may still be reading from the database. */ downgradeAllSharedCacheTableLocks(p); p->inTrans = TRANS_READ; }else{ |
︙ | ︙ | |||
3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 | assert( pBt->nTransaction>0 ); rc = sqlite3PagerCommitPhaseTwo(pBt->pPager); if( rc!=SQLITE_OK && bCleanup==0 ){ sqlite3BtreeLeave(p); return rc; } pBt->inTransaction = TRANS_READ; } btreeEndTransaction(p); sqlite3BtreeLeave(p); return SQLITE_OK; } | > | 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 | assert( pBt->nTransaction>0 ); rc = sqlite3PagerCommitPhaseTwo(pBt->pPager); if( rc!=SQLITE_OK && bCleanup==0 ){ sqlite3BtreeLeave(p); return rc; } pBt->inTransaction = TRANS_READ; btreeClearHasContent(pBt); } btreeEndTransaction(p); sqlite3BtreeLeave(p); return SQLITE_OK; } |
︙ | ︙ | |||
3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 | if( nPage==0 ) sqlite3PagerPagecount(pBt->pPager, &nPage); testcase( pBt->nPage!=nPage ); pBt->nPage = nPage; releasePage(pPage1); } assert( countWriteCursors(pBt)==0 ); pBt->inTransaction = TRANS_READ; } btreeEndTransaction(p); sqlite3BtreeLeave(p); return rc; } | > | 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 | if( nPage==0 ) sqlite3PagerPagecount(pBt->pPager, &nPage); testcase( pBt->nPage!=nPage ); pBt->nPage = nPage; releasePage(pPage1); } assert( countWriteCursors(pBt)==0 ); pBt->inTransaction = TRANS_READ; btreeClearHasContent(pBt); } btreeEndTransaction(p); sqlite3BtreeLeave(p); return rc; } |
︙ | ︙ |
Changes to test/sharedA.test.
︙ | ︙ | |||
12 13 14 15 16 17 18 | # Test some specific circumstances to do with shared cache mode. # set testdir [file dirname $argv0] source $testdir/tester.tcl db close | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | # Test some specific circumstances to do with shared cache mode. # set testdir [file dirname $argv0] source $testdir/tester.tcl db close 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 { sqlite3 db1 test.db sqlite3 db2 test.db db2 eval { |
︙ | ︙ |