-
Notifications
You must be signed in to change notification settings - Fork 5k
[Improvement][plugin] decommission connection pool in kyuubi #14190
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
|
@caishunfeng @SbloodyS plz review |
...hinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
Outdated
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## dev #14190 +/- ##
============================================
+ Coverage 38.52% 38.53% +0.01%
- Complexity 4575 4579 +4
============================================
Files 1260 1260
Lines 43804 43821 +17
Branches 4834 4833 -1
============================================
+ Hits 16874 16885 +11
- Misses 25057 25063 +6
Partials 1873 1873
... and 4 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
|
@caishunfeng @SbloodyS plz review |
|
@caishunfeng @SbloodyS Is there anything that need to improve ? Thanks. |
bf81161 to
4c19f77
Compare
SbloodyS
left a comment
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 check failed CI.
looks like the CI failed due to zookeeper connect timeout |
342e80d to
2355b0b
Compare
| if (DbType.valueOf(sqlParameters.getType()) == KYUUBI) { | ||
| log.info("full jdbc url : {}, user : {} begin to build a connection", | ||
| DataSourceUtils.getJdbcUrl(DbType.KYUUBI, baseConnectionParam), baseConnectionParam.getUser()); | ||
| Class.forName(baseConnectionParam.getDriverClassName()); | ||
| connection = DriverManager.getConnection(baseConnectionParam.getJdbcUrl(), | ||
| baseConnectionParam.getUser(), baseConnectionParam.getPassword()); | ||
| } else { | ||
| connection = | ||
| DataSourceClientProvider.getInstance().getConnection(DbType.valueOf(sqlParameters.getType()), | ||
| baseConnectionParam); | ||
| } |
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'm not sure if this is a good approach. If there are new data sources or task types in the future that need to share the same implementation.
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. It's not a good way to do it. Can we extract part of code into getConnection method ?
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
464f405 to
fd86a51
Compare
| while (connection == null) { | ||
| try { | ||
| connection = dataSource.getConnection(); | ||
| connection = driverManagerDataSource.getConnection(); |
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 add max retry times here, this is dangerous code, in fact, it's better to generate a new connection here, rather than use driverManagerDataSource.getConnection();
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.
Got 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.
done.
| this.driverManagerDataSource = | ||
| new DriverManagerDataSource(DataSourceUtils.getJdbcUrl(DbType.KYUUBI, baseConnectionParam), | ||
| baseConnectionParam.getUser(), PasswordUtils.decodePassword(baseConnectionParam.getPassword())); | ||
| driverManagerDataSource.setDriverClassName(baseConnectionParam.getDriverClassName()); | ||
| this.jdbcTemplate = new JdbcTemplate(driverManagerDataSource); | ||
| log.info("Init {} {} success.", getClass().getName(), | ||
| DataSourceUtils.getJdbcUrl(DbType.KYUUBI, baseConnectionParam)); |
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 don't need to use DriverManagerDataSource here, we can directly generate new connections.
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.
DriverManagerDataSource should create a new connection each time, so we possibly can stick to that.
e35eb2d to
b0606be
Compare
5249fe5 to
63ab6d9
Compare
|
SonarCloud Quality Gate failed.
|










Purpose of the pull request
close #14189
Brief change log
Verify this pull request
This pull request is code cleanup without any test coverage.
(or)
This pull request is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(or)
If your pull request contain incompatible change, you should also add it to
docs/docs/en/guide/upgrede/incompatible.md