Re: Torn page hazard in ginRedoUpdateMetapage() - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Torn page hazard in ginRedoUpdateMetapage()
Date
Msg-id CA+TgmoaNS50=8EWD=JMVdtM0s+sHRO7TivQRCKNtW8tE4khGLw@mail.gmail.com
Whole thread Raw
In response to Torn page hazard in ginRedoUpdateMetapage()  (Noah Misch <noah@leadboat.com>)
Responses Re: Torn page hazard in ginRedoUpdateMetapage()  (Heikki Linnakangas <hlinnakangas@vmware.com>)
List pgsql-hackers
On Mon, Apr 30, 2012 at 1:34 PM, Noah Misch <noah@leadboat.com> wrote:
> When GIN changes a metapage, we WAL-log its ex-header content and never use a
> backup block.  This reduces WAL volume since the vast majority of the metapage
> is unused.  However, ginRedoUpdateMetapage() only restores the WAL-logged
> content if the metapage LSN predates the WAL record LSN.  If a metapage write
> tore and updated the LSN but not the other content, we would fail to complete
> the update.  Instead, unconditionally reinitialize the metapage similar to how
> _bt_restore_meta() handles the situation.
>
> I found this problem by code reading and did not attempt to build a test case
> illustrating its practical consequences.  It's possible that there's no
> problem in practice on account of some reason I haven't contemplated.

The attached patch doesn't apply any more, but it looks like this
issue still exists.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Changeset Extraction v7.9.1
Next
From: Stephen Frost
Date:
Subject: Re: extension_control_path