-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Update memsql plugin JDBC driver dependency #11191
Update memsql plugin JDBC driver dependency #11191
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please submit the signed CLA to [email protected]. For more information, see https://github.com/trinodb/cla. |
We need to update By the way, when I tried the official driver |
<groupId>com.singlestore</groupId> | ||
<artifactId>singlestore-jdbc-client</artifactId> | ||
<version>1.0.1</version> |
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.
Is LGPL-2.1 a no-go, @martint ?
( https://search.maven.org/artifact/com.singlestore/singlestore-jdbc-client/1.0.1/jar )
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.
I was going to ask if a new dependency needed to be vetted or documented somewhere (in our list of open source licenses?).
Btw, the MariaDB driver this is replacing is also LGPL-2.1:
( https://search.maven.org/artifact/org.mariadb.jdbc/mariadb-java-client/2.7.2/jar )
The SingleSource driver is forked from it.
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.
Btw, the MariaDB driver this is replacing is also LGPL-2.1:
thanks for pointing this out.
I recall some offline discussion with the conclusion that LGPL dependency is OK, but still would prefer @martint to confirm. Will keep 'request for changes' for now here.
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.
Thanks for raising it - I have this as a draft as I'm completely new to the process (and the codebase), so all feedback and issues are great for me to be aware of 👍
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.
LGPL is ok. GPL is the one that we can't use, unless it has specific exclusions like JDK's Classpath Exception.
309c04c
to
0ad11fc
Compare
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please submit the signed CLA to [email protected]. For more information, see https://github.com/trinodb/cla. |
@ebyhr - Once I got the memsql.license I ran the tests locally and they passed 🟢 |
|
@leveyja Sorry, I pasted the wrong test name. Could you confirm |
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please submit the signed CLA to [email protected]. For more information, see https://github.com/trinodb/cla. |
Will users who currently specify the mariadb connection URL need to update? |
@@ -623,16 +623,16 @@ protected boolean isSupportedJoinCondition(JdbcJoinCondition joinCondition) | |||
} | |||
|
|||
String typeName = typeHandle.getJdbcTypeName().get(); | |||
if (typeName.equalsIgnoreCase("tinyint unsigned")) { | |||
if (typeName.equalsIgnoreCase("tinyint(3) unsigned")) { |
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.
Is it instead possible to create the proper JdbcTypeHandle for such columns in JdbcClient#getColumns
? See for example how Postgres overrides that to fill in information about array types.
This seems prone to breakage and I'm not sure if this depends on the exact server and driver versions being used.
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.
If this isn't possible to do then I suggest we drop this migration for now.
I'm of the opinion that if switching the driver isn't bringing any benefits at the moment then we should stick with the mariadb driver for now.
I looked at the current diff and don't see any improvements to consider the switch.
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.
@hashhar - I had a questions with @wendigo about whether this list is exhaustive or not (I look in their source and I see tinyint(1)->tinyint(4), so I expect it is not). I agree it's fragile and could fail unexpectedly unless we had coverage of all possible types.
I'll look at the JdbcTypeHandle/Postgress client.getColumns - thanks for the suggestion!
(Whether we postpone the change or not, at least this is a useful learning experience for me! 👍 )
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.
Considering the issues with the change to the connection string (thanks @jhlodin for raising that), it looks like a bigger change than originally envisioned, and for very little benefit (as you say, their current driver doesn't add much, and complicates the column mapping - future versions may change further, etc).
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.
Maybe we can revisit this PR in the future once their driver matures a bit. WDYT @wendigo ?
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.
Update / clarification: I'm going to attempt to update the type mapping as suggested, along with making jdbc:mariadb
urls work transparently (that's already done w/tests, etc).
I may close this PR + re-open a new one though - so shout if I should do that! 👍
@jhlodin - The docs are generated from the repo, and the source of that doc was updated in the PR: see https://github.com/trinodb/trino/blob/d05536e90fc585cd5f61a1cf52ce28af363cd65a/docs/src/main/sphinx/connector/memsql.rst Re: Will users have to update the connection URL - I just did a quick test, and yes - they would need to update the URL if we go ahead and change our underlying driver to the singlestore driver - (unless we have a layer where we could 's/mariadb/singlestore/g' to the connection string within the MemSQL plugin? But that seems brittle). In a case like this, where changing our driver would break consumers, do we have a preferred way of handling it? e.g., introduce a new setting to "update.mariadb.connection.to.singlestore=true" by default (and documenting that users should update their connection strings?). |
d05536e
to
c6ba520
Compare
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please submit the signed CLA to [email protected]. For more information, see https://github.com/trinodb/cla. |
@@ -378,6 +382,46 @@ private static RemoteTableName getRemoteTable(ResultSet resultSet) | |||
return Optional.empty(); | |||
} | |||
|
|||
public static ColumnMapping memsqlTimeColumnMapping(TimeType timeType) { |
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.
@@ -55,8 +57,14 @@ public static ConnectionFactory createConnectionFactory(BaseJdbcConfig config, C | |||
|
|||
return new DriverConnectionFactory( | |||
new Driver(), | |||
config.getConnectionUrl(), | |||
ensureUrlBackwardCompatibility(config.getConnectionUrl()), |
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.
I noticed our config is mutable: so while config.getConnectionUrl()
would still return "jdbc:mariadb", it would be possible to call config.setConnectionUrl(...)
, but this seems like it would cause impossible to diagnose issues (e.g., depending on when the Module is created, other components may have already "taken a copy" of the original url).
Should we create an ImmutableConfig
wrapper around the config (override all .set
methods w/throws UnsupportedOperationException("config is immutable")
) to make sure it isn't changing after a certain point in the startup lifecycle?
Checkstyle fixes
Closing in favour of new non-draft PR - #11301 |
Fixes #10669
Description
Update plugin dependency from MariaDB driver to official SingleStore (memsql) driver.
Related issues, pull requests, and links
Documentation
( ) No documentation is needed.
( ) Sufficient documentation is included in this PR.
( ) Documentation PR is available with #prnumber.
( ) Documentation issue #issuenumber is filed, and can be handled later.
Release notes
( ) No release notes entries required.
( ) Release notes entries required with the following suggested text: