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 2019/11/07 06:44:41 UTC

[GitHub] [incubator-shardingsphere] terrymanu commented on a change in pull request #3469: Update snowflake algorithm to support modulus of 2^n

terrymanu commented on a change in pull request #3469: Update snowflake algorithm to support modulus of 2^n
URL: https://github.com/apache/incubator-shardingsphere/pull/3469#discussion_r343496480
 
 

 ##########
 File path: sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/strategy/keygen/SnowflakeShardingKeyGenerator.java
 ##########
 @@ -148,6 +156,15 @@ private long waitUntilNextTime(final long lastTime) {
     }
     
     private void vibrateSequenceOffset() {
-        sequenceOffset = (byte) (~sequenceOffset & 1);
+        sequenceOffset = (sequenceOffset + 1) & getCustomVibrationValue();
 
 Review comment:
   This method is hard to understander, what is the proposal?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services