Re: _bt_delitems: change before WAL? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: _bt_delitems: change before WAL?
Date
Msg-id 19137.1215804693@sss.pgh.pa.us
Whole thread Raw
In response to _bt_delitems: change before WAL?  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-hackers
Alvaro Herrera <alvherre@commandprompt.com> writes:
> It's often said that the golden rule of WAL is that we must log the
> changes before actually doing the changes.

No, the golden rule is that the log entry must hit disk before the
data-page changes do.  This does not speak to the order in which you
make the changes in memory.

> However it seems to me that
> in _bt_delitems we're modifying the page (calling PageIndexMultiDelete)
> before actually logging what's going to happen.  Why is this OK?

Because we have write lock on the buffer, which will prevent anyone else
from writing it out (or even looking at it).  This is exactly like all the
other WAL-logging actions; see the WAL coding rules in access/transam/README.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: 8.1 index corruption woes
Next
From: Zdenek Kotala
Date:
Subject: Re: PATCH: CITEXT 2.0 v3