Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Revert "Do a rollback before discard all (#69026)" (#69633)

Nathan Voxland45a8927bb8f4
diff --git a/src/metabase/app_db/connection_pool_setup.clj b/src/metabase/app_db/connection_pool_setup.clj
index 4e70b4a62e4..f36bc24ffac 100644
--- a/src/metabase/app_db/connection_pool_setup.clj
+++ b/src/metabase/app_db/connection_pool_setup.clj
@@ -4,7 +4,6 @@
[java-time.api :as t]
[metabase.config.core :as config]
[metabase.connection-pool :as connection-pool]
- [metabase.util.log :as log]
[metabase.util.malli :as mu]
[metabase.util.malli.schema :as ms]
[potemkin :as p])
@@ -45,13 +44,8 @@
;; https://metaboat.slack.com/archives/C05MPF0TM3L/p1748538414384029?thread_ts=1748507464.051999&cid=C05MPF0TM3L for
;; rationale behind why we're doing it -- Cam
(when (postgres-connection? connection)
- (try
- (with-open [stmt (.createStatement connection)]
- (.execute stmt "ROLLBACK")
- (.execute stmt "DISCARD ALL;"))
- (catch Exception e
- (log/warn e "Failed to DISCARD ALL on connection check-in; connection will be destroyed")
- (throw e)))))
+ (with-open [stmt (.createStatement connection)]
+ (.execute stmt "DISCARD ALL;"))))
(defn- on-check-out [_connection]
(reset! latest-activity (t/offset-date-time)))
@@ -143,15 +137,6 @@
;; 15 is the c3p0 default but it's always nice to be explicit in case that changes
15)
- ;; Validate connections before handing them out. If DISCARD ALL killed a connection (e.g., because the PostgreSQL
- ;; server's default parameters differ from what the JDBC driver expects), this ensures the dead connection is
- ;; discarded and replaced before application code sees it.
- ;;
- ;; https://www.mchange.com/projects/c3p0/#testConnectionOnCheckout
- ;;
- "testConnectionOnCheckout"
- true
-
"unreturnedConnectionTimeout"
(or (config/config-int :mb-application-db-unreturned-connection-timeout)
;; we set an unreturnedConnectionTimeout for data warehouses, via