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

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com>
Cc: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, 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: 2014-02-08 01:10:22
Message-ID: 52F583FE.6060306@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 1/29/14, 7:37 PM, Haribabu Kommi wrote:
>
> On Tue, Jan 28, 2014 at 1:17 PM, Peter Eisentraut wrote:
>
> On 11/30/13, 6:59 AM, Haribabu kommi wrote:
> > To detect provided data and xlog directories are same or not, I
> reused the
> > Existing make_absolute_path() code as follows.
>
> I note that initdb does not detect whether the data and xlog directories
> are the same. I think there is no point in addressing this only in
> pg_basebackup. If we want to forbid it, it should be done in initdb
> foremost.
>
> Thanks for pointing it. if the following approach is fine for
> identifying the identical directories
> then I will do the same for initdb also.

I wouldn't bother. It's a lot of work for little benefit. Any mistake
a user would make can easily be fixed.

> I'm not sure it's worth the trouble, but if I were to do it, I'd just
> stat() the two directories and compare their inodes. That seems much
> easier and more robust than comparing path strings
>
> stat() is having problems in windows, because of that reason the patch is
> written to identify the directories with string comparison.

If stat() is having problems on Windows, then those problems would need
to be addressed.

I don't think a string comparison is going to be reliable. It can
easily be tricked by using multiple slashes for example, or various
kinds of links or bind mounts. You'd need to put in an awful lot of
work, and it still wouldn't work all the time.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2014-02-08 01:35:03 Re: [PATCH] Relocation of tablespaces in pg_basebackup
Previous Message Peter Eisentraut 2014-02-08 01:03:24 commit fest 2014-01 week 3 report