pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephen Frost <sfrost@snowman.net>
To: Sergei Kornilov <sk@zsrv.org>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: Postgres hackers <pgsql-hackers@postgresql.org>
Subject: Re: pgsql: Integrate recovery.conf into postgresql.conf
Date: Mon, 26 Nov 2018 15:48:55 -0500
Message-ID: <20181126204855.GA3415@tamriel.snowman.net> (raw)
In-Reply-To: <457381543264217@iva5-84bc572481fe.qloud-c.yandex.net>
References: <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>

Greetings,

* Sergei Kornilov (sk@zsrv.org) wrote:
> Updated patch attached:
> - added testcase to verify database does not start with multiple recovery targets
> - recovery_target = immediate was replaced with recovery_target_immediate bool GUC

I'd encourage you to look through the diff after you're finished hacking
before sending it to the list, in case things get left in that should be
removed, as below...

> diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
> index c80b14e..cd29606 100644
> --- a/src/backend/access/transam/xlog.c
> +++ b/src/backend/access/transam/xlog.c
> @@ -261,13 +261,21 @@ static bool restoredFromArchive = false;
>  static char *replay_image_masked = NULL;
>  static char *master_image_masked = NULL;
>  
> +/* recovery_target* original GUC values */
> +char *recovery_target_string;

This shouldn't be here now, should it?

> +char *recovery_target_xid_string;
> +char *recovery_target_time_string;
> +char *recovery_target_name_string;
> +char *recovery_target_lsn_string;

>  /* options formerly taken from recovery.conf for archive recovery */

Shouldn't all of the above be listed under this comment..?

>  char	   *recoveryRestoreCommand = NULL;
>  char	   *recoveryEndCommand = NULL;
>  char	   *archiveCleanupCommand = NULL;
> -RecoveryTargetType recoveryTarget = RECOVERY_TARGET_UNSET;
> +static RecoveryTargetType recoveryTarget = RECOVERY_TARGET_UNSET;
>  bool		recoveryTargetInclusive = true;
>  int			recoveryTargetAction = RECOVERY_TARGET_ACTION_PAUSE;
> +bool 		recoveryTargetImmediate;

Seems like this should, at least, be close to the char*'s that are
defining the other ways to specify a recovery targer.

>  TransactionId recoveryTargetXid;
>  TimestampTz recoveryTargetTime;
>  char	   *recoveryTargetName;
> @@ -5381,9 +5389,42 @@ readRecoverySignalFile(void)
>  static void
>  validateRecoveryParameters(void)
>  {
> +	uint8 targetSettingsCount = 0;
> +
>  	if (!ArchiveRecoveryRequested)
>  		return;
>  
> +	/* Check for mutually exclusive target actions */
> +	if (recoveryTargetImmediate)
> +	{
> +		++targetSettingsCount;
> +		recoveryTarget = RECOVERY_TARGET_IMMEDIATE;
> +	}
> +	if (strcmp(recovery_target_name_string, "") != 0)
> +	{
> +		++targetSettingsCount;
> +		recoveryTarget = RECOVERY_TARGET_NAME;
> +	}
> +	if (strcmp(recovery_target_lsn_string, "") != 0)
> +	{
> +		++targetSettingsCount;
> +		recoveryTarget = RECOVERY_TARGET_LSN;
> +	}
> +	if (strcmp(recovery_target_xid_string, "") != 0)
> +	{
> +		++targetSettingsCount;
> +		recoveryTarget = RECOVERY_TARGET_XID;
> +	}
> +	if (strcmp(recovery_target_time_string, "") != 0)
> +	{
> +		++targetSettingsCount;
> +		recoveryTarget = RECOVERY_TARGET_TIME;
> +	}
> +	if (targetSettingsCount > 1)
> +		ereport(FATAL,
> +				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
> +				 errmsg("can not specify multiple recovery targets")));

Doesn't look like you changed this based on my prior comment..?

Thanks!

Stephen

Attachments:

  signature.asc (application/pgp-signature, 818B) download

view thread (29+ messages)  latest in thread

Message-ID: <20181126204855.GA3415@tamriel.snowman.net>
Permalink:  ../20181126204855.GA3415@tamriel.snowman.net/
Also on:    postgresql.org/message-id/20181126204855.GA3415@tamriel.snowman.net

 · 

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: sfrost@snowman.net, sk@zsrv.org, michael@paquier.xyz, peter.eisentraut@2ndquadrant.com, pgsql-hackers@postgresql.org
  Subject: Re: pgsql: Integrate recovery.conf into postgresql.conf
  In-Reply-To: <20181126204855.GA3415@tamriel.snowman.net>
  References: <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> <20181126204855.GA3415@tamriel.snowman.net>

* 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