-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Clean up jdbc databases #10371
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
Clean up jdbc databases #10371
Conversation
This reverts commit cb0ca35.
/test connector=connectors/source-mysql
|
/test connector=connectors/source-mssql
|
/test connector=connectors/source-postgres
|
/test connector=connectors/source-mysql
|
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.
one tiny nit but otherwise this makes a lot of sense! (or at least, it makes the jdbc stuff less confusing lol)
@@ -116,7 +113,12 @@ public DatabaseMetaData getMetaData() throws SQLException { | |||
|
|||
@Override | |||
public void close() throws Exception { | |||
connectionSupplier.close(); | |||
if (dataSource instanceof AutoCloseable autoCloseable) { |
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.
tiny nitpick: it would be nice to keep this comment https://github.com/airbytehq/airbyte/pull/10342/files#diff-c7c618583584a27fb3b21cef812ca82b6d077d8bc779cf9a401bfc7658bb8dbaL145-L146
also I didn't know this instanceof T var
syntax existed! it's pretty cool 🚛
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.
Good point. Will add it in a follow-up PR.
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.
Done in #10444.
Summary
StreamingJdbcDatabase
should extendDefaultJdbcDatabase
instead of keeping a reference ofJdbcDatabase
. Otherwise theoretically it is possible to pass in aStreamingJdbcDatabase
to construct aStreamingJdbcDatabase
and have infinite call loops.ConnectionSupplier
interface is actually useless. TheDataSource
is already a connection supplier.