-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
[Bug] Fix TriggerRelationMapper cannot work due to miss DatabaseIdProvider #15153
Conversation
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
BTW, do we need to do some mapping ? as following :
@Bean
public DatabaseIdProvider databaseIdProvider() {
VendorDatabaseIdProvider databaseIdProvider = new VendorDatabaseIdProvider();
Properties properties = new Properties();
properties.put("Oracle","oracle");
properties.put("MySQL","mysql");
properties.put("PostgreSQL","pg");
databaseIdProvider.setProperties(properties);
return databaseIdProvider;
}
cc @EricGao888
Thank you for your review. I have made changes to the current code |
hi @destroydestiny Is it possible to write an enumeration class to reduce the magic value? |
I added an enum, but I'm not sure if I added it in the right package |
public enum DatabaseId { | ||
|
||
H2("H2", "h2"), | ||
ORACLE("Oracle", "oracle"), |
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.
We do not support oracle database as meta database.
public enum DatabaseId { | ||
|
||
H2("H2", "h2"), | ||
MYSQL("MySQL", "mysql"), | ||
POSTGRESQL("PostgreSQL", "pg"); | ||
|
||
private final String productName; | ||
private final String databaseId; | ||
} |
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 we move this into ado-plugin https://github.com/apache/dolphinscheduler/tree/dev/dolphinscheduler-dao-plugin, and add method to get databaseId mapping at https://github.com/apache/dolphinscheduler/blob/dev/dolphinscheduler-dao-plugin/dolphinscheduler-dao-api/src/main/java/org/apache/dolphinscheduler/dao/plugin/api/DaoPluginConfiguration.java
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
@@ -61,6 +63,11 @@ public MybatisPlusInterceptor paginationInterceptor(DbType dbType) { | |||
return interceptor; | |||
} | |||
|
|||
@Bean | |||
public DatabaseIdProvider databaseIdProvider() { | |||
return new FixedDatabaseIdProvider(daoPluginConfiguration.databaseId()); |
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 we directly use daoPluginConfiguration.dbType().name() as databaseId?
I find the databaseId only exist in TriggerRelationMapper.xml
if we modify the name to POSTGRE_SQL
this should work.
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.
that's what I thought at first, use DatabaseProductName
as databaseId. view commit 19d8510
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 so, we can remove databaseId, and use the default VendorDatabaseIdProvider
without add properties after change the datasourceId to PostgreSQL in mapper? .
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.
yup
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.
Please remove databaseId in DaoPlugin, and use this way.
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 I close this PR and recreate it? Too many commits are not clean enough
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.
You can rebase the commit, and I will use squash merge to edit the commit message when merged. So this is not a problem, don't worry.
…correctly, causing the workflow to fail to start
…n the productName and the databaseId
…guration that returns a databaseId to create a FixedDatabaseIdProvider.
55da505
to
b2e8f47
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.
LGTM
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.
+1
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #15153 +/- ##
============================================
- Coverage 38.23% 38.23% -0.01%
Complexity 4695 4695
============================================
Files 1285 1285
Lines 45453 45454 +1
Branches 4951 4951
============================================
Hits 17381 17381
Misses 26181 26181
- Partials 1891 1892 +1 ☔ View full report in Codecov by Sentry. |
Please retry analysis of this Pull-Request directly on SonarCloud. |
Merged, thanks for you pr. BTW, we don't only exist UT under h2, are you interesting add test for PG @destroydestiny |
fix #15152 : When using PostgreSQL, MyBatis did not set databaseId correctly, causing the workflow to fail to start
Purpose of the pull request
fix bug #15152
Brief change log
Verify this pull request