clean:clone uncleaned_roots for loop (#20714)
This commit is contained in:
committed by
GitHub
parent
9543fd9cdd
commit
6d7da6dbee
@ -2002,6 +2002,7 @@ impl AccountsDb {
|
|||||||
|
|
||||||
let total_keys_count = pubkeys.len();
|
let total_keys_count = pubkeys.len();
|
||||||
let mut accounts_scan = Measure::start("accounts_scan");
|
let mut accounts_scan = Measure::start("accounts_scan");
|
||||||
|
let uncleaned_roots = self.accounts_index.clone_uncleaned_roots();
|
||||||
let uncleaned_roots_len = self.accounts_index.uncleaned_roots_len();
|
let uncleaned_roots_len = self.accounts_index.uncleaned_roots_len();
|
||||||
let found_not_zero_accum = AtomicU64::new(0);
|
let found_not_zero_accum = AtomicU64::new(0);
|
||||||
let not_found_on_fork_accum = AtomicU64::new(0);
|
let not_found_on_fork_accum = AtomicU64::new(0);
|
||||||
@ -2036,7 +2037,7 @@ impl AccountsDb {
|
|||||||
let slot = *slot;
|
let slot = *slot;
|
||||||
drop(locked_entry);
|
drop(locked_entry);
|
||||||
|
|
||||||
if self.accounts_index.is_uncleaned_root(slot) {
|
if uncleaned_roots.contains(&slot) {
|
||||||
// Assertion enforced by `accounts_index.get()`, the latest slot
|
// Assertion enforced by `accounts_index.get()`, the latest slot
|
||||||
// will not be greater than the given `max_clean_root`
|
// will not be greater than the given `max_clean_root`
|
||||||
if let Some(max_clean_root) = max_clean_root {
|
if let Some(max_clean_root) = max_clean_root {
|
||||||
|
@ -1865,6 +1865,10 @@ impl<T: IndexValue> AccountsIndex<T> {
|
|||||||
self.roots_tracker.write().unwrap().roots.clear()
|
self.roots_tracker.write().unwrap().roots.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn clone_uncleaned_roots(&self) -> HashSet<Slot> {
|
||||||
|
self.roots_tracker.read().unwrap().uncleaned_roots.clone()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn uncleaned_roots_len(&self) -> usize {
|
pub fn uncleaned_roots_len(&self) -> usize {
|
||||||
self.roots_tracker.read().unwrap().uncleaned_roots.len()
|
self.roots_tracker.read().unwrap().uncleaned_roots.len()
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user