]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Use AtomicStore() and AtomicLoad() in a few more places to avoid a theoretically...
authordan <dan@noemail.net>
Wed, 13 May 2020 13:33:30 +0000 (13:33 +0000)
committerdan <dan@noemail.net>
Wed, 13 May 2020 13:33:30 +0000 (13:33 +0000)
FossilOrigin-Name: fda57d4d2f1499c861d43026aa9362d1a30d67c9c002ebf5b0cdc25251537fbb

manifest
manifest.uuid
src/wal.c

index b376e1162a269fb467f79942233540bfbc571506..c0186492c4286e18896020a0e53e7dade2e43a98 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C New\stest\scase\sin\stest/fuzzdata8.db.
-D 2020-05-11T11:11:25.317
+C Use\sAtomicStore()\sand\sAtomicLoad()\sin\sa\sfew\smore\splaces\sto\savoid\sa\stheoretically\sundefined\sbehaviour.\sThis\sis\snot\sactually\sproblem\son\sany\sknown\shardware.
+D 2020-05-13T13:33:30.884
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -617,7 +617,7 @@ F src/vdbetrace.c fa3bf238002f0bbbdfb66cc8afb0cea284ff9f148d6439bc1f6f2b4c3b7143
 F src/vdbevtab.c 8094dfc28dad82d60a1c832020a1b201a5381dc185c14638affc6d4e9d54c653
 F src/vtab.c 7b704a90515a239c6cdba6a66b1bb3a385e62326cceb5ecb05ec7a091d6b8515
 F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
-F src/wal.c fdbf7641be6fa6e57f86484e8b5ffe816dffae176c4fd72a9b76e5e0b99bf6dd
+F src/wal.c 3dc15756d3c859799e30460e1ec6cd304e660df7f680f5cb1b50537de1e6f678
 F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a
 F src/walker.c 7c429c694abd12413a5c17aec9f47cfe9eba6807e6b0a32df883e8e3a14835ed
 F src/where.c 9546c82056e8cdb27291f98cf1adca5d271240b399bb97b32f77fc2bea6146c9
@@ -1864,7 +1864,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 155e6649efe8614718be7ac6c3cccf5b073ae57496dc220db5e4313621f5188e
-R 36caa3745a6abe46d58d1719e568eb6e
-U drh
-Z df38843ea9d10d3e89173fd8fbdb90f5
+P fa11230135610f01c56d6f436f30a8b57a50b430fe7397ea3a0b6642986b3a39
+R 97cd6268c5f3d9fa542f4ecc0358de1f
+U dan
+Z 9f3f4a1597829e70406a86fd3ae421dc
index fca8aad7cf886bbb13f0de759411d282ac441b8b..2a22db18dfd777ed4d6587ceb0db91438f478e32 100644 (file)
@@ -1 +1 @@
-fa11230135610f01c56d6f436f30a8b57a50b430fe7397ea3a0b6642986b3a39
\ No newline at end of file
+fda57d4d2f1499c861d43026aa9362d1a30d67c9c002ebf5b0cdc25251537fbb
\ No newline at end of file
index baa1220b0df980cf16571bcbe67990d08fc11f26..115db09cd65f76596a07836ca9232e7226803405 100644 (file)
--- a/src/wal.c
+++ b/src/wal.c
@@ -1822,7 +1822,7 @@ static void walRestartHdr(Wal *pWal, u32 salt1){
   sqlite3Put4byte((u8*)&aSalt[0], 1 + sqlite3Get4byte((u8*)&aSalt[0]));
   memcpy(&pWal->hdr.aSalt[1], &salt1, 4);
   walIndexWriteHdr(pWal);
-  pInfo->nBackfill = 0;
+  AtomicStore(&pInfo->nBackfill, 0);
   pInfo->nBackfillAttempted = 0;
   pInfo->aReadMark[1] = 0;
   for(i=2; i<WAL_NREADER; i++) pInfo->aReadMark[i] = READMARK_NOT_USED;
@@ -1996,7 +1996,7 @@ static int walCheckpoint(
           }
         }
         if( rc==SQLITE_OK ){
-          pInfo->nBackfill = mxSafeFrame;
+          AtomicStore(&pInfo->nBackfill, mxSafeFrame);
         }
       }
 
@@ -2619,7 +2619,7 @@ static int walTryBeginRead(Wal *pWal, int *pChanged, int useWal, int cnt){
   assert( pWal->nWiData>0 );
   assert( pWal->apWiData[0]!=0 );
   pInfo = walCkptInfo(pWal);
-  if( !useWal && pInfo->nBackfill==pWal->hdr.mxFrame
+  if( !useWal && AtomicLoad(&pInfo->nBackfill)==pWal->hdr.mxFrame
 #ifdef SQLITE_ENABLE_SNAPSHOT
    && (pWal->pSnapshot==0 || pWal->hdr.mxFrame==0)
 #endif
@@ -2786,7 +2786,7 @@ int sqlite3WalSnapshotRecover(Wal *pWal){
         rc = SQLITE_NOMEM;
       }else{
         u32 i = pInfo->nBackfillAttempted;
-        for(i=pInfo->nBackfillAttempted; i>pInfo->nBackfill; i--){
+        for(i=pInfo->nBackfillAttempted; i>AtomicLoad(&pInfo->nBackfill); i--){
           WalHashLoc sLoc;          /* Hash table location */
           u32 pgno;                 /* Page number in db file */
           i64 iDbOff;               /* Offset of db file entry */