Re: crash-safe visibility map, take four

高增琦 <pgf00a@gmail.com>

From: 高增琦 <pgf00a@gmail.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>, Simon Riggs <simon@2ndquadrant.com>, Jesper Krogh <jesper@krogh.cc>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2011-03-31T08:46:10Z
Lists: pgsql-hackers
2011/3/30 Robert Haas <robertmhaas@gmail.com>

> Maybe we could check PD_ALL_VISIBLE before
> taking the buffer lock - if it appears to be set, then we pin the
> visibility map page before taking the buffer lock.  Otherwise, we take
> the buffer lock at once.  Either way, once we have the lock, we
> recheck the bit.  Only if it's set and we haven't got a pin do we need
> to do the drop-lock-pin-reacquire-lock dance.  Is that at all
> sensible?
>

But only lock can make sure the page has enough free space.
If we try the drop-lock-...-lock dance, we may fall into a dead loop.

-- 
GaoZengqi
pgf00a@gmail.com
zengqigao@gmail.com