On Sat, Jul 11, 2026 at 4:16 AM Jelte Fennema-Nio <[email protected]> wrote: > This is a redesign of the previous GoAway proposal[4] but this time > *without making any protocol changes*:
Hi, I think this is a good idea. At the risk of making you crazy, I think the previous proposal of making this a protocol extension i.e. _pq_.goaway=1, was superior, because these disadvantages are real: > Two notes of suboptimal behavior: > 1. Proxies using this to report their own shutdown will cause the value > of the ParameterStatus to be different than the value that > "SHOW disconnect_requested" reports, unless they also intercept those > queries. > 2. Right now the ParameterStatus is only sent at completion of a query, > not while a connection is idle. It'd be better if a connection pool > could check the current state of idle connections too, before handing > them off again. I'll address this in a follow-up commit once it's > agreed on that the general approach is sensible. If this works entirely at a protocol level, then there is no SHOW command that can give a conflicting view of the same state, and the message can be defined to be allowed at any point in the protocol stream. As you said on the GoAway thread, conceptually this is a link-level message. I think, in general, that you've given this the right semantics. Jacob mentioned in http://postgr.es/m/CAOYmi+mSn8xQ7ExqY07V6G2oFXN2nY+7f4yf_RV2=7xnckw...@mail.gmail.com/ asking or forcing clients to disconnect for security reasons, but that's really a different problem. This is basically just informing clients that the connection is being shut down, instead of not doing that and then being sad. AFAICS, the only real fly in the ointment here is whether clients adopt it. But the lovely thing is that even if only pgbouncer adopts it there is a meaningful gain, because pgbouncer can request this from the server and benefit from it even if the application clients don't ask for it from pgbouncer. That's pretty sweet. Compare that with something like SCRAM where we really needed every client to pick it up; AFAICT, they nearly all did, but that was a lot of work for a lot of people, and this is cool in that it doesn't require it. I quite agree with your statements elsewhere that smart shutdown is pretty dumb, and this would make it significantly less dumb. +1 for that. -- Robert Haas Databricks
