-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat: implement DenseSet::Shrink #6094
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
base: main
Are you sure you want to change the base?
Conversation
dranikpg
left a comment
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.
It seems to me that all those internal calls to Delete() are now not safe anymore. The safeguards are not a substitute for actually reviewing the code around it and its usage
|
@dranikpg I've already discussed with @vyavdoshenko all these problems; he rewrites all this logic. |
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.
Review completed. 3 suggestions posted.
Comment augment review to trigger a new review at any time.
038c970 to
c23eba4
Compare
dranikpg
left a comment
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.
After multiple rounds of review by Borys I don't have much comments 🙂 Please don't forget to set set_time (see comments)
| if (has_ttl && ObjExpireTime(obj) <= time_now_) { | ||
| ObjDelete(obj, true); | ||
| --size_; | ||
| continue; | ||
| } |
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.
this will currently never happen because you never call set_time() from the SHRINK command, you can look at container_utils::GetStringMap for an example
| << CI{"LATENCY", CO::NOSCRIPT | CO::LOADING | CO::FAST, -2, 0, 0, acl::kLatency}.HFUNC( | ||
| Latency) | ||
| << CI{"MEMORY", kMemOpts, -2, 0, 0, acl::kMemory}.HFUNC(Memory) | ||
| << CI{"SHRINK", CO::WRITE | CO::FAST, 2, 1, 1, acl::kMemory}.HFUNC(Shrink) |
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.
haven't seen what it was before, but I assumed it has to be part of MEMORY. It won't be as easy to a transaction then, because you'll need to create one manually
| continue; | ||
| } | ||
|
|
||
| uint32_t new_bid = BucketId(obj, 0); |
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.
based on the hash functon, it looks like 2*i and i are mapped to -> i. Not sure if its worth dcheck'ing or commenting, because the code looks more generic than it already is
Closes: #6044
Add
DenseSet::Shrink()to reduce the hash table size when sets/hashes have excess capacity after deletions.