djession opened a new issue #9087:
URL: https://github.com/apache/shardingsphere/issues/9087


   ## Bug Report
   
   
   ### Which version of ShardingSphere did you use?
   
   **sharding-proxy alpha 5.0.0**
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   **sharding-proxy alpha 5.0.0**
   
   ### Expected behavior
   1. initialize the system with the following parameters
   ```yaml
   schemaName: replica_sharding_db
   
   dataSourceCommon:
     username: root
     password: ding2201
     connectionTimeoutMilliseconds: 300000
     idleTimeoutMilliseconds: 600000
     maxLifetimeMilliseconds: 18000000
     maxPoolSize: 50
     minPoolSize: 1
     maintenanceIntervalMilliseconds: 300000
   
   dataSources:
     ds_0:
       url: 
jdbc:mysql://192.168.1.2:3306/demo_ds_0?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true
     ds_slave_0:
       url: 
jdbc:mysql://192.168.1.3:3306/demo_ds_0?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true
     ds_1:
       url: 
jdbc:mysql://192.168.1.4:3306/demo_ds_1?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true
     ds_slave_1:
       url: 
jdbc:mysql://192.168.1.5:3306/demo_ds_1?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true
   
   rules:
   
   - !REPLICA_QUERY
     dataSources:
       pr_ds_0:
         name: pr_ds_0
         primaryDataSourceName: ds_0
         replicaDataSourceNames:
           - ds_slave_0
       pr_ds_1:
         name: pr_ds_1
         primaryDataSourceName: ds_1
         replicaDataSourceNames:
           - ds_slave_1
   
   - !SHARDING
     tables:
       t_order:
         actualDataNodes: pr_ds_${0..1}.t_order_${0..19}
         tableStrategy:
           standard:
             shardingColumn: order_id
             shardingAlgorithmName: t_order_inline
         keyGenerateStrategy:
           column: order_id
           keyGeneratorName: snowflake
       t_order_item:
         actualDataNodes: pr_ds_${0..1}.t_order_item_${0..19}
         tableStrategy:
           standard:
             shardingColumn: order_id
             shardingAlgorithmName: t_order_item_inline
         keyGenerateStrategy:
           column: order_item_id
           keyGeneratorName: snowflake
     bindingTables:
       - t_order,t_order_item
     defaultDatabaseStrategy:
       standard:
         shardingColumn: user_id
         shardingAlgorithmName: database_inline
     defaultTableStrategy:
       none:
   
     shardingAlgorithms:
       database_inline:
         type: INLINE
         props:
           algorithm-expression: pr_ds_${user_id % 2}
           allow-range-query-with-inline-sharding: true
       t_order_inline:
         type: INLINE
         props:
           algorithm-expression: t_order_${order_id % 19}
           allow-range-query-with-inline-sharding: true
       t_order_item_inline:
         type: INLINE
         props:
           algorithm-expression: t_order_item_${order_id % 19}
           allow-range-query-with-inline-sharding: true
   
     keyGenerators:
       snowflake:
         type: SNOWFLAKE
         props:
           worker-id: 123
   ```
   
   ```sql
   create table t_order(user_id int not null,order_id bigint not null 
auto_increment primary key,status varchar(50))engine=innodb default 
charset=utf8;
   ```
   and then, intput command at the mysql-cli : 
   `
   use replica_sharding_db
   show tables
   `
   all is ok~when i restart the sharding-proxy, at mysql-cli input again: 
   `
   use replica_sharding_db
   show tables
   `
   mysql-cli show the error:
   `ERROR 10002 (C1000): 2Unknown exception: [Can not get connection from 
datasource pr_ds_0.]`
   shardingproxy report the error:
   `[ERROR] 16:35:01.108 [main] com.zaxxer.hikari.pool.HikariPool - 
HikariPool-1 - Exception during pool initialization.
   java.sql.SQLSyntaxErrorException: Unknown database 'demo_ds_0'
           at 
com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
           at 
com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
           at 
com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
           at 
com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:836)
           at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:456)
           at 
com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246)
           at 
com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:198)
           at 
com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138)
           at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:354)
           at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:202)
           at 
com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:473)
           at 
com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:554)
           at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115)
           at 
com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:81)
           at 
org.apache.shardingsphere.proxy.backend.communication.jdbc.datasource.factory.JDBCRawBackendDataSourceFactory.build(JDBCRawBackendDataSourceFactory.java:70)
           at 
org.apache.shardingsphere.proxy.initializer.impl.AbstractBootstrapInitializer.createDataSources(AbstractBootstrapInitializer.java:94)
           at 
org.apache.shardingsphere.proxy.initializer.impl.AbstractBootstrapInitializer.lambda$createDataSourcesMap$0(AbstractBootstrapInitializer.java:88)
           at java.util.stream.Collectors.lambda$toMap$58(Collectors.java:1321)
           at 
java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
           at java.util.Iterator.forEachRemaining(Iterator.java:116)
           at 
java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
           at 
java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
           at 
java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
           at 
java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
           at 
java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
           at 
java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
           at 
org.apache.shardingsphere.proxy.initializer.impl.AbstractBootstrapInitializer.createDataSourcesMap(AbstractBootstrapInitializer.java:88)
           at 
org.apache.shardingsphere.proxy.initializer.impl.AbstractBootstrapInitializer.createSchemaContexts(AbstractBootstrapInitializer.java:73)
           at 
org.apache.shardingsphere.proxy.initializer.impl.AbstractBootstrapInitializer.init(AbstractBootstrapInitializer.java:63)
   "stdout.log" 65889L, 3179040C`
   ### Actual behavior
   
   ### Reason analyze (If you can)
   is there a problem with the format of the data being written to the ETCD 
that causes the configuration could not repeatable read?
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   
   ### 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.

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


Reply via email to