]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
In btree.c, have setSharedCacheLock() assume that the b-tree is sharable instead...
authordanielk1977 <danielk1977@noemail.net>
Thu, 9 Jul 2009 08:27:14 +0000 (08:27 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Thu, 9 Jul 2009 08:27:14 +0000 (08:27 +0000)
FossilOrigin-Name: 3190eefd5f5285a5250d6f4729f109852fdb02ab

manifest
manifest.uuid
src/btree.c

index 2814670f1d8440f3e7ece65a7d3819f08808b036..7987c59fa48066a4c62df872ae1ff97b93972d05 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Restore\s(btree_set_cache_size)\sto\stest3.c.\sThis\sis\sused\son\sunix\sfor\sthe\stcl\s"crash\stests".\sMake\ssome\sfunctions\sno\slonger\sused\soutside\sof\sbtree.c\sstatic.\s(CVS\s6869)
-D 2009-07-09T05:07:38
+C In\sbtree.c,\shave\ssetSharedCacheLock()\sassume\sthat\sthe\sb-tree\sis\ssharable\sinstead\sof\schecking\sto\ssee\sif\sit\sis.\sThe\scaller\shas\salready\sperformed\sthis\scheck.\s(CVS\s6870)
+D 2009-07-09T08:27:14
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in df9359da7a726ccb67a45db905c5447d5c00c6ef
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -106,7 +106,7 @@ F src/auth.c 802a9439dfa0b8c208b10055cba400e82ef18025
 F src/backup.c 6f1c2d9862c8a3feb7739dfcca02c1f5352e37f3
 F src/bitvec.c 0ef0651714728055d43de7a4cdd95e703fac0119
 F src/btmutex.c 9b899c0d8df3bd68f527b0afe03088321b696d3c
-F src/btree.c 068c2d866c50c160935ff295e1e0352924d01c05
+F src/btree.c 45595e89ac2babfc6317ef27cc1a930e7db1bb19
 F src/btree.h e53a10fd31d16c60a86f03c9467a6f470aa3683b
 F src/btreeInt.h a568bf057aa249eb06fd31358b4393a5ac88c118
 F src/build.c 867028ee9f63f7bc8eb8d4a720bb98cf9b9a12b4
@@ -740,7 +740,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl 672f81d693a03f80f5ae60bfefacd8a349e76746
-P 579ba6c83f52d26860e5152f06355aa4f49e568d
-R d5b9a0157f1211f7631b1172e2a7ef04
+P 1d96ce8c76e007ca29e7971a6c72b6387fe0fb93
+R b4d836437dbb61ffda54759b119298cf
 U danielk1977
-Z 053de8785ae8ff1ebe93c77d8f639f56
+Z 394ccb1806f19bc1b72ed270bf66ac3f
index abd7554fff00bfb18026daaca0471c822b643309..7cc7488a74ae3795776aa259c47d0772cee50d4e 100644 (file)
@@ -1 +1 @@
-1d96ce8c76e007ca29e7971a6c72b6387fe0fb93
\ No newline at end of file
+3190eefd5f5285a5250d6f4729f109852fdb02ab
\ No newline at end of file
index 8f4d786d778b7cd43361befb13dfa8617f1b08d5..fe638abda056c1ce76109e4d8e9cb73fb17e7dbc 100644 (file)
@@ -9,7 +9,7 @@
 **    May you share freely, never taking more than you give.
 **
 *************************************************************************
-** $Id: btree.c,v 1.669 2009/07/09 05:07:38 danielk1977 Exp $
+** $Id: btree.c,v 1.670 2009/07/09 08:27:14 danielk1977 Exp $
 **
 ** This file implements a external (disk-based) database using BTrees.
 ** See the header comment on "btreeInt.h" for additional information.
@@ -255,8 +255,17 @@ static int querySharedCacheTableLock(Btree *p, Pgno iTab, u8 eLock){
 ** by Btree handle p. Parameter eLock must be either READ_LOCK or 
 ** WRITE_LOCK.
 **
-** SQLITE_OK is returned if the lock is added successfully. SQLITE_BUSY and
-** SQLITE_NOMEM may also be returned.
+** This function assumes the following:
+**
+**   (a) The specified b-tree connection handle is connected to a sharable
+**       b-tree database (one with the BtShared.sharable) flag set, and
+**
+**   (b) No other b-tree connection handle holds a lock that conflicts
+**       with the requested lock (i.e. querySharedCacheTableLock() has
+**       already been called and returned SQLITE_OK).
+**
+** SQLITE_OK is returned if the lock is added successfully. SQLITE_NOMEM 
+** is returned if a malloc attempt fails.
 */
 static int setSharedCacheTableLock(Btree *p, Pgno iTable, u8 eLock){
   BtShared *pBt = p->pBt;
@@ -273,11 +282,9 @@ static int setSharedCacheTableLock(Btree *p, Pgno iTable, u8 eLock){
   ** table, and that lock is obtained in BtreeBeginTrans().  */
   assert( 0==(p->db->flags&SQLITE_ReadUncommitted) || eLock==WRITE_LOCK );
 
-  /* This is a no-op if the shared-cache is not enabled */
-  if( !p->sharable ){
-    return SQLITE_OK;
-  }
-
+  /* This function should only be called on a sharable b-tree after it 
+  ** has been determined that no other b-tree holds a conflicting lock.  */
+  assert( p->sharable );
   assert( SQLITE_OK==querySharedCacheTableLock(p, iTable, eLock) );
 
   /* First search the list for an existing lock on this table. */