1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

More details on the comment justifying the aleged data race in the WAL-mode

checkpoint logic.

FossilOrigin-Name: 0fab65c79f675c825ed7e85c82b65ce6f990c9d0796ebb3886942d241df7b268
This commit is contained in:
drh
2019-11-27 20:40:44 +00:00
parent 2bbcaee833
commit 2ecf928ea9
3 changed files with 20 additions and 8 deletions

View File

@@ -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 );