-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
expression: support sequence function #14731
Conversation
/run-unit-test |
/build |
1 similar comment
/build |
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.
No test for those feature?
The sequence allcator is in next PR, the code here is the code in PTAL @crazycs520 |
type SequenceState struct { | ||
mu sync.Mutex | ||
// latestValueMap caches the last value obtained by nextval() for each sequence id. | ||
latestValueMap map[int64]int64 |
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.
Consider sync.Map and avoid use sync.Mutex
manually?
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.
Maybe the map[int64]int64
is more directly to know what kind of the k&v it is.
Sync.map will store the interface, and transform it, maybe too heavy for int64.
LGTM |
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.
LGTM
/run-all-tests |
/merge |
/run-all-tests |
What problem does this PR solve?
What is changed and how it works?
1: support sequence function
nextval
,lastval
,setval
.2: implement
sequenceState
which could be used to cache sequence lastval.3: introduce
SequenceSchema
interface to do the sequence schema check in expression package. (If we use information schema, that will cause import cycle problem)Check List
Tests
Code changes
SequenceSchema
interface in util package.Related changes
Release note