Only use the direct-overflow-read optimization if all data from the overflow page in question is being read.

FossilOrigin-Name: d8e1f75ddf10f3c0b21acd5455f90fdcea54a948
This commit is contained in:
dan 2014-03-20 18:56:35 +00:00
parent 926345e027
commit 9bc21b535e
4 changed files with 20 additions and 14 deletions

View File

@ -1,5 +1,5 @@
C Remove\sa\sstray\sC99-style\scomment.
D 2014-03-11T23:44:10.719
C Only\suse\sthe\sdirect-overflow-read\soptimization\sif\sall\sdata\sfrom\sthe\soverflow\spage\sin\squestion\sis\sbeing\sread.
D 2014-03-20T18:56:35.309
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -164,7 +164,7 @@ F src/auth.c 523da7fb4979469955d822ff9298352d6b31de34
F src/backup.c a729e63cf5cd1829507cb7b8e89f99b95141bb53
F src/bitvec.c 19a4ba637bd85f8f63fc8c9bae5ade9fb05ec1cb
F src/btmutex.c 976f45a12e37293e32cae0281b15a21d48a8aaa7
F src/btree.c 33b5ad54a14c2b62e8adbc7656dec2b7cd760cbf
F src/btree.c 0384d399cfb12b3767edec355f00996658bb093e
F src/btree.h 6b0c1a3f0937f9852ec727c820e71dbdd4bd0b27
F src/btreeInt.h d1784d1e17d08d29e890190dbb9836fa64573381
F src/build.c 0d50ef95aad63f4c4fc47f3fa2670d4557c45db0
@ -574,7 +574,7 @@ F test/fts4merge4.test c19c85ca1faa7b6d536832b49c12e1867235f584
F test/fts4noti.test aed33ba44808852dcb24bf70fa132e7bf530f057
F test/fts4unicode.test 01ec3fe2a7c3cfff3b4c0581b83caa11b33efa36
F test/full.test 6b3c8fb43c6beab6b95438c1675374b95fab245d
F test/func.test a21814945d32137412b553d98ad2107f9b2173a9
F test/func.test c2cbfc23d554c5bf8678d0fb271aa4f8ef94839c
F test/func2.test 772d66227e4e6684b86053302e2d74a2500e1e0f
F test/func3.test dbccee9133cfef1473c59ec07b5f0262b9d72f9a
F test/func4.test 6beacdfcb0e18c358e6c2dcacf1b65d1fa80955f
@ -1156,7 +1156,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
P 968fec44d7fde3adbd3e9603e4282351f0d4bda1
R c766c2eb192c274bbd3dc0af3849118d
U drh
Z 264233dee2a1cd950306c0e6dc59ee29
P f500e87d6ec6fa43c13f4e94edf32789f36e4233
R 97d65ef8b8853428f883a03b9234ff63
U dan
Z c025d7be55b561d9bf0252bb6230f9e0

View File

@ -1 +1 @@
f500e87d6ec6fa43c13f4e94edf32789f36e4233
d8e1f75ddf10f3c0b21acd5455f90fdcea54a948

View File

@ -3951,6 +3951,7 @@ static int accessPayload(
int iIdx = 0;
MemPage *pPage = pCur->apPage[pCur->iPage]; /* Btree page of current entry */
BtShared *pBt = pCur->pBt; /* Btree this cursor belongs to */
int bEnd; /* True if reading to end of data */
assert( pPage );
assert( pCur->eState==CURSOR_VALID );
@ -3960,6 +3961,7 @@ static int accessPayload(
getCellInfo(pCur);
aPayload = pCur->info.pCell + pCur->info.nHeader;
nKey = (pPage->intKey ? 0 : (int)pCur->info.nKey);
bEnd = (offset+amt==nKey+pCur->info.nData);
if( NEVER(offset+amt > nKey+pCur->info.nData)
|| &aPayload[pCur->info.nLocal] > &pPage->aData[pBt->usableSize]
@ -4064,6 +4066,7 @@ static int accessPayload(
** 3) the database is file-backed, and
** 4) there is no open write-transaction, and
** 5) the database is not a WAL database,
** 6) all data from the page is being read.
**
** then data can be read directly from the database file into the
** output buffer, bypassing the page-cache altogether. This speeds
@ -4071,6 +4074,7 @@ static int accessPayload(
*/
if( (eOp&0x01)==0 /* (1) */
&& offset==0 /* (2) */
&& (bEnd || a==ovflSize) /* (6) */
&& pBt->inTransaction==TRANS_READ /* (4) */
&& (fd = sqlite3PagerFile(pBt->pPager))->pMethods /* (3) */
&& pBt->pPage1->aData[19]==0x01 /* (5) */

View File

@ -1301,11 +1301,13 @@ do_test func-29.3 {
db eval {SELECT typeof(+x) FROM t29 ORDER BY id}
} {integer null real blob text}
if {[permutation] != "mmap"} {
do_test func-29.4 {
set x [lindex [sqlite3_db_status db CACHE_MISS 1] 1]
if {$x>100} {set x many}
set x
} {many}
ifcapable !direct_read {
do_test func-29.4 {
set x [lindex [sqlite3_db_status db CACHE_MISS 1] 1]
if {$x>100} {set x many}
set x
} {many}
}
}
do_test func-29.5 {
db close