aboutsummaryrefslogtreecommitdiff
path: root/src/backend/storage/buffer/freelist.c
diff options
context:
space:
mode:
authorJan Wieck <JanWieck@Yahoo.com>2003-11-19 15:55:08 +0000
committerJan Wieck <JanWieck@Yahoo.com>2003-11-19 15:55:08 +0000
commitcfeca62148582a05466362f1957572f5a9900ab5 (patch)
tree6a2c5086a40d410ceb8555d8f94b7f5492979283 /src/backend/storage/buffer/freelist.c
parent5032f83082e5bdb37f8dbf02fa00c4886fb6d2ce (diff)
downloadpostgresql-cfeca62148582a05466362f1957572f5a9900ab5.tar.gz
postgresql-cfeca62148582a05466362f1957572f5a9900ab5.zip
Background writer process
This first part of the background writer does no syncing at all. It's only purpose is to keep the LRU heads clean so that regular backends seldom to never have to call write(). Jan
Diffstat (limited to 'src/backend/storage/buffer/freelist.c')
-rw-r--r--src/backend/storage/buffer/freelist.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/backend/storage/buffer/freelist.c b/src/backend/storage/buffer/freelist.c
index 12d67b13424..84bcb1554d1 100644
--- a/src/backend/storage/buffer/freelist.c
+++ b/src/backend/storage/buffer/freelist.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/buffer/freelist.c,v 1.35 2003/11/16 16:41:00 wieck Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/buffer/freelist.c,v 1.36 2003/11/19 15:55:07 wieck Exp $
*
*-------------------------------------------------------------------------
*/
@@ -190,8 +190,28 @@ StrategyBufferLookup(BufferTag *tagPtr, bool recheck)
if (StrategyControl->stat_report + DebugSharedBuffers < now)
{
long all_hit, b1_hit, t1_hit, t2_hit, b2_hit;
+ int id, t1_clean, t2_clean;
ErrorContextCallback *errcxtold;
+ id = StrategyControl->listHead[STRAT_LIST_T1];
+ t1_clean = 0;
+ while (id >= 0)
+ {
+ if (BufferDescriptors[StrategyCDB[id].buf_id].flags & BM_DIRTY)
+ break;
+ t1_clean++;
+ id = StrategyCDB[id].next;
+ }
+ id = StrategyControl->listHead[STRAT_LIST_T2];
+ t2_clean = 0;
+ while (id >= 0)
+ {
+ if (BufferDescriptors[StrategyCDB[id].buf_id].flags & BM_DIRTY)
+ break;
+ t2_clean++;
+ id = StrategyCDB[id].next;
+ }
+
if (StrategyControl->num_lookup == 0)
{
all_hit = b1_hit = t1_hit = t2_hit = b2_hit = 0;
@@ -215,6 +235,8 @@ StrategyBufferLookup(BufferTag *tagPtr, bool recheck)
T1_TARGET, B1_LENGTH, T1_LENGTH, T2_LENGTH, B2_LENGTH);
elog(DEBUG1, "ARC total =%4ld%% B1hit=%4ld%% T1hit=%4ld%% T2hit=%4ld%% B2hit=%4ld%%",
all_hit, b1_hit, t1_hit, t2_hit, b2_hit);
+ elog(DEBUG1, "ARC clean buffers at LRU T1= %5d T2= %5d",
+ t1_clean, t2_clean);
error_context_stack = errcxtold;
StrategyControl->num_lookup = 0;