-
Notifications
You must be signed in to change notification settings - Fork 524
Support replication connections through PgBouncer #876
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
186c1e1 to
dff7db4
Compare
42102ac to
1a3c5fb
Compare
Moreover, replication connections cannot be reliably reused at all. Attempting to do so will lead to various mysteries like in wal sender code. Wal sender implicitly assumes that it works with one wal receiver. |
1a3c5fb to
fe7aee9
Compare
Thanks. I updated the wording in the PR to include that. |
7229637 to
422923a
Compare
c556d96 to
8a69366
Compare
aee39a6 to
c697684
Compare
|
Isn't the cancel key change a requirement to this feature? I suggest you to create a separate commit for it. |
Ops... I realized that you did it. Another suggestion is to explain in the commit message that it is a requirement for this feature. |
c936ee2 to
d6b65d1
Compare
I added a commit message and moved it before the actual replication change, but while doing that I realized I thought the change was special enough to warrant its own PR, so I made a new one: #945 |
ddb1721 to
804ec1d
Compare
804ec1d to
9bef95a
Compare
0756a88 to
55f8cc4
Compare
55f8cc4 to
4d190c7
Compare
d58be88 to
f259bd1
Compare
f3e82ef to
c17ba04
Compare
In session pooling mode PgBouncer is pretty much a transparent proxy, i.e. the client does normally not even need to know that PgBouncer is in the middle. This allows things like load balancing and failovers without the client needing to know about this at all. But as soon as replication connections are needed, this was not possible anymore, because PgBouncer would reject those instead of proxying them to the right server. This PR fixes that by also proxying replication connections. They are handled pretty differently from normal connections though. A client and server replication connection will form a strong pair, as soon as one is closed the other is closed too. So, there's no caching of the server replication connections, like is done for regular connections. Reusing replication connections comes with a ton of gotchas. Postgres will throw errors in many cases when trying to do so. So simply not doing it seems like a good tradeoff for ease of implementation. Especially because replication connections are pretty much always very long lived. So re-using them gains pretty much no performance benefits. Fixes pgbouncer#382
c17ba04 to
d7e067d
Compare
In session pooling mode PgBouncer is pretty much a transparent proxy,
i.e. the client does normally not even need to know that PgBouncer is in
the middle. This allows things like load balancing and failovers without
the client needing to know about this at all. But as soon as replication
connections are needed, this was not possible anymore, because PgBouncer
would reject those instead of proxying them to the right server.
This PR fixes that by also proxying replication connections. They are
handled pretty differently from normal connections though. A client and
server replication connection will form a strong pair, as soon as one is
closed the other is closed too. So, there's no caching of the server
replication connections, like is done for regular connections. Reusing
replication connections comes with a ton of gotchas. Postgres will
throw errors in many cases when trying to do so. So simply not
doing it seems like a good tradeoff for ease of implementation.
Especially because replication connections are pretty much always
very long lived. So re-using them gains pretty much no performance
benefits.
Fixes #382
Depends on #945