-
Notifications
You must be signed in to change notification settings - Fork 1.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
[Refactor] Remove charge_mode from LRUCache #55911
base: main
Are you sure you want to change the base?
Conversation
void (*deleter)(const CacheKey& key, void* value), CachePriority priority, | ||
size_t value_size) { | ||
Cache::Handle* LRUCache::insert(const CacheKey& key, uint32_t hash, void* value, size_t value_size, size_t charge, | ||
void (*deleter)(const CacheKey& key, void* value), CachePriority priority) { |
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.
If the value is self-descriptive, how about removing the value_size in the lru_cache because it is really unnecessary for a underly cache? It can reduce memory if value_size=charge
in many cases. If value_size!=size
, the caller can get the value size from the pointer.
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 suggestion. Removing it can save metadata memory. However, we won't change it in this PR. The purpose of this PR is to enable PageCache to use the StarCache interface.
@Mergifyio rebase main |
Signed-off-by: trueeyu <[email protected]>
Signed-off-by: trueeyu <[email protected]>
Signed-off-by: trueeyu <[email protected]>
Signed-off-by: trueeyu <[email protected]>
✅ Branch has been successfully rebased |
1e7162b
to
b7d2c00
Compare
[Java-Extensions Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
[FE Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
[BE Incremental Coverage Report]✅ pass : 25 / 25 (100.00%) file detail
|
Why I'm doing:
charge_size
is the actual memory size occupied by an element, whilevalue_size
is the size of the element. For the underlying cache, it only needs to knowcharge_size
for memory accounting purposes. As for the passed-in Item, if it needs to rely on thevalue_size
for decoding, then ensuring that the data structure is self-descriptive.The interface of
DataCache
only have one paramcharge_size
, so In order to unifyPageCache
andDataCache
, the charge mode ofLRUCache
will be removed.What I'm doing:
Remove charge_mode from LRUCache
What type of PR is this:
Does this PR entail a change in behavior?
If yes, please specify the type of change:
Checklist:
Bugfix cherry-pick branch check: