zjcnb opened a new issue #15426:
URL: https://github.com/apache/shardingsphere/issues/15426


   ### Which version of ShardingSphere did you use?
   
   `master`
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   `ShardingSphere-Proxy`
   
   ### Expected behavior
   
   `SHOW SCHEMA RESOURCES from readwrite_splitting_db has some response.`
   
   ### Actual behavior
   
   ```
   mysql> SHOW SCHEMA RESOURCES from readwrite_splitting_db;
   Empty set (0.01 sec)
   ```
   
   ### First Proxy Configuration
   
   `server.yaml`
   
   ```
   mode:
     type: Cluster
     repository:
       type: ZooKeeper
       props:
         namespace: governance_ds
         server-lists: localhost:2181
         retryIntervalMilliseconds: 500
         timeToLiveSeconds: 60
         maxRetries: 3
         operationTimeoutMilliseconds: 500
     overwrite: false
   
   rules:
     - !AUTHORITY
       users:
         - root@%:root
         - sharding@:sharding
       provider:
         type: ALL_PRIVILEGES_PERMITTED
   ```
   
   `config-sharding.yaml`
   
   ```
   schemaName: sharding_db
   
   dataSources:
     ds_0:
       url: 
jdbc:mysql://127.0.0.1:3306/demo_ds_0?serverTimezone=UTC&useSSL=false
       username: root
       password: 123456
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
       minPoolSize: 1
     ds_1:
       url: 
jdbc:mysql://127.0.0.1:3306/demo_ds_1?serverTimezone=UTC&useSSL=false
       username: root
       password: 123456
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
       minPoolSize: 1
   
   rules:
   - !SHARDING
     tables:
       t_order:
         actualDataNodes: ds_${0..1}.t_order_${0..1}
         tableStrategy:
           standard:
             shardingColumn: order_id
             shardingAlgorithmName: t_order_inline
         keyGenerateStrategy:
           column: order_id
           keyGeneratorName: snowflake
       t_order_item:
         actualDataNodes: ds_${0..1}.t_order_item_${0..1}
         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: ds_${user_id % 2}
       t_order_inline:
         type: INLINE
         props:
           algorithm-expression: t_order_${order_id % 2}
       t_order_item_inline:
         type: INLINE
         props:
           algorithm-expression: t_order_item_${order_id % 2}
   
     keyGenerators:
       snowflake:
         type: SNOWFLAKE
   ```
   
   ### Second Proxy Configuration
   
   `server.yaml`
   
   ```
   mode:
    type: Cluster
    repository:
      type: ZooKeeper
      props:
        namespace: governance_ds
        server-lists: localhost:2181
        retryIntervalMilliseconds: 500
        timeToLiveSeconds: 60
        maxRetries: 3
        operationTimeoutMilliseconds: 500
    overwrite: false
   
   rules:
    - !AUTHORITY
      users:
        - root@%:root
        - sharding@:sharding
      provider:
        type: ALL_PRIVILEGES_PERMITTED
   ```
   
   `config-readwrite-splitting.yaml`
   
   ```
   schemaName: readwrite_splitting_db
   
   dataSources:
    write_ds:
      url: 
jdbc:mysql://127.0.0.1:3306/demo_write_ds?serverTimezone=UTC&useSSL=false
      username: root
      password: 123456
      connectionTimeoutMilliseconds: 30000
      idleTimeoutMilliseconds: 60000
      maxLifetimeMilliseconds: 1800000
      maxPoolSize: 50
      minPoolSize: 1
    read_ds_0:
      url: 
jdbc:mysql://127.0.0.1:3306/demo_read_ds_0?serverTimezone=UTC&useSSL=false
      username: root
      password: 123456
      connectionTimeoutMilliseconds: 30000
      idleTimeoutMilliseconds: 60000
      maxLifetimeMilliseconds: 1800000
      maxPoolSize: 50
      minPoolSize: 1
    read_ds_1:
      url: 
jdbc:mysql://127.0.0.1:3306/demo_read_ds_1?serverTimezone=UTC&useSSL=false
      username: root
      password: 123456
      connectionTimeoutMilliseconds: 30000
      idleTimeoutMilliseconds: 60000
      maxLifetimeMilliseconds: 1800000
      maxPoolSize: 50
      minPoolSize: 1
   
   rules:
   - !READWRITE_SPLITTING
    dataSources:
      readwrite_ds:
        type: Static
        props:
          write-data-source-name: write_ds
          read-data-source-names: read_ds_0,read_ds_1
   ```
   
   The first Proxy has started up, And start up second Proxy. And then, execute 
`SHOW SCHEMA RESOURCES from readwrite_splitting_db;`
   
   <img width="1920" alt="image" 
src="https://user-images.githubusercontent.com/33742097/154092674-156ef9a6-17f5-4fd5-bf15-46857b34b008.png";>
   
   
   
   ### Reason analyze (If you can)
   
   `schemaConfigMap` not right in `MetaDataContextsBuilder` from Proxy 1.
   


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