Re: Patch: Implement failover on libpq connect level.

From: Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp>
To: mithun(dot)cy(at)enterprisedb(dot)com
Cc: robertmhaas(at)gmail(dot)com, peter(dot)eisentraut(at)2ndquadrant(dot)com, pvh(at)pvh(dot)ca, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Patch: Implement failover on libpq connect level.
Date: 2016-11-16 05:03:44
Message-ID: 20161116.140344.1033805703890845524.t-ishii@sraoss.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-jdbc

> JDBC is sending "show transaction_read_only" to find whether it is master
> or not.
> 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.

In my understanding pg_is_in_recovery() returns true if it's a standby
node. However, even if it returns other than true, the server is not
necessarily a primary. Even it's not configured as a streaming
replication primary, it returns other than true.

So if your intention is finding a primary, I am not sure if
pg_is_in_recovery() is the best solution.

Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2016-11-16 07:06:52 pgsql: Build HTML documentation using XSLT stylesheets by default
Previous Message Craig Ringer 2016-11-16 04:55:01 Re: [PATCH] Logical decoding timeline following take II

Browse pgsql-jdbc by date

  From Date Subject
Next Message Robert Haas 2016-11-16 13:50:22 Re: Patch: Implement failover on libpq connect level.
Previous Message Mithun Cy 2016-11-16 04:31:54 Re: Patch: Implement failover on libpq connect level.