From: drh <> Date: Mon, 11 Jul 2022 18:11:51 +0000 (+0000) Subject: Back out the optimization at [1a8c2e54375ee2cf7] because there are some X-Git-Tag: version-3.40.0~319 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc7f8f81daea563caa61d62c282812f4f6bbf9df;p=thirdparty%2Fsqlite.git Back out the optimization at [1a8c2e54375ee2cf7] because there are some cases where it does not work. FossilOrigin-Name: fe39c8d5fd813308fb27a05ce257ff003d3c09c0372f500e8def5a528a2558b7 --- diff --git a/manifest b/manifest index 7a7772b388..1b23b1b58b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Ensure\sthat\sthe\sParse.nErr\sflag\sis\sset\sfollowing\san\sSQLITE_TOOBIG\serror\son\na\snested\sparse.\s\sFix\sfor\sthe\sproblem\sidentified\sby\n[forum/forumpost/d5a82ba9eedee30c\s|\sforum\spost\sd5a82ba9eedee30c].\nAlso,\sremove\sunnecessary\sclearing\sof\sthe\sParse.zErrMsg\sfield\nfollowing\sa\snested\sparse. -D 2022-07-11T14:36:03.450 +C Back\sout\sthe\soptimization\sat\s[1a8c2e54375ee2cf7]\sbecause\sthere\sare\ssome\ncases\swhere\sit\sdoes\snot\swork. +D 2022-07-11T18:11:51.750 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 0f34033977b2275793c4330b2ebc3fa180a1baee06591cbc8f6e0d7aaa37988d +F src/wal.c b9df133a705093da8977da5eb202eaadb844839f1c7297c08d33471f5491843d F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a F src/walker.c f890a3298418d7cba3b69b8803594fdc484ea241206a8dfa99db6dd36f8cbb3b F src/where.c 5af9a9773a3bb84acf4eac8b92b7951b780ece1dca914223f78effc4effeca2d @@ -1979,8 +1979,9 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P d0bfe5c574dbc467ba97d96306d78a62a55b78dbbbe4d25aa962db6aa40406f6 -R e2485993c6349272c79d485280ee9729 +P 44d77a7f807f5dc3e94e6cd88a27bea79257f0f2ccf332891bdaa4668d0bb987 +Q -1a8c2e54375ee2cf73773b798fed0ae07b42f5e068fddc513c093de5c1f46615 +R fa1e214aa3098781f8133105e874fb59 U drh -Z d5e203512ebbc12e61da151fb9a99fc8 +Z 81ca1352813c96809ca09ee1d58005a6 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 3f2c1a3417..4c5e4745b0 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -44d77a7f807f5dc3e94e6cd88a27bea79257f0f2ccf332891bdaa4668d0bb987 \ No newline at end of file +fe39c8d5fd813308fb27a05ce257ff003d3c09c0372f500e8def5a528a2558b7 \ No newline at end of file diff --git a/src/wal.c b/src/wal.c index e7c1c053bd..fdc4ac39b6 100644 --- a/src/wal.c +++ b/src/wal.c @@ -3138,17 +3138,20 @@ int sqlite3WalFindFrame( u32 *piRead /* OUT: Frame number (or zero) */ ){ u32 iRead = 0; /* If !=0, WAL frame to return data from */ - u32 iLast; /* Last page in WAL for this reader */ + u32 iLast = pWal->hdr.mxFrame; /* 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 pWal->readLock==0, then the WAL is ignored by the reader - ** so return early, as if the WAL were empty. + /* 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 && pWal->bShmUnreliable==0 ){ + if( iLast==0 || (pWal->readLock==0 && pWal->bShmUnreliable==0) ){ *piRead = 0; return SQLITE_OK; } @@ -3179,7 +3182,6 @@ 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 */