Re: PostgreSQL shutdown modes
On Sat, Apr 2, 2022 at 9:39 AM wrote: > I've waited for April 2nd to submit this comment, but it seemed to me > that the > suggestion about the first-pass checkpoint in 'slow' mode is a > no-foolin' good one. Yeah. While the patch itself is mostly in jest, everything I wrote in the email is unfortunately pretty much 100% accurate, no fooling. I think it would be worth doing a number of things: - Provide some way of backing out of smart shutdown mode. - Provide some way of making a smart shutdown turn into a fast shutdown after a configurable period of time. - Do a preparatory checkpoint before the real shutdown checkpoint especially in fast mode, but maybe also in smart mode. Maybe there's some even smarter thing we could be doing here, not sure what exactly. - Consider renaming "immediate" mode, maybe to "crash" or something. Oracle uses "abort". > Then I wondered whether there could be an option to accompany the 'dumb' > mode that > would take a WHERE clause, to be implicitly applied to pg_stat_activity, > whose > purpose would be to select those sessions that are ok to evict without > waiting for > them to exit. It could recognize, say, backend connections in no current > transaction > that are from your pesky app or connection pooler that holds things > open. It could > also, for example, select things in transaction state but where > current_timestamp - state_change > '5 minutes' (so it would be > re-evaluated every > so often until ready to shut down). Seems like this might be better done in user-space than hard-coded into the server behavior. -- Robert Haas EDB: http://www.enterprisedb.com
Re: PostgreSQL shutdown modes
At Sat, 2 Apr 2022 11:58:55 +0900, Michael Paquier wrote in > On Fri, Apr 01, 2022 at 01:22:05PM -0400, Robert Haas wrote: > > I attach herewith a modest patch to rename these shutdown modes to > > more accurately correspond to their actual characteristics. > > > > Date: Fri, 1 Apr 2022 12:50:05 -0400 > > I love the idea. Just in time, before the feature freeze deadline. FWIW, this came in to my mailbox with at "4/2 2:22 JST":p regards. -- Kyotaro Horiguchi NTT Open Source Software Center
Re: PostgreSQL shutdown modes
On 2022-04-01 13:22, Robert Haas wrote: I attach herewith a modest patch to rename these shutdown modes to more accurately correspond to their actual characteristics. I've waited for April 2nd to submit this comment, but it seemed to me that the suggestion about the first-pass checkpoint in 'slow' mode is a no-foolin' good one. Then I wondered whether there could be an option to accompany the 'dumb' mode that would take a WHERE clause, to be implicitly applied to pg_stat_activity, whose purpose would be to select those sessions that are ok to evict without waiting for them to exit. It could recognize, say, backend connections in no current transaction that are from your pesky app or connection pooler that holds things open. It could also, for example, select things in transaction state but where current_timestamp - state_change > '5 minutes' (so it would be re-evaluated every so often until ready to shut down). For conciseness (and sanity), maybe the WHERE clause could be implicitly applied, not to pg_stat_activity directly, but to a (virtual or actual) view that has already been restricted to client backend sessions, and already has a column for current_timestamp - state_change. Regards, -Chap
Re: PostgreSQL shutdown modes
+1 for the idea of changing the name, as it's really confusing. I had quick check in the patch and noticed below replacements: -#define SmartShutdown 1 -#define FastShutdown 2 -#define ImmediateShutdown 3 +#define DumbShutdown 1 +#define SlowShutdown 2 +#define CrappyShutdown 3 About the new naming, if "Crappy" can be replaced with something else. But was not able to come up with any proper suggestions here. Or may be "Immediate" is appropriate, as here it's talking about a "Shutdown" operation. On Sat, Apr 2, 2022 at 8:29 AM Michael Paquier wrote: > On Fri, Apr 01, 2022 at 01:22:05PM -0400, Robert Haas wrote: > > I attach herewith a modest patch to rename these shutdown modes to > > more accurately correspond to their actual characteristics. > > > > Date: Fri, 1 Apr 2022 12:50:05 -0400 > > I love the idea. Just in time, before the feature freeze deadline. > -- > Michael > -- Rushabh Lathia
Re: PostgreSQL shutdown modes
On Fri, Apr 01, 2022 at 01:22:05PM -0400, Robert Haas wrote: > I attach herewith a modest patch to rename these shutdown modes to > more accurately correspond to their actual characteristics. > > Date: Fri, 1 Apr 2022 12:50:05 -0400 I love the idea. Just in time, before the feature freeze deadline. -- Michael signature.asc Description: PGP signature
Re: PostgreSQL shutdown modes
Isn't this missing support in pg_dumb ?