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-20 10:43:37 |
Message-ID: | 8977CB36860C5843884E0A18D8747B0372BEECC6@szxeml558-mbs.china.huawei.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 19 November 2013 19:12 Fujii Masao wrote:
> On Tue, Nov 19, 2013 at 9:14 PM, Haribabu kommi
> <haribabu(dot)kommi(at)huawei(dot)com> wrote:
> > On 18 November 2013 23:30 Fujii Masao wrote:
> >> On Tue, Nov 19, 2013 at 12:01 AM, Haribabu kommi
> >> <haribabu(dot)kommi(at)huawei(dot)com> wrote:
> >>
> >> Thanks for newer version of the patch!
> >>
> >> I found that the empty base directory is created and remains even
> >> when the same directory is specified in both -D and --xlogdir and
> the
> >> error occurs.
> >> I think that it's
> >> better to throw an error in that case before creating any new
> directory.
> >> Thought?
> >
> > By creating the base directory only the patch finds whether provided
> > base and Xlog directories are same or not? To solve this problem
> > following options are possible
> >
> > 1. No problem as it is just an empty base directory, so it can be
> reused in the next time
> > Leave it as it is.
> > 2. Once the error is identified, the base directory can be deleted.
> > 3. write a new function to remove the parent references from the
> provided path to identify
> > the absolute path used for detecting base and Xlog directories are
> same or not?
> >
> > Please provide your suggestions.
> >
> >> + xlogdir = get_absolute_path(xlog_dir);
> >>
> >> xlog_dir must be an absolute path. ISTM we don't do the above. No?
> >
> > It is required. As user can provide the path as
> /home/installation/bin/../bin/data.
> > The provided path is considered as absolute path only but while
> > comparing the same With data directory path it will not match.
>
> Okay, maybe I understand you. In order to know the real absolute path,
> basically we need to create the directory specified in --xlogdir,
> change the working directory to it and calculate the parent path.
> You're worried about the cases as follows, for example.
> Right?
>
> * path containing ".." like /aaa/bbb/../ccc is specified in --xlogdir
> * symbolic link is specified in --xlogdir
>
> On the second thought, I'm thinking that it might be overkill to add
> such not simple code for that small benefit.
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.
Regards,
Hari babu.
Attachment | Content-Type | Size |
---|---|---|
UserSpecifiedxlogDir_v6.patch | application/octet-stream | 7.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Heikki Linnakangas | 2013-11-20 10:48:50 | Re: Data corruption issues using streaming replication on 9.0.14/9.2.5/9.3.1 |
Previous Message | Michael Paquier | 2013-11-20 10:10:05 | Re: VACUUM for TOASTed objects |