-
Notifications
You must be signed in to change notification settings - Fork 590
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
refactor(common): generalize LookupEntryState
to EstimatedHashSet
#15843
Conversation
LookupEntryState
to EstimatedHashSet
LookupEntryState
to EstimatedHashSet
749e1e5
to
e21e7e1
Compare
e21e7e1
to
492b386
Compare
492b386
to
6554fa9
Compare
Signed-off-by: Richard Chien <[email protected]>
6554fa9
to
439649d
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.
Looks good
#[derive(Default)] | ||
pub struct EstimatedHashSet<T: EstimateSize> { | ||
inner: HashSet<T>, | ||
kv_heap_size: KvSize, |
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.
cc @yuhao-su May I ask what "kv" in the name is for? 😄
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.
Just renamed the kv_heap_size
field to heap_size
. Maybe we should revisit the name of KvSize
struct in the future, but let's keep it unchanged in this PR.
match op { | ||
Op::Insert | Op::UpdateInsert => { | ||
values.insert(row.into_owned_row()); | ||
if !values.insert(row) { | ||
panic!("inserting a duplicated value"); |
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 appears that we can now safely replace panic
with inconsistency_panic
after the refactoring.
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.
Yes, exactly.
Signed-off-by: Richard Chien <[email protected]>
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
Seems previously
LookupEntryState
is just a simpleEstimateSize
wrapper forHashSet
, this PR generalize it toEstimatedHashSet
so that other modules can reuse it in the future.Checklist
./risedev check
(or alias,./risedev c
)Documentation
Release note
If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.