1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Remove the mutex counter and the logic that attempts to verify that btree

mutexes are held continuously.  We are not making that assumption at this
time.

FossilOrigin-Name: 242ce7cff416a87d57d4eb624cb79fa4e2215559
This commit is contained in:
drh
2011-04-05 17:31:56 +00:00
parent ce8e5ffe1c
commit e54e051800
8 changed files with 25 additions and 139 deletions

View File

@@ -45,28 +45,10 @@ static void unlockBtreeMutex(Btree *p){
assert( sqlite3_mutex_held(p->db->mutex) );
assert( p->db==pBt->db );
pBt->iMutexCounter++;
sqlite3_mutex_leave(pBt->mutex);
p->locked = 0;
}
#ifdef SQLITE_DEBUG
/*
** Return the number of times that the mutex has been exited for
** the given btree.
**
** This is a small circular counter that wraps around to zero on
** overflow. It is used only for sanity checking - to verify that
** mutexes are held continously by asserting that the value of
** this counter at the beginning of a region is the same as at
** the end.
*/
u32 sqlite3BtreeMutexCounter(Btree *p){
assert( p->locked==1 || p->sharable==0 );
return p->pBt->iMutexCounter;
}
#endif
/*
** Enter a mutex on the given BTree object.
**
@@ -111,24 +93,6 @@ void sqlite3BtreeEnter(Btree *p){
p->wantToLock++;
if( p->locked ) return;
/* Increment the mutex counter on all locked btrees in the same
** database connection. This simulates the unlocking that would
** occur on a worst-case mutex dead-lock avoidance scenario.
*/
#ifdef SQLITE_DEBUG
{
int ii;
sqlite3 *db = p->db;
Btree *pOther;
for(ii=0; ii<db->nDb; ii++){
if( ii==1 ) continue;
pOther = db->aDb[ii].pBt;
if( pOther==0 || pOther->sharable==0 || pOther->locked==0 ) continue;
pOther->pBt->iMutexCounter++;
}
}
#endif
/* In most cases, we should be able to acquire the lock we
** want without having to go throught the ascending lock
** procedure that follows. Just be sure not to block.