Re: Patch: Implement failover on libpq connect level.

From: "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>
To: 'Tatsuo Ishii' <ishii(at)sraoss(dot)co(dot)jp>, "mithun(dot)cy(at)enterprisedb(dot)com" <mithun(dot)cy(at)enterprisedb(dot)com>
Cc: "robertmhaas(at)gmail(dot)com" <robertmhaas(at)gmail(dot)com>, "peter(dot)eisentraut(at)2ndquadrant(dot)com" <peter(dot)eisentraut(at)2ndquadrant(dot)com>, "pvh(at)pvh(dot)ca" <pvh(at)pvh(dot)ca>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Patch: Implement failover on libpq connect level.
Date: 2016-11-17 02:29:58
Message-ID: 0A3221C70F24FB45833433255569204D1F641367@G01JPEXMBYT05
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-jdbc

From: pgsql-hackers-owner(at)postgresql(dot)org
> [mailto:pgsql-hackers-owner(at)postgresql(dot)org] On Behalf Of Tatsuo Ishii
> 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.

Yes, I don't think pg_is_in_recovery() is the best, but there doesn't seem to be a better solution. pg_is_in_recovery(), as its name clearly suggests, returns true if the server is performing recovery. For example, it returns true if hot_standby=on is present in postgresql.conf and the recovery from backup is in progress. It's not a standby.

Regards
Takayuki Tsunakawa

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro HORIGUCHI 2016-11-17 02:31:09 Re: Document how to set up TAP tests for Perl 5.8.8
Previous Message Craig Ringer 2016-11-17 02:09:29 Re: [HACKERS] Patch: Implement failover on libpq connect level.

Browse pgsql-jdbc by date

  From Date Subject
Next Message Tsunakawa, Takayuki 2016-11-17 02:49:51 Re: [HACKERS] Patch: Implement failover on libpq connect level.
Previous Message Craig Ringer 2016-11-17 02:09:29 Re: [HACKERS] Patch: Implement failover on libpq connect level.