-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Upgrading mysql jar in presto #24754
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
Conversation
} | ||
catch (SQLException e) { | ||
catch (Exception e) { |
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.
Whats the specific exception here? Should we catch that 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.
Hi @agrawalreetika , thank you for your feedback. Based on my research , The code is building fine without an exception as well. Since it is optional and if required , would you recommend me adding an IllegalArgumentException
instead of Exception
?
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.
Earlier code was throwing SQLException
which is why it was added now in your current implementation I don't think try-catch is even needed.
Please check and update the code accordingly.
Thanks for the changes, please squash your changes into 1 with the relevant commit message. |
presto-product-tests/pom.xml
Outdated
<groupId>com.google.protobuf</groupId> | ||
<artifactId>protobuf-java</artifactId> | ||
</exclusion> | ||
</exclusions> |
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.
Do we need to exclude this or can we just pull up the dependency version through the dependencyManagement
section? Or is it due to duplicate class conflicts?
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.
@ZacBlanco, Excluding this as it is resulting in upper bound dependencies error.
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.
Can't we try to just upgrade the dependency to the required 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.
@agrawalreetika , thank you for your feedback! I tried removing the exclusions and tried upgrading the protobuf-java version to 4.29.0 using 2 approaches :
- upgraded the version to 4.29.0 in root pom. It is resulting in error in presto-main


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 with 4.29.0
version upgrade we are hitting duplicate class error then I am ok with excluding it from <artifactId>mysql-connector-j</artifactId>
if the CI tests are passing.
@ZacBlanco Do you have any concern with exclusion? Or have any other approach to handle this?
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 am not a fan of excluding random dependencies. The conflicts aren't even on Java classes, so this could potentially lead to runtime issues if we're excluding core protobuf classes. In this case I would rather add exceptions to the duplicate finder for the .proto
files
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.
Upgraded the protobuf-java
version in the root pom and ignored the dependency ratis-thirdparty-misc
under duplicate-finder-maven-plugin
since directly adding <ignoredResourcePattern>google/protobuf/*.proto</ignoredResourcePattern>
was resulting in the same error.
7105659
to
99a8a11
Compare
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.
Do we have a PR to upgrade the testing-mysql-server? I would prefer if we updated that + released a new version for Presto first before this gets merged in order to reduce the number of exclusions
import static java.lang.String.format; | ||
import static java.util.Locale.ENGLISH; | ||
|
||
public class MySqlClient | ||
extends BaseJdbcClient | ||
{ | ||
private static final String SQL_STATE_SYNTAX_ERROR = "42000"; | ||
private static final String SQL_STATE_ER_TABLE_EXISTS_ERROR = "42S01"; |
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.
Are these not defined/available in the new mysql client? Where is this documented?
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.
These are sql error codes corresponding to the mysql error code. https://dev.mysql.com/doc/connector-j/en/connector-j-reference-error-sqlstates.html.
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 think for the syntax error, we should instead catch the SQLSyntaxError exception from the client rather than catching and comparing the code. For the table exists error, there isn't a corresponding exception type, so we can keep the current approach. Though we should leave a comment with a link to the documentation of error codes for future developers to know where the code came from
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.
Added the SQLSyntaxError exception as well. Had to keep the SQLException as well as I was getting the error Unhandled exception: java.sql.SQLException .
presto-product-tests/pom.xml
Outdated
<groupId>com.google.protobuf</groupId> | ||
<artifactId>protobuf-java</artifactId> | ||
</exclusion> | ||
</exclusions> |
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 am not a fan of excluding random dependencies. The conflicts aren't even on Java classes, so this could potentially lead to runtime issues if we're excluding core protobuf classes. In this case I would rather add exceptions to the duplicate finder for the .proto
files
|
3048031
to
e11c91c
Compare
There already is a release for testing mysql-server 8 for the version being used. https://repo.maven.apache.org/maven2/com/facebook/presto/testing-mysql-server-8/ . |
0e50de0
to
641eba5
Compare
@ZacBlanco @agrawalreetika , I have addressed the review comments. Could you please help review once again whenever convenient. |
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.
LGTM. Please squash all your commits into one.
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 minor nit
presto-mysql/src/main/java/com/facebook/presto/plugin/mysql/MySqlClient.java
Outdated
Show resolved
Hide resolved
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.
LGTM! Thanks for the upgrade!
Description
This PR is for upgrading the mysql jar version to the latest version 9.2.0.
This fixes CVE-2023-22102.
Motivation and Context
Impact
Test Plan
Contributor checklist
Release Notes
Please follow release notes guidelines and fill in the release notes below.