Re: Race condition between hot standby and restoring a FPW - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Race condition between hot standby and restoring a FPW
Date
Msg-id 3601.1415805633@sss.pgh.pa.us
Whole thread Raw
In response to Re: Race condition between hot standby and restoring a FPW  (Heikki Linnakangas <hlinnakangas@vmware.com>)
Responses Re: Race condition between hot standby and restoring a FPW  (Heikki Linnakangas <hlinnakangas@vmware.com>)
List pgsql-hackers
Heikki Linnakangas <hlinnakangas@vmware.com> writes:
> On 11/12/2014 04:56 PM, Tom Lane wrote:
>> Not great either.  What about an RBM_NOERROR mode that is like RBM_ZERO
>> in terms of handling error conditions, but does not forcibly zero the page
>> if it's already valid?

> Anyway, you don't want to read the page from disk, just to check if it's 
> already valid.

Oh, good point.

> (Note that when the page is already in the buffer-cache, RBM_ZERO 
> already doesn't zero the page. So this race condition only happens when 
> the page isn't in the buffer cache yet).

Right.

On reconsideration I think the "RBM_ZERO returns page already locked"
alternative may be the less ugly.  That has the advantage that any code
that doesn't get updated will fail clearly and reliably.  With the other
thing, you need some additional back channel for the caller to know
whether it must complete the I/O, and it's not obvious what will happen
if it fails to do that (except that it will be bad).
        regards, tom lane



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: [REVIEW] Re: Compression of full-page-writes
Next
From: Heikki Linnakangas
Date:
Subject: Re: Race condition between hot standby and restoring a FPW