]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Merge version 3.32.0 into the wal2 branch.
authordrh <drh@noemail.net>
Fri, 22 May 2020 18:28:59 +0000 (18:28 +0000)
committerdrh <drh@noemail.net>
Fri, 22 May 2020 18:28:59 +0000 (18:28 +0000)
FossilOrigin-Name: 1cb46a7431797978a37e1c6ed77f6473eb44f13d15cd37267d4f9555ac825f53

1  2 
Makefile.msc
manifest
manifest.uuid
src/wal.c

diff --cc Makefile.msc
Simple merge
diff --cc manifest
index 84440f7bf4e62b81f2c02cabd056a1beac5846b3,e020405f88e44e38d3b2b8e7432f342576eca221..d712daea4bb3ba879739ce0ea7a8813aadc142f0
+++ b/manifest
@@@ -1,11 -1,11 +1,11 @@@
- C Merge\slatest\strunk\schanges\sinto\sthis\sbranch.
- D 2020-05-18T17:18:28.234
 -C Version\s3.32.0
 -D 2020-05-22T17:46:16.912
++C Merge\sversion\s3.32.0\sinto\sthe\swal2\sbranch.
++D 2020-05-22T18:28:59.454
  F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
  F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
  F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
 -F Makefile.in 376f53999defeb32b7ad2626fd58aae8f3694c38ab7ee30c2289e0d0525a9238
 +F Makefile.in 24e217b2b738eab3c0ad8832a04ebad94d56539d764f1021607252ae9af5bd2f
  F Makefile.linux-gcc f609543700659711fbd230eced1f01353117621dccae7b9fb70daa64236c5241
- F Makefile.msc 493e20799ae7571ff51cad0c3d6d03dec4f363da2d81ce78551f60ffb1b5c76b
 -F Makefile.msc 8d00aeba2609bb498dded5eead2890126321f02e292573bf29bf2d18487d37bd
++F Makefile.msc b5415749c997c5a0852c47ea103dc4c060c8052c92f97006c5fec210733eff73
  F README.md 1514a365ffca3c138e00c5cc839906108a01011a6b082bad19b09781e3aa498a
  F VERSION 980d78a2ce04a1fd0ebefbaabd665f7f9186563820629ee29c6e350e96f19b52
  F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50
@@@ -520,10 -518,10 +520,10 @@@ F src/os.h 48388821692e87da174ea198bf96
  F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85
  F src/os_setup.h 0dbaea40a7d36bf311613d31342e0b99e2536586
  F src/os_unix.c 13f983da988b6460ef3c4c22099c67ab0938291e543644ac4d99eccc8ba604f1
- F src/os_win.c 317718e8f04c449e7d9e1eacac0d14e7508e4a77c9d4c3cb7382299bd24561b7
+ F src/os_win.c e832e21e830c1f9409c9c54053939b6dcb14c1e92128b756204ce1e3e331d678
  F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
 -F src/pager.c 96436cb1920074d4ade120a1a8a9d0ae3f52df06651e21b7eccc5eae2f02b111
 -F src/pager.h 8d1dc9a2c3fc5eb6eeed75f48a076f425e77706f8935f05817fa05a308f587b5
 +F src/pager.c 5683689017800028c2f06602b1283474daf49b0848bfbcca03e109e269a28472
 +F src/pager.h 57058a96dc235ffdbd36a6b23400573a1c39a34a3b3c43a4acc41ee3830ad61c
  F src/parse.y c8eff38606f443d5ba245263fa7abc05e4116d95656e050c4b78e9bfbf931add
  F src/pcache.c 385ff064bca69789d199a98e2169445dc16e4291fa807babd61d4890c3b34177
  F src/pcache.h 4f87acd914cef5016fae3030343540d75f5b85a1877eed1a2a19b9f284248586
@@@ -604,10 -602,10 +604,10 @@@ F src/treeview.c 82c6391a3ba76215d4185f
  F src/trigger.c 4ada1037cc99777f647a882cdacbd1a4deb6567b69daf02946286401b88cdc04
  F src/update.c 3199098455830fc2d8c8fc4ae3ec2ea513eef64339ae9a7048db62b21169bc7a
  F src/upsert.c 2920de71b20f04fe25eb00b655d086f0ba60ea133c59d7fa3325c49838818e78
