Skip site navigation (1) Skip section navigation (2)

Re: bufmgr code question

From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: bufmgr code question
Date: 2003-11-04 14:35:50
Message-ID: 3FA7B946.6010107@Yahoo.com (view raw or flat)
Thread:
Lists: pgsql-hackers
Neil Conway wrote:
> In the BufferDesc struct, there seem to be two ways to mark a buffer
> page as dirty: setting the BM_DIRTY bit mask in the 'flags' field of the
> struct, and setting the 'cntxDirty' field to true. What is the
> difference between these two indications of a page's dirtiness?

I don't see any either ... could that be some artefact?

> 
> Or, more to the point, is there a reason we have two ways to do what
> looks like the same thing?
> 
> BTW, I'd like to remove the behavior that LockBuffer(buf, EXCLUSIVE)
> automatically marks the page as dirty. Since there are some situations
> in which we acquire an exclusive buffer lock but don't actually end up
> modifying the page, this results in dirtying more buffers than are
> necessary. I think it's also good practise for code that modifies a
> buffer to explicitly mark it as dirty, rather than depending upon
> LockBuffer() to do it. Does this sound reasonable, provided I find and
> catch all the places that depend upon this behavior? (i.e. and change
> them to explicitly mark the buffer as dirty)

Does make sense to me. "Provided you find and catch all" sounds like an 
"as early as possible in the 7.5 devel cycle" change to me, no?

It also looks to me that we are actually modifying the same sourcecode. 
We should try to avoid conflicting patches.


On 10/31 you wrote:
> I'd rather see us implement a buffer replacement policy that considers
> both frequency + recency (unlike LRU, which considers only recency).
> Ideally, that would work "automagically". I'm hoping to get a chance to
> implement ARC[1] during the 7.5 cycle.

I just posted another fix to my experimental ARC implementation to 
hackers. From the above I assume you're familiar with the algorithm. 
Could you please take a look at the "v2" diff and tell me if there's 
something fundamentally wrong?


Jan

-- 
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck(at)Yahoo(dot)com #


In response to

pgsql-hackers by date

Next:From: John IrelandDate: 2003-11-04 15:06:09
Subject: Re: pg_clog woes with 7.3.2 - Episode 2
Previous:From: Jan WieckDate: 2003-11-04 14:27:33
Subject: Re: 7.4RC1 tag'd, branched and bundled ...

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group