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

From Alvaro Herrera
Subject _bt_delitems: change before WAL?
Date
Msg-id 20080711170649.GE4110@alvh.no-ip.org
Whole thread Raw
Responses Re: _bt_delitems: change before WAL?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hi,

It's often said that the golden rule of WAL is that we must log the
changes before actually doing the changes.  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?

I see that we're holding the "super exclusive" lock on the page, but
does this promise that the bgwriter won't write the page early?  Another
thing that I notice is that the buffer is not marked dirty until much
later in btbulkdelete.  But what if the buffer was dirty beforehand?

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


pgsql-hackers by date:

Previous
From: "Jaime Casanova"
Date:
Subject: Re: Extending grant insert on tables to sequences
Next
From: Alvaro Herrera
Date:
Subject: Re: 8.1 index corruption woes