You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "TeslaCN (via GitHub)" <gi...@apache.org> on 2023/06/02 08:44:12 UTC

[GitHub] [shardingsphere] TeslaCN opened a new issue, #26016: All tables' row counts in shardingsphere.sharding_table_statistics are always 0

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

   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   
   5.3.2
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   ShardingSphere-Proxy
   
   ### Expected behavior
   
   Row counts in `shardingsphere.sharding_table_statistics` are equal to `information_schema.tables`.
   
   ### Actual behavior
   
   ![image](https://github.com/apache/shardingsphere/assets/20503072/12118981-40d9-41ee-9393-c6d120c9e061)
   
   ### Reason analyze (If you can)
   
   `org.apache.shardingsphere.sharding.metadata.data.ShardingStatisticsTableCollector` didn't handle logic data source and physical data source properly while using ShardingRule + ReadwriteSplittingRule.
   
   ![image](https://github.com/apache/shardingsphere/assets/20503072/bb5afd94-f1b1-4c59-b9e9-441f7da9ebb4)
   
   
   ![](https://github.com/apache/shardingsphere/assets/20503072/50f3ea22-b174-4eb2-a9b7-64d3d41c730c)
   
   ![8c452073-0b65-4cbb-bf8c-48cb40dafde0](https://github.com/apache/shardingsphere/assets/20503072/078ed60c-ba45-4f86-8b1a-a0b4239fa237)
   
   ![b1af3b51-f0a4-4f18-92de-4bb830105217](https://github.com/apache/shardingsphere/assets/20503072/6ef90755-58b8-475f-8345-318eba918dca)
   
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   
   ```yaml
   schemaName: bmsql
   dataSources:
     w0:
       url: jdbc:mysql://127.0.0.1:3306/bmsql_0_sharding_rw?useSSL=false&prepStmtCacheSize=8192&tcpRcvBuf=8192
       username: root
       password: root
       connectionTimeoutMilliseconds: 3000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 32
       minPoolSize: 0
     r0_0:
       url: jdbc:mysql://127.0.0.1:3306/bmsql_0_sharding_rw?useSSL=false&prepStmtCacheSize=8192&tcpRcvBuf=8192
       username: root
       password: root
       connectionTimeoutMilliseconds: 3000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 32
       minPoolSize: 0
     r0_1:
       url: jdbc:mysql://127.0.0.1:3306/bmsql_0_sharding_rw?useSSL=false&prepStmtCacheSize=8192&tcpRcvBuf=8192
       username: root
       password: root
       connectionTimeoutMilliseconds: 3000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 32
       minPoolSize: 0
       
     w1:
       url: jdbc:mysql://127.0.0.1:3306/bmsql_1_sharding_rw?useSSL=false&prepStmtCacheSize=8192&tcpRcvBuf=8192
       username: root
       password: root
       connectionTimeoutMilliseconds: 3000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 32
       minPoolSize: 0
     r1_0:
       url: jdbc:mysql://127.0.0.1:3306/bmsql_1_sharding_rw?useSSL=false&prepStmtCacheSize=8192&tcpRcvBuf=8192
       username: root
       password: root
       connectionTimeoutMilliseconds: 3000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 32
       minPoolSize: 0
     r1_1:
       url: jdbc:mysql://127.0.0.1:3306/bmsql_1_sharding_rw?useSSL=false&prepStmtCacheSize=8192&tcpRcvBuf=8192
       username: root
       password: root
       connectionTimeoutMilliseconds: 3000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 32
       minPoolSize: 0
       
     w2:
       url: jdbc:mysql://127.0.0.1:3306/bmsql_2_sharding_rw?useSSL=false&prepStmtCacheSize=8192&tcpRcvBuf=8192
       username: root
       password: root
       connectionTimeoutMilliseconds: 3000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 32
       minPoolSize: 0
     r2_0:
       url: jdbc:mysql://127.0.0.1:3306/bmsql_2_sharding_rw?useSSL=false&prepStmtCacheSize=8192&tcpRcvBuf=8192
       username: root
       password: root
       connectionTimeoutMilliseconds: 3000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 32
       minPoolSize: 0
     r2_1:
       url: jdbc:mysql://127.0.0.1:3306/bmsql_2_sharding_rw?useSSL=false&prepStmtCacheSize=8192&tcpRcvBuf=8192
       username: root
       password: root
       connectionTimeoutMilliseconds: 3000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 32
       minPoolSize: 0
       
     w3:
       url: jdbc:mysql://127.0.0.1:3306/bmsql_3_sharding_rw?useSSL=false&prepStmtCacheSize=8192&tcpRcvBuf=8192
       username: root
       password: root
       connectionTimeoutMilliseconds: 3000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 32
       minPoolSize: 0
     r3_0:
       url: jdbc:mysql://127.0.0.1:3306/bmsql_3_sharding_rw?useSSL=false&prepStmtCacheSize=8192&tcpRcvBuf=8192
       username: root
       password: root
       connectionTimeoutMilliseconds: 3000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 32
       minPoolSize: 0
     r3_1:
       url: jdbc:mysql://127.0.0.1:3306/bmsql_3_sharding_rw?useSSL=false&prepStmtCacheSize=8192&tcpRcvBuf=8192
       username: root
       password: root
       connectionTimeoutMilliseconds: 3000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 32
       minPoolSize: 0
   
   rules:
     - !READWRITE_SPLITTING
       dataSources:
         ds_0:
           transactionalReadQueryStrategy: PRIMARY
           writeDataSourceName: w0
           readDataSourceNames:
             - r0_0
             - r0_1
           loadBalancerName: random
         ds_1:
           transactionalReadQueryStrategy: PRIMARY
           writeDataSourceName: w1
           readDataSourceNames:
             - r1_0
             - r1_1
           loadBalancerName: random
         ds_2:
           transactionalReadQueryStrategy: PRIMARY
           writeDataSourceName: w2
           readDataSourceNames:
             - r2_0
             - r2_1
           loadBalancerName: random
         ds_3:
           transactionalReadQueryStrategy: PRIMARY
           writeDataSourceName: w3
           readDataSourceNames:
             - r3_0
             - r3_1
           loadBalancerName: random
       loadBalancers:
         random:
           type: RANDOM
           
     - !SHARDING
       bindingTables:
         - bmsql_warehouse, bmsql_customer
         - bmsql_stock, bmsql_district, bmsql_order_line
       defaultDatabaseStrategy:
         none:
       defaultTableStrategy:
         none:
       keyGenerators:
       tables:
         bmsql_config:
           actualDataNodes: ds_0.bmsql_config
   
         bmsql_warehouse:
           actualDataNodes: ds_${0..3}.bmsql_warehouse_${0..15}
           databaseStrategy:
             standard:
               shardingColumn: w_id
               shardingAlgorithmName: mod_4
           tableStrategy:
             standard:
               shardingColumn: w_id
               shardingAlgorithmName: mod_16
   
         bmsql_district:
           actualDataNodes: ds_${0..3}.bmsql_district_${0..15}
           databaseStrategy:
             standard:
               shardingColumn: d_w_id
               shardingAlgorithmName: mod_4
           tableStrategy:
             standard:
               shardingColumn: d_w_id
               shardingAlgorithmName: mod_16
   
         bmsql_customer:
           actualDataNodes: ds_${0..3}.bmsql_customer_${0..15}
           databaseStrategy:
             standard:
               shardingColumn: c_w_id
               shardingAlgorithmName: mod_4
           tableStrategy:
             standard:
               shardingColumn: c_w_id
               shardingAlgorithmName: mod_16
   
         bmsql_item:
           actualDataNodes: ds_${0..3}.bmsql_item_${0..15}
           databaseStrategy:
             standard:
               shardingColumn: i_id
               shardingAlgorithmName: mod_4
           tableStrategy:
             standard:
               shardingColumn: i_id
               shardingAlgorithmName: mod_16
   
         bmsql_history:
           actualDataNodes: ds_${0..3}.bmsql_history_${0..15}
           databaseStrategy:
             standard:
               shardingColumn: h_w_id
               shardingAlgorithmName: mod_4
           tableStrategy:
             standard:
               shardingColumn: h_w_id
               shardingAlgorithmName: mod_16
   
         bmsql_oorder:
           actualDataNodes: ds_${0..3}.bmsql_oorder_${0..15}
           databaseStrategy:
             standard:
               shardingColumn: o_w_id
               shardingAlgorithmName: mod_4
           tableStrategy:
             standard:
               shardingColumn: o_w_id
               shardingAlgorithmName: mod_16
   
         bmsql_stock:
           actualDataNodes: ds_${0..3}.bmsql_stock_${0..15}
           databaseStrategy:
             standard:
               shardingColumn: s_w_id
               shardingAlgorithmName: mod_4
           tableStrategy:
             standard:
               shardingColumn: s_w_id
               shardingAlgorithmName: mod_16
   
         bmsql_new_order:
           actualDataNodes: ds_${0..3}.bmsql_new_order_${0..15}
           databaseStrategy:
             standard:
               shardingColumn: no_w_id
               shardingAlgorithmName: mod_4
           tableStrategy:
             standard:
               shardingColumn: no_w_id
               shardingAlgorithmName: mod_16
   
         bmsql_order_line:
           actualDataNodes: ds_${0..3}.bmsql_order_line_${0..15}
           databaseStrategy:
             standard:
               shardingColumn: ol_w_id
               shardingAlgorithmName: mod_4
           tableStrategy:
             standard:
               shardingColumn: ol_w_id
               shardingAlgorithmName: mod_16
   
       shardingAlgorithms:
         mod_4:
           type: MOD
           props:
             sharding-count: 4
         mod_16:
           type: MOD
           props:
             sharding-count: 16
   ```
   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org