]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
More details on the comment justifying the aleged data race in the WAL-mode
authordrh <drh@noemail.net>
Wed, 27 Nov 2019 20:40:44 +0000 (20:40 +0000)
committerdrh <drh@noemail.net>
Wed, 27 Nov 2019 20:40:44 +0000 (20:40 +0000)
checkpoint logic.

FossilOrigin-Name: 0fab65c79f675c825ed7e85c82b65ce6f990c9d0796ebb3886942d241df7b268

manifest
manifest.uuid
src/wal.c

index d50fcfcb77436938234e80c450712433879c8ad2..446fad58dcc0ec9d9c70f663d579fb4e7902918f 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\svarious\sdocumentation\stypos\ssuggested\sby\sMark\sBenningfield.\nNo\schanges\sto\scode.
-D 2019-11-26T14:24:12.657
+C More\sdetails\son\sthe\scomment\sjustifying\sthe\saleged\sdata\srace\sin\sthe\sWAL-mode\ncheckpoint\slogic.
+D 2019-11-27T20:40:44.618
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -609,7 +609,7 @@ F src/vdbesort.c a3be032cc3fee0e3af31773af4a7a6f931b7230a34f53282ccf1d9a2a72343b
 F src/vdbetrace.c fa3bf238002f0bbbdfb66cc8afb0cea284ff9f148d6439bc1f6f2b4c3b7143f0
 F src/vtab.c 108f79166d4a232a8bfb9d46e2fbec191f83a87fe97f7b93fc4de976c3fa3434
 F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
-F src/wal.c bbd6838bd79c0a32144d482fb0b6a9d2d1a252fb3b16d5005ec30f2f80413b0d
+F src/wal.c 15a2845769f51ba132f9cf0b2c7a6887a91fc8437892dbcce9fcdc68b66d60a1
 F src/wal.h 606292549f5a7be50b6227bd685fa76e3a4affad71bb8ac5ce4cb5c79f6a176a
 F src/walker.c a137468bf36c92e64d2275caa80c83902e3a0fc59273591b96c6416d3253d05d
 F src/where.c 874845fb5d93b3bc07123df8fee805e9650bd091e3ed62988273c7e2141ab8bd
@@ -1851,7 +1851,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 fefe2d046725254367f9f82a8c8cb137e8b75dbbf4bc48debf0649479ff2f0c2
-R 2cbc86068e6280db02b2343a5ae4d180
+P 08f09dc4f986a27f4e4e69f8226dbfaf0cfe1269cefc2830bf0fbef7b9bbda48
+R b207e459d1be3160926607ccb6908528
 U drh
-Z bfb42d33cd846c85cfceaf8d7b65a29d
+Z 775e94978b5046eb8d005a7d1a58936a
index 08340fef94a323b477dbc592f074663f6c9d122d..8274492b84a90db246f8281f07075355d8161908 100644 (file)
@@ -1 +1 @@
-08f09dc4f986a27f4e4e69f8226dbfaf0cfe1269cefc2830bf0fbef7b9bbda48
\ No newline at end of file
+0fab65c79f675c825ed7e85c82b65ce6f990c9d0796ebb3886942d241df7b268
\ No newline at end of file
index 669be95208e06b90a13c2171448bd377934cb386..3d4a541d5ef5844bf0b1cdc8d8f52cbc913142ae 100644 (file)
--- a/src/wal.c
+++ b/src/wal.c
@@ -1824,7 +1824,19 @@ static int walCheckpoint(
       ** not decreasing it. So assuming either that either the "old" or
       ** "new" version of the value is read, and not some arbitrary value
       ** that would never be written by a real client, things are still 
-      ** safe.  */
+      ** safe.
+      **
+      ** Astute readers have pointed out that the assumption stated in the
+      ** last sentence of the previous paragraph is not guaranteed to be
+      ** true for all conforming systems.  However, the assumption is true
+      ** for all compilers and architectures in common use today (circa
+      ** 2019-11-27) and the alternatives are both slow and complex, and
+      ** so we will continue to go with the current design for now.  If this
+      ** bothers you, or if you really are running on a system where aligned
+      ** 32-bit reads and writes are not atomic, then you can simply avoid
+      ** the use of WAL mode, or only use WAL mode together with
+      ** PRAGMA locking_mode=EXCLUSIVE and all will be well.
+      */
       u32 y = pInfo->aReadMark[i];
       if( mxSafeFrame>y ){
         assert( y<=pWal->hdr.mxFrame );