Re: Block level concurrency during recovery - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Block level concurrency during recovery
Date
Msg-id 26577.1225724844@sss.pgh.pa.us
Whole thread Raw
In response to Re: Block level concurrency during recovery  (Simon Riggs <simon@2ndQuadrant.com>)
Responses Re: Block level concurrency during recovery  (Simon Riggs <simon@2ndQuadrant.com>)
List pgsql-hackers
Simon Riggs <simon@2ndQuadrant.com> writes:
> VACUUM with a btree index proceeds like this:
> 1. Scan table
> 2. Remove rows from btree identified in (1)
> 3. Remove rows from heap identified in (1)

> The purpose of the additional locking requirements during (2) for btrees
> is to ensure that we do not fail to find the rows identified in (1),
> because the rows can move after (1) and during (2) because of block
> splits. 

No, you are missing the point.  One purpose of the additional locking
requirements is to ensure that there is not a concurrent process that
has read a btree index entry just before you removed it but arrives at
the heap page only after you removed the heap entry (and, perhaps,
replaced it with some other row that doesn't match the index entry at
all).  This is clearly still a risk in a hot-standby environment.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: plperl needs upgrade for Fedora 10
Next
From: Tom Lane
Date:
Subject: Re: pre-MED