-
Notifications
You must be signed in to change notification settings - Fork 390
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
Refine the condition for 'should shrink' decision #3252
Conversation
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.
I'm failing to see how, by calling is_candidate_for_shrink()
instead of manually calculating the 90% of the alive bytes, we're adding all the ancient storages to AncientSlotInfos.
Ah ok, I looked at the code and now see: by default the shrink threshold is with TotalSpace, not IndividualStore. |
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!
I assume this PR is included in the most recent run on jw12. Right?
@@ -7518,7 +7518,7 @@ impl AccountsDb { | |||
true | |||
} | |||
|
|||
fn is_candidate_for_shrink(&self, store: &AccountStorageEntry) -> bool { | |||
pub(crate) fn is_candidate_for_shrink(&self, store: &AccountStorageEntry) -> bool { |
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.
Can we document this fn?
pub(crate) fn is_candidate_for_shrink(&self, store: &AccountStorageEntry) -> bool { | |
/// Determines whether a given AccountStorageEntry instance is a candidate for shrinking. | |
pub(crate) fn is_candidate_for_shrink(&self, store: &AccountStorageEntry) -> bool { |
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.
I'll make a follow up pr with the documentation. Good point, though. Thanks!
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
* Refine the condition for 'should shrink' decision * Fix tests * Fix clippy * Brooks
Problem
When the ancient packing algorithm was designed, the intention was for 'shrinking' to occur as part of packing. This was observed to cause cold and warm accounts to be continually mixed, resulting in lots of disk i/o churn. In the newer strategy, we don't combine previously packed ancient storages with newly ancient storages. We do, however, rely on shrinking to shrink ancient storages. An important concept is that older ancient storages are very cold. Thus, the accounts in them are not expected to change frequently. if we require a threshold, like < 90% accounts are alive, some of these storages will never fail the threshold and be eligible for shrinking. When shrinking is idle, it finds the ancient storage with the highest # dead bytes and shrinks it.
Summary of Changes
Ancient packing adds ALL storages with dead bytes to the list that shrink uses to determine which ancient storages to shrink when shrink is otherwise idle.