make max_roots_inclusive clear (#22942)
This commit is contained in:
parent
514aab46d9
commit
a160fc30f2
|
@ -2000,7 +2000,7 @@ impl AccountsDb {
|
|||
timings: &mut CleanKeyTimings,
|
||||
) -> Vec<Pubkey> {
|
||||
let mut dirty_store_processing_time = Measure::start("dirty_store_processing");
|
||||
let max_slot = max_clean_root.unwrap_or_else(|| self.accounts_index.max_root());
|
||||
let max_slot = max_clean_root.unwrap_or_else(|| self.accounts_index.max_root_inclusive());
|
||||
let mut dirty_stores = Vec::with_capacity(self.dirty_stores.len());
|
||||
self.dirty_stores.retain(|(slot, _store_id), store| {
|
||||
if *slot > max_slot {
|
||||
|
|
|
@ -615,7 +615,7 @@ impl RollingBitField {
|
|||
#[derive(Debug)]
|
||||
pub struct RootsTracker {
|
||||
roots: RollingBitField,
|
||||
max_root: Slot,
|
||||
max_root_inclusive: Slot,
|
||||
uncleaned_roots: HashSet<Slot>,
|
||||
previous_uncleaned_roots: HashSet<Slot>,
|
||||
}
|
||||
|
@ -633,7 +633,7 @@ impl RootsTracker {
|
|||
pub fn new(max_width: u64) -> Self {
|
||||
Self {
|
||||
roots: RollingBitField::new(max_width),
|
||||
max_root: 0,
|
||||
max_root_inclusive: 0,
|
||||
uncleaned_roots: HashSet::new(),
|
||||
previous_uncleaned_roots: HashSet::new(),
|
||||
}
|
||||
|
@ -958,10 +958,10 @@ impl<T: IndexValue> AccountsIndex<T> {
|
|||
// the `ongoing_scan_roots` lock is held,
|
||||
// make sure inverse doesn't happen to avoid
|
||||
// deadlock
|
||||
let max_root = self.max_root();
|
||||
*w_ongoing_scan_roots.entry(max_root).or_default() += 1;
|
||||
let max_root_inclusive = self.max_root_inclusive();
|
||||
*w_ongoing_scan_roots.entry(max_root_inclusive).or_default() += 1;
|
||||
|
||||
max_root
|
||||
max_root_inclusive
|
||||
};
|
||||
|
||||
// First we show that for any bank `B` that is a descendant of
|
||||
|
@ -1793,7 +1793,7 @@ impl<T: IndexValue> AccountsIndex<T> {
|
|||
let roots_tracker = &self.roots_tracker.read().unwrap();
|
||||
let newest_root_in_slot_list =
|
||||
Self::get_newest_root_in_slot_list(&roots_tracker.roots, slot_list, max_clean_root);
|
||||
let max_clean_root = max_clean_root.unwrap_or(roots_tracker.max_root);
|
||||
let max_clean_root = max_clean_root.unwrap_or(roots_tracker.max_root_inclusive);
|
||||
|
||||
slot_list.retain(|(slot, value)| {
|
||||
let should_purge =
|
||||
|
@ -1874,8 +1874,8 @@ impl<T: IndexValue> AccountsIndex<T> {
|
|||
w_roots_tracker.uncleaned_roots.insert(slot);
|
||||
}
|
||||
// `AccountsDb::flush_accounts_cache()` relies on roots being added in order
|
||||
assert!(slot >= w_roots_tracker.max_root);
|
||||
w_roots_tracker.max_root = slot;
|
||||
assert!(slot >= w_roots_tracker.max_root_inclusive);
|
||||
w_roots_tracker.max_root_inclusive = slot;
|
||||
}
|
||||
|
||||
pub fn add_uncleaned_roots<I>(&self, roots: I)
|
||||
|
@ -1886,8 +1886,8 @@ impl<T: IndexValue> AccountsIndex<T> {
|
|||
w_roots_tracker.uncleaned_roots.extend(roots);
|
||||
}
|
||||
|
||||
pub fn max_root(&self) -> Slot {
|
||||
self.roots_tracker.read().unwrap().max_root
|
||||
pub fn max_root_inclusive(&self) -> Slot {
|
||||
self.roots_tracker.read().unwrap().max_root_inclusive
|
||||
}
|
||||
|
||||
/// Remove the slot when the storage for the slot is freed
|
||||
|
|
Loading…
Reference in New Issue