brokenjacobs opened a new issue, #32590:
URL: https://github.com/apache/airflow/issues/32590

   ### Official Helm Chart version
   
   1.10.0 (latest released)
   
   ### Apache Airflow version
   
   2.6.2
   
   ### Kubernetes Version
   
   v1.26.5-gke.1200
   
   ### Helm Chart configuration
   
   values.pgbouncer.enabled: true
   workers.keda.enabled: true
   
   And configure a postgres database of any sort.
   
   ### Docker Image customizations
   
   _No response_
   
   ### What happened
   
   If KEDA is enabled in the helm chart, and pgbouncer is also enabled, KEDA 
will be configured to use the connection string from the worker pod to connect 
to the postgres database. That means it will connect to pgbouncer. Pgbouncer is 
configured in transaction pool mode according to the secret:
   [pgbouncer]
   pool_mode = transaction
   
   And it appears that KEDA uses prepared statements in it's queries to 
postgres, resulting in numerous repeated errors in the KEDA logs:
   ```
   2023-07-13T18:21:35Z ERROR   postgresql_scaler       could not query 
postgreSQL: ERROR: prepared statement "stmtcache_47605" does not exist 
(SQLSTATE 26000) {"type": "ScaledObject", "namespace": "airflow-sae-int", 
"name": "airflow-sae-int-worker", "error": "ERROR: prepared statement 
\"stmtcache_47605\" does not exist (SQLSTATE 26000)"}
   ```
   
   Now KEDA still works, as it does the query again without the prepared 
statement, but this is not ideal and results in a ton of error logging. 
   
   
   ### What you think should happen instead
   
   
   I suggest having the KEDA connection go direct to the upstream configured 
postgresql server, as it's only one connection, instead of using pgbouncer. 
   
   ### How to reproduce
   
   Enabled KEDA for workers, and pgbouncer at the same time. 
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to