Skip to content

Commit

Permalink
Uses IntSet in AccountSlots (#2892)
Browse files Browse the repository at this point in the history
  • Loading branch information
brooksprumo committed Sep 12, 2024
1 parent d7011b5 commit c8c6d2a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions accounts-db/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ impl<'a> MultiThreadProgress<'a> {
pub type AtomicAccountsFileId = AtomicU32;
pub type AccountsFileId = u32;

type AccountSlots = HashMap<Pubkey, HashSet<Slot>>;
type AccountSlots = HashMap<Pubkey, IntSet<Slot>>;
type SlotOffsets = HashMap<Slot, IntSet<usize>>;
type ReclaimResult = (AccountSlots, SlotOffsets);
type PubkeysRemovedFromAccountsIndex = HashSet<Pubkey>;
Expand Down Expand Up @@ -15444,7 +15444,7 @@ pub mod tests {
&pubkeys_removed_from_accounts_index,
);
assert_eq!(
vec![(pk1, vec![slot1].into_iter().collect::<HashSet<_>>())],
vec![(pk1, vec![slot1].into_iter().collect::<IntSet<_>>())],
purged_stored_account_slots.into_iter().collect::<Vec<_>>()
);
let expected = u64::from(already_removed);
Expand Down Expand Up @@ -15498,7 +15498,7 @@ pub mod tests {
&pubkeys_removed_from_accounts_index,
);
assert_eq!(
vec![(pk1, vec![slot1].into_iter().collect::<HashSet<_>>())],
vec![(pk1, vec![slot1].into_iter().collect::<IntSet<_>>())],
purged_stored_account_slots.into_iter().collect::<Vec<_>>()
);
assert_eq!(db.accounts_index.ref_count_from_storage(&pk1), 0);
Expand Down Expand Up @@ -15536,7 +15536,7 @@ pub mod tests {
);
for (pk, slots) in [(pk1, vec![slot1, slot2]), (pk2, vec![slot1])] {
let result = purged_stored_account_slots.remove(&pk).unwrap();
assert_eq!(result, slots.into_iter().collect::<HashSet<_>>());
assert_eq!(result, slots.into_iter().collect::<IntSet<_>>());
}
assert!(purged_stored_account_slots.is_empty());
assert_eq!(db.accounts_index.ref_count_from_storage(&pk1), 0);
Expand Down

0 comments on commit c8c6d2a

Please sign in to comment.