You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2019/10/29 03:30:37 UTC
[GitHub] [incubator-shardingsphere] terrymanu commented on a change in pull
request #3390: support select for update
terrymanu commented on a change in pull request #3390: support select for update
URL: https://github.com/apache/incubator-shardingsphere/pull/3390#discussion_r339880832
##########
File path: sharding-core/sharding-core-route/src/main/java/org/apache/shardingsphere/core/route/router/masterslave/MasterSlaveRouter.java
##########
@@ -70,6 +72,14 @@
}
private boolean isMasterRoute(final SQLStatement sqlStatement) {
- return !(sqlStatement instanceof SelectStatement) || MasterVisitedManager.isMasterVisited() || HintManager.isMasterRouteOnly();
+ return isLockSegment(sqlStatement) || !(sqlStatement instanceof SelectStatement) || MasterVisitedManager.isMasterVisited() || HintManager.isMasterRouteOnly();
+ }
+
+ private boolean isLockSegment(final SQLStatement sqlStatement) {
Review comment:
maybe we can simplify the code as:
`return sqlStatement instanceof SelectStatement && ((SelectStatement) sqlStatement).getLock().isPresent()`
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services