peilinqian opened a new issue, #19303:
URL: https://github.com/apache/shardingsphere/issues/19303

   ## Bug Report
   
   **For English only**, other languages will not accept.
   
   Before report a bug, make sure you have:
   
   - Searched open and closed [GitHub 
issues](https://github.com/apache/shardingsphere/issues).
   - Read documentation: [ShardingSphere 
Doc](https://shardingsphere.apache.org/document/current/en/overview).
   
   Please pay attention on issues you submitted, because we maybe need more 
details. 
   If no response anymore and we cannot reproduce it on current information, we 
will **close it**.
   
   Please answer these questions before submitting your issue. Thanks!
   
   ### Which version of ShardingSphere did you use?
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   ### Expected behavior
   sql hint and other strategies are configured at the same time, routed by the 
order of strategies
   ### Actual behavior
   sql hint and other strategies are configured at the same time, regardless of 
the order of strategies, they are routed by sqlhint
   ### Reason analyze (If you can)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   1、create traffic rule
   ```
   drop traffic rule sql_hint_traffic;
   drop traffic rule sql_match_traffic;
   create traffic rule sql_match_traffic (labels(sharding2),
   traffic_algorithm(type(name=sql_match,properties("sql" = "SELECT * FROM 
t_order WHERE content IN (?, ?);update t_order set content='test11' where 
user_id=11;"))),
   load_balancer(type(name=round_robin)));
   create traffic rule sql_hint_traffic(labels(sharding1),
   traffic_algorithm(type(name=SQL_HINT)),
   load_balancer(type(name=round_robin)));
   show traffic rules;
   ```
   
   2、ss-jdbc excute sql,hint:useTraffic=true
   ```
        @Test
        public void testTraffic_22() throws SQLException {
                String sql = "/* shardingsphere hint:useTraffic=true */SELECT * 
FROM t_order WHERE content IN (?, ?)";
                String sql2 = "/* shardingsphere hint:useTraffic=true */update  
t_order   set content='test11'   where   user_id=11;";
                for (int i = 0; i < 10; i++) {
                        PreparedStatement statement = getPreparedStatement(sql, 
Arrays.asList("test1", "test10"));
                        statement.executeQuery();
                        getStatement().executeUpdate(sql2);
                }
        }
   ```
   
   3、change traffic rules's order
   ```
   drop traffic rule sql_hint_traffic;
   drop traffic rule sql_match_traffic;
   create traffic rule sql_hint_traffic(labels(sharding1),
   traffic_algorithm(type(name=SQL_HINT)),
   load_balancer(type(name=round_robin)));
   create traffic rule sql_match_traffic (labels(sharding2),
   traffic_algorithm(type(name=sql_match,properties("sql" = "SELECT * FROM 
t_order WHERE content IN (?, ?);update t_order set content='test11' where 
user_id=11;"))),
   load_balancer(type(name=round_robin)));
   show traffic rules;
   ```
   
   4、repeat step 2
   
   ### Example codes for reproduce this issue (such as a github link).
   


-- 
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: 
[email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to