From: Alvaro Herrera <alvhe...@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 document read-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 SHOW transaction_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 the server 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_attr a 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 the same, 
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's a new feature effective for new 
servers.)


Regards
Takayuki Tsunakawa

Reply via email to