1
0
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:
dan
2016-04-13 16:52:11 +00:00
parent 199f56b984
commit 0f52455a35
5 changed files with 46 additions and 10 deletions

View File

@@ -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)
/*