-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add snowflake id #3500
Add snowflake id #3500
Conversation
src/common/expression/CMakeLists.txt
Outdated
@@ -32,6 +32,7 @@ nebula_add_library( | |||
PredicateExpression.cpp | |||
ListComprehensionExpression.cpp | |||
ReduceExpression.cpp | |||
../id/SnowFlake.cpp |
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.
You could add a new object for the ids.
UNUSED(ctx); | ||
SnowFlake generator; |
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.
Why always new a generator?
src/common/id/SnowFlake.h
Outdated
int64_t getId(); | ||
|
||
private: | ||
mutable std::mutex lock_; |
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.
Why we still have s lock here?
UNUSED(ctx); | ||
Snowflake generator; | ||
result_ = generator.getId(); |
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.
add a long term generator for client
src/common/id/test/CMakeLists.txt
Outdated
$<TARGET_OBJECTS:base_obj> | ||
$<TARGET_OBJECTS:snowflake_obj> | ||
LIBRARIES gtest gtest_main | ||
) |
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 new line
990e4d6
to
232d11b
Compare
src/graph/util/test/CMakeLists.txt
Outdated
@@ -8,6 +8,7 @@ nebula_add_test( | |||
$<TARGET_OBJECTS:concurrent_obj> | |||
$<TARGET_OBJECTS:datatypes_obj> | |||
$<TARGET_OBJECTS:expression_obj> | |||
$<TARGET_OBJECTS:snowflake_obj> |
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.
format
4271b48
to
7ed4877
Compare
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.
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.
Good job!
* snowflake id * fix bug * fix review * remove redundant * tmp * tmp * finish * fix * fix * fix header * fix header * fix format * fix test * fix review * fix bench * add 64 * fix review * fix review * fix viarable Co-authored-by: Sophie <84560950+Sophie-Xie@users.noreply.github.com> Co-authored-by: jakevin <30525741+jackwener@users.noreply.github.com> Co-authored-by: Sophie <84560950+Sophie-Xie@users.noreply.github.com>
What type of PR is this?
Which issue(s) this PR fixes:
close #3447
What this PR does / why we need it?
Add a kind of unquie id
Special notes for your reviewer, ex. impact of this fix, etc:
Additional context:
Checklist:
Release notes:
Please confirm whether to reflect in release notes and how to describe: