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

From Tsunakawa, Takayuki
Subject Re: Patch: Implement failover on libpq connect level.
Date
Msg-id 0A3221C70F24FB45833433255569204D1F641BA6@G01JPEXMBYT05
Whole thread Raw
In response to Re: Patch: Implement failover on libpq connect level.  (Mithun Cy <mithun.cy@enterprisedb.com>)
Responses Re: Patch: Implement failover on libpq connect level.
List pgsql-hackers
From: pgsql-hackers-owner@postgresql.org
> [mailto:pgsql-hackers-owner@postgresql.org] On Behalf Of Mithun Cy
> I am adding next version of the patch it have following fixes.
> Tsunakawa's comments
> 
> 1.  PGconn->target_server_type is now freed in freePGconn() 2.  Added
> PGTARGETSERVERTYPE.
> 
> 
> Additional comments from others
> 3.  Moved from SELECT pg_is_in_recovery() to SHOW transaction_read_only
> now should handle different kind of replication, as we recognise server
> to which writable connection can be made as primary. Very exactly like JDBC
> driver. Also documented about it.
> 4. renamed words from master to primary.

Thank you.  The following items need addressing.  Some of them require some more discussion to reach consensus, and I
hopethey will settle down soon.  After checking the progress for a week or so, I'll mark the CommitFest entry as "ready
forcommitter" or "waiting on author".
 

(1)
+        server. Set this to <literaL>any</literal>, if you want to connect to
+        A server is recognized as a primary/standby by observering whether it

Typo.  <literaL. -> <literal>, and "observering" -> "observing".


(2)
+    {"target_server_type", "PGTARGETSERVERTYPE", NULL, NULL,
+        "Target server type", "", 6,

Looking at existing parameters, the default value is defined as a macro, and the display label is a sequence of words
separatedby "-".  i.e.
 

+    {"target_server_type", "PGTARGETSERVERTYPE", DefaultTargetServerType, NULL,
+        "Target-Server-Type", "", 6,


(3)
Please avoid adding another round trip by using a GUC_REPORTed variable (ParameterStatus entry).  If you want to
supportthis libpq failover with pre-10 servers, you can switch the method of determining the primary based on the
serverversion.  But I don't think it's worth supporting older servers at the price of libpq code complexity.
 


(4)
Please consider supporting "standby" and "prefer_standby" like PgJDBC.  They are useful without load balancing when
multiplestandbys are used for HA.
 


(5)
I haven't tracked the progress of logical replication, but will target_server_type be likely to be usable with it?  How
willtarget_server_type fit logical replication?
 

Regards
Takayuki Tsunakawa



pgsql-hackers by date:

Previous
From: Craig Ringer
Date:
Subject: Re: Document how to set up TAP tests for Perl 5.8.8
Next
From: Amit Langote
Date:
Subject: Re: Declarative partitioning - another take