Hello is there anyone using pgbouncer
# spicedb
p
Hello, is there anyone using pgbouncer around here? I'm having some errors that seems to come from it + SpiceDB. Like:
2 UNKNOWN: unable to find revision: ERROR: prepared statement \"lrupsc_89_0\" does not exist (SQLSTATE 26000)
l
yes, we also ran into this using zalando's postgres operator and enabling the connection pooler. This uses pgbouncer. To fix the errors, you can also use a different mode for pgbouncer (when you use zalando's operator)
Copy code
connectionPooler:
    mode: session
or see https://www.pgbouncer.org/config.html#pool_mode. Otherwise I believe, the pgbouncer cleans up all prepared statements, causing those errors
v
opened https://github.com/authzed/spicedb/issues/1217 to explore adding pgbouncer tests and documenting configuration, we've honestly not tested it, so thanks @poulpi for reporting and @leonnicolas for sharing your fix!
s
I am trying to use pgbouncer as well. With tx pooling and default_query_exec_mode=simple_protocol I get gc errors straight away.
Copy code
{
  "level": "warn",
  "error": "error deleting in gc: unable to encode postgres.xid8{Uint64:0x1, Valid:true} into text format for unknown type (OID 0): cannot find encode plan",
  "next-attempt-in": 597.742967,
  "time": "2023-10-04T12:41:30Z",
  "message": "error attempting to perform garbage collection"
}
I am not sure session pooling is a good idea at all. Are there any recommendations for pgbouncer+spicedb?