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 1gw998-0003mG-7w for pgsql-general@arkaria.postgresql.org; Tue, 19 Feb 2019 17:25:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gw996-0006Sg-J9 for pgsql-general@arkaria.postgresql.org; Tue, 19 Feb 2019 17:25:28 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gw996-0006SZ-7g for pgsql-general@lists.postgresql.org; Tue, 19 Feb 2019 17:25:28 +0000 Received: from tamriel.snowman.net ([2001:470:e38f::11]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gw993-0004Z3-Gz for pgsql-general@lists.postgresql.org; Tue, 19 Feb 2019 17:25:26 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id C10DB5F79E; Tue, 19 Feb 2019 12:25:24 -0500 (EST) Date: Tue, 19 Feb 2019 12:25:24 -0500 From: Stephen Frost To: =?iso-8859-1?Q?Mart=EDn_Fern=E1ndez?= Cc: Hellmuth Vargas , "pgsql-generallists.postgresql.org" Subject: Re: PG Upgrade with hardlinks, when to start/stop master and replicas Message-ID: <20190219172524.GW6197@tamriel.snowman.net> References: <5c6c2c3e3ec218380d000001@polymail.io> <20190219163706.GV6197@tamriel.snowman.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="pr2uf1USn+1lHhL+" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --pr2uf1USn+1lHhL+ Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Greetings, * Mart=EDn Fern=E1ndez (fmartin91@gmail.com) wrote: > On Tue, Feb 19, 2019 at 1:37 PM Stephen Frost wrote: > > * Mart=EDn Fern=E1ndez (fmartin91@gmail.com) wrote: > > > Thanks for information! I've refactor our migration scripts to follow > > the suggestions. > > > > Please don't top-post on these mailing lists. > > > > > One extra question that popped up. As long as we don't start the stan= dby > > (after running rsync), we can always `rm -f $PGDATA_10` and promote the > > standby if necessary for failover right ? We also need to `mv` > > pg_control.old to pg_control in the old data directory. > > > > Not sure which standby we're talking about here, but in general, yes, as > > long as you haven't actually started the system after the > > pg_upgrade/rsync, you should be able to blow away the new cluster that > > pg_upgrade/rsync created and start the old cluster back up and promote > > it (if necessary) and use it. > > > > Note that you should *not* need to do anything with pg_control, I have > > no idea what you're referring to there, but the old cluster should have > > the pg_control file and all the catalog tables in place from before the > > pg_upgrade/rsync (those aren't touched during the pg_upgrade/rsync > > process) and you would just need to start up the old binaries pointing > > at the old PG data directory and everything should just work. > > > I did some successful tests yesterday around this scenario. That standby = in > this context is that one that received the rsync from the master but was > never started. The old data directory stays intact except for the fact th= at > globa/pg_control was renmaed with a .old >=20 > I have found the documentation on pg_ugprade that states this: >=20 > ` If you ran pg_upgrade without --link or did not start the new server, t= he > old cluster was not modified except that, if linking started, a .old suff= ix > was appended to > $PGDATA/global/pg_control. To reuse the old cluster, > possibly remove the .old suffix from $PGDATA/global/pg_control; you can > then restart the old cluster.` Ah, right, I forgot that it did that, fair enough. I've never been thrilled with that particular approach due to the inherent risks of people messing directly with files like pg_control, but that's how it is for now. Thanks! Stephen --pr2uf1USn+1lHhL+ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJcbDwEAAoJEO1sijiDR2RVbr8QAIIBL4nBfnNOLbAIPbry2MqT e33bHkhTOfOMSU0TmXPibBw1LY/ZMPNjIjBwlrRJCxh23IWwrNFtU50/aBc9WVa3 KD5olTf1Lwl+XYV903Qo3AJ5NzUU4QOKeIZWJ1eKUi7NNp+bhnBfXs2cQ+KWHYkd WtbvraTOgV7yoYlAAK+rMp52NS01Wgw4VbOEUQz1fkTh3OANOWGyDHlLJfwHL3GU DEIp0R3F5i+TRcUJgE6Ak0dB2VXQ2IfVjaz7qjTKO5ZXKPdRk8B4JzEujyzKXI66 8oT8PvX6Lrue9DvIn2ggOaP/Tqp+CXSoKKyGf8U4dDWhWFGUR/gAo4WfPn1w3G3Q N4rSUdSXG+BFxLLzmT95KhNjjtkDnMtPTW7ZzPjvLj5NiDoPD6DCle+i8x/GOERk nfZaPyfI5TkXuNuum3MC7HlC6Qn4rgwIb3G1zEg4SZyywNz12asj8Al0nL7gEb2a A4RpDwIiUu/P37xgD4bU90bHda935hAVs54dmoqJDb01I4a7WcSr+AFgKiaU9gk8 UJXeGssD0cbAxt7F6or0EokQE5R+iIhbgSYqf/AGWTz0i5EQZufegdMBp/UrmYua 1XTJgD3gDeYqWBwX6IlN4xxiQufO5fzq4dBmc1P/gLwmbfJH77Rrb6gazmlzOyrA AGDBxpUY2EHBSeOsqdds =vCEa -----END PGP SIGNATURE----- --pr2uf1USn+1lHhL+--