aboutsummaryrefslogtreecommitdiff
path: root/src/pcache.c
diff options
context:
space:
mode:
authordan <dan@noemail.net>2016-04-05 21:07:58 +0000
committerdan <dan@noemail.net>2016-04-05 21:07:58 +0000
commit41113b6429967b290386c05a4cbf6b9efc632b7a (patch)
tree2c3650962598e2f182ebe7849a88fd583e5c8334 /src/pcache.c
parented06a131dac1433711cf8c26fc38269c1ee7125b (diff)
downloadsqlite-41113b6429967b290386c05a4cbf6b9efc632b7a.tar.gz
sqlite-41113b6429967b290386c05a4cbf6b9efc632b7a.zip
Defer opening the file used for the temp database (where CREATE TEMP TABLE tables are stored) until the database is too large to reside entirely within the cache. There are likely still problems on this branch.
FossilOrigin-Name: be5a549eba6cf8e29cb6b9824fd6d0db9d03ca7f
Diffstat (limited to 'src/pcache.c')
-rw-r--r--src/pcache.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/pcache.c b/src/pcache.c
index 61e758742..52661c28a 100644
--- a/src/pcache.c
+++ b/src/pcache.c
@@ -254,7 +254,7 @@ sqlite3_pcache_page *sqlite3PcacheFetch(
/*
** If the sqlite3PcacheFetch() routine is unable to allocate a new
-** page because new clean pages are available for reuse and the cache
+** page because no clean pages are available for reuse and the cache
** size limit has been reached, then this routine can be invoked to
** try harder to allocate a page. This routine might invoke the stress
** callback to spill dirty pages to the journal. It will then try to
@@ -440,6 +440,17 @@ void sqlite3PcacheCleanAll(PCache *pCache){
}
/*
+** Clear the PGHDR_NEED_SYNC and PGHDR_WRITEABLE flag from all dirty pages.
+*/
+void sqlite3PcacheClearWritable(PCache *pCache){
+ PgHdr *p;
+ for(p=pCache->pDirty; p; p=p->pDirtyNext){
+ p->flags &= ~(PGHDR_NEED_SYNC|PGHDR_WRITEABLE);
+ }
+ pCache->pSynced = pCache->pDirtyTail;
+}
+
+/*
** Clear the PGHDR_NEED_SYNC flag from all dirty pages.
*/
void sqlite3PcacheClearSyncFlags(PCache *pCache){
@@ -484,7 +495,7 @@ void sqlite3PcacheTruncate(PCache *pCache, Pgno pgno){
** it must be that pgno==0.
*/
assert( p->pgno>0 );
- if( ALWAYS(p->pgno>pgno) ){
+ if( p->pgno>pgno ){
assert( p->flags&PGHDR_DIRTY );
sqlite3PcacheMakeClean(p);
}