-
Notifications
You must be signed in to change notification settings - Fork 383
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
[#2227] improvement(jdbc-backend): Improve the judgment of exception information in JDBC backend #2862
Conversation
@yuqi1129 @qqqttt123 Please help take a look of this, thanks. |
public GravitinoRuntimeException toGravitinoException( | ||
SQLException se, Entity.EntityType type, String name) { | ||
switch (se.getErrorCode()) { | ||
case 1062: |
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 1062
the value defined by MySQL internally which means a table or a database already exists?
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.
It means found a duplicated entry for a primary key or a unique key, see: 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.
OK
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 you please attach the document links to the code here? @xloya
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 you please attach the document links to the code here? @xloya
Have added the document link in annotations.
|
||
private SQLExceptionConverterFactory() {} | ||
|
||
public static synchronized void initConverter(Config config) { |
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.
When will this method be accessed concurrently?
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.
There is currently no concurrent access, just ensure the singleton of the converter
in the factory class.
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.
OK
Generally LGTM. |
...ain/java/com/datastrato/gravitino/storage/relational/converters/MySQLExceptionConverter.java
Outdated
Show resolved
Hide resolved
.../main/java/com/datastrato/gravitino/storage/relational/converters/SQLExceptionConverter.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.
Merge into main, thanks for your contributions @xloya |
What changes were proposed in this pull request?
Determine exceptions more accurately based on SQL Exception error codes.
Why are the changes needed?
Fix: #2227
How was this patch tested?
Add the unit tests.