Re: pg_basebackup vs. Windows and tablespaces - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: pg_basebackup vs. Windows and tablespaces
Date
Msg-id CAA4eK1KujN04Tr0OrotjemSUDOnYjKvcQRXQ5u6EC-+-MKsLCA@mail.gmail.com
Whole thread Raw
In response to pg_basebackup vs. Windows and tablespaces  (Noah Misch <noah@leadboat.com>)
Responses Re: pg_basebackup vs. Windows and tablespaces  (Dilip kumar <dilip.kumar@huawei.com>)
Re: pg_basebackup vs. Windows and tablespaces  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
 Magnus Hagander wrote:
>On Mon, Aug 5, 2013 at 10:03 PM, Noah Misch <noah(at)leadboat(dot)com> wrote:
>> 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 points,
>>>> then have archive recovery recreate them.  This file would be managed like the
>>>> backup label file; exclusive backups would actually write it to the master
>>>> data directory, and non-exclusive backups would incorporate it on the fly.
>>>> 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.

>+1.

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.

Feedback?

With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
Attachment

pgsql-hackers by date:

Previous
From: "MauMau"
Date:
Subject: Re: [bug fix] pg_ctl always uses the same event source
Next
From: Magnus Hagander
Date:
Subject: Re: [bug fix] pg_ctl always uses the same event source