_bt_delitems: change before WAL?

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: _bt_delitems: change before WAL?
Date: 2008-07-11 17:06:49
Message-ID: 20080711170649.GE4110@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2008-07-11 18:02:23 Re: 8.1 index corruption woes
Previous Message Jaime Casanova 2008-07-11 16:57:37 Re: Extending grant insert on tables to sequences