On Saturday, March 18, 2017 3:33:16 AM EDT Michael Paquier wrote: > On Sat, Mar 18, 2017 at 2:56 AM, Elvis Pranskevichus <elpr...@gmail.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 -- Sent via pgsql-hackers mailing list (email@example.com) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers