Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement snowflake algorithm #659

Closed
wants to merge 4 commits into from
Closed

Conversation

azhsmesos
Copy link
Contributor

解决两个问题:
1.时钟回拨,没有采用redis的方式,而是本地保存当前最大timestart,每次启动时就找到这台机器上面的max_time自增就好了,保持逻辑时钟
2.跨毫秒起始值起始每次默认都是0,这会导致末尾是偶数不方便取余,所以采用random的方式选取1~3的随机数

@azhsmesos azhsmesos changed the title feat:implement snowflake algorithm feat: implement snowflake algorithm Jun 18, 2022
@codecov
Copy link

codecov bot commented Jun 18, 2022

Codecov Report

Merging #659 (1c2602b) into main (00a5984) will decrease coverage by 0.13%.
The diff coverage is 40.90%.

@@            Coverage Diff             @@
##             main     #659      +/-   ##
==========================================
- Coverage   60.92%   60.78%   -0.14%     
==========================================
  Files         120      121       +1     
  Lines        6377     6421      +44     
==========================================
+ Hits         3885     3903      +18     
- Misses       2120     2142      +22     
- Partials      372      376       +4     
Impacted Files Coverage Δ
...ponents/sequencer/snowflake/sequencer_snowflake.go 40.90% <40.90%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2aa9090...1c2602b. Read the comment docs.

Copy link
Member

@seeflood seeflood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to implement GetSegment

@seeflood
Copy link
Member

seeflood commented Jun 18, 2022

action:
调研一下要不要接存储
调研一下时钟回拨问题
沟通一下GLCC 课题,要先提交申请再写PR

@ZLBer @seeflood

)

var (
machineRoomIdBits = 5 // 机房id 五位数
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need english comments

@ZLBer
Copy link
Member

ZLBer commented Jun 19, 2022

@seeflood
This subject participated in GLCC.I think we should follow the rules of GLCC.
PR should not be submitted now.It's not fair.
We should choose the candidate from all students who have submitted their proposal.

@seeflood
Copy link
Member

seeflood commented Jun 20, 2022

@ZLBer Agreed. We should follow the rules and make it fair.
@azhsmesos Thanks for your contribution, but please submit a GLCC proposal and wait for the approval before submitting this PR.
We have to close this PR and wait for the GLCC process.
For now, you can continue with other PR, like #554 and the istio one
Thanks for your understanding, and sorry for the inconvenience !

@seeflood seeflood closed this Jun 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants