Re: [HACKERS] Patch: Implement failover on libpq connect level.

From: Kevin Grittner <kgrittn(at)gmail(dot)com>
To: Mithun Cy <mithun(dot)cy(at)enterprisedb(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Peter van Hardenberg <pvh(at)pvh(dot)ca>, "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: [HACKERS] Patch: Implement failover on libpq connect level.
Date: 2016-11-16 14:02:48
Message-ID: CACjxUsPNdxDY8irtKoo5fKMU+jrcxYO8cgqjCxkuAq7nPnL1QA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-jdbc

[moving this branch of discussion to pgsql-jdbc]

On Tue, Nov 15, 2016 at 10:31 PM, Mithun Cy <mithun(dot)cy(at)enterprisedb(dot)com> wrote:

> JDBC is sending "show transaction_read_only" to find whether it
> is master or not.

If true, that's insane. That can be different on each connection
to the cluster and can change tens of thousands of times per second
on any connection!

I know of one large shop that sets default_transaction_read_only =
true because 99% of their transactions are read only and they use
serializable transactions -- which run faster and with less
contention when transactions which don't need to write are flagged
as read only. It seems safer to them to only turn off the read
only property for transactions which might need to write.

> Victor's patch also started with it, but later it was transformed into
> pg_is_in_recovery
> by him as it appeared more appropriate to identify the master / slave.

I don't know whether that is ideal, but it is sure a lot better
than something which can change with every transaction -- or even
within a transaction (in one direction).

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2016-11-16 14:09:05 Re: [COMMITTERS] pgsql: Build HTML documentation using XSLT stylesheets by default
Previous Message Peter Eisentraut 2016-11-16 14:02:11 Re: [COMMITTERS] pgsql: Build HTML documentation using XSLT stylesheets by default

Browse pgsql-jdbc by date

  From Date Subject
Next Message Robert Haas 2016-11-16 15:13:14 Re: [HACKERS] Patch: Implement failover on libpq connect level.
Previous Message Robert Haas 2016-11-16 13:50:22 Re: Patch: Implement failover on libpq connect level.