pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Daniel Verite <daniel@manitou-mail.org>
To: vitus@wagner.pp.ru
Cc: pgsql-hackers@postgresql.org
Subject: Re: Proposal: Implement failover on libpq connect level.
Date: Mon, 07 Sep 2015 17:32:48 +0200
Message-ID: <8cebcc80-6d93-47e2-8168-4dc9e4d08bad@mm> (raw)
In-Reply-To: <20150819074417.GE31302@wagner.pp.ru>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

	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
> 
>    show transaction_read_only 
> 
> 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 
 transaction_read_only ?

That's because a database or user can be made read-only-on-connect 
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,
-- 
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (63+ messages)  latest in thread

Message-ID: <8cebcc80-6d93-47e2-8168-4dc9e4d08bad@mm>
Permalink:  ../8cebcc80-6d93-47e2-8168-4dc9e4d08bad@mm/
Also on:    postgresql.org/message-id/8cebcc80-6d93-47e2-8168-4dc9e4d08bad@mm

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: daniel@manitou-mail.org, vitus@wagner.pp.ru, pgsql-hackers@postgresql.org
  Subject: Re: Proposal: Implement failover on libpq connect level.
  In-Reply-To: <8cebcc80-6d93-47e2-8168-4dc9e4d08bad@mm>
  References: <20150819074417.GE31302@wagner.pp.ru> <8cebcc80-6d93-47e2-8168-4dc9e4d08bad@mm>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox