]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Remove an unreachable branch from lockBtree(). Add comments. (CVS 6428)
authordanielk1977 <danielk1977@noemail.net>
Wed, 1 Apr 2009 19:07:03 +0000 (19:07 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Wed, 1 Apr 2009 19:07:03 +0000 (19:07 +0000)
FossilOrigin-Name: 859792958b4d4a3623d68526ff773f778bdf3f0d

manifest
manifest.uuid
src/btree.c

index 6832a0b272dfd0918874e2e4340c47df9adb8937..5152717dc3f2de95212c6a6a9de14f9c6cf309cf 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\sbug\sin\sthe\ssqlite3Utf16ByteLen()\sfunction\sso\sthat\sit\scomputes\sthe\ncorrect\slength\seven\sfor\sstrings\sthat\scontain\ssurrogate\spairs.\nTicket\s#3766.\s(CVS\s6427)
-D 2009-04-01T18:40:32
+C Remove\san\sunreachable\sbranch\sfrom\slockBtree().\sAdd\scomments.\s(CVS\s6428)
+D 2009-04-01T19:07:04
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in 583e87706abc3026960ed759aff6371faf84c211
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -103,7 +103,7 @@ F src/auth.c c8b2ab5c8bad4bd90ed7c294694f48269162c627
 F src/backup.c 0082d0e5a63f04e88faee0dff0a7d63d3e92a78d
 F src/bitvec.c 44f7059ac1f874d364b34af31b9617e52223ba75
 F src/btmutex.c 341502bc496dc0840dcb00cde65680fb0e85c3ab
-F src/btree.c 3e831426631f0eff0b56d7980ba39cfc53911727
+F src/btree.c dcf8157bd4b28a6125d2900f3031a034c1f57720
 F src/btree.h e302c5747494067cd4f5763000fbe7bca767d816
 F src/btreeInt.h df64030d632f8c8ac217ed52e8b6b3eacacb33a5
 F src/build.c 72357fd75ef036d0afbf1756edab6d62c56fcf4b
@@ -714,7 +714,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 3a92c95644ead7c4728ffec1ec70676663518188
-R a8645e4c19e0d7546ed7b3fc51d85afa
-U drh
-Z f7ca868d3c85446b0badce3658c2c808
+P 766bb7e59c28884e40ce13e3fc55c870d06d7e34
+R 3a6094ea8b9dd0c5d4c7f018f1b56432
+U danielk1977
+Z 51aefb40d1f48fec12c4fcbcd1a2197b
index 4e6aa45b329b7c7804eb7b5b1cdf1d640df3bd93..164ad3198d5df52e5aa431bb6e4df2474ad12e2c 100644 (file)
@@ -1 +1 @@
-766bb7e59c28884e40ce13e3fc55c870d06d7e34
\ No newline at end of file
+859792958b4d4a3623d68526ff773f778bdf3f0d
\ No newline at end of file
index d012bbc70b6a8cdf0f0e369c21686bfc45c26c7b..69264f42aa5fbbdc95f1aaa33844885543e86bdf 100644 (file)
@@ -9,7 +9,7 @@
 **    May you share freely, never taking more than you give.
 **
 *************************************************************************
-** $Id: btree.c,v 1.586 2009/04/01 18:03:01 danielk1977 Exp $
+** $Id: btree.c,v 1.587 2009/04/01 19:07:04 danielk1977 Exp $
 **
 ** This file implements a external (disk-based) database using BTrees.
 ** See the header comment on "btreeInt.h" for additional information.
@@ -1886,7 +1886,7 @@ static int lockBtree(BtShared *pBt){
   int nPage;
 
   assert( sqlite3_mutex_held(pBt->mutex) );
-  if( pBt->pPage1 ) return SQLITE_OK;
+  assert( pBt->pPage1==0 );
   rc = sqlite3BtreeGetPage(pBt, 1, &pPage1, 0);
   if( rc!=SQLITE_OK ) return rc;
 
@@ -2155,11 +2155,14 @@ int sqlite3BtreeBeginTrans(Btree *p, int wrflag){
 #endif
 
   do {
-    if( pBt->pPage1==0 ){
-      do{
-        rc = lockBtree(pBt);
-      }while( pBt->pPage1==0 && rc==SQLITE_OK );
-    }
+    /* Call lockBtree() until either pBt->pPage1 is populated or
+    ** lockBtree() returns something other than SQLITE_OK. lockBtree()
+    ** may return SQLITE_OK but leave pBt->pPage1 set to 0 if after
+    ** reading page 1 it discovers that the page-size of the database 
+    ** file is not pBt->pageSize. In this case lockBtree() will update
+    ** pBt->pageSize to the page-size of the file on disk.
+    */
+    while( pBt->pPage1==0 && SQLITE_OK==(rc = lockBtree(pBt)) );
 
     if( rc==SQLITE_OK && wrflag ){
       if( pBt->readOnly ){