You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/07/29 08:13:23 UTC
[GitHub] [inlong] haibo-duan opened a new pull request, #5280: [INLONG-5279][Manager] Optimize the creation code of databases and tables
haibo-duan opened a new pull request, #5280:
URL: https://github.com/apache/inlong/pull/5280
### Prepare a Pull Request
*(Change the title refer to the following example)*
- Title Example: [INLONG-XYZ][Component] Title of the pull request
*(The following *XYZ* should be replaced by the actual [GitHub Issue](https://github.com/apache/inlong/issues) number)*
- Fixes #XYZ
### Motivation
*Explain here the context, and why you're making that change. What is the problem you're trying to solve?*
### Modifications
*Describe the modifications you've done.*
### Verifying this change
*(Please pick either of the following options)*
- [ ] This change is a trivial rework/code cleanup without any test coverage.
- [ ] This change is already covered by existing tests, such as:
*(please describe tests)*
- [ ] This change added tests and can be verified as follows:
*(example:)*
- *Added integration tests for end-to-end deployment with large payloads (10MB)*
- *Extended integration test for recovery after broker failure*
### Documentation
- Does this pull request introduce a new feature? (yes / no)
- If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
- If a feature is not applicable for documentation, explain why?
- If a feature is not documented yet in this PR, please create a follow-up issue for adding the documentation
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] healchow commented on a diff in pull request #5280: [INLONG-5279][Manager] Optimize the creation code of databases and tables
Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #5280:
URL: https://github.com/apache/inlong/pull/5280#discussion_r933718318
##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/resource/mysql/MySQLJdbcUtils.java:
##########
@@ -81,8 +82,8 @@ public static Connection getConnection(String url, String user, String password)
*/
public static void executeSql(Connection conn, String sql) throws Exception {
Statement stmt = conn.createStatement();
- LOG.info("execute sql [{}] success !", sql);
stmt.execute(sql);
+ LOG.info("execute sql [{}] success !", sql);
Review Comment:
No need to add `!` in log info.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] leosanqing commented on a diff in pull request #5280: [INLONG-5279][Manager] Optimize the creation code of databases and tables
Posted by GitBox <gi...@apache.org>.
leosanqing commented on code in PR #5280:
URL: https://github.com/apache/inlong/pull/5280#discussion_r933978407
##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/resource/sink/oracle/OracleJdbcUtils.java:
##########
@@ -145,19 +146,20 @@ public static void createTable(Connection conn, OracleTableInfo tableInfo)
* @return true if table exist, otherwise false
* @throws Exception on check table exist error
*/
- public static boolean checkTablesExist(Connection conn, String userName, String tableName)
- throws Exception {
+ public static boolean checkTablesExist(Connection conn, String userName, String tableName) throws Exception {
boolean result = false;
String checkTableSql = OracleSqlBuilder.getCheckTable(userName, tableName);
ResultSet resultSet = executeQuerySql(conn, checkTableSql);
if (null != resultSet && resultSet.next()) {
int size = resultSet.getInt(1);
if (size > 0) {
- LOG.info("check table exist for username={} table={}, result={}", userName, tableName, result);
- return true;
+ result = true;
}
}
- resultSet.close();
+ LOG.info("check table exist for username={} table={}, result={}", userName, tableName, result);
+ if (Objects.nonNull(resultSet)) {
+ resultSet.close();
Review Comment:
same as above
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] dockerzhang merged pull request #5280: [INLONG-5279][Manager] Optimize the creation code of databases and tables
Posted by GitBox <gi...@apache.org>.
dockerzhang merged PR #5280:
URL: https://github.com/apache/inlong/pull/5280
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] leosanqing commented on a diff in pull request #5280: [INLONG-5279][Manager] Optimize the creation code of databases and tables
Posted by GitBox <gi...@apache.org>.
leosanqing commented on code in PR #5280:
URL: https://github.com/apache/inlong/pull/5280#discussion_r933978195
##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/resource/sink/oracle/OracleJdbcUtils.java:
##########
@@ -108,14 +108,16 @@ public static ResultSet executeQuerySql(Connection conn, String sql)
* @param sqls SQL string to be executed
* @throws Exception on get execute SQL batch error
*/
- public static void executeSqlBatch(Connection conn, List<String> sqls)
- throws Exception {
+ public static void executeSqlBatch(Connection conn, List<String> sqls) throws Exception {
+ conn.setAutoCommit(false);
Statement stmt = conn.createStatement();
for (String entry : sqls) {
stmt.execute(entry);
}
+ conn.commit();
+ conn.setAutoCommit(true);
+ LOG.info("execute batch sql [{}] success", sqls);
stmt.close();
Review Comment:
It would be better to use Try-with-resources,or close the stream in finally, the commit commit throws an exception, and the stream cannot be closed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] dockerzhang commented on pull request #5280: [INLONG-5279][Manager] Optimize the creation code of databases and tables
Posted by GitBox <gi...@apache.org>.
dockerzhang commented on PR #5280:
URL: https://github.com/apache/inlong/pull/5280#issuecomment-1200812910
@haibo-duan please fix the conflicting files, thanks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] kipshi commented on a diff in pull request #5280: [INLONG-5279][Manager] Optimize the creation code of databases and tables
Posted by GitBox <gi...@apache.org>.
kipshi commented on code in PR #5280:
URL: https://github.com/apache/inlong/pull/5280#discussion_r933915832
##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/resource/sink/mysql/MySQLResourceOperator.java:
##########
@@ -85,53 +85,33 @@ private void createTable(SinkInfo sinkInfo) {
// set columns
List<MySQLColumnInfo> columnList = new ArrayList<>();
for (StreamSinkFieldEntity field : fieldList) {
- MySQLColumnInfo columnInfo = new MySQLColumnInfo();
- columnInfo.setName(field.getFieldName());
- columnInfo.setType(field.getFieldType());
- columnInfo.setComment(field.getFieldComment());
+ MySQLColumnInfo columnInfo = new MySQLColumnInfo(field.getFieldName(), field.getFieldType(),
+ field.getFieldComment());
columnList.add(columnInfo);
}
MySQLSinkDTO mySQLSink = MySQLSinkDTO.getFromJson(sinkInfo.getExtParams());
MySQLTableInfo tableInfo = MySQLSinkDTO.getTableInfo(mySQLSink, columnList);
- String url = mySQLSink.getJdbcUrl();
Review Comment:
why not use final ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] haibo-duan commented on a diff in pull request #5280: [INLONG-5279][Manager] Optimize the creation code of databases and tables
Posted by GitBox <gi...@apache.org>.
haibo-duan commented on code in PR #5280:
URL: https://github.com/apache/inlong/pull/5280#discussion_r933945637
##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/resource/sink/mysql/MySQLResourceOperator.java:
##########
@@ -85,53 +85,33 @@ private void createTable(SinkInfo sinkInfo) {
// set columns
List<MySQLColumnInfo> columnList = new ArrayList<>();
for (StreamSinkFieldEntity field : fieldList) {
- MySQLColumnInfo columnInfo = new MySQLColumnInfo();
- columnInfo.setName(field.getFieldName());
- columnInfo.setType(field.getFieldType());
- columnInfo.setComment(field.getFieldComment());
+ MySQLColumnInfo columnInfo = new MySQLColumnInfo(field.getFieldName(), field.getFieldType(),
+ field.getFieldComment());
columnList.add(columnInfo);
}
MySQLSinkDTO mySQLSink = MySQLSinkDTO.getFromJson(sinkInfo.getExtParams());
MySQLTableInfo tableInfo = MySQLSinkDTO.getTableInfo(mySQLSink, columnList);
- String url = mySQLSink.getJdbcUrl();
Review Comment:
Its a good idea.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] dockerzhang commented on pull request #5280: [INLONG-5279][Manager] Optimize the creation code of databases and tables
Posted by GitBox <gi...@apache.org>.
dockerzhang commented on PR #5280:
URL: https://github.com/apache/inlong/pull/5280#issuecomment-1200145847
@haibo-duan the conflicting files please fix them first. Thanks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org