From: | Elvis Pranskevichus <elprans(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Cc: | 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-18 19:01:42 |
Message-ID: | 1610850.8GvGs1Lbrr@hammer.magicstack.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Saturday, March 18, 2017 3:33:16 AM EDT Michael Paquier wrote:
> On Sat, Mar 18, 2017 at 2:56 AM, Elvis Pranskevichus
<elprans(at)gmail(dot)com> wrote:
> > Currently, clients wishing to know when the server exits hot standby
> > have to resort to polling, which is often suboptimal.
> >
> > This adds the new "in_hot_standby" GUC variable that is reported via
> > a>
> > ParameterStatus message. This allows the clients to:
> > (a) know right away that they are connected to a server in hot
> >
> > standby; and
> >
> > (b) know immediately when a server exits hot standby.
> >
> > This change will be most beneficial to various connection pooling
> > systems (pgpool etc.)
>
> 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.
Elvis
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2017-03-18 19:46:18 | Re: [PATCH] Use $ parameters as replacement characters for pg_stat_statements |
Previous Message | Petr Jelinek | 2017-03-18 18:30:01 | Re: PoC plpgsql - possibility to force custom or generic plan |