Re: pg_standby -l might destory the archived file

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Aidan Van Dyk <aidan(at)highrise(dot)ca>
Subject: Re: pg_standby -l might destory the archived file
Date: 2009-06-02 06:40:02
Message-ID: 4A24C942.2090708@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Fujii Masao wrote:
> On Tue, Jun 2, 2009 at 10:21 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Fujii Masao <masao(dot)fujii(at)gmail(dot)com> writes:
>>> Yes, the old xlog itself is not used again. But, the *old file* might
>>> be recycled and used later. The case that I'm looking at is that the
>>> symlink to a temporary area is recycled. Am I missing something?
>> Actually, I think the right fix for that would be to add defenses to
>> xlog.c to not try to "recycle" a file that is a symlink.
>
> OK, I tweaked Aidan's patch. Thanks Aidan!
> http://archives.postgresql.org/message-id/20090601152736.GL15213@yugib.highrise.ca
>
> Changes are:
> - use lstat instead of stat
> - add #if HAVE_WORKING_LINK and #endif code

Committed. I left out the "#ifdef HAVE_WORKING_LINK" and used S_ISREG()
instead of S_ISLNK. We use lstat + S_ISREG elsewhere too, so there
should be no portability issues.

I backpatched to 8.3, since that's when pg_standby was added. Arguably
earlier versions should've been changed too, as pg_standby works with
earlier versions, but I decided to not rock the boat as this only
affects the pg_standby -l mode.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Marko Kreen 2009-06-02 06:43:29 Re: PostgreSQL Developer meeting minutes up
Previous Message Kris Jurka 2009-06-02 05:09:49 Re: It's June 1; do you know where your release is?