]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Minor simplification and performance optimization for Direct Overflow Read.
authordrh <drh@noemail.net>
Thu, 26 Jan 2017 16:27:32 +0000 (16:27 +0000)
committerdrh <drh@noemail.net>
Thu, 26 Jan 2017 16:27:32 +0000 (16:27 +0000)
FossilOrigin-Name: 3e96d6efa867b765c8acf1454014b1e71b2e4f21

manifest
manifest.uuid
src/btree.c

index 133861bb31a5baf9abec525ac8e71d203b0ca365..90d70de805b4c2382b77b53c5d83b24dcc0d6a66 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Make\sSQLITE_DIRECT_OVERFLOW_READ\swork\sfor\sin\sWAL\smode\sas\slong\sas\sthe\spage\nbeing\sread\sis\snot\sin\sthe\sthe\s-wal\sfile.
-D 2017-01-26T02:26:02.936
+C Minor\ssimplification\sand\sperformance\soptimization\sfor\sDirect\sOverflow\sRead.
+D 2017-01-26T16:27:32.813
 F Makefile.in 5f415e7867296d678fed2e6779aea10c1318b4bc
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 F Makefile.msc b8ca53350ae545e3562403d5da2a69cec79308da
@@ -333,7 +333,7 @@ F src/auth.c 930b376a9c56998557367e6f7f8aaeac82a2a792
 F src/backup.c faf17e60b43233c214aae6a8179d24503a61e83b
 F src/bitvec.c 17ea48eff8ba979f1f5b04cc484c7bb2be632f33
 F src/btmutex.c 0e9ce2d56159b89b9bc8e197e023ee11e39ff8ca
-F src/btree.c 4a4ae5fd82ee576b85163277610d8b8174831f16
+F src/btree.c a168da7c4fff00dbd939c49ad4445d378eff1b11
 F src/btree.h e6d352808956ec163a17f832193a3e198b3fb0ac
 F src/btreeInt.h 10c4b77c2fb399580babbcc7cf652ac10dba796e
 F src/build.c 9e799f1edd910dfa8a0bc29bd390d35d310596af
@@ -1547,7 +1547,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 62a4851ccf88837d1c16dae8204f7f264e80e3c9
-R 5def997b16301f95d47461ef6a1c2e30
+P 9879be1899adf5634f551a2077b15ccb1133e4e3
+R d7cd9a6ab86d59aef41165d7cf109b11
 U drh
-Z c8beae43adff961172e88276d51d2aaf
+Z 50b1b915cab08ae10917e730aa3424e6
index 3045549ece51297f435390a84ab38c4bb4a9a247..d3b805d95ad02b709bfde40f0355169ea2799c42 100644 (file)
@@ -1 +1 @@
-9879be1899adf5634f551a2077b15ccb1133e4e3
\ No newline at end of file
+3e96d6efa867b765c8acf1454014b1e71b2e4f21
\ No newline at end of file
index 016e7f6ccac2b6cd86921de1a038ad5e83ceb65d..3150026a587b7bd08f2576b59d47b4897095e3ff 100644 (file)
@@ -4460,8 +4460,7 @@ static int accessPayload(
   MemPage *pPage = pCur->apPage[pCur->iPage]; /* Btree page of current entry */
   BtShared *pBt = pCur->pBt;                  /* Btree this cursor belongs to */
 #ifdef SQLITE_DIRECT_OVERFLOW_READ
-  unsigned char * const pBufStart = pBuf;
-  int bEnd;                                 /* True if reading to end of data */
+  unsigned char * const pBufStart = pBuf;     /* Start of original out buffer */
 #endif
 
   assert( pPage );
@@ -4472,9 +4471,6 @@ static int accessPayload(
 
   getCellInfo(pCur);
   aPayload = pCur->info.pPayload;
-#ifdef SQLITE_DIRECT_OVERFLOW_READ
-  bEnd = offset+amt==pCur->info.nPayload;
-#endif
   assert( offset+amt <= pCur->info.nPayload );
 
   assert( aPayload > pPage->aData );
@@ -4579,7 +4575,7 @@ static int accessPayload(
         ** range of data that is being read (eOp==0) or written (eOp!=0).
         */
 #ifdef SQLITE_DIRECT_OVERFLOW_READ
-        sqlite3_file *fd;
+        sqlite3_file *fd;      /* File from which to do direct overflow read */
 #endif
         int a = amt;
         if( a + offset > ovflSize ){
@@ -4591,11 +4587,10 @@ static int accessPayload(
         **
         **   1) this is a read operation, and 
         **   2) data is required from the start of this overflow page, and
-        **   3) the database is file-backed, and
-        **   4) there is no open write-transaction, and
+        **   3) there is no open write-transaction, and
+        **   4) the database is file-backed, and
         **   5) the page is not in the WAL file
-        **   6) all data from the page is being read.
-        **   7) at least 4 bytes have already been read into the output buffer 
+        **   6) at least 4 bytes have already been read into the output buffer 
         **
         ** then data can be read directly from the database file into the
         ** output buffer, bypassing the page-cache altogether. This speeds
@@ -4603,15 +4598,14 @@ 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->inTransaction==TRANS_READ                     /* (3) */
+         && (fd = sqlite3PagerFile(pBt->pPager))->pMethods     /* (4) */
          && 0==sqlite3PagerUseWal(pBt->pPager, nextPage)       /* (5) */
-         && &pBuf[-4]>=pBufStart                               /* (7) */
+         && &pBuf[-4]>=pBufStart                               /* (6) */
         ){
           u8 aSave[4];
           u8 *aWrite = &pBuf[-4];
-          assert( aWrite>=pBufStart );                         /* hence (7) */
+          assert( aWrite>=pBufStart );                         /* due to (6) */
           memcpy(aSave, aWrite, 4);
           rc = sqlite3OsRead(fd, aWrite, a+4, (i64)pBt->pageSize*(nextPage-1));
           nextPage = get4byte(aWrite);