- F src/utf.c 95fb6e03a5ca679045c5adccd05380f0addccabef5911abddcb06af069500ab7
+ F src/utf.c d7a61c1dfdac3eb091d43341a674032dca5a34e122f78ef0b5bd2d5a31967dde
  F src/util.c 3b6cedf7a0c69bd6e1acce832873952d416212d6293b18d03064e07d7a9b5118
  F src/vacuum.c de9780b89fa4ee74c3534f60b94820e3179aca759ffc1338ee53cb4ea7693dd3
 -F src/vdbe.c e3dba0dee25bc92e871c13cac655260912b3be4abcc85b439259c9934b208da3
 +F src/vdbe.c d8a95ca518c10963198938e26c15b8e646840e1d538866ace82e9b1c8b4205af
  F src/vdbe.h 07b8c636a87df8b6e58f29d6badd7f10d5844353deff1d7c88ed1c2bfe3bbd35
  F src/vdbeInt.h 571413068b5ac07e2ed8ca7a02fa529622fd5455ae6981498376e5e492d2e5ef
  F src/vdbeapi.c e467b75a710ea099f8d2d022abf601d2ccd05e28f63b44b12d93000b6a75f4a8
@@@ -619,8 -617,8 +619,8 @@@ F src/vdbetrace.c fa3bf238002f0bbbdfb66
  F src/vdbevtab.c ee5b4c902fdda2230f9503ac7b84c6d614c91e8f6f4dc1633e2e8dfef8ffb144
  F src/vtab.c 7b452592ed2ee95dedb1f323d557cebede5a6f3b4558b21a5dca527e6ae9b12c
  F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
- F src/wal.c a12866b518cb4362445601d837e17c1c28cef5e7b95ecd3a352a4d031849a4c8
 -F src/wal.c 17ea0a319d3ead17ef3b16aa30f10f2626056893effea7e609a20a6661ffec1b
 -F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a
++F src/wal.c 942cf950d76a7d38304106055e5e27d77b37cc76f81b602ea09a4d67f6f45ade
 +F src/wal.h d01234e828943e002040c22a7e017642962f9fd9b2dc142fa599769ae4e459e9
  F src/walker.c 7c429c694abd12413a5c17aec9f47cfe9eba6807e6b0a32df883e8e3a14835ed
  F src/where.c 9546c82056e8cdb27291f98cf1adca5d271240b399bb97b32f77fc2bea6146c9
  F src/whereInt.h 6b874aa15f94e43a2cec1080be64d955b04deeafeac90ffb5d6975c0d511be3c
@@@ -1878,7 -1866,10 +1878,7 @@@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a9
  F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
  F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
  F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
- P 6fb870625cb7007fe5055609da35f6af87f3b375b7a43fd4e842d40dfef9169f 69e149f76853d196c8855fedfc98848b60fb116ac36bc08824b1a122469f8ece
- R c2ab80ad5e65c7322c33833a421871e0
- U dan
- Z 2201cfa00c678efbefa3c7153a345e7b
 -P ce36b6d1331edba5a921fef32553e2470a79bdb1f62d2cfd81190691c83d5b06
 -R b5a877f3e2a7ab538bc565ffd2aae787
 -T +bgcolor * #d0c0ff
 -T +sym-release *
 -T +sym-version-3.32.0 *
++P 16b1eca922d6e10a0ebce1deb559c6c7dd74f8655e3456bad8384c6f4637e6d6 5998789c9c744bce92e4cff7636bba800a75574243d6977e1fc8281e360f8d5a
++R 32296d1150198735579e4176a9dcfa34
+ U drh
 -Z 4af13806b6e302c99aeddae94a54c013
++Z fe31575cc7d5638205afb058dad1ad1c
diff --cc manifest.uuid
index 9389bdff6846428071e400f965357a75804df007,d9fa627cdb4979bcbebeb688032243bb1d9ee61d..391724f9e328c36a49c18770975766fe9a9d4db2
@@@ -1,1 -1,1 +1,1 @@@
- 16b1eca922d6e10a0ebce1deb559c6c7dd74f8655e3456bad8384c6f4637e6d6
 -5998789c9c744bce92e4cff7636bba800a75574243d6977e1fc8281e360f8d5a
