Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZZAZN-0006hs-0F for pgsql-hackers@arkaria.postgresql.org; Tue, 08 Sep 2015 04:31:45 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZZAZM-0003Vr-6z for pgsql-hackers@arkaria.postgresql.org; Tue, 08 Sep 2015 04:31:44 +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 1ZZAY3-00023E-BB for pgsql-hackers@postgresql.org; Tue, 08 Sep 2015 04:30:23 +0000 Received: from wagner.pp.ru ([178.63.209.18] helo=mx.wagner.pp.ru) by makus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1ZZAY0-0005S4-Q0 for pgsql-hackers@postgresql.org; Tue, 08 Sep 2015 04:30:22 +0000 Received: from mail.wagner.pp.ru (unknown [192.168.217.131]) by mx.wagner.pp.ru (Postfix) with ESMTP id A7356486142 for ; Tue, 8 Sep 2015 07:29:35 +0300 (MSK) Received: from wagner.wagner.home (wifi [192.168.217.63]) by mail.wagner.pp.ru (Postfix) with ESMTPSA id 74310216B3 for ; Tue, 8 Sep 2015 07:29:33 +0300 (MSK) Date: Tue, 8 Sep 2015 07:29:32 +0300 From: Victor Wagner To: pgsql-hackers@postgresql.org Subject: Re: Proposal: Implement failover on libpq connect level. Message-ID: <20150908072932.72f4e974@wagner.wagner.home> In-Reply-To: <8cebcc80-6d93-47e2-8168-4dc9e4d08bad@mm> References: <20150819074417.GE31302@wagner.pp.ru> <8cebcc80-6d93-47e2-8168-4dc9e4d08bad@mm> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; i586-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 =D0=92 Mon, 07 Sep 2015 17:32:48 +0200 "Daniel Verite" =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > Victor Wagner wrote: >=20 > > 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. >=20 > 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 ? >=20 Purpose of this feature is to distinguish between master and standby servers.=20 This allows failover system to work with standby servers accepting client connections, and even to create system where read-only clients=20 can be loadbalanced among several hot backup servers, and read-write clients work with master, but do not need reconfiguration when failover happens. pg_is_in_recovery() is really better. But it seems that chapter 25 of documentation should be improved and this function mentioned in the section 25.5.1 (Hot Standby / User Overview) --=20 Victor Wagner --=20 Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers