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