]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Remove an unnecessary call to sqlite3PcacheMakeClean() inside of the ROLLBACK
authordrh <drh@noemail.net>
Thu, 12 May 2016 12:01:20 +0000 (12:01 +0000)
committerdrh <drh@noemail.net>
Thu, 12 May 2016 12:01:20 +0000 (12:01 +0000)
logic.

FossilOrigin-Name: 0dc50d9915cd88916229ca5c3834de82fa16f017

manifest
manifest.uuid
src/pager.c
src/pcache.c

index 796ba4e54878245b242b8b6e9ca6a34f5fcb546d..eff6cd9a5e8d12e6ce8dbb17ad01a03bdbd7f270 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\sa\smissing\sOPTIMIZATION-IF-FALSE\scomment\sto\spcache.c.
-D 2016-05-12T09:48:23.099
+C Remove\san\sunnecessary\scall\sto\ssqlite3PcacheMakeClean()\sinside\sof\sthe\sROLLBACK\nlogic.
+D 2016-05-12T12:01:20.280
 F Makefile.in 9eda6e1c90d05c199c3ec8a7069b0682ad307657
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 F Makefile.msc db82b35aef27f412fef14d8534afc022138bcdfd
@@ -364,10 +364,10 @@ F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa
 F src/os_unix.c a9443cdab41d7f3cdf0df3a5aab62fd6e1c9b234
 F src/os_win.c 852fc2ff6084296348ed3739c548b2cf32df394e
 F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca
-F src/pager.c cb7a3990eabd895f6487c0856a7fec02b5e40faa
+F src/pager.c b7f9341d1c8917d0050f11597c588d0b4e379df9
 F src/pager.h 329bdf078a4e0a3b35084534d58625d21fd03681
 F src/parse.y 10eb2f3fb62341291528c7984498054731f9d31e
-F src/pcache.c 481e549dec06c01e8db84f80af835b3386a83bb0
+F src/pcache.c 0e8453c2aaa8a72e09c58edeb0f0976dc652e827
 F src/pcache.h 6b865be765d1ebd06145219550b10921c7da7cc9
 F src/pcache1.c 7f51d2b541aab57596adf62db2c4bb025d34f04d
 F src/pragma.c faf42922bb7ab2f6672cb550356c1967abae3c84
@@ -1488,7 +1488,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 3bfd2621d13b4f842f3af6d35519653f4eb8cad7
-R 1f5b4032d8f04ae7caac9d7a76ea1776
-U dan
-Z c8fcd1a1ab31e8e9159bebaf1a63834b
+P bc202e5b418d5a57bfc766883c4417c94829d96e
+R 94f384a80fd36cfa7eab53c97f52730e
+U drh
+Z 3db2648b2bf79fa343d087598efa8f84
index 5372f9c927e6cffead36b448a080248049d40d4f..e0fbea1e69795731540a5f45b739ddaec11d0c27 100644 (file)
@@ -1 +1 @@
-bc202e5b418d5a57bfc766883c4417c94829d96e
\ No newline at end of file
+0dc50d9915cd88916229ca5c3834de82fa16f017
\ No newline at end of file
index d2dd639892f22bcf6303168447c41c20d27891c2..654cc640d3b4850d0d9969ea7f1deaa2d2847919 100644 (file)
@@ -2387,33 +2387,10 @@ static int pager_playback_one_page(
     pData = pPg->pData;
     memcpy(pData, (u8*)aData, pPager->pageSize);
     pPager->xReiniter(pPg);
-    if( isMainJrnl && (!isSavepnt || *pOffset<=pPager->journalHdr) ){
-      /* If the contents of this page were just restored from the main 
-      ** journal file, then its content must be as they were when the 
-      ** transaction was first opened. In this case we can mark the page
-      ** as clean, since there will be no need to write it out to the
-      ** database.
-      **
-      ** There is one exception to this rule. If the page is being rolled
-      ** back as part of a savepoint (or statement) rollback from an 
-      ** unsynced portion of the main journal file, then it is not safe
-      ** to mark the page as clean. This is because marking the page as
-      ** clean will clear the PGHDR_NEED_SYNC flag. Since the page is
-      ** already in the journal file (recorded in Pager.pInJournal) and
-      ** the PGHDR_NEED_SYNC flag is cleared, if the page is written to
-      ** again within this transaction, it will be marked as dirty but
-      ** the PGHDR_NEED_SYNC flag will not be set. It could then potentially
-      ** be written out into the database file before its journal file
-      ** segment is synced. If a crash occurs during or following this,
-      ** database corruption may ensue.
-      **
-      ** Update: Another exception is for temp files that are not 
-      ** in-memory databases. In this case the page may have been dirty
-      ** at the start of the transaction.
-      */
-      assert( !pagerUseWal(pPager) );
-      if( pPager->tempFile==0 ) sqlite3PcacheMakeClean(pPg);
-    }
+    /* It used to be that sqlite3PcacheMakeClean(pPg) was called here.  But
+    ** that call was dangerous and had no detectable benefit since the cache
+    ** is normally cleaned by sqlite3PcacheCleanAll() after rollback and so
+    ** has been removed. */
     pager_set_pagehash(pPg);
 
     /* If this was page 1, then restore the value of Pager.dbFileVers.
index 8634a7918894a7f5c01612a61ba6a728a930c1df..fab6ad32a2e620c71afd01cd15977f26fb1885e0 100644 (file)
@@ -470,7 +470,7 @@ void sqlite3PcacheMakeDirty(PgHdr *p){
 ** make it so.
 */
 void sqlite3PcacheMakeClean(PgHdr *p){
-  if( (p->flags & PGHDR_DIRTY) ){
+  if( ALWAYS((p->flags & PGHDR_DIRTY)!=0) ){
     assert( (p->flags & PGHDR_CLEAN)==0 );
     pcacheManageDirtyList(p, PCACHE_DIRTYLIST_REMOVE);
     p->flags &= ~(PGHDR_DIRTY|PGHDR_NEED_SYNC|PGHDR_WRITEABLE);