From 15747fad54405d60d5da2c5a5f97f29fa5146c5d Mon Sep 17 00:00:00 2001 From: Cam Saul <cammsaul@gmail.com> Date: Mon, 8 Apr 2019 17:23:41 -0700 Subject: [PATCH] Fix too much logging on query cancelation :wrench: --- src/metabase/async/api_response.clj | 2 +- src/metabase/driver/sql_jdbc/execute.clj | 2 +- src/metabase/query_processor.clj | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/metabase/async/api_response.clj b/src/metabase/async/api_response.clj index 881d192a9ff..506d63511df 100644 --- a/src/metabase/async/api_response.clj +++ b/src/metabase/async/api_response.clj @@ -51,7 +51,7 @@ (.flush out) true (catch EofException e - (log/debug e (u/format-color 'yellow (trs "connection closed, canceling request"))) + (log/debug (u/format-color 'yellow (trs "connection closed, canceling request"))) false) (catch Throwable e (log/error e (trs "Unexpected error writing keepalive characters")) diff --git a/src/metabase/driver/sql_jdbc/execute.clj b/src/metabase/driver/sql_jdbc/execute.clj index 8a86ac8687c..105f52f4516 100644 --- a/src/metabase/driver/sql_jdbc/execute.clj +++ b/src/metabase/driver/sql_jdbc/execute.clj @@ -181,7 +181,7 @@ ;; we can give up on the query running in the future @query-future) (catch InterruptedException e - (log/warn e (tru "Client closed connection, cancelling query")) + (log/warn (tru "Client closed connection, canceling query")) ;; This is what does the real work of canceling the query. We aren't checking the result of ;; `query-future` but this will cause an exception to be thrown, saying the query has been cancelled. (.cancel stmt) diff --git a/src/metabase/query_processor.clj b/src/metabase/query_processor.clj index 4794a3fbead..74b1c16afda 100644 --- a/src/metabase/query_processor.clj +++ b/src/metabase/query_processor.clj @@ -300,7 +300,10 @@ (throw (ex-info (str (tru "Invalid response from database driver. No :status provided.")) query-result))) (when (= :failed (:status query-result)) - (log/warn (u/pprint-to-str 'red query-result)) + (if (= InterruptedException (:class query-result)) + (log/info (trs "Query canceled")) + (log/warn (trs "Query failure") + (u/pprint-to-str 'red query-result))) (throw (ex-info (str (get query-result :error (tru "General error"))) query-result)))) @@ -341,11 +344,8 @@ (let [result (process-query query)] (assert-query-status-successful result) (save-and-return-successful-query! query-execution result)) + ;; canceled query (catch Throwable e - (log/warn (u/format-color 'red (trs "Query failure") - (.getMessage e) - "\n" - (u/pprint-to-str (u/filtered-stacktrace e)))) (save-and-return-failed-query! query-execution e))))) (s/defn ^:private assoc-query-info [query, options :- mbql.s/Info] -- GitLab