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

Added the transparent mode #600

Draft
wants to merge 18 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ itertools = "0.10"
clap = { version = "4.3.1", features = ["derive", "env"] }
tracing = "0.1.37"
tracing-subscriber = { version = "0.3.17", features = ["json", "env-filter", "std"]}
uuid = { version = "1.4.1", features = ["v4"] }

[target.'cfg(not(target_env = "msvc"))'.dependencies]
jemallocator = "0.5.0"
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ PostgreSQL pooler and proxy (like PgBouncer) with support for sharding, load bal
|-------------|------------|--------------|
| Transaction pooling | **Stable** | Identical to PgBouncer with notable improvements for handling bad clients and abandoned transactions. |
| Session pooling | **Stable** | Identical to PgBouncer. |
| Transparent pooling | **Stable** | A new pooling mechanism that enables transparent (distributed) transactions. |
| Multi-threaded runtime | **Stable** | Using Tokio asynchronous runtime, the pooler takes advantage of multicore machines. |
| Load balancing of read queries | **Stable** | Queries are automatically load balanced between replicas and the primary. |
| Failover | **Stable** | Queries are automatically rerouted around broken replicas, validated by regular health checks. |
Expand Down Expand Up @@ -145,6 +146,9 @@ In transaction mode, a client talks to one server for the duration of a single t

This mode is enabled by default.

### Transparent mode
In transparent mode, a client talks to one or more servers for the duration of a single transaction; once it's over, the servers are returned to the pool. `SET SHARD` and `SET SHARDING KEY` statements **are** supported, but prepared statements, other `SET` statements and advisory locks **are not** supported.

### Load balancing of read queries
All queries are load balanced against the configured servers using either the random or least open connections algorithms. The most straightforward configuration example would be to put this pooler in front of several replicas and let it load balance all queries.

Expand Down
4 changes: 1 addition & 3 deletions pgcat.toml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ result = [
# Pool mode (see PgBouncer docs for more).
# `session` one server connection per connected client
# `transaction` one server connection per client transaction
pool_mode = "transaction"
pool_mode = "transparent"

# Load balancing mode
# `random` selects the server at random
Expand Down Expand Up @@ -280,8 +280,6 @@ username = "sharding_user"
# if `server_password` is not set.
password = "sharding_user"

pool_mode = "transaction"

# PostgreSQL username used to connect to the server.
# server_username = "another_user"

Expand Down
Loading