]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Reduce divergence of wal2 from trunk.
authordrh <>
Mon, 16 Dec 2024 17:46:21 +0000 (17:46 +0000)
committerdrh <>
Mon, 16 Dec 2024 17:46:21 +0000 (17:46 +0000)
FossilOrigin-Name: 90d744d67446a270f7547910531e76593dee82ce537e75c11af0d94eca8404cf

manifest
manifest.uuid
src/vdbe.c
src/wal.c

index 2a87516bc5d39d048dac2b4b961e6acf726bb13d..38c7fc1be555a3a3447b4811c2bc1f07dc7caf25 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Sync\swith\strunk.
-D 2024-12-16T13:32:27.273
+C Reduce\sdivergence\sof\swal2\sfrom\strunk.
+D 2024-12-16T17:46:21.982
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d
@@ -848,7 +848,7 @@ F src/upsert.c 215328c3f91623c520ec8672c44323553f12caeb4f01b1090ebdca99fdf7b4f1
 F src/utf.c 8b29d9a5956569ea2700f869669b8ef67a9662ee5e724ff77ab3c387e27094ba
 F src/util.c e5f6a5eeaa26b69054a43bbd0048cfe3d2851f6961052b35aed8f695df922850
 F src/vacuum.c b763b6457bd058d2072ef9364832351fd8d11e8abf70cbb349657360f7d55c40
-F src/vdbe.c f14ac99e5ff68a244d3eeac2081ff5201105f4b3d97099177da0d65924e304c1
+F src/vdbe.c b2d91fce8b2d357b69d3c4aa9d9175736132a1db52baa091ee8cc54f0926120a
 F src/vdbe.h 9676348d342bd04e21e384c63b57224171ce84fac77853357334ef94c4d33cf4
 F src/vdbeInt.h bf294a0c8fc4cc80779e74b04b8bd82c6e1197b3137cefe0b16cdf002fc7dfd6
 F src/vdbeapi.c 38c252a202d70b56cfb734460bc888ddbd581afec1a10cd4d6c894c9e0b5baea
@@ -860,7 +860,7 @@ F src/vdbetrace.c fe0bc29ebd4e02c8bc5c1945f1d2e6be5927ec12c06d89b03ef2a4def34bf8
 F src/vdbevtab.c fc46b9cbd759dc013f0b3724549cc0d71379183c667df3a5988f7e2f1bd485f3
 F src/vtab.c 316cd48e9320660db3047cd306cd056e4361180cebb4d0f10a39244e10c11422
 F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
-F src/wal.c 2ec54ef10bb354fc61424c4b65f407e795abe07059001d0d1c5f99be5bb8b7bf
+F src/wal.c f5588f5e2d04afcf49add28b866cc76e4af2e2d8d2531486ac98f502bf8ca93c
 F src/wal.h 97b8a9903387401377b59507e86b93a148ef1ad4e5ce0f23659a12dcdce56af2
 F src/walker.c d5006d6b005e4ea7302ad390957a8d41ed83faa177e412f89bc5600a7462a014
 F src/where.c 9ad3dea8003a8913da6a4ca8322e2fe30773f46e88a0d4fbf9db13bdb999efa2
@@ -2216,8 +2216,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350
 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 3619baa19e8e7617a7c5918073a826af1cc4d5dc9e9f27b4e4187e988b534d7f 4fab85b3d0d1cad2d185f2456de7ddf281badf8561cc051e10e16655441dcc84
-R b4df0a1efe11f3e544155b403f6ca5be
+P eab619453abf6979962a68d298c44553ef0d9eb18112e61420d4de8a9c16f620
+R 80e0eedebdef6156cabc3ad9fa1485f5
 U drh
-Z a3ec2e08a3dfb16a51c5778333a7d435
+Z d17a5f7761993d7328d68cbb53bd5978
 # Remove this line to create a well-formed Fossil manifest.
index 31d69dde163770a5466cd0a19889cee6bf999c64..0dad6e95c87518d8ae7bf59ed73596f009597872 100644 (file)
@@ -1 +1 @@
-eab619453abf6979962a68d298c44553ef0d9eb18112e61420d4de8a9c16f620
+90d744d67446a270f7547910531e76593dee82ce537e75c11af0d94eca8404cf
index 71a68fb4c1bf1728f2c53f405b9077ba64947484..0590f2a61b8aaca05d449ab8cf7f28cf5f9a6041 100644 (file)
@@ -7959,34 +7959,34 @@ case OP_JournalMode: {    /* out2 */
           (eNew==PAGER_JOURNALMODE_WAL ? "into" : "out of")
       );
       goto abort_due_to_error;
-    }
+    }else{
+
+      if( isWalMode(eOld) ){
+        /* If leaving WAL mode, close the log file. If successful, the call
+        ** to PagerCloseWal() checkpoints and deletes the write-ahead-log
+        ** file. An EXCLUSIVE lock may still be held on the database file
+        ** after a successful return.
+        */
+        rc = sqlite3PagerCloseWal(pPager, db);
+        if( rc==SQLITE_OK ){
+          sqlite3PagerSetJournalMode(pPager, eNew);
+        }
+      }else if( eOld==PAGER_JOURNALMODE_MEMORY ){
+        /* Cannot transition directly from MEMORY to WAL.  Use mode OFF
+        ** as an intermediate */
+        sqlite3PagerSetJournalMode(pPager, PAGER_JOURNALMODE_OFF);
+      }
  
-    if( isWalMode(eOld) ){
-      /* If leaving WAL mode, close the log file. If successful, the call
-      ** to PagerCloseWal() checkpoints and deletes the write-ahead-log 
-      ** file. An EXCLUSIVE lock may still be held on the database file 
-      ** after a successful return. 
+      /* Open a transaction on the database file. Regardless of the journal
+      ** mode, this transaction always uses a rollback journal.
       */
-      rc = sqlite3PagerCloseWal(pPager, db);
+      assert( sqlite3BtreeTxnState(pBt)!=SQLITE_TXN_WRITE );
       if( rc==SQLITE_OK ){
-        sqlite3PagerSetJournalMode(pPager, eNew);
+        /* 1==rollback, 2==wal, 3==wal2 */
+        rc = sqlite3BtreeSetVersion(pBt, 
+            1 + isWalMode(eNew) + (eNew==PAGER_JOURNALMODE_WAL2)
+        );
       }
-    }else if( eOld==PAGER_JOURNALMODE_MEMORY ){
-      /* Cannot transition directly from MEMORY to WAL.  Use mode OFF
-      ** as an intermediate */
-      sqlite3PagerSetJournalMode(pPager, PAGER_JOURNALMODE_OFF);
-    }
-
-    /* Open a transaction on the database file. Regardless of the journal
-    ** mode, this transaction always uses a rollback journal.
-    */
-    assert( sqlite3BtreeTxnState(pBt)!=SQLITE_TXN_WRITE );
-    if( rc==SQLITE_OK ){
-      /* 1==rollback, 2==wal, 3==wal2 */
-      rc = sqlite3BtreeSetVersion(pBt, 
-          1 + isWalMode(eNew) + (eNew==PAGER_JOURNALMODE_WAL2)
-      );
-
     }
   }
 #endif /* ifndef SQLITE_OMIT_WAL */
index ddb0b9dd6213e986c240375d5b97bd17e12c786d..87344947e487ea2ea2cedff9d44b8b59e8114ef2 100644 (file)
--- a/src/wal.c
+++ b/src/wal.c
@@ -882,7 +882,6 @@ struct WalIterator {
     sizeof(ht_slot)*HASHTABLE_NSLOT + HASHTABLE_NPAGE*sizeof(u32) \
 )
 
-
 /*
 ** Structured Exception Handling (SEH) is a Windows-specific technique
 ** for catching exceptions raised while accessing memory-mapped files.
@@ -989,6 +988,7 @@ static void sehInjectFault(Wal *pWal){
 # define SEH_SET_ON_ERROR(X,Y)
 #endif /* ifdef SQLITE_USE_SEH */
 
+
 /*
 ** Obtain a pointer to the iPage'th page of the wal-index. The wal-index
 ** is broken into pages of WALINDEX_PGSZ bytes. Wal-index pages are
@@ -4128,7 +4128,6 @@ int sqlite3WalBeginReadTransaction(Wal *pWal, int *pChanged){
   return rc;
 }
 
-
 /*
 ** Finish with a read transaction.  All this does is release the
 ** read-lock.
@@ -4438,14 +4437,13 @@ int sqlite3WalBeginWriteTransaction(Wal *pWal){
     if( memcmp(&pWal->hdr, (void *)walIndexHdr(pWal), sizeof(WalIndexHdr))!=0 ){
       rc = SQLITE_BUSY_SNAPSHOT;
     }
-  } 
+  }
   SEH_EXCEPT( rc = SQLITE_IOERR_IN_PAGE; )
 
   if( rc!=SQLITE_OK ){
     walUnlockExclusive(pWal, WAL_WRITE_LOCK, 1);
     pWal->writeLock = 0;
   }
-
   return rc;
 }
 
@@ -5072,7 +5070,6 @@ static int walFrames(
   return rc;
 }
 
-
 /* 
 ** Write a set of frames to the log. The caller must hold the write-lock
 ** on the log file (obtained using sqlite3WalBeginWriteTransaction()).
@@ -5198,7 +5195,7 @@ int sqlite3WalCheckpoint(
       }else{
         rc = walCheckpoint(pWal, db, eMode2, xBusy2, pBusyArg, sync_flags,zBuf);
       }
-  
+
       /* If no error occurred, set the output variables. */
       if( rc==SQLITE_OK || rc==SQLITE_BUSY ){
         if( pnLog ){
@@ -5292,7 +5289,6 @@ int sqlite3WalCallback(Wal *pWal){
 */
 int sqlite3WalExclusiveMode(Wal *pWal, int op){
   int rc;
-
   assert( pWal->writeLock==0 );
   assert( pWal->exclusiveMode!=WAL_HEAPMEMORY_MODE || op==-1 );
 
@@ -5355,7 +5351,7 @@ int sqlite3WalSnapshotGet(Wal *pWal, sqlite3_snapshot **ppSnapshot){
 
   assert( pWal->readLock>=0 && pWal->writeLock==0 );
 
-  if( memcmp(&pWal->hdr.aFrameCksum[0],aZero,8)==0 ){
+  if( memcmp(&pWal->hdr.aFrameCksum[0],aZero,16)==0 ){
     *ppSnapshot = 0;
     return SQLITE_ERROR;
   }
@@ -5438,7 +5434,7 @@ int sqlite3WalSnapshotCheck(Wal *pWal, sqlite3_snapshot *pSnapshot){
       }
     }
   }
-  SEH_EXCEPT( rc = walHandleException(pWal) );
+  SEH_EXCEPT( rc = walHandleException(pWal); )
   return rc;
 }