pg_standby -l might destory the archived file - Mailing list pgsql-hackers

From Fujii Masao
Subject pg_standby -l might destory the archived file
Date
Msg-id 3f0b79eb0905312247u3cc3db16hdd20e6b36b86ac71@mail.gmail.com
Whole thread Raw
Responses Re: pg_standby -l might destory the archived file
Re: pg_standby -l might destory the archived file
List 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


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Win32 link() function
Next
From: Sam Mason
Date:
Subject: Re: Patch: AdjustIntervalForTypmod shouldn't discard high-order data