-C Get\smain.c\sto\scompile\swhen\sHAVE_USLEEP\sis\s0.\s(CVS\s4245)
-D 2007-08-20T11:12:41
+C Bug\sfix\sin\sBTree\sshared\scache\slocking\scode.\s(CVS\s4246)
+D 2007-08-20T13:14:29
F Makefile.in 0c0e53720f658c7a551046442dd7afba0b72bfbe
F Makefile.linux-gcc 65241babba6faf1152bf86574477baab19190499
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
F src/analyze.c a14237d869c6bea0846493b59317e4097e81a0b6
F src/attach.c a52225c75b107be8c5bc144a2b6d20201be3f8f8
F src/auth.c 5ea90bc93dfea46e9fe4bf531e14c7cd98219ecb
-F src/btree.c f00ed30c442b4934d042af84e065498c542d21aa
+F src/btree.c f8a04f35eb81360773899983f7c2008145e13935
F src/btree.h 91ee529d581c1473d8e6e15299acc3b8de1d0674
-F src/btreeInt.h 6329e955a7dadd8628d5866e2465721b5fd25ef2
+F src/btreeInt.h 9b4ca8999e52f713420e5f297dd86887a7a9820f
F src/build.c add67be992307b4b11849a6611bfd3352aacde92
F src/callback.c 143436453bb93e831c9574fea0b9b9eb90e40ff3
F src/complete.c ea63834e798a0ab14159bdc6e6cabc3df21aa346
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P 41f2175b1ed7eccf271b687ee5c3ea262a0cd096
-R 3e86c1deeec6de8a6818d829abf2506d
+P b27f022fb924709f1c5e4642d5d59cab942e826d
+R ee810a3824b25c07a2182b7d0dedc3f5
U drh
-Z e107c976a8aac7848166a53955d0d290
+Z 6c13724b198dff1360ddd718c375cb8a
-b27f022fb924709f1c5e4642d5d59cab942e826d
\ No newline at end of file
+399d3e755253a7b4604a62b9f171e0f1154134e2
\ No newline at end of file
** May you share freely, never taking more than you give.
**
*************************************************************************
-** $Id: btree.c,v 1.401 2007/08/17 16:50:38 danielk1977 Exp $
+** $Id: btree.c,v 1.402 2007/08/20 13:14:29 drh Exp $
**
** This file implements a external (disk-based) database using BTrees.
** See the header comment on "btreeInt.h" for additional information.
#if !defined(SQLITE_OMIT_SHARED_CACHE) && !defined(SQLITE_OMIT_DISKIO)
/* If the new Btree uses a sharable pBtShared, then link the new
** Btree into the list of all sharable Btrees for the same connection.
- ** The list is kept in ascending order by pBtShared address.
+ ** The list is kept in ascending order by pBt address.
*/
if( p->sharable ){
int i;
p->pPrev = 0;
pSib->pPrev = p;
}else{
- while( pSib->pNext && pSib->pNext->pBt>p->pBt ){
+ while( pSib->pNext && pSib->pNext->pBt<p->pBt ){
pSib = pSib->pNext;
}
p->pNext = pSib->pNext;
** Clean out and delete the BtShared object.
*/
assert( !pBt->pCursor );
- assert( pBt->nRef==0 );
sqlite3PagerClose(pBt->pPager);
if( pBt->xFreeSchema && pBt->pSchema ){
pBt->xFreeSchema(pBt->pSchema);
** May you share freely, never taking more than you give.
**
*************************************************************************
-** $Id: btreeInt.h,v 1.6 2007/08/17 01:14:38 drh Exp $
+** $Id: btreeInt.h,v 1.7 2007/08/20 13:14:29 drh Exp $
**
** This file implements a external (disk-based) database using BTrees.
** For a detailed discussion of BTrees, refer to
** points to the same BtShared object. The database cache and the
** schema associated with the database file are all contained within
** the BtShared object.
+**
+** All fields in this structure are accessed under the sqlite3.pMutex
+** mutex.
*/
struct Btree {
sqlite3 *pSqlite; /* The database connection holding this btree */
** private Btree object for the file and each of those Btrees points
** to this one BtShared object. BtShared.nRef is the number of
** connections currently sharing this database file.
+**
+** Fields in this structure are accessed under the BtShared.mutex
+** mutex, except for nRef and pNext which are accessed under the
+** global SQLITE_MUTEX_STATIC_MASTER mutex.
*/
struct BtShared {
Pager *pPager; /* The page cache */
int minLeaf; /* Minimum local payload in a LEAFDATA table */
BusyHandler *pBusyHandler; /* Callback for when there is lock contention */
u8 inTransaction; /* Transaction state */
- int nRef; /* Number of references to this structure */
int nTransaction; /* Number of open transactions (read + write) */
void *pSchema; /* Pointer to space allocated by sqlite3BtreeSchema() */
void (*xFreeSchema)(void*); /* Destructor for BtShared.pSchema */
#ifndef SQLITE_OMIT_SHARED_CACHE
+ int nRef; /* Number of references to this structure */
+ BtShared *pNext; /* Next on a list of sharable BtShared structs */
sqlite3_mutex *mutex; /* Non-recursive mutex required to access this struct */
BtLock *pLock; /* List of locks held on this shared-btree struct */
- BtShared *pNext; /* Next in ThreadData.pBtree linked list */
#endif
};
** When a single database file can shared by two more database connections,
** but cursors cannot be shared. Each cursor is associated with a
** particular database connection identified BtCursor.pBtree.pSqlite.
+**
+** The fields in this structure are accessed under the sqlite3.pMutex
+** mutex, specifically the BtCurser.pBtree->pSqlite->pMutex mutex.
+** The pNext and pPrev fields also require the BtShared.mutex mutex.
*/
struct BtCursor {
Btree *pBtree; /* The Btree to which this cursor belongs */