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

remove coupling of ShrinkCandidates to HashMap #33176

Merged
merged 1 commit into from
Sep 7, 2023
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
14 changes: 7 additions & 7 deletions accounts-db/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4311,8 +4311,8 @@ impl AccountsDb {

// Working from the beginning of store_usage which are the most sparse and see when we can stop
// shrinking while still achieving the overall goals.
let mut shrink_slots: ShrinkCandidates = HashMap::new();
let mut shrink_slots_next_batch: ShrinkCandidates = HashMap::new();
let mut shrink_slots = ShrinkCandidates::new();
let mut shrink_slots_next_batch = ShrinkCandidates::new();
for usage in &store_usage {
let store = &usage.store;
let alive_ratio = (total_alive_bytes as f64) / (total_bytes as f64);
Expand Down Expand Up @@ -8161,7 +8161,7 @@ impl AccountsDb {
assert!(self.storage.no_shrink_in_progress());

let mut dead_slots = HashSet::new();
let mut new_shrink_candidates: ShrinkCandidates = HashMap::new();
let mut new_shrink_candidates = ShrinkCandidates::new();
let mut measure = Measure::start("remove");
for (slot, account_info) in reclaims {
// No cached accounts should make it here
Expand Down Expand Up @@ -13250,7 +13250,7 @@ pub mod tests {
fn test_select_candidates_by_total_usage_no_candidates() {
// no input candidates -- none should be selected
solana_logger::setup();
let candidates: ShrinkCandidates = HashMap::new();
let candidates = ShrinkCandidates::new();

let (selected_candidates, next_candidates) = AccountsDb::select_candidates_by_total_usage(
&candidates,
Expand All @@ -13266,7 +13266,7 @@ pub mod tests {
fn test_select_candidates_by_total_usage_3_way_split_condition() {
// three candidates, one selected for shrink, one is put back to the candidate list and one is ignored
solana_logger::setup();
let mut candidates: ShrinkCandidates = HashMap::new();
let mut candidates = ShrinkCandidates::new();

let common_store_path = Path::new("");
let slot_id_1 = 12;
Expand Down Expand Up @@ -13340,7 +13340,7 @@ pub mod tests {
fn test_select_candidates_by_total_usage_2_way_split_condition() {
// three candidates, 2 are selected for shrink, one is ignored
solana_logger::setup();
let mut candidates: ShrinkCandidates = HashMap::new();
let mut candidates = ShrinkCandidates::new();

let common_store_path = Path::new("");
let slot_id_1 = 12;
Expand Down Expand Up @@ -13410,7 +13410,7 @@ pub mod tests {
fn test_select_candidates_by_total_usage_all_clean() {
// 2 candidates, they must be selected to achieve the target alive ratio
solana_logger::setup();
let mut candidates: ShrinkCandidates = HashMap::new();
let mut candidates = ShrinkCandidates::new();

let slot1 = 12;
let common_store_path = Path::new("");
Expand Down