Monday, June 30, 2008

Re: [HACKERS] odd output in restore mode

Index: src/backend/access/transam/xlog.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v
retrieving revision 1.314
diff -c -c -r1.314 xlog.c
*** src/backend/access/transam/xlog.c 12 Jun 2008 09:12:30 -0000 1.314
--- src/backend/access/transam/xlog.c 30 Jun 2008 22:10:07 -0000
***************
*** 4523,4535 ****
/*
* does nothing if a recovery_target is not also set
*/
! if (strcmp(tok2, "true") == 0)
! recoveryTargetInclusive = true;
! else
! {
! recoveryTargetInclusive = false;
! tok2 = "false";
! }
ereport(LOG,
(errmsg("recovery_target_inclusive = %s", tok2)));
}
--- 4523,4532 ----
/*
* does nothing if a recovery_target is not also set
*/
! if (!parse_bool(tok2, &recoveryTargetInclusive))
! ereport(ERROR,
! (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
! errmsg("parameter \"recovery_target_inclusive\" requires a Boolean value")));
ereport(LOG,
(errmsg("recovery_target_inclusive = %s", tok2)));
}
***************
*** 4538,4550 ****
/*
* does nothing if a recovery_target is not also set
*/
! if (strcmp(tok2, "true") == 0)
! recoveryLogRestartpoints = true;
! else
! {
! recoveryLogRestartpoints = false;
! tok2 = "false";
! }
ereport(LOG,
(errmsg("log_restartpoints = %s", tok2)));
}
--- 4535,4544 ----
/*
* does nothing if a recovery_target is not also set
*/
! if (!parse_bool(tok2, &recoveryLogRestartpoints))
! ereport(ERROR,
! (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
! errmsg("parameter \"log_restartpoints\" requires a Boolean value")));
ereport(LOG,
(errmsg("log_restartpoints = %s", tok2)));
}
Index: src/backend/utils/misc/guc.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v
retrieving revision 1.457
diff -c -c -r1.457 guc.c
*** src/backend/utils/misc/guc.c 30 Jun 2008 10:58:47 -0000 1.457
--- src/backend/utils/misc/guc.c 30 Jun 2008 22:10:07 -0000
***************
*** 3991,3997 ****
* If the string parses okay, return true, else false.
* If okay and result is not NULL, return the value in *result.
*/
! static bool
parse_bool(const char *value, bool *result)
{
size_t len = strlen(value);
--- 3991,3997 ----
* If the string parses okay, return true, else false.
* If okay and result is not NULL, return the value in *result.
*/
! bool
parse_bool(const char *value, bool *result)
{
size_t len = strlen(value);
Index: src/include/utils/guc.h
===================================================================
RCS file: /cvsroot/pgsql/src/include/utils/guc.h,v
retrieving revision 1.96
diff -c -c -r1.96 guc.h
*** src/include/utils/guc.h 28 May 2008 09:04:06 -0000 1.96
--- src/include/utils/guc.h 30 Jun 2008 22:10:07 -0000
***************
*** 223,228 ****
--- 223,229 ----
extern void AtEOXact_GUC(bool isCommit, int nestLevel);
extern void BeginReportingGUCOptions(void);
extern void ParseLongOption(const char *string, char **name, char **value);
+ extern bool parse_bool(const char *value, bool *result);
extern bool set_config_option(const char *name, const char *value,
GucContext context, GucSource source,
GucAction action, bool changeVal);
Andrew Dunstan wrote:
>
> I have just been working on setting up a continuous recovery failover
> system, and noticed some odd log lines, shown below. (Using 8.3).
>
> First note that our parsing of recovery.conf in xlog.c is pretty bad,
> and at least we need to document the quirks if it's not going to be
> fixed. log_restartpoints is said to be boolean, but when I set it to an
> unquoted true I got a fatal error, while a quoted 'on' sets it to false,
> as seen. Ick. What is more, I apparently managed to get the recovery

I have fixed the boolean problem with the attached, applied patch. It
exposes guc.c::parse_bool() for use in xlog.c.

I assume all the other problems you reported have been corrected.

--
Bruce Momjian <bruce@momjian.us>

http://momjian.us

EnterpriseDB

http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

No comments: