You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "tuichenchuxin (via GitHub)" <gi...@apache.org> on 2023/10/18 09:34:27 UTC
[PR] Optimize ShardingSpherePreparedStatement for multi executionContext [shardingsphere]
tuichenchuxin opened a new pull request, #28796:
URL: https://github.com/apache/shardingsphere/pull/28796
Changes proposed in this pull request:
-
---
Before committing this PR, I'm sure that I have checked the following options:
- [ ] My code follows the [code of conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/) of this project.
- [ ] I have self-reviewed the commit code.
- [ ] I have (or in comment I request) added corresponding labels for the pull request.
- [ ] I have passed maven check locally : `./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e`.
- [ ] I have made corresponding changes to the documentation.
- [ ] I have added corresponding unit tests for my changes.
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Optimize ShardingSpherePreparedStatement for multi executionContext [shardingsphere]
Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu commented on code in PR #28796:
URL: https://github.com/apache/shardingsphere/pull/28796#discussion_r1364752068
##########
jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/adapter/AbstractStatementAdapter.java:
##########
@@ -66,11 +66,14 @@ protected final boolean isNeedImplicitCommitTransaction(final ShardingSphereConn
if (!TransactionType.isDistributedTransaction(connectionTransaction.getTransactionType()) || isInTransaction) {
return false;
}
- return isModifiedSQL(executionContext) && executionContext.getExecutionUnits().size() > 1;
+ if (1 == executionContexts.size()) {
+ SQLStatement sqlStatement = executionContexts.iterator().next().getSqlStatementContext().getSqlStatement();
+ return isModifiedSQL(sqlStatement) && executionContexts.iterator().next().getExecutionUnits().size() > 1;
+ }
+ return executionContexts.stream().anyMatch(each -> isModifiedSQL(each.getSqlStatementContext().getSqlStatement()));
Review Comment:
Please don't use stream api in main process.
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Optimize ShardingSpherePreparedStatement for multi executionContext [shardingsphere]
Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu merged PR #28796:
URL: https://github.com/apache/shardingsphere/pull/28796
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org