Skip to content

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

Skip cancelation on closed statements (#72477)

metambenaae297a31783
diff --git a/src/metabase/driver/sql_jdbc/execute.clj b/src/metabase/driver/sql_jdbc/execute.clj
index ae97a46c20a..78d6c2e0352 100644
--- a/src/metabase/driver/sql_jdbc/execute.clj
+++ b/src/metabase/driver/sql_jdbc/execute.clj
@@ -814,12 +814,13 @@
;; TODO: Following `when` is in place just to find out if vertica is flaking because of cancelations.
;; It should be removed afterwards!
(when-not (= :vertica driver)
- (try (.cancel stmt)
+ (try (when-not (.isClosed stmt)
+ (.cancel stmt))
(catch SQLFeatureNotSupportedException _
(log/warnf "Statemet's `.cancel` method is not supported by the `%s` driver."
(name driver)))
- (catch Throwable _
- (log/warn "Statement cancelation failed.")))))))))))))
+ (catch Throwable e
+ (log/info e "Statement cancelation failed.")))))))))))))
(defn reducible-query
"Returns a reducible collection of rows as maps from `db` and a given SQL query. This is similar to [[jdbc/reducible-query]] but reuses the