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 2020/02/12 05:53:17 UTC

[GitHub] [incubator-shardingsphere] gxgmy521 opened a new issue #4256: hintManager.setDatabaseShardingValue do not work.

gxgmy521 opened a new issue #4256: hintManager.setDatabaseShardingValue do not work.
URL: https://github.com/apache/incubator-shardingsphere/issues/4256
 
 
   ## 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/incubator-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 **more than 7 days** 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?
   4.0.0
   
   ### Which project did you use? Sharding-JDBC or Sharding-Proxy?
   Sharding-JDBC
   ### Expected behavior
   The hintManager.setDatabaseShardingValue do not work,In the ShardingSphere-example , the `the hint-raw-jdbc-example` project don't work as expect,when I choose the type HintType TYPE = HintType.DATABASE_ONLY,the expected behavior  should be  all the sql  routing to one datasource which is set by   hintManager.setDatabaseShardingValue(1L);  
   ### Actual behavior
   the hint does not work ,sql route to all datasouces,here is the log
   ```
   [INFO ] 2020-02-12 12:56:13,923 --main-- [ShardingSphere-SQL] Rule Type: sharding 
   [INFO ] 2020-02-12 12:56:13,924 --main-- [ShardingSphere-SQL] Logic SQL: SELECT i.* FROM t_order o, t_order_item i WHERE o.order_id = i.order_id 
   [INFO ] 2020-02-12 12:56:13,925 --main-- [ShardingSphere-SQL] SQLStatement: SelectSQLStatementContext(super=CommonSQLStatementContext(sqlStatement=org.apache.shardingsphere.sql.parser.sql.statement.dml.SelectStatement@59496961, tablesContext=TablesContext(tables=[Table(name=t_order, alias=Optional.of(o)), Table(name=t_order_item, alias=Optional.of(i))], schema=Optional.absent())), projectionsContext=ProjectionsContext(startIndex=7, stopIndex=9, distinctRow=false, projections=[ShorthandProjection(owner=Optional.of(i))], columnLabels=[order_item_id, order_id, user_id, status]), groupByContext=org.apache.shardingsphere.sql.parser.relation.segment.select.groupby.GroupByContext@408b87aa, orderByContext=org.apache.shardingsphere.sql.parser.relation.segment.select.orderby.OrderByContext@79b08632, paginationContext=org.apache.shardingsphere.sql.parser.relation.segment.select.pagination.PaginationContext@787f32b7, containsSubquery=false) 
   [INFO ] 2020-02-12 12:56:13,932 --main-- [ShardingSphere-SQL] Actual SQL: ds_0 ::: SELECT i.* FROM t_order o, t_order_item i WHERE o.order_id = i.order_id 
   [INFO ] 2020-02-12 12:56:13,932 --main-- [ShardingSphere-SQL] Actual SQL: ds_1 ::: SELECT i.* FROM t_order o, t_order_item i WHERE o.order_id = i.order_id 
   
   ```
   ### Reason analyze (If you can)
   int the 3.1.0 version .there is a class `DatabaseHintRoutingEngine` to route to some certain sharding database without sharding tables,SQL parse and rewrite phase will be skipped,however ,in the 4.0.0 verision, there is no class to use the value I set in the hintManager, because there is no caller of the method  `getDatabaseShardingValues`
   ```java
    /**
        * Get database sharding values.
        *
        * @return database sharding values
        */
       public static Collection<Comparable<?>> getDatabaseShardingValues() {
           return getDatabaseShardingValues("");
       }
   ```
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   git clone the project, https://github.com/apache/incubator-shardingsphere-example
    switch to 4.0.0, chage the HintType to HintType.DATABASE_ONLY and run the 
   ExampleMain
   ### Example codes for reproduce this issue (such as a github link).
   https://github.com/apache/incubator-shardingsphere-example/tree/dev/sharding-jdbc-example/other-feature-example/hint-example
   

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

[GitHub] [incubator-shardingsphere] KomachiSion closed issue #4256: hintManager.setDatabaseShardingValue do not work.

Posted by GitBox <gi...@apache.org>.
KomachiSion closed issue #4256: hintManager.setDatabaseShardingValue do not work.
URL: https://github.com/apache/incubator-shardingsphere/issues/4256
 
 
   

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

[GitHub] [incubator-shardingsphere] KomachiSion commented on issue #4256: hintManager.setDatabaseShardingValue do not work.

