Re: pg_standby -l might destory the archived file

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_standby -l might destory the archived file
Date: 2009-06-04 09:01:28
Message-ID: 1244106088.23910.159.camel@ebony.2ndQuadrant
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On Tue, 2009-06-02 at 19:43 +0300, Heikki Linnakangas wrote:
> Simon Riggs wrote:
> > On Mon, 2009-06-01 at 14:47 +0900, Fujii Masao wrote:
> >
> >> pg_standby can use ln command to restore an archived file,
> >> which might destroy the archived file as follows.
> >>
> >> 1) pg_standby creates the symlink to the archived file '102'
> >> 2) '102' is applied
> >> 3) the next file '103' doesn't exist and the trigger file is created
> >> 4) '102' is re-fetched
> >> 5) at the end of recovery, the symlink to '102' is rename to '202',
> >> but it still points '102'
> >> 6) after recovery, '202' is recycled (rename to '208', which still
> >> points '102')
> >> 7) '208' is written new xlog records over
> >> --> the archived file '102' comes down!
> >>
> >> One simple solution to fix this problem...
> >
> > err...I don't see *any* problem at all, since pg_standby does not do
> > step (1) in the way you say and therefore never does step (5). Any links
> > created are explicitly deleted in all cases at the end of recovery.
>
> I don't know how you came to that conclusion, but Fujii-sans description
> seems accurate to me, and I can reproduce the behavior on my laptop.

I accept there is a bug, though the initial description did not appear
to reflect the way the code works.

Thank you for not making further changes while we wait to discuss.

--
Simon Riggs www.2ndQuadrant.com
PostgreSQL Training, Services and Support

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Markus Wanner 2009-06-04 09:07:34 Re: PostgreSQL Developer meeting minutes up
Previous Message Simon Riggs 2009-06-04 08:53:05 Re: pg_standby -l might destory the archived file