-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HOLY GRAIL OF PRs UNBLOCK PARALLEL-TEST-SAFE SETTINGS!!!!!!!!!!!1 MASSIVE TEST PERFORMANCE IMPROVEMENT!!!!! #42194
base: master
Are you sure you want to change the base?
Changes from 14 commits
623b3f2
3d04283
f74e280
ca87f11
669ce1a
1a544fd
831353a
3c67d94
3de56f7
2646efe
c887722
77adf12
ceb7498
c553f17
8cbad9a
08312a5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -458,10 +458,6 @@ | |
" */ " | ||
(qp.util/default-query->remark query))) | ||
|
||
(defmethod sql-jdbc.execute/set-parameter [:redshift java.time.ZonedDateTime] | ||
[driver ps i t] | ||
(sql-jdbc.execute/set-parameter driver ps i (t/sql-timestamp (t/with-zone-same-instant t (t/zone-id "UTC"))))) | ||
Comment on lines
-461
to
-463
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is actually unused as of a few days ago but I forgot to remove it |
||
|
||
(defmethod driver/upload-type->database-type :redshift | ||
[_driver upload-type] | ||
(case upload-type | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -577,10 +577,10 @@ | |
(mt/defdataset dst-change | ||
[["dst_tz_test" [{:field-name "dtz" | ||
:base-type :type/DateTimeWithTZ}] | ||
[["2023-09-30 23:59:59 +1000"] ; September | ||
["2023-10-01 00:00:00 +1000"] ; October before DST starts | ||
["2023-10-01 05:00:00 +1100"] ; October after DST starts | ||
["2023-11-01 05:00:00 +1100"]]]]) ; November | ||
[["2023-09-30 23:59:59 +1000"] ; September | ||
["2023-10-01 00:00:00 +1000"] ; October before DST starts | ||
["2023-10-01 05:00:00 +1100"] ; October after DST starts | ||
["2023-11-01 05:00:00 +1100"]]]]) ; November | ||
|
||
(deftest date-bucketing-test | ||
(testing "#37065" | ||
|
@@ -593,8 +593,8 @@ | |
(lib/breakout dtz) | ||
(lib/aggregate (lib/count)))] | ||
(mt/with-native-query-testing-context query | ||
(is (= [["2023-09-30T00:00:00+10:00" 1] | ||
["2023-10-01T00:00:00+10:00" 2] | ||
["2023-11-01T00:00:00+11:00" 1]] | ||
(mt/with-temporary-setting-values [report-timezone "Australia/Sydney"] | ||
(mt/with-temporary-setting-values [report-timezone "Australia/Sydney"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
(is (= [["2023-09-30T00:00:00+10:00" 1] | ||
["2023-10-01T00:00:00+10:00" 2] | ||
["2023-11-01T00:00:00+11:00" 1]] | ||
(mt/rows (qp/process-query query))))))))))) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -220,6 +220,18 @@ For setting the maximum, see [MB_APPLICATION_DB_MAX_CONNECTION_POOL_SIZE](#mb_ap | |
[database] | ||
(set-pool! (u/the-id database) nil nil)) | ||
|
||
(defn invalidate-pool-for-db-if-needed! | ||
"Invalidate the connection pool for the given database if the connection details have changed." | ||
[database] | ||
(when-let [old-hash (get @database-id->jdbc-spec-hash (u/the-id database))] | ||
(let [new-hash (jdbc-spec-hash database)] | ||
(log/tracef "Maybe invalidating connection pool for %s... old hash: %s, new hash: %s" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This feels like it should log "Invalidating" / "Not invalidating" based on the |
||
(pr-str (select-keys database [:id :name :engine])) | ||
(pr-str old-hash) | ||
(pr-str new-hash)) | ||
(when-not (= old-hash new-hash) | ||
(invalidate-pool-for-db! database))))) | ||
|
||
(defn- log-ssh-tunnel-reconnect-msg! [db-id] | ||
(log/warn (u/format-color :red "ssh tunnel for database %s looks closed; marking pool invalid to reopen it" db-id)) | ||
nil) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -181,7 +181,7 @@ | |
;; default method for Postgres not covered by any [driver jdbc-type] methods | ||
(defmethod read-column-thunk :postgres | ||
...)" | ||
{:added "0.35.0", :arglists '([driver ^java.sql.ResultSet rs ^java.sql.ResultSetMetaData rsmeta i])} | ||
{:added "0.35.0", :arglists '([driver ^java.sql.ResultSet rs ^java.sql.ResultSetMetaData rsmeta ^Long i])} | ||
(fn [driver _rs ^ResultSetMetaData rsmeta ^Long col-idx] | ||
[(driver/dispatch-on-initialized-driver driver) (.getColumnType rsmeta col-idx)]) | ||
:hierarchy #'driver/hierarchy) | ||
|
@@ -571,14 +571,14 @@ | |
(execute-prepared-statement! driver st)))) | ||
|
||
(defmethod read-column-thunk :default | ||
[driver ^ResultSet rs rsmeta ^long i] | ||
[driver ^ResultSet rs rsmeta ^Long i] | ||
(let [driver-default-method (get-method read-column-thunk driver)] | ||
(if-not (= driver-default-method (get-method read-column-thunk :default)) | ||
^{:name (format "(read-column-thunk %s)" driver)} (driver-default-method driver rs rsmeta i) | ||
^{:name (format "(.getObject rs %d)" i)} (fn [] | ||
(.getObject rs i))))) | ||
|
||
(defn- get-object-of-class-thunk [^ResultSet rs, ^long i, ^Class klass] | ||
(defn- get-object-of-class-thunk [^ResultSet rs ^Long i ^Class klass] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also unrelated but |
||
^{:name (format "(.getObject rs %d %s)" i (.getCanonicalName klass))} | ||
(fn [] | ||
(.getObject rs i klass))) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unrelated but this is a big no-no because if anyone ever creates a new driver based on
:presto-jdbc
it will be instantly broken because their own methods forqp.timezone/report-timezone-id-if-supported
would never get called. Imagine if Postgres did this, how would Redshift even work