Posted by GitBox <gi...@apache.org>.
KomachiSion commented on issue #4256: hintManager.setDatabaseShardingValue do not work.
URL: https://github.com/apache/incubator-shardingsphere/issues/4256#issuecomment-585072477
 
 
   It seems similar to #3964 .
   I will check together.

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

[GitHub] [incubator-shardingsphere] masankin commented on issue #4256: hintManager.setDatabaseShardingValue do not work.

Posted by GitBox <gi...@apache.org>.
masankin commented on issue #4256: hintManager.setDatabaseShardingValue do not work.
URL: https://github.com/apache/incubator-shardingsphere/issues/4256#issuecomment-605669368
 
 
   > duplicate with #3964 .
   
   How long could it  to be released to the next version

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

[GitHub] [incubator-shardingsphere] gxgmy521 commented on issue #4256: hintManager.setDatabaseShardingValue do not work.

Posted by GitBox <gi...@apache.org>.
gxgmy521 commented on issue #4256: hintManager.setDatabaseShardingValue do not work.
URL: https://github.com/apache/incubator-shardingsphere/issues/4256#issuecomment-585220769
 
 
   I read you commit, and i think it should work. but in the manual (https://shardingsphere.apache.org/document/current/en/manual/sharding-jdbc/usage/hint/) it said that 
   Users can use hintManager.setDatabaseShardingValue to add shardings in hint route to some certain sharding database without sharding tables. After that, SQL parse and rewrite phase will be skipped and the overall enforcement efficiency can be enhanced.
   I think  that in version 4.0.0 ,the setDatabaseShardingValue can only sikp the sql rewrite ,can't skip the sql parse , am i wrong?
   

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

[GitHub] [incubator-shardingsphere] masankin edited a comment on issue #4256: hintManager.setDatabaseShardingValue do not work.

Posted by GitBox <gi...@apache.org>.
masankin edited a comment on issue #4256: hintManager.setDatabaseShardingValue do not work.
URL: https://github.com/apache/incubator-shardingsphere/issues/4256#issuecomment-605669368
 
 
   > duplicate with #3964 .
   
   How long could it  to be release to the next version

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

[GitHub] [incubator-shardingsphere] KomachiSion commented on issue #4256: hintManager.setDatabaseShardingValue do not work.

Posted by GitBox <gi...@apache.org>.
KomachiSion commented on issue #4256: hintManager.setDatabaseShardingValue do not work.
URL: https://github.com/apache/incubator-shardingsphere/issues/4256#issuecomment-585121768
 
 
   duplicate with #3964 .

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

[GitHub] [incubator-shardingsphere] gxgmy521 edited a comment on issue #4256: hintManager.setDatabaseShardingValue do not work.

Posted by GitBox <gi...@apache.org>.
gxgmy521 edited a comment on issue #4256: hintManager.setDatabaseShardingValue do not work.
URL: https://github.com/apache/incubator-shardingsphere/issues/4256#issuecomment-585220769
 
 
   > duplicate with #3964 .
   
   I read you commit, and i think it should work. but in the manual (https://shardingsphere.apache.org/document/current/en/manual/sharding-jdbc/usage/hint/) it said that 
   Users can use hintManager.setDatabaseShardingValue to add shardings in hint route to some certain sharding database without sharding tables. After that, SQL parse and rewrite phase will be skipped and the overall enforcement efficiency can be enhanced.
   I think  that in version 4.0.0 ,the setDatabaseShardingValue can only sikp the sql rewrite ,can't skip the sql parse , am i wrong?
   
   

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

[GitHub] [incubator-shardingsphere] gxgmy521 edited a comment on issue #4256: hintManager.setDatabaseShardingValue do not work.

Posted by GitBox <gi...@apache.org>.
gxgmy521 edited a comment on issue #4256: hintManager.setDatabaseShardingValue do not work.
URL: https://github.com/apache/incubator-shardingsphere/issues/4256#issuecomment-585220769
 
 
   > duplicate with #3964 .
   
   I read you commit, and i think it should work. but in the manual (https://shardingsphere.apache.org/document/current/en/manual/sharding-jdbc/usage/hint/) it said that 
   Users can use hintManager.setDatabaseShardingValue to add shardings in hint route to some certain sharding database without sharding tables. After that, SQL parse and rewrite phase will be skipped and the overall enforcement efficiency can be enhanced.
   I think  that in version 4.0.0 ,the setDatabaseShardingValue can only sikp the sql rewrite ,can't skip the sql parse , am i wrong?
   
   
   > duplicate with #3964 .
   
   

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