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

From Elvis Pranskevichus
Subject Re: [HACKERS] [PATCH v1] Add and report the new "in_hot_standby" GUC pseudo-variable.
Date
Msg-id 1572601.d6Y6hSXNBC@hammer.magicstack.net
Whole thread Raw
In response to Re: [HACKERS] [PATCH v1] Add and report the new "in_hot_standby"GUC pseudo-variable.  ("Tsunakawa, Takayuki" <tsunakawa.takay@jp.fujitsu.com>)
Responses Re: [HACKERS] [PATCH v1] Add and report the new "in_hot_standby" GUC pseudo-variable.
List pgsql-hackers
On Wednesday, May 24, 2017 9:38:36 PM EDT Tsunakawa, Takayuki wrote:
> The clients will know the change of session_read_only when they do
> something that calls RecoveryInProgress().  Currently,
> RecoveryInProgress() seems to be the only place where the sessions
> notice the promotion, so I set session_read_only to the value of
> default_transaction_read_only there.  I think that there is room for
> discussion here.  It would be ideal for the sessions to notice the
> server promotion promptly and notify the clients of the change.  I
> have no idea to do that well.

My original patch did that via the new SendSignalToAllBackends() helper,
which is called whenever the postmaster exits hot stanby.

I incorporated those bits into your patch and rebased in onto master.  
Please see attached.

FWIW, I think that mixing the standby status and the default 
transaction writability is suboptimal.  They are related, yes, but not 
the same thing.  It is possible to have a master cluster in the 
read-only mode, and with this patch it would be impossible to 
distinguish from a hot-standby replica without also polling 
pg_is_in_recovery(), which defeats the purpose of having to do no
database roundtrips.  

                                 Elvis

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachment

pgsql-hackers by date:

Previous
From: Arseny Sher
Date:
Subject: Re: [HACKERS] DROP SUBSCRIPTION hangs if sub is disabled in the same transaction
Next
From: Sokolov Yura
Date:
Subject: Re: [HACKERS] Small improvement to compactify_tuples