Re: [COMMITTERS] pgsql: Introduce WAL records to log reuse of btree pages, allowing

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [COMMITTERS] pgsql: Introduce WAL records to log reuse of btree pages, allowing
Date: 2010-03-19 11:07:07
Message-ID: 1268996827.3556.33.camel@ebony
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Thu, 2010-02-18 at 14:23 +0200, Heikki Linnakangas wrote:
> Simon Riggs wrote:
> > Introduce WAL records to log reuse of btree pages, allowing conflict
> > resolution during Hot Standby. Page reuse interlock requested by Tom.
> > Analysis and patch by me.
>
> There's still a theoretical possibility for this to happen:
>
> 1. A page is marked as deleted by VACUUM, setting xact field in the opaque
> 2. Master crashes. WAL replay replays the XLOG_BTREE_DELETE_PAGE record.
> It resets the xact field to FrozenTransactionId
> 3. The page is recycled. This writes a XLOG_BTREE_REUSE_PAGE record with
> FrozenTransactionId as latestRemovedXid
>
> When the standby replays that, it will call
> ResolveRecoveryConflictWithSnapshot with FrozenTransactionid, not the
> original xid that was used in the master when the page was deleted.
>
> A straightforward way to fix that is to WAL-log the real xid in the
> XLOG_BTREE_DELETE_PAGE records, instead of resetting it to
> FrozenTransactionId.

Bug accepted, proposal implemented and committed.

--
Simon Riggs www.2ndQuadrant.com

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Heikki Linnakangas 2010-03-19 11:37:08 Re: Re: [COMMITTERS] pgsql: Make standby server continuously retry restoring the next WAL
Previous Message Simon Riggs 2010-03-19 11:05:15 pgsql: Adjust comment in .history file to match recovery target

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2010-03-19 11:16:23 Re: Getting to beta1
Previous Message Simon Riggs 2010-03-19 10:41:22 pgsql: Reset btpo.xact following recovery of btree delete page.