Skip to content

Commit

Permalink
Uses IntSet for RootsTracker::uncleaned_roots (solana-labs#33524)
Browse files Browse the repository at this point in the history
  • Loading branch information
brooksprumo authored Oct 4, 2023
1 parent d41fa34 commit 5a99568
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions accounts-db/src/accounts_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use {
ThreadPool,
},
solana_measure::measure::Measure,
solana_nohash_hasher::IntSet,
solana_sdk::{
account::ReadableAccount,
clock::{BankId, Slot},
Expand Down Expand Up @@ -457,7 +458,7 @@ pub struct RootsTracker {
/// Updated every time we add a new root or clean/shrink an append vec into irrelevancy.
/// Range is approximately the last N slots where N is # slots per epoch.
pub alive_roots: RollingBitField,
uncleaned_roots: HashSet<Slot>,
uncleaned_roots: IntSet<Slot>,
}

impl Default for RootsTracker {
Expand All @@ -473,7 +474,7 @@ impl RootsTracker {
pub fn new(max_width: u64) -> Self {
Self {
alive_roots: RollingBitField::new(max_width),
uncleaned_roots: HashSet::new(),
uncleaned_roots: IntSet::default(),
}
}

Expand Down Expand Up @@ -1994,7 +1995,7 @@ impl<T: IndexValue, U: DiskIndexValue + From<T> + Into<T>> AccountsIndex<T, U> {
tracker.alive_roots.get_all()
}

pub fn clone_uncleaned_roots(&self) -> HashSet<Slot> {
pub fn clone_uncleaned_roots(&self) -> IntSet<Slot> {
self.roots_tracker.read().unwrap().uncleaned_roots.clone()
}

Expand Down

0 comments on commit 5a99568

Please sign in to comment.