Re: Why does VACUUM FULL bother locking pages?

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Why does VACUUM FULL bother locking pages?
Date: 2005-09-22 14:36:41
Message-ID: 20050922143641.GA30584@surnet.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Sep 16, 2005 at 11:50:21PM -0700, Simon Riggs wrote:
> > Alvaro Herrera wrote
> > The only caller of both is
> > repair_frag, whose only caller in turn is full_vacuum_rel.
>
> ...bgwriter still needs to access blocks. The WAL system relies on the
> locking behaviour for recoverability, see comments in LockBuffer() and
> SyncOneBuffer().

Oh, certainly! In this case, may I point out that scan_heap() does not
bother locking pages, mentioning that "we assume that holding exclusive
lock on the relation will keep other backends from looking at the page".
In particular, it calls PageRepairFragmentation which runs with the page
unlocked AFAICT.

Seems like a bug to me.

--
Alvaro Herrera http://www.amazon.com/gp/registry/CTMLCN8V17R4
"Now I have my system running, not a byte was off the shelf;
It rarely breaks and when it does I fix the code myself.
It's stable, clean and elegant, and lightning fast as well,
And it doesn't cost a nickel, so Bill Gates can go to hell."

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-09-22 14:40:20 Re: feature proposal ...
Previous Message Greg Stark 2005-09-22 13:15:23 Re: feature proposal ...