]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fixes for snapshots API on this branch. Also ensure that the snapshots API
authordan <dan@noemail.net>
Wed, 5 Dec 2018 16:31:02 +0000 (16:31 +0000)
committerdan <dan@noemail.net>
Wed, 5 Dec 2018 16:31:02 +0000 (16:31 +0000)
cannot be used with wal2 mode databases (for now anyhow).

FossilOrigin-Name: 19c61ab79458936ff4dfca46cf4d1fb1ab16d7bdb5024f502eb4339ec4eef32c

manifest
manifest.uuid
src/wal.c

index adbd28acea3fb73541c38b346f6b17348b45fe08..5cf7e8b10d7dfa323a8181de53626fab37089918 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Increase\sa\stimeout\sin\stest\sfile\swalprotocol2.test.\sTo\saccount\sfor\sunix\sbuilds\nwithout\sHAVE_USLEEP.
-D 2018-12-03T18:13:46.107
+C Fixes\sfor\ssnapshots\sAPI\son\sthis\sbranch.\sAlso\sensure\sthat\sthe\ssnapshots\sAPI\ncannot\sbe\sused\swith\swal2\smode\sdatabases\s(for\snow\sanyhow).
+D 2018-12-05T16:31:02.698
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F Makefile.in a050c8670ea0d7b37b2192306cbb50d392acd9902b84e9b56f3444d006f97a6c
@@ -589,7 +589,7 @@ F src/vdbesort.c 90aad5a92608f2dd771c96749beabdb562c9d881131a860a7a5bccf66dc3be7
 F src/vdbetrace.c 79d6dbbc479267b255a7de8080eee6e729928a0ef93ed9b0bfa5618875b48392
 F src/vtab.c 70188a745dc4e57d26e942681ff4b2912b7c8249ad5de3f60f0677b4337bcfaa
 F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
-F src/wal.c e5b19ec1ce95882a2ae610d2657b441b079734427757c1a4d069f5f57bb7e9a2
+F src/wal.c 2b9b1bc7eeb819b46b0abe0bf4d9c48a13df0989814bb213da1b480d4b1c8107
 F src/wal.h fc6113057f2950fc14631176b748293e216fb385ea8df665e6d259e37f8f7d21
 F src/walker.c fb94aadc9099ff9c6506d0a8b88d51266005bcaa265403f3d7caf732a562eb66
 F src/where.c 3818e8a736a05d2cb194e64399af707e367fbcc5c251d785804d02eaf121288e
@@ -1782,7 +1782,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 7a44fa5a350a3f19b8e9f5196d22535788885f8c0e849572202bf64a055ddc2d
-R 8dcc78dd7464cc5597695c90813a01e4
+P 480be916c840e9e28010c22cf29a8396502c9e6387f31f750260c6290f58e9a1
+R 869a87f8972d12d94814188a57f87377
 U dan
-Z 7d2b6bedf7bcc33a553c67266fb7675b
+Z 200899075d870fbfb9b7c809d447f2d7
index 2987cabc9a67db16b89b27e783ddc7cfcf727b98..0754a48ec21ee984f424c9557fdb913bcccc22c5 100644 (file)
@@ -1 +1 @@
-480be916c840e9e28010c22cf29a8396502c9e6387f31f750260c6290f58e9a1
\ No newline at end of file
+19c61ab79458936ff4dfca46cf4d1fb1ab16d7bdb5024f502eb4339ec4eef32c
\ No newline at end of file
index 42001bf2d2bd541c70ef886ac272ddd5fe386958..97bb781d79eb9bb0f40c14ce5e9c3a487ba44bb9 100644 (file)
--- a/src/wal.c
+++ b/src/wal.c
@@ -3234,6 +3234,9 @@ static int walTryBeginRead(Wal *pWal, int *pChanged, int useWal, int cnt){
 int sqlite3WalSnapshotRecover(Wal *pWal){
   int rc;
 
+  /* Snapshots may not be used with wal2 mode databases. */
+  if( isWalMode2(pWal) ) return SQLITE_ERROR;
+
   assert( pWal->readLock>=0 );
   rc = walLockExclusive(pWal, WAL_CKPT_LOCK, 1);
   if( rc==SQLITE_OK ){
@@ -3308,6 +3311,7 @@ int sqlite3WalBeginReadTransaction(Wal *pWal, int *pChanged){
 #ifdef SQLITE_ENABLE_SNAPSHOT
   int bChanged = 0;
   WalIndexHdr *pSnapshot = pWal->pSnapshot;
+  if( pSnapshot && isWalMode2(pWal) ) return SQLITE_ERROR;
   if( pSnapshot && memcmp(pSnapshot, &pWal->hdr, sizeof(WalIndexHdr))!=0 ){
     bChanged = 1;
   }
@@ -4534,9 +4538,12 @@ int sqlite3WalSnapshotGet(Wal *pWal, sqlite3_snapshot **ppSnapshot){
   WalIndexHdr *pRet;
   static const u32 aZero[4] = { 0, 0, 0, 0 };
 
+  /* Snapshots may not be used with wal2 mode databases. */
+  if( isWalMode2(pWal) ) return SQLITE_ERROR;
+
   assert( pWal->readLock>=0 && pWal->writeLock==0 );
 
-  if( memcmp(&pWal->hdr.aFrameCksum[0],aZero,16)==0 ){
+  if( memcmp(&pWal->hdr.aFrameCksum[0],aZero,8)==0 ){
     *ppSnapshot = 0;
     return SQLITE_ERROR;
   }
@@ -4587,6 +4594,10 @@ int sqlite3_snapshot_cmp(sqlite3_snapshot *p1, sqlite3_snapshot *p2){
 */
 int sqlite3WalSnapshotCheck(Wal *pWal, sqlite3_snapshot *pSnapshot){
   int rc;
+
+  /* Snapshots may not be used with wal2 mode databases. */
+  if( isWalMode2(pWal) ) return SQLITE_ERROR;
+
   rc = walLockShared(pWal, WAL_CKPT_LOCK);
   if( rc==SQLITE_OK ){
     WalIndexHdr *pNew = (WalIndexHdr*)pSnapshot;