From: drh Date: Thu, 7 Apr 2011 14:47:01 +0000 (+0000) Subject: When searching a list of freelist trunk pages looking for a specific page X-Git-Tag: version-3.7.6~20 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=93b4fc78cf8a32f0b9c4563a77706034e56c6093;p=thirdparty%2Fsqlite.git When searching a list of freelist trunk pages looking for a specific page to allocate, avoid unnecessary journalling of the unchanged trunk pages towards the start of the list. FossilOrigin-Name: d03d63d77ed144ac2c02a0245c4b4b070b79c88e --- diff --git a/manifest b/manifest index 518827889c..097db8a15d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Avoid\srunning\sthread1.test\sor\sthread2.test\sif\sSQLITE_MUTEX_NOOP\sis\sdefined. -D 2011-04-07T14:05:47.844 +C When\ssearching\sa\slist\sof\sfreelist\strunk\spages\slooking\sfor\sa\sspecific\spage\nto\sallocate,\savoid\sunnecessary\sjournalling\sof\sthe\sunchanged\strunk\spages\stowards\nthe\sstart\sof\sthe\slist. +D 2011-04-07T14:47:01.943 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 7a4d9524721d40ef9ee26f93f9bd6a51dba106f2 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -121,7 +121,7 @@ F src/auth.c 523da7fb4979469955d822ff9298352d6b31de34 F src/backup.c b7529a6691f0fd534ae8ff622203c46a7f1b626b F src/bitvec.c af50f1c8c0ff54d6bdb7a80e2fceca5a93670bef F src/btmutex.c 976f45a12e37293e32cae0281b15a21d48a8aaa7 -F src/btree.c 4fcad108b612a4d33dac568b11d26e4d38ccbe35 +F src/btree.c 6a9164af8a2ef4612ee30b253635a9bd8e5e1b1b F src/btree.h 11753dd46597a20702bca8746cb4caa4486a82b5 F src/btreeInt.h 67978c014fa4f7cc874032dd3aacadd8db656bc3 F src/build.c b7c993274ee2a029937b0bc4815bdef80b330017 @@ -927,7 +927,7 @@ F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/split-sqlite3c.tcl d9be87f1c340285a3e081eb19b4a247981ed290c F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P e4e99606fdf1f1cecf914dc865b066bf07793d1f -R 42c41e910cfc7e1c1b9040c4c34f5e86 -U dan -Z e11fdaaab64fe55fe7338be760f5f876 +P 532ae32ea0f5e821dac643cbc4b041c103cadfdc +R ada284aaaa309102c01ae8aa530bb601 +U drh +Z 52b476a7ff4c3a8d80844592d209d819 diff --git a/manifest.uuid b/manifest.uuid index 4b9265b79f..ada919f6d9 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -532ae32ea0f5e821dac643cbc4b041c103cadfdc \ No newline at end of file +d03d63d77ed144ac2c02a0245c4b4b070b79c88e \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index bfdc3d98a8..103a1f3230 100644 --- a/src/btree.c +++ b/src/btree.c @@ -4819,7 +4819,7 @@ static int allocateBtreePage( goto end_allocate_page; } - k = get4byte(&pTrunk->aData[4]); + k = get4byte(&pTrunk->aData[4]); /* # of leaves on this trunk page */ if( k==0 && !searchList ){ /* The trunk has no leaves and the list is not being searched. ** So extract the trunk page itself and use it as the newly @@ -4904,10 +4904,6 @@ static int allocateBtreePage( u32 closest; Pgno iPage; unsigned char *aData = pTrunk->aData; - rc = sqlite3PagerWrite(pTrunk->pDbPage); - if( rc ){ - goto end_allocate_page; - } if( nearby>0 ){ u32 i; int dist; @@ -4937,11 +4933,12 @@ static int allocateBtreePage( TRACE(("ALLOCATE: %d was leaf %d of %d on trunk %d" ": %d more free pages\n", *pPgno, closest+1, k, pTrunk->pgno, n-1)); + rc = sqlite3PagerWrite(pTrunk->pDbPage); + if( rc ) goto end_allocate_page; if( closestpDbPage) ); noContent = !btreeGetHasContent(pBt, *pPgno); rc = btreeGetPage(pBt, *pPgno, ppPage, noContent); if( rc==SQLITE_OK ){ @@ -5010,6 +5007,7 @@ end_allocate_page: }else{ *ppPage = 0; } + assert( rc!=SQLITE_OK || sqlite3PagerIswriteable((*ppPage)->pDbPage) ); return rc; }