-
-
Notifications
You must be signed in to change notification settings - Fork 197
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
PgBouncer and prepared statements #269
Comments
Hi @danmaz74. Thanks for opening the issue. I believe the underlying issue you're experiencing is an incompatibility with PgBouncer's transaction-mode. I'm planning to add this to the readme; your feedback is invaluable: PgBouncer compatibilityGoodJob is not compatible with PgBouncer in transaction mode. GoodJob uses connection-based advisory locks and requires a dedicated database connection for the duration of a job's execution. With Rails 6.0's support for multiple databases, a direct connection to the database can be configured.
|
Thanks a lot @bensheldon for the in-depth answer and quick turnaround. I just checked and found out that transaction pooling mode is also incompatible with listen/notify, which is also needed by good_job from what I read: https://www.pgbouncer.org/features.html I'll check with our SRE team if having a direct connection for good_job is an option. Definitely a good idea to add it to the readme :) |
I added these details to the Readme. Happy to continue the conversation. |
I'm testing the integration of good_job into a project where we use PgBouncer in transaction mode, and we've got this configuration in db.rb:
config['prepared_statements'] = false
When trying to run a job with this configuration, I get this error:
PG::ProtocolViolation: ERROR: bind message supplies 0 parameters, but prepared statement "" requires 2
from the query executed by advisory_lock in lockable.rb
The same works if I change the config to prepared_statements = true
I didn't find anything with a search in the project issues, and I'm wondering if good_job is compatible with this setting; if not, I'm wondering if it wouldn't be worth it to make it compatible (either by default, or with some specialised code as it's already done - with a simpler case - in pg_or_jdbc_query).
The text was updated successfully, but these errors were encountered: