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/09/19 04:03:36 UTC

[GitHub] [incubator-shardingsphere] hunter7727 opened a new issue #3064: Cannot find actual datasource intersection for logic tables:["table_name", %]

hunter7727 opened a new issue #3064: Cannot find actual datasource intersection for logic tables:["table_name",%]
URL: https://github.com/apache/incubator-shardingsphere/issues/3064
 
 
   ## 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-RC2
   ### Which project did you use? Sharding-JDBC or Sharding-Proxy?
   Sharding-Proxy
   ### Expected behavior
   Ability to discover data sources And Execute sql statement without error
   ### Actual behavior
   Execute sql statement error
   ### Reason analyze (If you can)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   Environmental configuration:
      I have two mysql database instances And each instance of the database contains “order_tbl” table.
   My ss-proxy configuration:
   ````````````````````````````````````````````````````
   schemaName: cyberplus_meta
   
   dataSources:
     cyberplus_meta_instance_1:
       url: jdbc:mysql://localhost:3306/cyberplus_meta_instance_1?useSSL=false&serverTimezone=UTC
       username: root
       password: 123456
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
     cyberplus_meta_instance_2:
       url: jdbc:mysql://localhost:3306/cyberplus_meta_instance_2?useSSL=false&serverTimezone=UTC
       username: root
       password: 123456
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
   
   
   shardingRule:
     tables:
       order_tbl:
         actualDataNodes: cyberplus_meta_instance_${1..2}.order_tbl
         databaseStrategy:
           inline:
             shardingColumn: id
             algorithmExpression: cyberplus_meta_instance_${id % 2 + 1}
     defaultDatabaseStrategy:
       none:
     defaultTableStrategy:
       none:
     defaultDataSourceName: cyberplus_meta_instance_1
   ```````````````````````````````````````````````````````
   Error stack information:
   `````````````````````````````````````````````````
    Rule Type: sharding
    Logic SQL: SELECT * FROM order_tbl LIMIT 1
    SQLStatement: ShardingSelectOptimizedStatement(tables=Tables(tables=[Table(name=order_tbl, alias=Optional.absent())], schema=Optional.absent()), groupBy=org.apache.shardingsphere.core.optimize.sharding.segment.select.groupby.GroupBy@4683a848, orderBy=org.apache.shardingsphere.core.optimize.sharding.segment.select.orderby.OrderBy@6d56908d, selectItems=SelectItems(startIndex=7, stopIndex=7, distinctRow=false, items=[ShorthandSelectItem(owner=Optional.absent())], tables=[TableSegment(startIndex=14, stopIndex=22, name=order_tbl, quoteCharacter=NONE, owner=Optional.absent(), alias=Optional.absent())]), pagination=org.apache.shardingsphere.core.optimize.sharding.segment.select.pagination.Pagination@4225d0fc, containsSubquery=false)
    Actual SQL: cyberplus_meta_instance_1 ::: SELECT * FROM order_tbl LIMIT 1
    Actual SQL: cyberplus_meta_instance_2 ::: SELECT * FROM order_tbl LIMIT 1
    Rule Type: sharding
    Logic SQL: SHOW FULL TABLES FROM `cyberplus_meta` LIKE 'order_tbl'
    SQLStatement: TransparentOptimizedStatement(tables=Tables(tables=[Table(name=order_tbl, alias=Optional.absent())], schema=Optional.absent()))
    Actual SQL: cyberplus_meta_instance_1 ::: SHOW FULL TABLES  LIKE 'order_tbl'
    
   [ERROR] 15:34:04.170 [ShardingSphere-Command-14] o.a.s.s.f.c.CommandExecutorTask - Exception occur: 
   org.apache.shardingsphere.core.config.ShardingConfigurationException: Cannot find actual datasource intersection for logic tables: [order_tbl, %]
   	at org.apache.shardingsphere.core.route.type.unicast.UnicastRoutingEngine.route(UnicastRoutingEngine.java:92)
   	at org.apache.shardingsphere.core.route.router.sharding.ParsingSQLRouter.route(ParsingSQLRouter.java:78)
   	at org.apache.shardingsphere.core.route.StatementRoutingEngine.route(StatementRoutingEngine.java:56)
   	at org.apache.shardingsphere.core.SimpleQueryShardingEngine.route(SimpleQueryShardingEngine.java:60)
   	at org.apache.shardingsphere.core.BaseShardingEngine.executeRoute(BaseShardingEngine.java:86)
   	at org.apache.shardingsphere.core.BaseShardingEngine.shard(BaseShardingEngine.java:70)
   	at org.apache.shardingsphere.shardingproxy.backend.communication.jdbc.wrapper.StatementExecutorWrapper.doShardingRoute(StatementExecutorWrapper.java:75)
   	at org.apache.shardingsphere.shardingproxy.backend.communication.jdbc.wrapper.StatementExecutorWrapper.route(StatementExecutorWrapper.java:61)
   	at org.apache.shardingsphere.shardingproxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:80)
   	at org.apache.shardingsphere.shardingproxy.backend.text.admin.UnicastBackendHandler.execute(UnicastBackendHandler.java:57)
   	at org.apache.shardingsphere.shardingproxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:72)
   	at org.apache.shardingsphere.shardingproxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:86)
   	at org.apache.shardingsphere.shardingproxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:66)
   	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
   	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
   	at java.lang.Thread.run(Thread.java:748)
   	
    Rule Type: sharding
    Logic SQL: SELECT * FROM order_tbl LIMIT 1
    SQLStatement: ShardingSelectOptimizedStatement(tables=Tables(tables=[Table(name=order_tbl, alias=Optional.absent())], schema=Optional.absent()), groupBy=org.apache.shardingsphere.core.optimize.sharding.segment.select.groupby.GroupBy@53ea2899, orderBy=org.apache.shardingsphere.core.optimize.sharding.segment.select.orderby.OrderBy@747ee701, selectItems=SelectItems(startIndex=7, stopIndex=7, distinctRow=false, items=[ShorthandSelectItem(owner=Optional.absent())], tables=[TableSegment(startIndex=14, stopIndex=22, name=order_tbl, quoteCharacter=NONE, owner=Optional.absent(), alias=Optional.absent())]), pagination=org.apache.shardingsphere.core.optimize.sharding.segment.select.pagination.Pagination@12707aa3, containsSubquery=false)
    Actual SQL: cyberplus_meta_instance_1 ::: SELECT * FROM order_tbl LIMIT 1
    Actual SQL: cyberplus_meta_instance_2 ::: SELECT * FROM order_tbl LIMIT 1
    Rule Type: sharding
    Logic SQL: SHOW FULL TABLES FROM `cyberplus_meta` LIKE 'order_tbl'
    SQLStatement: TransparentOptimizedStatement(tables=Tables(tables=[Table(name=order_tbl, alias=Optional.absent())], schema=Optional.absent()))
    Actual SQL: cyberplus_meta_instance_1 ::: SHOW FULL TABLES  LIKE 'order_tbl'
   [ERROR] 15:34:04.184 [ShardingSphere-Command-2] o.a.s.s.f.c.CommandExecutorTask - Exception occur: 
   org.apache.shardingsphere.core.config.ShardingConfigurationException: Cannot find actual datasource intersection for logic tables: [order_tbl, %]
   	at org.apache.shardingsphere.core.route.type.unicast.UnicastRoutingEngine.route(UnicastRoutingEngine.java:92)
   	at org.apache.shardingsphere.core.route.router.sharding.ParsingSQLRouter.route(ParsingSQLRouter.java:78)
   	at org.apache.shardingsphere.core.route.StatementRoutingEngine.route(StatementRoutingEngine.java:56)
   	at org.apache.shardingsphere.core.SimpleQueryShardingEngine.route(SimpleQueryShardingEngine.java:60)
   	at org.apache.shardingsphere.core.BaseShardingEngine.executeRoute(BaseShardingEngine.java:86)
   	at org.apache.shardingsphere.core.BaseShardingEngine.shard(BaseShardingEngine.java:70)
   	at org.apache.shardingsphere.shardingproxy.backend.communication.jdbc.wrapper.StatementExecutorWrapper.doShardingRoute(StatementExecutorWrapper.java:75)
   	at org.apache.shardingsphere.shardingproxy.backend.communication.jdbc.wrapper.StatementExecutorWrapper.route(StatementExecutorWrapper.java:61)
   	at org.apache.shardingsphere.shardingproxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:80)
   	at org.apache.shardingsphere.shardingproxy.backend.text.admin.UnicastBackendHandler.execute(UnicastBackendHandler.java:57)
   	at org.apache.shardingsphere.shardingproxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:72)
   	at org.apache.shardingsphere.shardingproxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:86)
   	at org.apache.shardingsphere.shardingproxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:66)
   	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
   	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
   	at java.lang.Thread.run(Thread.java:748)
   
   ````````````````````````````````````````````````
   
   ### Example codes for reproduce this issue (such as a github link).
   Executing sql is 
   SHOW FULL TABLES FROM `cyberplus_meta` LIKE 'order_tbl'
   
   

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