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/11/01 09:33:23 UTC

[GitHub] [incubator-shardingsphere] terrymanu commented on a change in pull request #3429: fix #3273, route to defaultDataSource or master when the sql without tableName

terrymanu commented on a change in pull request #3429: fix #3273, route to defaultDataSource or master when the sql without tableName
URL: https://github.com/apache/incubator-shardingsphere/pull/3429#discussion_r341503257
 
 

 ##########
 File path: sharding-core/sharding-core-route/src/main/java/org/apache/shardingsphere/core/route/router/masterslave/MasterSlaveRouter.java
 ##########
 @@ -70,10 +70,15 @@
     }
     
     private boolean isMasterRoute(final SQLStatement sqlStatement) {
-        return containsLockSegment(sqlStatement) || !(sqlStatement instanceof SelectStatement) || MasterVisitedManager.isMasterVisited() || HintManager.isMasterRouteOnly();
+        return containsLockSegment(sqlStatement) || !(sqlStatement instanceof SelectStatement) || MasterVisitedManager.isMasterVisited()
+                || HintManager.isMasterRouteOnly() || isSelectWithoutTable(sqlStatement);
     }
 
     private boolean containsLockSegment(final SQLStatement sqlStatement) {
         return sqlStatement instanceof SelectStatement && ((SelectStatement) sqlStatement).getLock().isPresent();
     }
+
+    private boolean isSelectWithoutTable(final SQLStatement sqlStatement) {
 
 Review comment:
   Sorry, here we need discuss again.
   If it is a select SQL without table, route to slave database is fine, is it?

----------------------------------------------------------------
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