Re: [HACKERS] [PATCH v1] Add and report the new "in_hot_standby" GUC pseudo-variable. - Mailing list pgsql-hackers

From Magnus Hagander
Subject Re: [HACKERS] [PATCH v1] Add and report the new "in_hot_standby" GUC pseudo-variable.
Date
Msg-id CABUevExopW8jxMdj2j2UnP-FZVU-0zESo8kPAGZYp8X=HMc1Ug@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] [PATCH v1] Add and report the new "in_hot_standby" GUCpseudo-variable.  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Responses Re: [HACKERS] [PATCH v1] Add and report the new "in_hot_standby" GUC pseudo-variable.  (Elvis Pranskevichus <elprans@gmail.com>)
Re: [PATCH v1] Add and report the new "in_hot_standby" GUC pseudo-variable.  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On Wed, Mar 22, 2017 at 9:00 PM, Peter Eisentraut <peter.eisentraut@2ndquadrant.com> wrote:
On 3/22/17 14:09, Robert Haas wrote:
>> The opposite means primary.  I can flip the GUC name to "is_primary", if
>> that's clearer.
> Hmm, I don't find that clearer.  "hot standby" has a very specific
> meaning; "primary" isn't vague, but I would say it's less specific.

The problem I have is that there is already a GUC named "hot_standby",
which determines whether an instance is in hot (as opposed to warm?)
mode if it is a standby.  This is proposing to add a setting named
"in_hot_standby" which says nothing about the hotness, but something
about the standbyness.  Note that these are all in the same namespace.

I think we could use "in_recovery", which would be consistent with
existing naming.

One thing we might want to consider around this -- in 10 we have target_session_attrs=read-write (since 721f7bd3cbccaf8c07cad2707826b83f84694832), which will issue a SHOW transaction_read_only on the connection.

We should probably consider if there is some way we can implement these two things the same way. If we're inventing a new variable that gets pushed on each connection, perhaps we can use that one and avoid the SHOW command? Is the read-write thing really interesting in the aspect of the general case, or is it more about detectinv readonly standbys as well? Or to flip that, would sending the transaction_read_only parameter be enough for the usecase in this thread, without having to invent a new variable?

(I haven't thought it through all the way, but figured I should mention the thought as I'm working through my email backlog.)

--

pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: [HACKERS] Measuring replay lag
Next
From: Erik Rijkers
Date:
Subject: Re: [HACKERS] bug/oversight in TestLib.pm and PostgresNode.pm