++1cb46a7431797978a37e1c6ed77f6473eb44f13d15cd37267d4f9555ac825f53
diff --cc src/wal.c
index 5d451131ab415021648459302be354b0a35feee2,63dee8233040e483c5a4685662e7994132939ade..f4cf443e551928cc152bbce4bba4d23578e9f536
+++ b/src/wal.c
@@@ -967,8 -723,9 +984,9 @@@ static SQLITE_NO_TSAN void walIndexWrit
  
    assert( pWal->writeLock );
    pWal->hdr.isInit = 1;
 -  pWal->hdr.iVersion = WALINDEX_MAX_VERSION;
 +  assert( pWal->hdr.iVersion==WAL_VERSION1||pWal->hdr.iVersion==WAL_VERSION2 );
    walChecksumBytes(1, (u8*)&pWal->hdr, nCksum, 0, pWal->hdr.aCksum);
+   /* Possible TSAN false-positive.  See tag-20200519-1 */
    memcpy((void*)&aHdr[1], (const void*)&pWal->hdr, sizeof(WalIndexHdr));
    walShmBarrier(pWal);
    memcpy((void*)&aHdr[0], (const void*)&pWal->hdr, sizeof(WalIndexHdr));
@@@ -2464,48 -1907,27 +2482,29 @@@ static int walCheckpoint
      ** in the SQLITE_CHECKPOINT_PASSIVE mode. */
      assert( eMode!=SQLITE_CHECKPOINT_PASSIVE || xBusy==0 );
  
 -    /* Compute in mxSafeFrame the index of the last frame of the WAL that is
 -    ** safe to write into the database.  Frames beyond mxSafeFrame might
 -    ** overwrite database pages that are in use by active readers and thus
 -    ** cannot be backfilled from the WAL.
 +    /* If this is a wal system (not wal2), compute in mxSafeFrame the index 
 +    ** of the last frame of the WAL that is safe to write into the database.
 +    ** Frames beyond mxSafeFrame might overwrite database pages that are in 
 +    ** use by active readers and thus cannot be backfilled from the WAL.
      */
 -    mxSafeFrame = pWal->hdr.mxFrame;
 -    mxPage = pWal->hdr.nPage;
 -    for(i=1; i<WAL_NREADER; i++){
 -      u32 y = AtomicLoad(pInfo->aReadMark+i);
 -      if( mxSafeFrame>y ){
 -        assert( y<=pWal->hdr.mxFrame );
 -        rc = walBusyLock(pWal, xBusy, pBusyArg, WAL_READ_LOCK(i), 1);
 -        if( rc==SQLITE_OK ){
 -          u32 iMark = (i==1 ? mxSafeFrame : READMARK_NOT_USED);
 -          AtomicStore(pInfo->aReadMark+i, iMark);
 -          walUnlockExclusive(pWal, WAL_READ_LOCK(i), 1);
 -        }else if( rc==SQLITE_BUSY ){
 -          mxSafeFrame = y;
 -          xBusy = 0;
 -        }else{
 -          goto walcheckpoint_out;
 +    if( bWal2==0 ){
 +      mxSafeFrame = pWal->hdr.mxFrame;
 +      mxPage = pWal->hdr.nPage;
 +      for(i=1; i<WAL_NREADER; i++){
-         /* Thread-sanitizer reports that the following is an unsafe read,
-         ** as some other thread may be in the process of updating the value
-         ** of the aReadMark[] slot. The assumption here is that if that is
-         ** happening, the other client may only be increasing the value,
-         ** 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.
-         **
-         ** 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];
++        u32 y = AtomicLoad(pInfo->aReadMark+i);
 +        if( mxSafeFrame>y ){
 +          assert( y<=pWal->hdr.mxFrame );
 +          rc = walBusyLock(pWal, xBusy, pBusyArg, WAL_READ_LOCK(i), 1);
 +          if( rc==SQLITE_OK ){
-             pInfo->aReadMark[i] = (i==1 ? mxSafeFrame : READMARK_NOT_USED);
++            u32 iMark = (i==1 ? mxSafeFrame : READMARK_NOT_USED);
++            AtomicStore(pInfo->aReadMark+i, iMark);
 +            walUnlockExclusive(pWal, WAL_READ_LOCK(i), 1);
 +          }else if( rc==SQLITE_BUSY ){
 +            mxSafeFrame = y;
 +            xBusy = 0;
 +          }else{
 +            goto walcheckpoint_out;
 +          }
          }
        }
      }