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

   ## Question
   When I start a sample with shadow feature, it complains 'Table not exist', 
are there some configs that i'm missing or making wrong?
   
   version: 5.5.0
   
   shadow config: sharding.yaml
   ```
   dataSources:
     ds:
       driverClassName: com.mysql.cj.jdbc.Driver
       dataSourceClassName: com.alibaba.druid.pool.DruidDataSource
       # 使用druid必须用url,而不是jdbcUrl
       url: jdbc:mysql://127.0.0.1:3306/ds?characterEncoding=utf-8
       username: mysql
       password: mysql
     ds_shadow:
       driverClassName: com.mysql.cj.jdbc.Driver
       dataSourceClassName: com.alibaba.druid.pool.DruidDataSource
       # 使用druid必须用url,而不是jdbcUrl
       url: jdbc:mysql://127.0.0.1:3306/ds_shadow?characterEncoding=utf-8
       username: mysql
       password: mysql
   
   rules:
     - !SHADOW
       dataSources:
         shadowDataSource:
           productionDataSourceName: ds
           shadowDataSourceName: ds_shadow
       tables:
         t_user:
           dataSourceNames:
             - shadowDataSource
           shadowAlgorithmNames:
             - user_id_insert_match_algorithm
             - user_id_delete_match_algorithm
             - user_id_select_match_algorithm
             - sql_hint_algorithm
       shadowAlgorithms:
         user_id_insert_match_algorithm:
           type: REGEX_MATCH
           props:
             operation: insert
             column: user_type
             regex: "[1]"
         user_id_delete_match_algorithm:
           type: REGEX_MATCH
           props:
             operation: delete
             column: user_type
             regex: "[1]"
         user_id_select_match_algorithm:
           type: REGEX_MATCH
           props:
             operation: select
             column: user_type
             regex: "[1]"
         sql_hint_algorithm:
           type: SQL_HINT
   #打印sql
   props:
     sql-show: true
   ```
   
   throws exception:
   ```
   
org.apache.shardingsphere.infra.exception.kernel.metadata.TableNotFoundException:
 Table or view 't_user' does not exist.
        at 
org.apache.shardingsphere.infra.binder.segment.from.impl.SimpleTableSegmentBinder.lambda$checkTableExists$4(SimpleTableSegmentBinder.java:151)
 ~[shardingsphere-infra-binder-5.5.0.jar:5.5.0]
        at 
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions.checkState(ShardingSpherePreconditions.java:41)
 ~[shardingsphere-infra-exception-core-5.5.0.jar:5.5.0]
        at 
org.apache.shardingsphere.infra.binder.segment.from.impl.SimpleTableSegmentBinder.checkTableExists(SimpleTableSegmentBinder.java:148)
 ~[shardingsphere-infra-binder-5.5.0.jar:5.5.0]
        at 
org.apache.shardingsphere.infra.binder.segment.from.impl.SimpleTableSegmentBinder.bind(SimpleTableSegmentBinder.java:84)
 ~[shardingsphere-infra-binder-5.5.0.jar:5.5.0]
        at 
org.apache.shardingsphere.infra.binder.statement.dml.InsertStatementBinder.lambda$bind$0(InsertStatementBinder.java:58)
 ~[shardingsphere-infra-binder-5.5.0.jar:5.5.0]
        at java.base/java.util.Optional.ifPresent(Optional.java:178) ~[?:?]
        at 
org.apache.shardingsphere.infra.binder.statement.dml.InsertStatementBinder.bind(InsertStatementBinder.java:58)
 ~[shardingsphere-infra-binder-5.5.0.jar:5.5.0]
        at 
org.apache.shardingsphere.infra.binder.statement.dml.InsertStatementBinder.bind(InsertStatementBinder.java:48)
 ~[shardingsphere-infra-binder-5.5.0.jar:5.5.0]
        at 
org.apache.shardingsphere.infra.binder.engine.SQLBindEngine.bindDMLStatement(SQLBindEngine.java:85)
 ~[shardingsphere-infra-binder-5.5.0.jar:5.5.0]
        at 
org.apache.shardingsphere.infra.binder.engine.SQLBindEngine.bind(SQLBindEngine.java:72)
 ~[shardingsphere-infra-binder-5.5.0.jar:5.5.0]
        at 
org.apache.shardingsphere.infra.binder.engine.SQLBindEngine.bind(SQLBindEngine.java:63)
 ~[shardingsphere-infra-binder-5.5.0.jar:5.5.0]
        at 
org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.<init>(ShardingSpherePreparedStatement.java:207)
 ~[shardingsphere-jdbc-5.5.0.jar:5.5.0]
        at 
org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.<init>(ShardingSpherePreparedStatement.java:172)
 ~[shardingsphere-jdbc-5.5.0.jar:5.5.0]
        at 
org.apache.shardingsphere.driver.jdbc.core.connection.ShardingSphereConnection.prepareStatement(ShardingSphereConnection.java:94)
 ~[shardingsphere-jdbc-5.5.0.jar:5.5.0]
        at 
com.zaxxer.hikari.pool.ProxyConnection.prepareStatement(ProxyConnection.java:327)
 ~[HikariCP-5.0.1.jar:?]
        at 
com.zaxxer.hikari.pool.HikariProxyConnection.prepareStatement(HikariProxyConnection.java)
 ~[HikariCP-5.0.1.jar:?]
        at 
org.apache.ibatis.executor.statement.PreparedStatementHandler.instantiateStatement(PreparedStatementHandler.java:88)
 ~[mybatis-3.5.14.jar:3.5.14]
   ```
   


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