Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gRNoZ-0001WV-11 for pgsql-hackers@arkaria.postgresql.org; Mon, 26 Nov 2018 20:49:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gRNoW-0006OI-GZ for pgsql-hackers@arkaria.postgresql.org; Mon, 26 Nov 2018 20:49:04 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gRNoW-0006OA-8x for pgsql-hackers@lists.postgresql.org; Mon, 26 Nov 2018 20:49:04 +0000 Received: from tamriel.snowman.net ([2001:470:e38f::11]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gRNoO-0001ek-NO for pgsql-hackers@postgresql.org; Mon, 26 Nov 2018 20:49:03 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id 483815F7A4; Mon, 26 Nov 2018 15:48:55 -0500 (EST) Date: Mon, 26 Nov 2018 15:48:55 -0500 From: Stephen Frost To: Sergei Kornilov Cc: Michael Paquier , Peter Eisentraut , Postgres hackers Subject: Re: pgsql: Integrate recovery.conf into postgresql.conf Message-ID: <20181126204855.GA3415@tamriel.snowman.net> References: <20181126002849.GD1776@paquier.xyz> <27802171543235530@iva2-6ec8f0a6115e.qloud-c.yandex.net> <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> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="NMMtlwleeRJSevFd" Content-Disposition: inline In-Reply-To: <457381543264217@iva5-84bc572481fe.qloud-c.yandex.net> User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --NMMtlwleeRJSevFd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Greetings, * Sergei Kornilov (sk@zsrv.org) wrote: > Updated patch attached: > - added testcase to verify database does not start with multiple recovery= targets > - recovery_target =3D immediate was replaced with recovery_target_immedia= te 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/trans= am/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 =3D false; > static char *replay_image_masked =3D NULL; > static char *master_image_masked =3D NULL; > =20 > +/* 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 =3D NULL; > char *recoveryEndCommand =3D NULL; > char *archiveCleanupCommand =3D NULL; > -RecoveryTargetType recoveryTarget =3D RECOVERY_TARGET_UNSET; > +static RecoveryTargetType recoveryTarget =3D RECOVERY_TARGET_UNSET; > bool recoveryTargetInclusive =3D true; > int recoveryTargetAction =3D 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 =3D 0; > + > if (!ArchiveRecoveryRequested) > return; > =20 > + /* Check for mutually exclusive target actions */ > + if (recoveryTargetImmediate) > + { > + ++targetSettingsCount; > + recoveryTarget =3D RECOVERY_TARGET_IMMEDIATE; > + } > + if (strcmp(recovery_target_name_string, "") !=3D 0) > + { > + ++targetSettingsCount; > + recoveryTarget =3D RECOVERY_TARGET_NAME; > + } > + if (strcmp(recovery_target_lsn_string, "") !=3D 0) > + { > + ++targetSettingsCount; > + recoveryTarget =3D RECOVERY_TARGET_LSN; > + } > + if (strcmp(recovery_target_xid_string, "") !=3D 0) > + { > + ++targetSettingsCount; > + recoveryTarget =3D RECOVERY_TARGET_XID; > + } > + if (strcmp(recovery_target_time_string, "") !=3D 0) > + { > + ++targetSettingsCount; > + recoveryTarget =3D 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 --NMMtlwleeRJSevFd Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJb/Fw2AAoJEO1sijiDR2RVu+sP/0Y1v9YYptU9pMDKbVAzB53n Oq34Ie2u0ZJVnbsbkJtZxrY0MzK/pWomnWoJBVSbI0Tsf57wh5AbGaDbCQPThbZ9 NtRDLywoV1ire38EBih3UQbHRkUDeFpuJqWkcA5afz1rmJGI3a4QhCsDVQ0sBbyl s6Me1np/oqFWFr0UnMkIj3fCV0ypcnp85uguDbVVcJZ3NduRAKWA2FejtM4yq2Io M/fhqVoq2abf5A2kDJtB/4EXp1bUfBseUNbCZ4/vH5omOqRyLbwbL6G2PbBiPqfN wx7rZu1OTdIMgV03AfXFqinjFEj8a6g6GBYvZH9350lZ+bCDhJibKPycrO5bMUhc uIR0L1l+I9qGCHhz3as3zRF/oQTdMNhSpIxuG2xOHPO1/o9VY+k1RbFJ9fO3U23U pCcFaqz2YDm6POnFPpqcWp75rHDasTh1JY21uUbBSYbXskQJpfBif68NaxvQOH1d TJXLu9QhcoBTer+Zyw15q6JNVcRLgtE01Uj1D+2QbBGXYY0RywxP5mLR70QRv3Hx sPJBXH17zWU9s4+rU8DLJeuebLn4Ss/anEYKqjFa+g0i1fE8W8IkXjdyuvYs2K/2 C10WOytqzVYo/WGF9oOVqABO9/HXcVrNO8QNIjgUcChIRRDSMKgdN2sPAQb55jzq jO/VRMVRRv0djDnOJqlf =/tVB -----END PGP SIGNATURE----- --NMMtlwleeRJSevFd--