Re: New option for pg_basebackup, to specify a different directory for pg_xlog

From: Haribabu kommi <haribabu(dot)kommi(at)huawei(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: New option for pg_basebackup, to specify a different directory for pg_xlog
Date: 2013-11-30 11:59:37
Message-ID: 8977CB36860C5843884E0A18D8747B0372BF0D61@szxeml558-mbs.china.huawei.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 27 November 2013 10:35 Fujii Masao wrote:
> On Wed, Nov 27, 2013 at 1:27 PM, Haribabu kommi
> <haribabu(dot)kommi(at)huawei(dot)com> wrote:
> > On 26 November 2013 23:11 Fujii Masao wrote:
> >> On Wed, Nov 20, 2013 at 7:43 PM, Haribabu kommi
> >> <haribabu(dot)kommi(at)huawei(dot)com> wrote:
> >> > I tried using of stat'ing in two directories, which is having a
> >> problem in windows.
> >> > So modified old approach to detect limited errors. Updated patch
> >> attached.
> >> > This will detect and throw an error in the following scenarios.
> >> > 1. pg_basebackup -D /home/data --xlogdir=/home/data 2.
> >> > pg_basebackup -D data --xlogdir=/home/data -- home is the CWD 3.
> >> > pg_basebackup -D ../data --xlogdir=/data -- home is the CWD
> >> >
> >> > Please let me know your suggestions.
> >>
> >> Checking only #1 and #2 cases looks sufficient to at least me. If
> >> we do that, we can refactor the patch so that it reuses
> >> make_absolute_path() instead of adding new functions, as pointed
in
> >> upthread. Anyway, what about committing the core patch (Updated
> >> version of core patch attached) first? Then, we can discuss the
> check logic more.
> >
> > Yes it is fine. The core patch attached in the mail is working fine.
>
> Okay. Committed!

To detect provided data and xlog directories are same or not, I reused the
Existing make_absolute_path() code as follows.

1. Moved the make_absolute_path() function from miscinit.c to path.c and
Changed all error reporting functions. And also it returns NULL incase of
any error.

2. Added a new file called fe_path.c which contains make_absolute_path()
only for frontend code.

The patches are attached in the mail for both approaches, please review and let
Me know your suggestions.

On top those patches, the error detection logic is added in pg_basebackup and the
Same is attached in the mail.

Regards,
Hari babu.

Attachment Content-Type Size
same_dir_error_v1.patch application/octet-stream 1.8 KB
frontend_make_abs_path_v1.patch application/octet-stream 3.9 KB
make_abs_path_v1.patch application/octet-stream 7.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2013-11-30 13:08:05 Re: Hstore: Query speedups with Gin index
Previous Message Atri Sharma 2013-11-30 09:40:07 Re: palloc0