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

   ----
   sharding-jdbc version: 4.1.1
   ---
   this mysql sharding config:
   
   ### 
       datasource:
         names: qrcodedb0,qrcodedb1,qrcodedb2,
         qrcodedb0:
           type: com.zaxxer.hikari.HikariDataSource
           driver-class-name: com.mysql.cj.jdbc.Driver
           jdbc-url: 
jdbc:mysql://192.168.31.10:30006/db0?characterEncoding=utf-8&&serverTimezone=GMT%2B8
           username: root
           password: root
         qrcodedb1:
           type: com.zaxxer.hikari.HikariDataSource
           driver-class-name: com.mysql.cj.jdbc.Driver
           jdbc-url: 
jdbc:mysql://192.168.31.10:30007/db1?characterEncoding=utf-8&&serverTimezone=GMT%2B8
           username: root
           password: root
         qrcodedb2:
           type: com.zaxxer.hikari.HikariDataSource
           driver-class-name: com.mysql.cj.jdbc.Driver
           jdbc-url: 
jdbc:mysql://192.168.31.10:30009/db2?characterEncoding=utf-8&&serverTimezone=GMT%2B8
           username: root
           password: root
       sharding:
         default-database-strategy:
           inline:
             shardingColumn: id
             algorithm-expression: qrcodedb$->{id%3}
         tables:
           qr_code_ins:
             actual-data-nodes: qrcodedb$->{0..2}.qr_code_ins$->{0..10}
             key-generator:
               column: id
               props:
                 worker.id: ${workerId}
               type: SNOWFLAKE
             tableStrategy: # 切分策略
               inline:
                 shardingColumn: id   
                 algorithm-expression: qr_code_ins$->{id%11}
   ### 
   
   actual sql:
   ### 
       <insert id="insertQrCodeInsList" parameterType="java.util.List">
   
           insert into qr_code_ins
           
(qr_code,parent_code,status,type,c_line_id,c_task_id,c_class_id,b_line_id,b_task_id,b_class_id,brand_id,oper_user_id
           )
   
           values
           <foreach collection="list" item="item" index="index" separator=",">
          (
               #{item.qrCode},
               #{item.parentCode},
               #{item.status},
               #{item.type},
               #{item.cLineId},
               #{item.cTaskId},
               #{item.cClassId},
               #{item.bLineId},
               #{item.bTaskId},
               #{item.bClassId},
               #{item.brandId},
               #{item.operUserId}
          )
           </foreach>
       </insert>
   
   ### 
    this is my  db0, qr_code_ins0  data:
   ###
   
![image](https://user-images.githubusercontent.com/45196489/204529133-df980711-ad18-4d5d-938f-cac5b82048df.png)
   ###
   
   First 5 ID modeling results:
   ---
   id=804439884781764641
   Modulo 3=2
   Modulo 11=3
   
   id= 804439887843606536
   Modulo 3=2
   Modulo 11=5
   
   id=804439884781764641
   Modulo 3=1
   Modulo 11=5
   
   id= 804439892226654230
   Modulo 3=2
   Modulo 11=8
   
   id=804439892226654263
   Modulo 3=2
   Modulo 11=8
   
   **In db0 and  qr_code_ins0,
   The correct module results for all IDs should be: database: 0, table: 0, and 
the results are much worse. Is this a bug or a configuration .**
   


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