From: | Elvis Pranskevichus <elprans(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Cc: | Jaime Casanova <jaime(dot)casanova(at)2ndquadrant(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
Subject: | Re: [PATCH v1] Add and report the new "in_hot_standby" GUC pseudo-variable. |
Date: | 2017-03-22 18:27:12 |
Message-ID: | 4476051.LHuCsbPn2V@hammer.magicstack.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wednesday, March 22, 2017 2:17:27 PM EDT Jaime Casanova wrote:
> On 18 March 2017 at 14:01, Elvis Pranskevichus <elprans(at)gmail(dot)com> wrote:
> > On Saturday, March 18, 2017 3:33:16 AM EDT Michael Paquier wrote:
> >> Why adding a good chunk of code instead of using
> >> pg_is_in_recovery(),
> >> which switches to false once a server exits recovery?
> >
> > That requires polling the database continuously, which may not be
> > possible or desirable.
> >
> > My main motivation here is to gain the ability to manage a pool of
> > connections in asyncpg efficiently. A part of the connection
> > release
> > protocol is "UNLISTEN *;", which the server in Hot Standby would
> > fail to process. Polling the database for pg_is_in_recovery() is
> > not feasible in this case, unfortunately.
>
> Sorry, i still don't understand the motivation for this.
> At one point you're going to poll for the value of the GUC in
> pg_settings, no? Or how are you going to know the current value of
> the GUC that makes it different to just poll for pg_is_in_recovery()?
It is marked as GUC_REPORT and is reported by the server on
connection and on every change:
https://www.postgresql.org/docs/current/static/protocol-flow.html#PROTOCOL-ASYNC
Elvis
From | Date | Subject | |
---|---|---|---|
Next Message | Fujii Masao | 2017-03-22 18:44:33 | Re: PATCH: Make pg_stop_backup() archive wait optional |
Previous Message | Jaime Casanova | 2017-03-22 18:17:27 | Re: [PATCH v1] Add and report the new "in_hot_standby" GUC pseudo-variable. |