]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Size reduction and performance optimization in sqlite3WalFindFrame().
authordrh <>
Mon, 4 Jul 2022 15:14:25 +0000 (15:14 +0000)
committerdrh <>
Mon, 4 Jul 2022 15:14:25 +0000 (15:14 +0000)
FossilOrigin-Name: 1a8c2e54375ee2cf73773b798fed0ae07b42f5e068fddc513c093de5c1f46615

manifest
manifest.uuid
src/wal.c

index 5fa3a502bc1ced0723145e68742669e64c6cb708..41d014f90bb0ae1689818a16ca5faddef104815c 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C In\sthe\sgetNormalPage()\sroutine\sof\spager.c,\sconsolidate\spgno\serror\schecking\ninto\sa\ssingle\sspot\sfor\ssmall\ssize\sreduction\sand\sperformance\sincrease.
-D 2022-07-04T09:41:44.103
+C Size\sreduction\sand\sperformance\soptimization\sin\ssqlite3WalFindFrame().
+D 2022-07-04T15:14:25.563
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -654,7 +654,7 @@ F src/vdbetrace.c fe0bc29ebd4e02c8bc5c1945f1d2e6be5927ec12c06d89b03ef2a4def34bf8
 F src/vdbevtab.c f99b275366c5fc5e2d99f734729880994ab9500bdafde7fae3b02d562b9d323c
 F src/vtab.c 3d72c780d1ea08906a198e4f033921a658a54590e3ed72c544995d84f3f9464a
 F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
-F src/wal.c b9df133a705093da8977da5eb202eaadb844839f1c7297c08d33471f5491843d
+F src/wal.c 0f34033977b2275793c4330b2ebc3fa180a1baee06591cbc8f6e0d7aaa37988d
 F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a
 F src/walker.c f890a3298418d7cba3b69b8803594fdc484ea241206a8dfa99db6dd36f8cbb3b
 F src/where.c 9a44063e60d8f42dd9dc8147b8e8dcfc315bbd13e25c395211292c36d828c869
@@ -1978,8 +1978,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 3c04d21e6c632feb3bea8d1fa76bedcbfe254b0dc59865633d158a3f1bddefba
-R 14e47e4bb1ab8f4db4305d42d7534790
+P a1c090e08139f99d30aa89db0756dc59fe8990ce15b3db4d4b726cc6acdab46f
+R fed5903c05b22f31489b7dc87a54bece
 U drh
-Z 5c670065e3a48de39ba2455ceb117563
+Z d121505cf61aa3dde02d007851da9f4e
 # Remove this line to create a well-formed Fossil manifest.
index 9df82a5fbcf3430f82fb4eb932032a487c0a5767..3778ae1c493ff9522698131ee843328d6f3ce72f 100644 (file)
@@ -1 +1 @@
-a1c090e08139f99d30aa89db0756dc59fe8990ce15b3db4d4b726cc6acdab46f
\ No newline at end of file
+1a8c2e54375ee2cf73773b798fed0ae07b42f5e068fddc513c093de5c1f46615
\ No newline at end of file
index fdc4ac39b6212e8e12aafb294e53c76ed90003b6..e7c1c053bd1a30992fd356242f3579b95b9c344b 100644 (file)
--- a/src/wal.c
+++ b/src/wal.c
@@ -3138,20 +3138,17 @@ int sqlite3WalFindFrame(
   u32 *piRead                     /* OUT: Frame number (or zero) */
 ){
   u32 iRead = 0;                  /* If !=0, WAL frame to return data from */
-  u32 iLast = pWal->hdr.mxFrame;  /* Last page in WAL for this reader */
+  u32 iLast;                      /* Last page in WAL for this reader */
   int iHash;                      /* Used to loop through N hash tables */
   int iMinHash;
 
   /* This routine is only be called from within a read transaction. */
   assert( pWal->readLock>=0 || pWal->lockError );
 
-  /* If the "last page" field of the wal-index header snapshot is 0, then
-  ** no data will be read from the wal under any circumstances. Return early
-  ** in this case as an optimization.  Likewise, if pWal->readLock==0, 
-  ** then the WAL is ignored by the reader so return early, as if the 
-  ** WAL were empty.
+  /* if pWal->readLock==0,  then the WAL is ignored by the reader
+  ** so return early, as if the  WAL were empty.
   */
-  if( iLast==0 || (pWal->readLock==0 && pWal->bShmUnreliable==0) ){
+  if( pWal->readLock==0 && pWal->bShmUnreliable==0 ){
     *piRead = 0;
     return SQLITE_OK;
   }
@@ -3182,6 +3179,7 @@ int sqlite3WalFindFrame(
   **     table after the current read-transaction had started.
   */
   iMinHash = walFramePage(pWal->minFrame);
+  iLast = pWal->hdr.mxFrame;
   for(iHash=walFramePage(iLast); iHash>=iMinHash; iHash--){
     WalHashLoc sLoc;              /* Hash table location */
     int iKey;                     /* Hash slot index */