Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find actual datasource intersection for logic tables:["table_name",%] #3064

Closed
hunter7727 opened this issue Sep 19, 2019 · 4 comments
Closed
Assignees

Comments

@hunter7727
Copy link

Bug Report

For English only, other languages will not accept.

Before report a bug, make sure you have:

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'

@sunbufu
Copy link
Contributor

sunbufu commented Sep 19, 2019

If you have questions about show tables, please look at this first.

@hunter7727
Copy link
Author

Thank you, may I ask when this pr can be merged into the master branch?

@sunbufu
Copy link
Contributor

sunbufu commented Sep 20, 2019

The PR is blocked by the refactor of route engine, so please wait patiently.

@sunbufu
Copy link
Contributor

sunbufu commented Sep 20, 2019

Duplicate of #2904.

@sunbufu sunbufu self-assigned this Sep 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants