You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/04/18 09:01:40 UTC

[GitHub] [shardingsphere] weekndyyy opened a new issue, #16895: conflict key generated: shardingsphere/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/keygen/DefaultKeyGenerator.java

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

   I am using sharding-jdbc-core 4.1.1 and defined a custom key generator which is based on **shardingsphere/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/keygen/DefaultKeyGenerator.java**, the only difference is changing WORKER_ID_BITS and SEQUENCE_BITS to 6 bits:
   
   `private static final long SEQUENCE_BITS = 6L;`
   `private static final long WORKER_ID_BITS = 6L;`
   
   My concurrency is not large, but sometimes a key conflict occurs, two threads generated the same key:
   ![snowflake](https://user-images.githubusercontent.com/48077356/163783910-13f11aad-a342-4fee-8833-099f0e9c6411.PNG)
   
   How can I fix this problem?


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


[GitHub] [shardingsphere] zjcnb commented on issue #16895: conflict key generated: shardingsphere/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/keygen/DefaultKeyGenerator.java

Posted by GitBox <gi...@apache.org>.
zjcnb commented on issue #16895:
URL: https://github.com/apache/shardingsphere/issues/16895#issuecomment-1102457272

   @weekndyyy  Hello, Can you try it again with 5.1.1 version? I think you used version are too old.
   
   


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

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


[GitHub] [shardingsphere] weekndyyy commented on issue #16895: conflict key generated: shardingsphere/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/keygen/DefaultKeyGenerator.java

Posted by GitBox <gi...@apache.org>.
weekndyyy commented on issue #16895:
URL: https://github.com/apache/shardingsphere/issues/16895#issuecomment-1103361606

   > @weekndyyy Hello, Can you try it again with 5.1.1 version? I think you used version are too old.
   
   Is this problem caused by the low version?


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

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


[GitHub] [shardingsphere] pzpupu commented on issue #16895: conflict key generated: shardingsphere/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/keygen/DefaultKeyGenerator.java

Posted by GitBox <gi...@apache.org>.
pzpupu commented on issue #16895:
URL: https://github.com/apache/shardingsphere/issues/16895#issuecomment-1136696231

   我使用5.1.1版本,在并发高的时候使用snowflake id, 仍会出现重复的情况
   ---------------
   I use version 5.1.1 and use snowflake id when the concurrency is high, and there will still be duplicates


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

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


[GitHub] [shardingsphere] weekndyyy closed issue #16895: conflict key generated: shardingsphere/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/keygen/DefaultKeyGenerator.java

Posted by GitBox <gi...@apache.org>.
weekndyyy closed issue #16895: conflict key generated: shardingsphere/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/keygen/DefaultKeyGenerator.java
URL: https://github.com/apache/shardingsphere/issues/16895


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

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


Re: [I] conflict key generated: shardingsphere/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/keygen/DefaultKeyGenerator.java [shardingsphere]

Posted by "Qiudenghui (via GitHub)" <gi...@apache.org>.
Qiudenghui commented on issue #16895:
URL: https://github.com/apache/shardingsphere/issues/16895#issuecomment-2076293347

   你好,请问下这个最后怎么处理了,现在我也遇到这个情况,workerId  也配置了,仍然主键重复


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

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