Re: Inadequate thought about buffer locking during hot standby replay - Mailing list pgsql-hackers

From Daniel Farina
Subject Re: Inadequate thought about buffer locking during hot standby replay
Date
Msg-id CAAZKuFZUSEOVUumMut9Ejeo07yTk0Dna+PV0vnd_3ut9XZDThg@mail.gmail.com
Whole thread Raw
In response to Inadequate thought about buffer locking during hot standby replay  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Fri, Nov 9, 2012 at 3:24 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> During normal running, operations such as btree page splits are
> extremely careful about the order in which they acquire and release
> buffer locks, if they're doing something that concurrently modifies
> multiple pages.
>
> During WAL replay, that all goes out the window.  Even if an individual
> WAL-record replay function does things in the right order for "standard"
> cases, RestoreBkpBlocks has no idea what it's doing.  So if one or more
> of the referenced pages gets treated as a full-page image, we are left
> with no guarantee whatsoever about what order the pages are restored in.
> That never mattered when the code was originally designed, but it sure
> matters during Hot Standby when other queries might be able to see the
> intermediate states.
>
> I can't prove that this is the cause of bug #7648,

(I was the reporter of 7648)

To lend slightly more circumstantial evidence in support of this, I
also happened to note that the relfile in question was the last
segment and it was about a quarter full, so the access attempt was
definitely at the extreme outermost edge of the index most generally.

--
fdr



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Inadequate thought about buffer locking during hot standby replay
Next
From: Jeff Janes
Date:
Subject: Re: Further pg_upgrade analysis for many tables