-
Notifications
You must be signed in to change notification settings - Fork 563
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(storage): use arc SstableInfo in HummockVersion #18573
base: main
Are you sure you want to change the base?
Conversation
062bcb2
to
365b2e4
Compare
32f5534
to
852b9a7
Compare
852b9a7
to
39a5b2e
Compare
} | ||
|
||
#[derive(Debug, PartialEq, Clone, Default)] | ||
pub struct SstableInfoRef { |
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.
As we have implemented our own SstableInfo
struct, can we just make the implementation of the clone of SstableInfo
a shallow clone instead of explicitly introducing a struct wrapping it with arc? In this way, most of the changes in this PR can be avoided.
} | ||
|
||
task_local! { | ||
pub static SSTABLE_INFO_CACHE: *mut SstableInfoCache; |
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.
May use LazyCell
pub type HummockVersionType = HummockVersionCommon<SstableInfoType>; | ||
pub type HummockVersionDeltaType = HummockVersionDeltaCommon<SstableInfoType>; | ||
|
||
pub trait SstableInfoReader { |
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.
Instead of implementing this trait, it's easier to use impl Deref<Target = SstableInfo>
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
Given that compute node now will retain many recent hummock versions, to reduce its memory footprint, this PR stores and reuses
Arc<SstableInfo>
instead ofSstableInfo
inHummockVersion
for compute node.Two major changes:
Arc<SstableInfo>
andSstableInfo
.SstableInfoCache
inHummockObserverNode
, wherePbHummockVersion
andPbHummockVersionDelta
are converted from to types, i.e.HummockVersion<Arc<SstableInfo>>
.Arc<SstableInfo>
is retrieved from the cache whenever feasible.Please find more details about how the
Arc<SstableInfo>
is cached and shared inimpl From<&PbSstableInfo> for SstableInfoRef
insstable_info_ref.rs
.This PR is part1 of the refactor, aiming to adapt the related methods to be compatible with bothArc<SstableInfo>
andSstableInfo
. After this PR, theHummockVersion
in compute node will useArc<SstableInfo>
. However theseArc<SstableInfo>
is not reused acrossHummockVersion
, i.e. the memory footprint is not reduced yet. It'll be done in another PR after this one.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.