-
Notifications
You must be signed in to change notification settings - Fork 171
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
feature: add sequencer api component by mysql #509
Conversation
Codecov Report
@@ Coverage Diff @@
## main #509 +/- ##
==========================================
- Coverage 60.70% 60.33% -0.37%
==========================================
Files 120 122 +2
Lines 6382 6492 +110
==========================================
+ Hits 3874 3917 +43
- Misses 2139 2195 +56
- Partials 369 380 +11
Continue to review full report at Codecov.
|
Currently we can ignore the codecov error in CI because all UT won't be run. |
# Conflicts: # components/pkg/utils/mysql.go # components/sequencer/mysql/mysql_test.go
@@ -397,6 +398,9 @@ func NewRuntimeGrpcServer(data json.RawMessage, opts ...grpc.ServerOption) (mgrp | |||
runtime_sequencer.NewFactory("in-memory", func() sequencer.Store { | |||
return sequencer_inmemory.NewInMemorySequencer() | |||
}), | |||
runtime_sequencer.NewFactory("Mysql", func() sequencer.Store { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lowercase
) | ||
|
||
const ( | ||
defaultTableName = "tableName" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you change defaultTableName to another? such as layotto_sequencer
} | ||
} else { | ||
Value += 1 | ||
_, err := begin.Exec("UPDATE ? SET sequencer_value += 1 WHERE sequencer_key = ?", metadata.TableName, req.Key) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might occur concurrency problem , such as clientA and clientB all want to add the sequencer form 1 to 2 , the db sequencer added to 3,but the both client will get 2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do I need to use SnowFlake? Or simply add a lock to the method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@GimmeCyy global lock? not very good. try db optimistic lock ?
|
||
} else { | ||
Value += int64(req.Size) | ||
_, err1 := begin.Exec("UPDATE ? SET sequencer_value = ? WHERE sequencer_key = ?", metadata.TableName, Value, req.Key) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
Why is this pr closed? Is it a wrong click? hhhhh |
@GimmeCyy Great contribution. Could u add more test cases to increase ut coverage rate and fix the codecov errors? We have fixed the CI |
我的代码推了几次这里都没反应,我可能需要重新提一个pr |
What this PR does:
add sequencer api component by mysql
Which issue(s) this PR fixes:
#489