Skip to content
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

Add support of dedicated backends #10506

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Add support of dedicated backends #10506

wants to merge 6 commits into from

Conversation

knizhnik
Copy link
Contributor

@knizhnik knizhnik commented Jan 25, 2025

Problem

We are now going to provide connection pooling by default:

https://neondb.slack.com/archives/C04DGM6SMTM/p1737726792110159

The problem is that connections pooler in transactions or statement mode doesn't preserve session semantic.
It means that Postgres applications using

  • GUCs
  • temporary tables
  • advisory locks
  • sequence access functions (currval, nextval)
    will not work.

Summary of changes

We can still provide connection pooling by default, but enforce dedicated backends at Postgres level. In pgbouncer we are using transaction pooler mode. It means that pgbouncer will not reschedule backend to some other session until ned of transaction. End of transaction is determined by pgbouncer by backend status in ReadyForQuery message ('T' - transaction, 'I' - idle). We can add some checks to Postgres (I already done in in my pooler and it affects only very few places in Postgres core) which detects if connection need to preserve session semantic.
In this case we will always return 'T' status in ReadyForQuery message, preventing pgbouncer from reusing our backend.

See neondatabase/postgres#571

@knizhnik knizhnik requested a review from a team as a code owner January 25, 2025 12:31
@knizhnik knizhnik requested review from hlinnaka and ololobus January 25, 2025 12:31
Copy link

github-actions bot commented Jan 25, 2025

7403 tests run: 7016 passed, 0 failed, 387 skipped (full report)


Flaky tests (2)

Postgres 17

Code coverage* (full report)

  • functions: 33.5% (8498 of 25347 functions)
  • lines: 49.3% (71497 of 144978 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
2ce2fac at 2025-01-27T07:03:41.115Z :recycle:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant