Skip to content

Commit

Permalink
remove coupling of ShrinkCandidates to HashMap (#33176)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffwashington authored Sep 7, 2023
1 parent 528a03f commit e331275
Showing 1 changed file with 7 additions and 7 deletions.
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

0 comments on commit e331275

Please sign in to comment.