Skip site navigation (1) Skip section navigation (2)

Torn page hazard in ginRedoUpdateMetapage()

From: Noah Misch <noah(at)leadboat(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Torn page hazard in ginRedoUpdateMetapage()
Date: 2012-04-30 17:34:24
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
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.



pgsql-hackers by date

Next:From: Bruce MomjianDate: 2012-04-30 17:38:52
Subject: Re: Future In-Core Replication
Previous:From: Noah MischDate: 2012-04-30 17:12:42
Subject: Re: Analyzing foreign tables & memory problems

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group