Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZYyR3-0002yM-88 for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Sep 2015 15:34:21 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZYyR2-00063x-H2 for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Sep 2015 15:34:20 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZYyPk-0004X9-9d for pgsql-hackers@postgresql.org; Mon, 07 Sep 2015 15:33:00 +0000 Received: from ks311736.kimsufi.com ([188.165.209.130]) by makus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1ZYyPc-0007Xu-WB for pgsql-hackers@postgresql.org; Mon, 07 Sep 2015 15:32:59 +0000 Received: from genius-map.net (verite.pro [195.154.189.246]) by ks311736.kimsufi.com (Postfix) with ESMTP id CDB76C02CD; Mon, 7 Sep 2015 17:44:17 +0200 (CEST) Received: by genius-map.net (Postfix, from userid 1001) id C349038A0E55; Mon, 7 Sep 2015 17:32:49 +0200 (CEST) Content-Type: text/plain; charset="iso-8859-15" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: Proposal: Implement failover on libpq connect level. From: "Daniel Verite" To: vitus@wagner.pp.ru CC: pgsql-hackers@postgresql.org In-Reply-To: <20150819074417.GE31302@wagner.pp.ru> Date: Mon, 07 Sep 2015 17:32:48 +0200 Message-ID: <8cebcc80-6d93-47e2-8168-4dc9e4d08bad@mm> X-Mailer: Manitou v1.3.1 X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Victor Wagner wrote: > It would just take a bit more time for client and a bit more load for > server - to make sure that this connection is read-write by > issuing >=20 > show transaction_read_only=20 >=20 > statement before considering connection useful. If the purpose of the feature is to wait for a failover to complete, shouldn't it check for pg_is_in_recovery() rather than=20 transaction_read_only ? That's because a database or user can be made read-only-on-connect=20 on an otherwise read-write instance by issuing ALTER DATABASE dbname SET default_transaction_read_only TO on; The same for a user with ALTER USER. In that case, transaction_read_only would be OFF after connecting, both on the master and on a slave, independantly of any failover in progress or finished or not having occurred at all. Best regards, --=20 Daniel V=E9rit=E9 PostgreSQL-powered mailer: http://www.manitou-mail.org Twitter: @DanielVerite --=20 Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers