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

bufmgr code question

From: Neil Conway <neilc(at)samurai(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: bufmgr code question
Date: 2003-11-04 05:36:56
Message-ID: 1067924216.13534.58.camel@tokyo (view raw or flat)
Thread:
Lists: pgsql-hackers
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?

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)

-Neil



Responses

pgsql-hackers by date

Next:From: Peter EisentrautDate: 2003-11-04 09:10:49
Subject: Re: 7.4RC1 tag'd, branched and bundled ...
Previous:From: Neil ConwayDate: 2003-11-04 04:49:24
Subject: Re: equal() perf tweak

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