Bug in parse_basebackup_options Re: [COMMITTERS] pgsql: Make walsender options order-independent

Started by Fujii Masaoalmost 15 years ago2 messages
#1Fujii Masao
masao.fujii@gmail.com
1 attachment(s)

On Mon, Jan 24, 2011 at 7:41 AM, Magnus Hagander <magnus@hagander.net> wrote:

Make walsender options order-independent

While doing this, also move base backup options into
a struct instead of increasing the number of parameters
to multiple functions for each new option.

When I read the include-WAL-in-backup patch, I found that this
commit had the bug; parse_basebackup_options fails in parsing
options because of wrong usage of MemSet. Here is the patch.

Regards,

--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

Attachments:

parse_basebackup_options_bugfix_v1.patchapplication/octet-stream; name=parse_basebackup_options_bugfix_v1.patchDownload
*** a/src/backend/replication/basebackup.c
--- b/src/backend/replication/basebackup.c
***************
*** 148,154 **** parse_basebackup_options(List *options, basebackup_options *opt)
  	bool		o_progress = false;
  	bool		o_fast = false;
  
! 	MemSet(opt, 0, sizeof(opt));
  	foreach(lopt, options)
  	{
  		DefElem    *defel = (DefElem *) lfirst(lopt);
--- 148,154 ----
  	bool		o_progress = false;
  	bool		o_fast = false;
  
! 	MemSet(opt, 0, sizeof(*opt));
  	foreach(lopt, options)
  	{
  		DefElem    *defel = (DefElem *) lfirst(lopt);
#2Magnus Hagander
magnus@hagander.net
In reply to: Fujii Masao (#1)
Re: Bug in parse_basebackup_options Re: [COMMITTERS] pgsql: Make walsender options order-independent

On Tue, Jan 25, 2011 at 10:32, Fujii Masao <masao.fujii@gmail.com> wrote:

On Mon, Jan 24, 2011 at 7:41 AM, Magnus Hagander <magnus@hagander.net> wrote:

Make walsender options order-independent

While doing this, also move base backup options into
a struct instead of increasing the number of parameters
to multiple functions for each new option.

When I read the include-WAL-in-backup patch, I found that this
commit had the bug; parse_basebackup_options fails in parsing
options because of wrong usage of MemSet. Here is the patch.

Wow. I know I fixed that at one point, it must've gone bad again in a
merge. Interestingly enough it works in my environment, but that must
be pure luck.

So thanks - applied.

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/