Re: Proposal: Implement failover on libpq connect level. - Mailing list pgsql-hackers

From Daniel Verite
Subject Re: Proposal: Implement failover on libpq connect level.
Date
Msg-id 8cebcc80-6d93-47e2-8168-4dc9e4d08bad@mm
Whole thread Raw
In response to Re: Proposal: Implement failover on libpq connect level.  (''Victor Wagner *EXTERN*' *EXTERN*' <vitus@wagner.pp.ru>)
Responses Re: Proposal: Implement failover on libpq connect level.
List pgsql-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



pgsql-hackers by date:

Previous
From: Masahiko Sawada
Date:
Subject: Re: Freeze avoidance of very large table.
Next
From: Teodor Sigaev
Date:
Subject: Re: WIP: Access method extendability