Magnus Hagander wrote:
>On Mon, Aug 5, 2013 at 10:03 PM, Noah Misch <noah(at)leadboat(dot)com>
>> On Thu, Aug 01, 2013 at 01:04:42PM -0400, Andrew Dunstan wrote:
>>> On 08/01/2013 12:15 PM, Noah Misch wrote:
>>>> 1. Include in the base backup a file listing symbolic links/junction
>>>> then have archive recovery recreate them.  This file would be managed
like the
>>>> backup label file; exclusive backups would actually write it to the
>>>> data directory, and non-exclusive backups would incorporate it on the
>>>> pg_basebackup could also omit the actual links from its backup.
 Nearly any
>>>> tar or file copy utility would then suffice.
>>> I like #1, it seems nice and workable.
>> Agreed.  I'll lean in that direction for resolving the proximate problem.


I had implemented the above feature which will help to
restore symlinks during archive recovery.

Implementation details:
1. This feature is implemented only for tar format in windows
as native windows utilites are not able to create symlinks while
extracting files from tar (It might be possible to create symlinks
if cygwin is installed on your system, however I feel we need this
feature to work for native windows as well).  Another reason to not
create it for non-tar (plain) format is that plain format can update the
symlinks via -T option and backing up symlink file during that
operation can lead to spurious symlinks after archive recovery.

2. Symlink file format:
<oid> <linkpath>
16387 E:\PostgreSQL\tbs

Symlink file will contain entries for all the tablspaces
under pg_tblspc directory.  I have kept the file name as
symlink_label (suggestion are welcome if you want some
different name for this file).

3. While taking  exclusive backup, write the symlink file
in master data directory similar to backup_label file.

4. Non-exclusive backups include the symlink file in archive.

5. Archive recovery will create symlinks if symlink_label file
is present and contain information about symlinks, it will rename
the file symlink_label.old after its done with the usage of file.

6. Cancel backup will rename the file symlink_label to
symlink_label.old to avoid server trying to create symlinks
during archive recovery.


With Regards,
Amit Kapila.

Attachment: extend_basebackup_to_include_symlink_v1.patch
Description: Binary data

Sent via pgsql-hackers mailing list (
To make changes to your subscription:

Reply via email to