mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-12 13:01:09 +03:00
On commit, flush dirty temp-file pages only if the file is already open and 25% or more of the cache is dirty.
FossilOrigin-Name: f6babf2920340f25815c0a3c58de1e902c2f5542
This commit is contained in:
11
src/pcache.c
11
src/pcache.c
@@ -686,6 +686,17 @@ void sqlite3PcacheShrink(PCache *pCache){
|
||||
*/
|
||||
int sqlite3HeaderSizePcache(void){ return ROUND8(sizeof(PgHdr)); }
|
||||
|
||||
/*
|
||||
** Return the number of dirty pages currently in the cache, as a percentage
|
||||
** of the configured cache size.
|
||||
*/
|
||||
int sqlite3PCachePercentDirty(PCache *pCache){
|
||||
PgHdr *pDirty;
|
||||
int nDirty = 0;
|
||||
int nCache = numberOfCachePages(pCache);
|
||||
for(pDirty=pCache->pDirty; pDirty; pDirty=pDirty->pDirtyNext) nDirty++;
|
||||
return (int)(((i64)nDirty * 100) / nCache);
|
||||
}
|
||||
|
||||
#if defined(SQLITE_CHECK_PAGES) || defined(SQLITE_DEBUG)
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user