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: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, "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-16 05:18:43
Message-ID: 8977CB36860C5843884E0A18D8747B0372BDBCBE@szxeml558-mbs.china.huawei.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 15 November 2013 17:26 Magnus Hagander wrote:
On Fri, Nov 15, 2013 at 12:10 PM, Haribabu kommi <haribabu(dot)kommi(at)huawei(dot)com<mailto:haribabu(dot)kommi(at)huawei(dot)com>> wrote:
On 14 November 2013 23:59 Fujii Masao wrote:
> On Thu, Nov 14, 2013 at 9:08 PM, Haribabu kommi
> <haribabu(dot)kommi(at)huawei(dot)com<mailto:haribabu(dot)kommi(at)huawei(dot)com>> wrote:
> > Please find attached the patch, for adding a new option for
> > pg_basebackup, to specify a different directory for pg_xlog.
>
> Sounds good! Here are the review comments:
>
> + printf(_(" --xlogdir=XLOGDIR location for the
> transaction log directory\n"));
>
> This message is not aligned well.
Fixed.

> - if (!streamwal || strcmp(filename +
> strlen(filename) - 8, "/pg_xlog") != 0)
> + if ((!streamwal && (strcmp(xlog_dir, "") == 0))
> + || strcmp(filename + strlen(filename) -
> 8, "/pg_xlog") != 0)
>
> You need to update the source code comment.
Corrected the source code comment. Please check once.

> +#ifdef HAVE_SYMLINK
> + if (symlink(xlog_dir, linkloc) != 0)
> + {
> + fprintf(stderr, _("%s: could not create symbolic link
> \"%s\": %s\n"),
> + progname, linkloc, strerror(errno));
> + exit(1);
> + }
> +#else
> + fprintf(stderr, _("%s: symlinks are not supported on this
> platform "
> + "cannot use xlogdir"));
> + exit(1);
> +#endif
> + }
>
> Is it better to call pg_free() at the end? Even if we don't do that, it
> would be almost harmless, though.
Added pg_free to free up the linkloc.

> Don't we need to prevent users from specifying the same directory in
> both --pgdata and --xlogdir?
I feel no need to prevent, even if user specifies both --pgdata and --xlogdir as same directory
all the transaction log files will be created in the base directory instead of pg_xlog directory.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Haribabu kommi 2013-11-16 05:27:46 Re: New option for pg_basebackup, to specify a different directory for pg_xlog
Previous Message Amit Kapila 2013-11-16 04:12:40 Re: ALTER SYSTEM SET command to change postgresql.conf parameters (RE: Proposal for Allow postgresql.conf values to be changed via SQL [review])