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 1gjEmr-0003gK-JS for pgsql-hackers@arkaria.postgresql.org; Tue, 15 Jan 2019 02:49:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gjEmq-0003jf-CQ for pgsql-hackers@arkaria.postgresql.org; Tue, 15 Jan 2019 02:49:08 +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 1gjEmq-0003jY-4w for pgsql-hackers@lists.postgresql.org; Tue, 15 Jan 2019 02:49:08 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gjEmn-0008S1-Qt for pgsql-hackers@postgresql.org; Tue, 15 Jan 2019 02:49:07 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id CF79D29117; Mon, 14 Jan 2019 21:49:02 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 14 Jan 2019 21:49:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=UiXjshPh/me69xJlgmRaF8SkYlN 4EW5ofTPIAlQNSPc=; b=yEXb5bMNA7N7VGN4S7spbcLVy/gZ0AhUQZ+7qzJ+UWm NyzR4E4v89el0NQ2YJP9mWq1H0+aHCgK55Gu0HniOIp4e7FSM0puBqD+MpN2R66m Sry2mcdOzaSCI4gUDy3KpBHcfdO38HkiBPGlo8FX51ozoH3nivczwKsBLp/zQuA7 kVxgRvS+0kl2ulr+jfK7x0tQ4R1kL3ranBSnOg6bT2Hv2fD613Ir6LZrrImxXVZ9 /2n7n5bity7/1m4A6S5bg1GcdoJkdxINhst9uVrY3t2cMDMm1U4JvjZNB2iy0QwY EsJDyS6fKbhOLw7MS5u7x4yY/MGvMedawfkPl6lRQlA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=UiXjsh Ph/me69xJlgmRaF8SkYlN4EW5ofTPIAlQNSPc=; b=jGmPN13CKC+pDn3F1rHv9g LG9HLN12C57mNzq3JurK6Ee8f4Kn0q25jQHJszRpURyECV5d2AMsqwa4g7U8tX7/ 6M8Jt17pZco87wqdjnNQT893PP1m8eKFdKgUqjNOr7LVcOJyjo6nlh+uLnKXJOeX uQVCZwjH/anrYdrl/P5Vj7K/ue9VYEE5Jz7qWuSruI1Eat3PcbNzpP1/qAElbyna zfQ9haP/0ENqObtW0zgj3FYeOmFofq2hk97JTAxewM2SUY2z7wLFgGpvBB6Ehx8H y6KBnw1msef5MiHIRcVADojRmCpFnQ18I54IJSokp1cifbQGxW/om0bE4oJslcgw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrgedvgdeglecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnegfrhhlucfvnfffucdljedtmd enucfjughrpeffhffvuffkfhggtggujgesghdtreertddtvdenucfhrhhomhepofhitghh rggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprghquhhivghrrdighiiiqeenuc fkphepiedurddvudehrddufeejrdduiedvnecurfgrrhgrmhepmhgrihhlfhhrohhmpehm ihgthhgrvghlsehprghquhhivghrrdighiiinecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from paquier.xyz (c137162.net61215.cablenet.ne.jp [61.215.137.162]) by mail.messagingengine.com (Postfix) with ESMTPA id 9B15EE425A; Mon, 14 Jan 2019 21:48:58 -0500 (EST) Date: Tue, 15 Jan 2019 11:48:55 +0900 From: Michael Paquier To: "Tsunakawa, Takayuki" Cc: 'Tom Lane' , Dave Cramer , Robert Haas , "laurenz.albe@cybertec.at" , Haribabu Kommi , Jing Wang , PostgreSQL-development Subject: Re: Libpq support to connect to standby server as priority Message-ID: <20190115024855.GC1433@paquier.xyz> References: <67be09458f276c0c95a4b2a2a383dca9775d19cd.camel@cybertec.at> <26890.1542047012@sss.pgh.pa.us> <096a642cff0dd68b8157a5f8838e1762d0050d18.camel@cybertec.at> <28777.1542386147@sss.pgh.pa.us> <26251.1547504236@sss.pgh.pa.us> <0A3221C70F24FB45833433255569204D1FB67687@G01JPEXMBYT05> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="+xNpyl7Qekk2NvDX" Content-Disposition: inline In-Reply-To: <0A3221C70F24FB45833433255569204D1FB67687@G01JPEXMBYT05> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --+xNpyl7Qekk2NvDX Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jan 15, 2019 at 02:00:57AM +0000, Tsunakawa, Takayuki wrote: > But as some people said, I don't think this is the right way. I > suppose what's leading to the current somewhat complicated situation > is that there was no easy way for the client to know whether the > server is the master. That ended up in using "SHOW > transaction_read_only" instead, and people supported that compromise > by saying "read only status is more useful than whether the server > is standby or not," I'm afraid. Right. Another pin point is that it is complicated for a client to be sure that it is connected to a standby as at the time between transaction_read_only is checked and the connection is reported as ready to be used for the application, you may be actually linked to a primary which has just recently been promoted. I am not personally sure if it is worth caring about that in such level of details to get to get something useful, but there have been doubts about not making that absolutely right to leverage correctly applications willing to use read-only clients. > The original desire should have been the ability to connect to a > primary or a standby. So, I think we should go back to the original > thinking (and not complicate the feature), and create a read only > GUC_REPORT variable, say, server_role, that identifies whether the > server is a primary or a standby.=20 =46rom the point of view of making sure that a client is really connected to a primary or a standby, this is the best idea around. -- Michael --+xNpyl7Qekk2NvDX Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAlw9ShcACgkQnvQgOdby QH0GLQ/9EwTB1uo6qHKJfvbX1FSHCGCpW0Z9MRjUfD5iyFoFs8NmSsqbY7V1ObLH e3qH1KMBlIcqdxpUYv+MnkjZsrfGHGgcMZsaQWMtHrWXaI89iqJ0GlGEtHIBaXwH Cqvj+5RNTCOHQqj17/md2XK/X8hWQWDXl6cQc4fn8fjOrBq1+IHGtdMNmYaR9XM+ U7WkPSsnrx6HJ3vhRSKlJaRu6l8Sb3CpMTr+1sfj+n6W3sXDQvC6AgR8whLyMd5H HZuYMRZZ7QUIK5NkZowNQlbLMKR2Sz2TXAUzRT7bnpVVW0AfzGiOwEk1rUPFGdeK Pc6Pa6qNLcL16a8LFm1VickwFwrXsFq95Fo2lnTXl1QJp5HOnrD+Nz3KC2k81028 r11z8NeBCCXOk8QtqnfckBGhRy+twNk0ccrJ9kR7RYq+WH74YiYJjwCZ/FwlZlOP zlU2M/DCN5YFWdP8bPbbgnWThvPGDbrHtGK6H9mZEkZB0fas4cuYNOMaS/5Rj19K OYEK/1C1Lo/3i38r4tei571/3VqEZo0xfJQhv26ckgNlhhPUO6Gjn+Bc4Mr/OmOZ DUTymT+Cz7kGDKzWQ62lNOr0Lxc0kjhpr1OaVcDsPaFBZQ1xHcwbo7e0Mr7zK4Jo NEb+vwP6zqkHcZglNkO8qSuIyT/qqYQTqoNA7hkcDFRB9XO9dIs= =nutV -----END PGP SIGNATURE----- --+xNpyl7Qekk2NvDX--