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

Re: Hot Backup with rsync fails at pg_clog if under load

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Florian Pflug <fgp(at)phlo(dot)org>
Cc: Daniel Farina <daniel(at)heroku(dot)com>, Chris Redekop <chris(at)replicon(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Hot Backup with rsync fails at pg_clog if under load
Date: 2011-10-25 09:13:14
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
On Tue, Oct 25, 2011 at 8:03 AM, Simon Riggs <simon(at)2ndquadrant(dot)com> wrote:

> We are starting recovery at the right place but we are initialising
> the clog and subtrans incorrectly. Precisely, the oldestActiveXid is
> being derived later than it should be, which can cause problems if
> this then means that whole pages are unitialised in subtrans. The bug
> only shows up if you do enough transactions (2048 is always enough) to
> move to the next subtrans page between the redo pointer and the
> checkpoint record while at the same time we do not have a long running
> transaction that spans those two points. That's just enough to happen
> reasonably frequently on busy systems and yet just enough to have
> slipped through testing.
> We must either
> 1. During CreateCheckpoint() we should derive oldestActiveXid before
> we derive the redo location
> 2. Change the way subtrans pages are initialized during recovery so we
> don't rely on oldestActiveXid
> I need to think some more before a decision on this in my own mind,
> but I lean towards doing (1) as a longer term fix and doing (2) as a
> short term fix for existing releases. I expect to have a fix later
> today.

(1) looks the best way forwards in all cases.

Patch attached. Will be backpatched to 9.0

I think it is possible to avoid taking XidGenLock during
GetRunningTransactions() now, but I haven't included that change in
this patch.

Any other comments before commit?

 Simon Riggs         
 PostgreSQL Development, 24x7 Support, Training & Services

Attachment: oldestActiveXid_fixed.v1.patch
Description: application/octet-stream (4.9 KB)

In response to


pgsql-hackers by date

Next:From: Magnus HaganderDate: 2011-10-25 10:15:21
Subject: Re: pgsql_fdw, FDW for PostgreSQL server
Previous:From: Shigeru HanadaDate: 2011-10-25 09:11:00
Subject: pgsql_fdw, FDW for PostgreSQL server

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