layotto icon indicating copy to clipboard operation
layotto copied to clipboard

feat: add sequencer api component with snowflake algorithm

Open OOOOlh opened this issue 2 years ago • 6 comments

What this PR does: add snowflake sequencer

  • [x] mysql
  • [x] ringbuffer
  • [x] uidgenerator

Which issue(s) this PR fixes:

Fixes #193

OOOOlh avatar Aug 16 '22 14:08 OOOOlh

Codecov Report

Base: 60.55% // Head: 60.69% // Increases project coverage by +0.14% :tada:

Coverage data is based on head (301b3c1) compared to base (18ceced). Patch coverage: 66.08% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #767      +/-   ##
==========================================
+ Coverage   60.55%   60.69%   +0.14%     
==========================================
  Files         135      137       +2     
  Lines        8815     9101     +286     
==========================================
+ Hits         5338     5524     +186     
- Misses       2823     2889      +66     
- Partials      654      688      +34     
Impacted Files Coverage Δ
...ponents/sequencer/snowflake/snowflake_sequencer.go 65.88% <65.88%> (ø)
components/sequencer/snowflake/snowflake.go 66.16% <66.16%> (ø)
components/lock/zookeeper/zookeeper_lock.go 54.38% <0.00%> (-5.27%) :arrow_down:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov[bot] avatar Aug 17 '22 03:08 codecov[bot]

@OOOOlh There are several issues that need to be resolved:

  1. The function name and important steps should be commented
  2. I see that you have defined a lot of parameters, you also should explain it
  3. The test is not enough, there is only one simple test now, you need to add some more. For example: multi-concurrency, recovery in case of errors, etc.

If you are done coding, remove [WIP].

ZLBer avatar Aug 27 '22 08:08 ZLBer

@ZLBer got it

OOOOlh avatar Aug 27 '22 11:08 OOOOlh

I will add more unit tests.

OOOOlh avatar Sep 02 '22 14:09 OOOOlh

@OOOOlh hi, Have you done integration test? i mean, real using mysql to generate many many snowflake sequence and check the correctness of sequence

ZLBer avatar Sep 18 '22 09:09 ZLBer

@ZLBer yes, it can produce increasing uid correctly

OOOOlh avatar Sep 21 '22 06:09 OOOOlh

@OOOOlh hi,bro, after you fix the issues, remember to tell me.

ZLBer avatar Sep 26 '22 14:09 ZLBer

@seeflood help review this pr, pls

ZLBer avatar Oct 09 '22 14:10 ZLBer

@ZLBer Please review again 😘

seeflood avatar Oct 19 '22 09:10 seeflood