Skip to content
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

limit ancient pack budget for shrinking #2205

Merged
merged 1 commit into from
Jul 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion accounts-db/src/ancient_append_vecs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,15 @@ impl AncientSlotInfos {
// shrink enough slots to write 'percent_of_alive_shrunk_data'% of the total alive data
// from slots that exceeded the shrink threshold.
// The goal is to limit overall i/o in this pass while making progress.
// Simultaneously, we cannot allow the overall budget to be dominated by ancient storages that need to be shrunk.
// So, we have to limit how much of the total resulting budget can be allocated to re-packing/shrinking ancient storages.
let threshold_bytes =
self.total_alive_bytes_shrink.0 * tuning.percent_of_alive_shrunk_data / 100;
(self.total_alive_bytes_shrink.0 * tuning.percent_of_alive_shrunk_data / 100).min(
u64::from(tuning.max_resulting_storages)
* u64::from(tuning.ideal_storage_size)
* tuning.percent_of_alive_shrunk_data
/ 100,
);
for info_index in &self.shrink_indexes {
let info = &mut self.all_infos[*info_index];
if bytes_to_shrink_due_to_ratio.0 >= threshold_bytes {
Expand Down
Loading