From: | Elvis Pranskevichus <elprans(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Cc: | "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>, 'Tom Lane' <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Craig Ringer <craig(at)2ndquadrant(dot)com>, Magnus Hagander <magnus(at)hagander(dot)net>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Michael Banck <michael(dot)banck(at)credativ(dot)de> |
Subject: | Re: [PATCH v1] Add and report the new "in_hot_standby" GUC pseudo-variable. |
Date: | 2017-09-12 15:48:28 |
Message-ID: | 1572601.d6Y6hSXNBC@hammer.magicstack.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
Attachment | Content-Type | Size |
---|---|---|
session-read-only.patch | text/x-patch | 21.2 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Sokolov Yura | 2017-09-12 15:49:01 | Re: Small improvement to compactify_tuples |
Previous Message | Arseny Sher | 2017-09-12 15:48:18 | Re: DROP SUBSCRIPTION hangs if sub is disabled in the same transaction |