Re: pg_basebackup vs. Windows and tablespaces

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Magnus Hagander <magnus(at)hagander(dot)net>, Noah Misch <noah(at)leadboat(dot)com>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_basebackup vs. Windows and tablespaces
Date: 2014-07-15 13:59:07
Message-ID: CAA4eK1KujN04Tr0OrotjemSUDOnYjKvcQRXQ5u6EC-+-MKsLCA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
extend_basebackup_to_include_symlink_v1.patch application/octet-stream 29.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message MauMau 2014-07-15 14:01:51 Re: [bug fix] pg_ctl always uses the same event source
Previous Message Magnus Hagander 2014-07-15 13:45:54 Re: Audit of logout