Open JelteF opened 11 months ago
Prepared expressions are not supported in transaction
mode. That's probably the problem
They are supported. This is probably a bug we need to chase down.
Ran into some prepared statement issues myself.
To enable Prepared Statements you need to:
session
mode orprepared_statements_cache_size = {N}
to your config. prepared_statements_enabled
is not actually loaded from config.
It is set inside client.rs:
let transaction_mode = pool.settings.pool_mode == PoolMode::Transaction;
prepared_statements_enabled = transaction_mode && pool.prepared_statement_cache.is_some();
@levkk Happy to make a PR, but what should the expected behaviour be?
have some error to
pgcat --version: pgcat 1.1.2-dev4
my config:
[general]
host = "0.0.0.0"
port = 5433
enable_prometheus_exporter = false
prometheus_exporter_port = 9930
connect_timeout = 3000 # milliseconds
idle_timeout = 120 # milliseconds
server_lifetime = 86400000 # 24 hours
idle_client_in_transaction_timeout = 0 # milliseconds
healthcheck_timeout = 3000 # milliseconds
healthcheck_delay = 30000 # milliseconds
shutdown_timeout = 60000 # milliseconds
ban_time = 60 # seconds
log_client_connections = false
log_client_disconnections = false
autoreload = 15000
worker_threads = 16
tcp_keepalives_idle = 3
tcp_keepalives_count = 3
tcp_keepalives_interval = 3
server_tls = false
verify_server_certificate = false
admin_username = "myadmin"
admin_password = "myadminpass"
[pools.mypoll]
pool_mode = "transaction"
load_balancing_mode = "loc"
default_role = "any"
prepared_statements = true
prepared_statements_cache_size = 1000 # bytes?
query_parser_enabled = false
query_parser_read_write_splitting = false
primary_reads_enabled = true
sharding_function = "pg_bigint_hash"
idle_timeout = 40000
connect_timeout = 3000
[pools.mypoll.shards.0]
servers = [["127.0.0.1", 5432, "primary"]]
database = "mydb"
[pools.mypoll.users.0]
username = "mydb"
password = "mydbpass"
pool_size = 1000000
statement_timeout = 0
pgcat log
Jun 10 08:28:40 rvm24 pgcat[803656]: #033[2m2024-06-10T08:28:40.483554Z#033[0m #033[33m WARN#033[0m ThreadId(15) #033[2mpgcat#033[0m#033[2m:#033[0m Client disconnected with error SocketError("Error reading message code from socket - Error Kind(UnexpectedEof)")
Jun 10 08:28:51 rvm24 pgcat[803656]: #033[2m2024-06-10T08:28:51.883512Z#033[0m #033[33m WARN#033[0m ThreadId(18) #033[2mpgcat#033[0m#033[2m:#033[0m Client disconnected with error SocketError("Error reading message code from socket - Error Kind(UnexpectedEof)")
Jun 10 08:29:04 rvm24 pgcat[803656]: #033[2m2024-06-10T08:29:04.179101Z#033[0m #033[33m WARN#033[0m ThreadId(15) #033[2mpgcat#033[0m#033[2m:#033[0m Client disconnected with error SocketError("Error reading message code from socket - Error Kind(UnexpectedEof)")
Jun 10 08:29:17 rvm24 pgcat[803656]: #033[2m2024-06-10T08:29:17.081964Z#033[0m #033[33m WARN#033[0m ThreadId(15) #033[2mpgcat#033[0m#033[2m:#033[0m Client disconnected with error SocketError("Error reading message code from socket - Error Kind(UnexpectedEof)")
Jun 10 08:29:27 rvm24 pgcat[803656]: #033[2m2024-06-10T08:29:27.598001Z#033[0m #033[33m WARN#033[0m ThreadId(18) #033[2mpgcat#033[0m#033[2m:#033[0m Client disconnected with error SocketError("Error reading message code from socket - Error Kind(UnexpectedEof)")
Jun 10 08:29:30 rvm24 pgcat[803656]: #033[2m2024-06-10T08:29:30.970949Z#033[0m #033[33m WARN#033[0m ThreadId(18) #033[2mpgcat#033[0m#033[2m:#033[0m Client disconnected with error SocketError("Error reading message code from socket - Error Kind(UnexpectedEof)")
Jun 10 08:29:35 rvm24 pgcat[803656]: #033[2m2024-06-10T08:29:35.824437Z#033[0m #033[33m WARN#033[0m ThreadId(15) #033[2mpgcat#033[0m#033[2m:#033[0m Client disconnected with error SocketError("Error reading message code from socket - Error Kind(UnexpectedEof)")
Jun 10 08:29:58 rvm24 pgcat[803656]: #033[2m2024-06-10T08:29:58.641439Z#033[0m #033[33m WARN#033[0m ThreadId(18) #033[2mpgcat#033[0m#033[2m:#033[0m Client disconnected with error SocketError("Error reading message code from socket - Error Kind(UnexpectedEof)")
Jun 10 08:30:09 rvm24 pgcat[803656]: #033[2m2024-06-10T08:30:09.870358Z#033[0m #033[33m WARN#033[0m ThreadId(15) #033[2mpgcat#033[0m#033[2m:#033[0m Client disconnected with error SocketError("Error reading message code from socket - Error Kind(UnexpectedEof)")
Jun 10 08:30:15 rvm24 pgcat[803656]: #033[2m2024-06-10T08:30:15.022998Z#033[0m #033[33m WARN#033[0m ThreadId(15) #033[2mpgcat#033[0m#033[2m:#033[0m Client disconnected with error SocketError("Error reading message code from socket - Error Kind(UnexpectedEof)")
Jun 10 08:30:28 rvm24 pgcat[803656]: #033[2m2024-06-10T08:30:28.515409Z#033[0m #033[33m WARN#033[0m ThreadId(18) #033[2mpgcat#033[0m#033[2m:#033[0m Client disconnected with error SocketError("Error reading message code from socket - Error Kind(UnexpectedEof)")
Jun 10 08:30:33 rvm24 pgcat[803656]: #033[2m2024-06-10T08:30:33.695416Z#033[0m #033[33m WARN#033[0m ThreadId(18) #033[2mpgcat#033[0m#033[2m:#033[0m Client disconnected with error SocketError("Error reading message code from socket - Error Kind(UnexpectedEof)")
posrgresql 14 log so clear
2024-06-10 08:06:51.568 UTC [803554] LOG: starting PostgreSQL 14.12 (Ubuntu 14.12-0ubuntu0.22.04.1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, 64-bit
2024-06-10 08:06:51.568 UTC [803554] LOG: listening on IPv4 address "0.0.0.0", port 5432
2024-06-10 08:06:51.568 UTC [803554] LOG: listening on IPv6 address "::", port 5432
2024-06-10 08:06:51.581 UTC [803554] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2024-06-10 08:06:51.606 UTC [803555] LOG: database system was shut down at 2024-06-10 08:06:46 UTC
2024-06-10 08:06:51.639 UTC [803554] LOG: database system is ready to accept connections
https://www.postgresql.org/docs/current/runtime-config-resource.html#GUC-MAX-PREPARED-TRANSACTIONS
maybe in pg max_prepared_transactions default is 0 (disabled) ?
udp: set max_prepared_transactions = 1024 in pg conf not supported - pgcat error in log dnt disappeared.
udp1: new errors
Jun 10 11:34:12 rvm24 pgcat[805450]: #033[2m2024-06-10T11:34:12.626533Z#033[0m #033[32m INFO#033[0m ThreadId(07) #033[2mpgcat::server::cleanup#033[0m#033[2m:#033[0m Server returned with session state altered, discarding state (SET: true, PREPARE: false) for application pgcat
Jun 10 11:34:12 rvm24 pgcat[805450]: #033[2m2024-06-10T11:34:12.670471Z#033[0m #033[32m INFO#033[0m ThreadId(07) #033[2mpgcat::server::cleanup#033[0m#033[2m:#033[0m Server returned with session state altered, discarding state (SET: true, PREPARE: false) for application pgcat
Jun 10 11:34:12 rvm24 pgcat[805450]: #033[2m2024-06-10T11:34:12.760395Z#033[0m #033[32m INFO#033[0m ThreadId(07) #033[2mpgcat::server::cleanup#033[0m#033[2m:#033[0m Server returned with session state altered, discarding state (SET: true, PREPARE: false) for application pgcat
I am unable to reproduce this issue on the latest main
. @makegodhere / @tobyhede can you checkout main and run and try to reproduce this issue? if the failure is still happening, please provide me with reproduction steps.
šāāļø
Describe the bug Running pgbench with multiple commands outside of a transaction with prepared statements fails.
To Reproduce Use the minimal config from the repo, but add
prepared_statements = true
.Expected behavior Not throw an error.
Actual behaviour