RE: Libpq support to connect to standby server as priority - Mailing list pgsql-hackers

From tsunakawa.takay@fujitsu.com
Subject RE: Libpq support to connect to standby server as priority
Date
Msg-id OSAPR01MB50734D667954D53A8FE303B7FE3C0@OSAPR01MB5073.jpnprd01.prod.outlook.com
Whole thread Raw
In response to Re: Libpq support to connect to standby server as priority  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: Libpq support to connect to standby server as priority  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
From: Alvaro Herrera <alvherre@2ndquadrant.com>
> So, we can know whether server is primary/standby by checking
> in_recovery, as opposed to knowing whether read-write which is done by
> checking transaction_read_only.  So we can keep read-write as a synonym
> for "primary", and check in_recovery when used in servers that support
> the new GUC, and check transaction_read_only in older servers.
> 
> It seems there's a lot of code that we can discard from the patch:
> first, we can discard checking for "read-only" altogether.  Second, have
> us check transaction_read_only *only* if the server is of an older
> version.

Let me check my understanding.  Are you proposing these?

* The canonical libpq connection parameter is target_session_attr = {primary | standby | prefer-standby}.  Leave and
documentread-write as a synonym for primary.
 

* When the server version is 13 or later, libpq just checks in_recovery, not checking transaction_read_only or sending
SHOWtransaction_read_only.
 

* When the server version is before 13, libpq sends SHOW transaction_read_only as before.


Personally, 100% agreed, considering what we really wanted to do when target_session_attr was introduced is to tell if
theserver is primary or standby.  The questions are:
 

Q1: Should we continue to use the name target_session_attr, or rename it to target_server_type and make
target_session_attra synonym for it?  I'm in favor of the latter.
 

Q2: Can we accept the subtle incompatibility that target_session_attr=read-write and target_server_type=primary are not
thesame, when default_transaction_read_only is on?  (I'd like to hear yes)
 

Q3: Can we go without supporting standby and prefer-standby for older servers?  (I think yes because we can say that
it'sa new feature effective for new servers.)
 


Regards
Takayuki Tsunakawa


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Removing pg_pltemplate and creating "trustable" extensions
Next
From: Michael Paquier
Date:
Subject: Re: Assert failure due to "drop schema pg_temp_3 cascade" fortemporary tables and \d+ is not showing any info after drooping temp tableschema