1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Remove an unnecessary call to sqlite3PcacheMakeClean() inside of the ROLLBACK

logic.

FossilOrigin-Name: 0dc50d9915cd88916229ca5c3834de82fa16f017
This commit is contained in:
drh
2016-05-12 12:01:20 +00:00
parent 613723d9fd
commit 42bee5f4d6
4 changed files with 14 additions and 37 deletions

View File

@@ -1,5 +1,5 @@
C Add\sa\smissing\sOPTIMIZATION-IF-FALSE\scomment\sto\spcache.c. C Remove\san\sunnecessary\scall\sto\ssqlite3PcacheMakeClean()\sinside\sof\sthe\sROLLBACK\nlogic.
D 2016-05-12T09:48:23.099 D 2016-05-12T12:01:20.280
F Makefile.in 9eda6e1c90d05c199c3ec8a7069b0682ad307657 F Makefile.in 9eda6e1c90d05c199c3ec8a7069b0682ad307657
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc db82b35aef27f412fef14d8534afc022138bcdfd F Makefile.msc db82b35aef27f412fef14d8534afc022138bcdfd
@@ -364,10 +364,10 @@ F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa
F src/os_unix.c a9443cdab41d7f3cdf0df3a5aab62fd6e1c9b234 F src/os_unix.c a9443cdab41d7f3cdf0df3a5aab62fd6e1c9b234
F src/os_win.c 852fc2ff6084296348ed3739c548b2cf32df394e F src/os_win.c 852fc2ff6084296348ed3739c548b2cf32df394e
F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca
F src/pager.c cb7a3990eabd895f6487c0856a7fec02b5e40faa F src/pager.c b7f9341d1c8917d0050f11597c588d0b4e379df9
F src/pager.h 329bdf078a4e0a3b35084534d58625d21fd03681 F src/pager.h 329bdf078a4e0a3b35084534d58625d21fd03681
F src/parse.y 10eb2f3fb62341291528c7984498054731f9d31e F src/parse.y 10eb2f3fb62341291528c7984498054731f9d31e
F src/pcache.c 481e549dec06c01e8db84f80af835b3386a83bb0 F src/pcache.c 0e8453c2aaa8a72e09c58edeb0f0976dc652e827
F src/pcache.h 6b865be765d1ebd06145219550b10921c7da7cc9 F src/pcache.h 6b865be765d1ebd06145219550b10921c7da7cc9
F src/pcache1.c 7f51d2b541aab57596adf62db2c4bb025d34f04d F src/pcache1.c 7f51d2b541aab57596adf62db2c4bb025d34f04d
F src/pragma.c faf42922bb7ab2f6672cb550356c1967abae3c84 F src/pragma.c faf42922bb7ab2f6672cb550356c1967abae3c84
@@ -1488,7 +1488,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 3bfd2621d13b4f842f3af6d35519653f4eb8cad7 P bc202e5b418d5a57bfc766883c4417c94829d96e
R 1f5b4032d8f04ae7caac9d7a76ea1776 R 94f384a80fd36cfa7eab53c97f52730e
U dan U drh
Z c8fcd1a1ab31e8e9159bebaf1a63834b Z 3db2648b2bf79fa343d087598efa8f84

View File

@@ -1 +1 @@
bc202e5b418d5a57bfc766883c4417c94829d96e 0dc50d9915cd88916229ca5c3834de82fa16f017

View File

@@ -2387,33 +2387,10 @@ static int pager_playback_one_page(
pData = pPg->pData; pData = pPg->pData;
memcpy(pData, (u8*)aData, pPager->pageSize); memcpy(pData, (u8*)aData, pPager->pageSize);
pPager->xReiniter(pPg); pPager->xReiniter(pPg);
if( isMainJrnl && (!isSavepnt || *pOffset<=pPager->journalHdr) ){ /* It used to be that sqlite3PcacheMakeClean(pPg) was called here. But
/* If the contents of this page were just restored from the main ** that call was dangerous and had no detectable benefit since the cache
** journal file, then its content must be as they were when the ** is normally cleaned by sqlite3PcacheCleanAll() after rollback and so
** transaction was first opened. In this case we can mark the page ** has been removed. */
** 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);
}
pager_set_pagehash(pPg); pager_set_pagehash(pPg);
/* If this was page 1, then restore the value of Pager.dbFileVers. /* If this was page 1, then restore the value of Pager.dbFileVers.

View File

@@ -470,7 +470,7 @@ void sqlite3PcacheMakeDirty(PgHdr *p){
** make it so. ** make it so.
*/ */
void sqlite3PcacheMakeClean(PgHdr *p){ void sqlite3PcacheMakeClean(PgHdr *p){
if( (p->flags & PGHDR_DIRTY) ){ if( ALWAYS((p->flags & PGHDR_DIRTY)!=0) ){
assert( (p->flags & PGHDR_CLEAN)==0 ); assert( (p->flags & PGHDR_CLEAN)==0 );
pcacheManageDirtyList(p, PCACHE_DIRTYLIST_REMOVE); pcacheManageDirtyList(p, PCACHE_DIRTYLIST_REMOVE);
p->flags &= ~(PGHDR_DIRTY|PGHDR_NEED_SYNC|PGHDR_WRITEABLE); p->flags &= ~(PGHDR_DIRTY|PGHDR_NEED_SYNC|PGHDR_WRITEABLE);