Re: [PATCH v1] Add and report the new "in_hot_standby" GUC pseudo-variable.

From: "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>
To: 'Tom Lane' <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: 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>, Elvis Pranskevichus <elprans(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH v1] Add and report the new "in_hot_standby" GUC pseudo-variable.
Date: 2017-05-25 01:38:36
Message-ID: 0A3221C70F24FB45833433255569204D1F6FD499@G01JPEXMBYT05
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

From: pgsql-hackers-owner(at)postgresql(dot)org
> [mailto:pgsql-hackers-owner(at)postgresql(dot)org] On Behalf Of Tom Lane
> I didn't look at exactly how you tried to do that, but GUCs whose values
> depend on other GUCs generally don't work well at all.

transaction_read_only and transaction_isolation depends on default_transaction_read_only and default_transaction_isolation respectively. But I feel you are concerned about something I'm not aware of. Could you share your worries? I haven't found a problem so far.

> >> * Its value is false during recovery.
> [ scratches head... ] Surely this should read as "true" during recovery?

Ouch, you are right.

> Also, what happens if the standby server goes live mid-session?

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.

Takayuki Tsunakawa

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2017-05-25 01:41:10 Re: Create subscription with `create_slot=false` and incorrect slot name
Previous Message Robert Haas 2017-05-25 01:36:29 Re: pg_dump ignoring information_schema tables which used in Create Publication.