From 1a86f50d85bdce2d8e766ba2f45a458b9952661b Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 5 Apr 2011 19:27:41 +0000 Subject: [PATCH] Simplifications to the sqlite3BtreeEnterAll() and LeaveAll() routines. Just have them call BtreeEnter and BtreeLeave() repeatedly rather than trying to be clever. FossilOrigin-Name: 51039b3578f948c23a810d176e81fa51a278fb28 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/btmutex.c | 31 +++---------------------------- 3 files changed, 10 insertions(+), 35 deletions(-) diff --git a/manifest b/manifest index e1a02097f3..949247b639 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Simplifications\sto\sthe\ssqlite3ResetInternalSchema()\slogic\sto\seliminate\nunreachable\sbranches. -D 2011-04-05T19:26:30.895 +C Simplifications\sto\sthe\ssqlite3BtreeEnterAll()\sand\sLeaveAll()\sroutines.\nJust\shave\sthem\scall\sBtreeEnter\sand\sBtreeLeave()\srepeatedly\srather\sthan\ntrying\sto\sbe\sclever. +D 2011-04-05T19:27:41.740 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 7a4d9524721d40ef9ee26f93f9bd6a51dba106f2 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -120,7 +120,7 @@ F src/attach.c 7cae2cf0c14762ce14c074a860ec52890a973a56 F src/auth.c 523da7fb4979469955d822ff9298352d6b31de34 F src/backup.c b7529a6691f0fd534ae8ff622203c46a7f1b626b F src/bitvec.c af50f1c8c0ff54d6bdb7a80e2fceca5a93670bef -F src/btmutex.c 1f951523accdfa1d204b06150e016b5b69529b8a +F src/btmutex.c 7907af20b954a8605766fbd2d87b47647422960e F src/btree.c 107723ed4f9bdb55213ba6164c30c49af75f4bf9 F src/btree.h 221e186cd64127088890a878aaab154344380fe8 F src/btreeInt.h b5e339df994d12bcd9067d04f9125c8792de51ac @@ -926,7 +926,7 @@ F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/split-sqlite3c.tcl d9be87f1c340285a3e081eb19b4a247981ed290c F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P a89f24e2c9591d09cbe329895ceec87885059184 -R 4633b95d671699f85d5e19626e085a29 +P a4c3ac989d4e93f0279172901b9ece822d137700 +R b358e3039856b3a4cedf9c746c6172be U drh -Z a7a8333914941d20132af834f7ba9e5c +Z 63f8b79eae39a68f25008b0134502554 diff --git a/manifest.uuid b/manifest.uuid index eaf1aefc85..811f3eeeb6 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a4c3ac989d4e93f0279172901b9ece822d137700 \ No newline at end of file +51039b3578f948c23a810d176e81fa51a278fb28 \ No newline at end of file diff --git a/src/btmutex.c b/src/btmutex.c index 1de9db07e7..ffe124fdd6 100644 --- a/src/btmutex.c +++ b/src/btmutex.c @@ -186,30 +186,11 @@ void sqlite3BtreeLeaveCursor(BtCursor *pCur){ */ void sqlite3BtreeEnterAll(sqlite3 *db){ int i; - Btree *p, *pLater; + Btree *p; assert( sqlite3_mutex_held(db->mutex) ); for(i=0; inDb; i++){ p = db->aDb[i].pBt; - assert( !p || (p->locked==0 && p->sharable) || p->pBt->db==p->db ); - if( p && p->sharable ){ - p->wantToLock++; - if( !p->locked ){ - assert( p->wantToLock==1 ); - while( p->pPrev ) p = p->pPrev; - /* Reason for ALWAYS: There must be at least one unlocked Btree in - ** the chain. Otherwise the !p->locked test above would have failed */ - while( p->locked && ALWAYS(p->pNext) ) p = p->pNext; - for(pLater = p->pNext; pLater; pLater=pLater->pNext){ - if( pLater->locked ){ - unlockBtreeMutex(pLater); - } - } - while( p ){ - lockBtreeMutex(p); - p = p->pNext; - } - } - } + if( p ) sqlite3BtreeEnter(p); } } void sqlite3BtreeLeaveAll(sqlite3 *db){ @@ -218,13 +199,7 @@ void sqlite3BtreeLeaveAll(sqlite3 *db){ assert( sqlite3_mutex_held(db->mutex) ); for(i=0; inDb; i++){ p = db->aDb[i].pBt; - if( p && p->sharable ){ - assert( p->wantToLock>0 ); - p->wantToLock--; - if( p->wantToLock==0 ){ - unlockBtreeMutex(p); - } - } + if( p ) sqlite3BtreeLeave(p); } } -- 2.39.5