pg.ddx.io pgsql-committers@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Sergei Kornilov <sk@zsrv.org>
To: Stephen Frost <sfrost@snowman.net>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Postgres hackers <pgsql-hackers@postgresql.org>
Subject: Re: pgsql: Integrate recovery.conf into postgresql.conf
Date: Tue, 27 Nov 2018 13:45:20 +0100
Message-ID: <c17e63ce-b78a-dbb5-8fd1-30b2984a53b4@2ndquadrant.com> (raw )
In-Reply-To: <362e291f-2442-3bbf-62f5-dde97beb3940@2ndquadrant.com >
References: <E1gQwex-0001Vd-OW@gemulon.postgresql.org >
<20181126002849.GD1776@paquier.xyz >
<27802171543235530@iva2-6ec8f0a6115e.qloud-c.yandex.net >
<cd804d8f-0873-f81c-2420-2f1b0f99d889@2ndquadrant.com >
<20181126131640.GD14598@paquier.xyz >
<20181126151852.GW3415@tamriel.snowman.net >
<29465041543250389@iva4-f774db2b5297.qloud-c.yandex.net >
<20181126172118.GY3415@tamriel.snowman.net >
<145311543257278@sas1-0a6c2e2b59d7.qloud-c.yandex.net >
<20181126191253.GZ3415@tamriel.snowman.net >
<457381543264217@iva5-84bc572481fe.qloud-c.yandex.net >
<873d2d6b-8a85-2274-7222-abe2f0602f5d@2ndquadrant.com >
<3206661543309827@sas2-b4ed770db137.qloud-c.yandex.net >
<362e291f-2442-3bbf-62f5-dde97beb3940@2ndquadrant.com >
On 27/11/2018 13:29, Peter Eisentraut wrote:
> On 27/11/2018 10:10, Sergei Kornilov wrote:
>> Hello
>>
>>>> - recovery_target = immediate was replaced with recovery_target_immediate bool GUC
>>>
>>> Why?
>> Due this comment: https://www.postgresql.org/message-id/20181126172118.GY3415%40tamriel.snowman.net
>>> I've not been following this very closely, but seems like
>>> recovery_target_string is a bad idea.. Why not just make that
>>> 'recovery_target_immediate' and make it a boolean? Having a GUC that's
>>> only got one valid value seems really odd.
>
> It is a bit odd, but that's the way it's been, and I don't see a reason
> to change it as part of this fix. We are attempting to fix the way the
> GUC parameters are parsed, not change the name and meaning of the
> parameters themselves.
The attached seems to be the simplest way to fix this. (Needs
documentation updates, test updates, error message refinement.)
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Attachments:
0001-WIP-Only-allow-one-recovery-target-setting.patch (text/plain, 3.3K) download
From d5cb3f3a30bd045283c9848bd39ff012c817d908 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter_e@gmx.net>
Date: Tue, 27 Nov 2018 13:43:54 +0100
Subject: [PATCH] WIP Only allow one recovery target setting
---
src/backend/utils/misc/guc.c | 29 +++++++++++++++--------------
src/include/access/xlog.h | 2 +-
2 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 6497393c03..dd2caee95b 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -11065,14 +11065,11 @@ check_recovery_target(char **newval, void **extra, GucSource source)
static void
assign_recovery_target(const char *newval, void *extra)
{
+ if (recoveryTarget)
+ elog(ERROR, "multiple recovery targets specified");
+
if (newval && strcmp(newval, "") != 0)
recoveryTarget = RECOVERY_TARGET_IMMEDIATE;
- else
- /*
- * Reset recoveryTarget to RECOVERY_TARGET_UNSET to proper handle user
- * setting multiple recovery_target with blank value on last.
- */
- recoveryTarget = RECOVERY_TARGET_UNSET;
}
static bool
@@ -11098,13 +11095,14 @@ check_recovery_target_xid(char **newval, void **extra, GucSource source)
static void
assign_recovery_target_xid(const char *newval, void *extra)
{
+ if (recoveryTarget)
+ elog(ERROR, "multiple recovery targets specified");
+
if (newval && strcmp(newval, "") != 0)
{
recoveryTarget = RECOVERY_TARGET_XID;
recoveryTargetXid = *((TransactionId *) extra);
}
- else
- recoveryTarget = RECOVERY_TARGET_UNSET;
}
static bool
@@ -11161,13 +11159,14 @@ check_recovery_target_time(char **newval, void **extra, GucSource source)
static void
assign_recovery_target_time(const char *newval, void *extra)
{
+ if (recoveryTarget)
+ elog(ERROR, "multiple recovery targets specified");
+
if (newval && strcmp(newval, "") != 0)
{
recoveryTarget = RECOVERY_TARGET_TIME;
recoveryTargetTime = *((TimestampTz *) extra);
}
- else
- recoveryTarget = RECOVERY_TARGET_UNSET;
}
static bool
@@ -11186,13 +11185,14 @@ check_recovery_target_name(char **newval, void **extra, GucSource source)
static void
assign_recovery_target_name(const char *newval, void *extra)
{
+ if (recoveryTarget)
+ elog(ERROR, "multiple recovery targets specified");
+
if (newval && strcmp(newval, "") != 0)
{
recoveryTarget = RECOVERY_TARGET_NAME;
recoveryTargetName = (char *) newval;
}
- else
- recoveryTarget = RECOVERY_TARGET_UNSET;
}
static bool
@@ -11240,13 +11240,14 @@ check_recovery_target_lsn(char **newval, void **extra, GucSource source)
static void
assign_recovery_target_lsn(const char *newval, void *extra)
{
+ if (recoveryTarget)
+ elog(ERROR, "multiple recovery targets specified");
+
if (newval && strcmp(newval, "") != 0)
{
recoveryTarget = RECOVERY_TARGET_LSN;
recoveryTargetLSN = *((XLogRecPtr *) extra);
}
- else
- recoveryTarget = RECOVERY_TARGET_UNSET;
}
static bool
diff --git a/src/include/access/xlog.h b/src/include/access/xlog.h
index f3a7ba4d42..1fd4aec3c7 100644
--- a/src/include/access/xlog.h
+++ b/src/include/access/xlog.h
@@ -79,7 +79,7 @@ extern HotStandbyState standbyState;
*/
typedef enum
{
- RECOVERY_TARGET_UNSET,
+ RECOVERY_TARGET_UNSET = 0,
RECOVERY_TARGET_XID,
RECOVERY_TARGET_TIME,
RECOVERY_TARGET_NAME,
--
2.19.1
view thread (29+ messages) latest in thread
Message-ID: <c17e63ce-b78a-dbb5-8fd1-30b2984a53b4@2ndquadrant.com>
Permalink: ../c17e63ce-b78a-dbb5-8fd1-30b2984a53b4@2ndquadrant.com/
Also on: postgresql.org/message-id/c17e63ce-b78a-dbb5-8fd1-30b2984a53b4@2ndquadrant.com
copy link · copy postgr.es · copy git am
reply Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: peter.eisentraut@2ndquadrant.com, sk@zsrv.org, sfrost@snowman.net, michael@paquier.xyz, pgsql-hackers@postgresql.org
Subject: Re: pgsql: Integrate recovery.conf into postgresql.conf
In-Reply-To: <c17e63ce-b78a-dbb5-8fd1-30b2984a53b4@2ndquadrant.com>
References: <E1gQwex-0001Vd-OW@gemulon.postgresql.org> <20181126002849.GD1776@paquier.xyz> <27802171543235530@iva2-6ec8f0a6115e.qloud-c.yandex.net> <cd804d8f-0873-f81c-2420-2f1b0f99d889@2ndquadrant.com> <20181126131640.GD14598@paquier.xyz> <20181126151852.GW3415@tamriel.snowman.net> <29465041543250389@iva4-f774db2b5297.qloud-c.yandex.net> <20181126172118.GY3415@tamriel.snowman.net> <145311543257278@sas1-0a6c2e2b59d7.qloud-c.yandex.net> <20181126191253.GZ3415@tamriel.snowman.net> <457381543264217@iva5-84bc572481fe.qloud-c.yandex.net> <873d2d6b-8a85-2274-7222-abe2f0602f5d@2ndquadrant.com> <3206661543309827@sas2-b4ed770db137.qloud-c.yandex.net> <362e291f-2442-3bbf-62f5-dde97beb3940@2ndquadrant.com> <c17e63ce-b78a-dbb5-8fd1-30b2984a53b4@2ndquadrant.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox