pg_standby -l might destory the archived file

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: pg_standby -l might destory the archived file
Date: 2009-06-01 05:47:36
Message-ID: 3f0b79eb0905312247u3cc3db16hdd20e6b36b86ac71@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

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 is copying the content
of the symlink (ie. the archived file itself) and deleting it instead
of renaming it at the end of recovery.

Thought?

--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Sam Mason 2009-06-01 09:19:36 Re: Patch: AdjustIntervalForTypmod shouldn't discard high-order data
Previous Message Bruce Momjian 2009-06-01 04:14:50 Re: Win32 link() function