From: danielk1977 Date: Wed, 1 Apr 2009 19:07:03 +0000 (+0000) Subject: Remove an unreachable branch from lockBtree(). Add comments. (CVS 6428) X-Git-Tag: version-3.6.15~322 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=295dc10573784659acaf709fdddaf53b0e6798bc;p=thirdparty%2Fsqlite.git Remove an unreachable branch from lockBtree(). Add comments. (CVS 6428) FossilOrigin-Name: 859792958b4d4a3623d68526ff773f778bdf3f0d --- diff --git a/manifest b/manifest index 6832a0b272..5152717dc3 100644 --- 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 diff --git a/manifest.uuid b/manifest.uuid index 4e6aa45b32..164ad3198d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -766bb7e59c28884e40ce13e3fc55c870d06d7e34 \ No newline at end of file +859792958b4d4a3623d68526ff773f778bdf3f0d \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index d012bbc70b..69264f42aa 100644 --- a/src/btree.c +++ b/src/btree.c @@ -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 ){