For in-memory databases, it does not matter if pcache entries are marked
"clean" or "writable".

FossilOrigin-Name: ad601c7962a60a11699cf31f1faee09b95d5c710
diff --git a/manifest b/manifest
index 6c5a26e..5293168 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Remove\sa\sredundant\scondition\sfrom\spcache.c.\sAdd\san\sOPTIMIZATION-IF-TRUE\scomment\sto\sanother\scondition\sthat\srequires\sit.
-D 2016-05-11T20:03:23.145
+C For\sin-memory\sdatabases,\sit\sdoes\snot\smatter\sif\spcache\sentries\sare\smarked\n"clean"\sor\s"writable".
+D 2016-05-11T23:54:14.261
 F Makefile.in 9eda6e1c90d05c199c3ec8a7069b0682ad307657
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 F Makefile.msc db82b35aef27f412fef14d8534afc022138bcdfd
@@ -364,11 +364,11 @@
 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 76fe5ad6998772a6abda30145c181e99e7743a1d
 F src/pager.h 329bdf078a4e0a3b35084534d58625d21fd03681
 F src/parse.y 10eb2f3fb62341291528c7984498054731f9d31e
-F src/pcache.c 95ee5008eddda9c61b8d053de8eebf72cf5df7c6
-F src/pcache.h 6b865be765d1ebd06145219550b10921c7da7cc9
+F src/pcache.c 132a78c71bd510fde0085bfc44608bc64b945d48
+F src/pcache.h 33b40350df1b6c278e019dee37f87e1bac276223
 F src/pcache1.c 7f51d2b541aab57596adf62db2c4bb025d34f04d
 F src/pragma.c faf42922bb7ab2f6672cb550356c1967abae3c84
 F src/pragma.h 64c78a648751b9f4f297276c4eb7507b14b4628c
@@ -1488,7 +1488,10 @@
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 9cc8cad78fdfe044ad6726ebfe6909c1e242fa55
-R bd613f88cc94ba593741d724ce8bf946
-U dan
-Z ba94a14dc94ea0c9562dd2071f1152d6
+P 3bfd2621d13b4f842f3af6d35519653f4eb8cad7
+R 399bfb6002bea3bb0fdfe001a40139f7
+T *branch * pager-dev
+T *sym-pager-dev *
+T -sym-trunk *
+U drh
+Z 75fe10a9420951c23350bd3808039177
diff --git a/manifest.uuid b/manifest.uuid
index 034ae63..3e5a24e 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-3bfd2621d13b4f842f3af6d35519653f4eb8cad7
\ No newline at end of file
+ad601c7962a60a11699cf31f1faee09b95d5c710
\ No newline at end of file
diff --git a/src/pager.c b/src/pager.c
index d2dd639..3f33fae 100644
--- a/src/pager.c
+++ b/src/pager.c
@@ -2033,7 +2033,7 @@
   pPager->pInJournal = 0;
   pPager->nRec = 0;
   if( rc==SQLITE_OK ){
-    if( MEMDB || pagerFlushOnCommit(pPager) ){
+    if( pagerFlushOnCommit(pPager) ){
       sqlite3PcacheCleanAll(pPager->pPCache);
     }else{
       sqlite3PcacheClearWritable(pPager->pPCache);
diff --git a/src/pcache.c b/src/pcache.c
index 4051bee..f30b60e 100644
--- a/src/pcache.c
+++ b/src/pcache.c
@@ -14,7 +14,13 @@
 #include "sqliteInt.h"
 
 /*
-** A complete page cache is an instance of this structure.
+** A complete page cache is an instance of this structure.  Every
+** entry in the cache holds a single page of the database file.  The
+** btree layer only operates on the cached copy of the database pages.
+**
+** A page cache entry is "clean" if it exactly matches what is currently
+** on disk.  A page is "dirty" if it has been modified and needs to be
+** persisted to disk.
 **
 ** pDirty, pDirtyTail, pSynced:
 **   All dirty pages are linked into the doubly linked list using
diff --git a/src/pcache.h b/src/pcache.h
index 04bce28..8e0f12e 100644
--- a/src/pcache.h
+++ b/src/pcache.h
@@ -26,7 +26,7 @@
   sqlite3_pcache_page *pPage;    /* Pcache object page handle */
   void *pData;                   /* Page data */
   void *pExtra;                  /* Extra content */
-  PgHdr *pDirty;                 /* Transient list of dirty pages */
+  PgHdr *pDirty;                 /* Transient list of dirty sorted by pgno */
   Pager *pPager;                 /* The pager this page is part of */
   Pgno pgno;                     /* Page number for this page */
 #ifdef SQLITE_CHECK_PAGES