-
Notifications
You must be signed in to change notification settings - Fork 492
Improve connection fail fast logic #998
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thanks a lot for looking into it! |
052e7a6
to
e366f63
Compare
For a very long time, we've had logic to quickly close all clients when the a server could not be connected to. This wasn't working correctly in all cases, one of those was when an auth_user was set (and no auth_db). This was reported in pgbouncer#989. While looking closer into that issue I realized it also wouldn't handle cases where first connecting worked but then after a while it doesn't anymore, because it relied only on `wait_for_welcome`. It's not strictly necessary to kill all waiting connections when creating new server connections is not possible anymore, as long as there are still working server connections. But if those don't exist either, then we're effectively in the same state as complete refresh (except that we have cached the welcome message). Fixes pgbouncer#989 Fixes pgbouncer#985 Co-Authored-By: Anna Khanova <annakhanova@neon.tech>
e366f63
to
171ec14
Compare
kill_pool_logins_server_error(server->pool, pkt); | ||
else | ||
log_server_error("S: login failed", pkt); | ||
kill_pool_logins_server_error(server->pool, pkt); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why to remove the below log?
log_server_error("S: login failed", pkt);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We now always call kill_pool_logins_server_error
and that already logs the error using:
log_warning("server login failed: %s %s", level, msg);
(it's a warning not an error this time, but that seems like a not very important change)
Changes look fine to me. |
## Problem Update pgbouncer from 1.21 (and patches[0][1]) to 1.22 (which includes these patches) - [0] pgbouncer/pgbouncer#972 - [1] pgbouncer/pgbouncer#998 ## Summary of changes - Build pgbouncer 1.22.0 for neonVMs from upstream
For a very long time, we've had logic to quickly close all clients when
the a server could not be connected to.
This wasn't working correctly in all cases, one of those was when an
auth_user
was set (and noauth_db
). This was reported in #989.While looking closer into that issue I realized it also wouldn't handle
cases where first connecting worked but then after a while it doesn't
anymore, because it relied only on
wait_for_welcome
. It's not strictlynecessary to kill all waiting connections when creating new server
connections is not possible anymore, as long as there are still working
server connections. But if those don't exist either, then we're
effectively in the same state as complete refresh (except that we have
cached the welcome message).
Fixes #989
Fixes #985