diff --git a/src/metabase/driver/mysql/ddl.clj b/src/metabase/driver/mysql/ddl.clj index 6086ca0c76dbd00638280a6edfa0f31ab0c0ca3b..be38b455cf3211ff17d0ebee09279b549cf008c1 100644 --- a/src/metabase/driver/mysql/ddl.clj +++ b/src/metabase/driver/mysql/ddl.clj @@ -68,7 +68,7 @@ ;; That is ok, the persisted-info will be marked inactive and the next refresh will try again. (execute-with-timeout! conn db-spec - (.toMillis (t/seconds 30)) + (.toMillis (t/minutes 10)) (into [(sql.ddl/create-table-sql database definition query)] params)) {:state :success}))) diff --git a/test/metabase/driver/mysql_test.clj b/test/metabase/driver/mysql_test.clj index 10c84b3e3633054b4cd22919a16eec211ba1be58..72251cb8df10083d8345fe3bca080548c36c2fde 100644 --- a/test/metabase/driver/mysql_test.clj +++ b/test/metabase/driver/mysql_test.clj @@ -613,24 +613,17 @@ (mt/db) (t2/select-one Table :db_id (mt/id) :name "bigint-and-bool-table"))))))))) -(deftest ddl-execute-with-timeout-test1 - (mt/test-driver :mysql - (mt/dataset json - (let [db-spec (sql-jdbc.conn/db->pooled-connection-spec (mt/db))] - (is (thrown-with-msg? - Exception - #"Killed mysql process id [\d,]+ due to timeout." - (#'mysql.ddl/execute-with-timeout! db-spec db-spec 10 ["select sleep(5)"]))))))) - (deftest ddl-execute-with-timeout-test (mt/test-driver :mysql (mt/dataset json (let [db-spec (sql-jdbc.conn/db->pooled-connection-spec (mt/db))] - (is (thrown-with-msg? - Exception - #"Killed mysql process id [\d,]+ due to timeout." - (#'mysql.ddl/execute-with-timeout! db-spec db-spec 10 ["select sleep(5)"]))) - (is (some? (#'mysql.ddl/execute-with-timeout! db-spec db-spec 5000 ["select sleep(0.1) as val"]))))))) + (testing "When the query takes longer that the timeout, it is killed." + (is (thrown-with-msg? + Exception + #"Killed mysql process id [\d,]+ due to timeout." + (#'mysql.ddl/execute-with-timeout! db-spec db-spec 10 ["select sleep(5)"])))) + (testing "When the query takes less time than the timeout, it is successful." + (is (some? (#'mysql.ddl/execute-with-timeout! db-spec db-spec 5000 ["select sleep(0.1) as val"])))))))) (deftest syncable-schemas-test (mt/test-driver :mysql