get root lock once (#16829)
This commit is contained in:
parent
e6f49a3e79
commit
ffbe8906ed
|
@ -1313,10 +1313,11 @@ impl<T: 'static + Clone + IsCached + ZeroLamport> AccountsIndex<T> {
|
||||||
/// Remove the slot when the storage for the slot is freed
|
/// Remove the slot when the storage for the slot is freed
|
||||||
/// Accounts no longer reference this slot.
|
/// Accounts no longer reference this slot.
|
||||||
pub fn clean_dead_slot(&self, slot: Slot) -> Option<AccountsIndexRootsStats> {
|
pub fn clean_dead_slot(&self, slot: Slot) -> Option<AccountsIndexRootsStats> {
|
||||||
if self.is_root(slot) {
|
|
||||||
let (roots_len, uncleaned_roots_len, previous_uncleaned_roots_len, roots_range) = {
|
let (roots_len, uncleaned_roots_len, previous_uncleaned_roots_len, roots_range) = {
|
||||||
let mut w_roots_tracker = self.roots_tracker.write().unwrap();
|
let mut w_roots_tracker = self.roots_tracker.write().unwrap();
|
||||||
w_roots_tracker.roots.remove(&slot);
|
if !w_roots_tracker.roots.remove(&slot) {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
w_roots_tracker.uncleaned_roots.remove(&slot);
|
w_roots_tracker.uncleaned_roots.remove(&slot);
|
||||||
w_roots_tracker.previous_uncleaned_roots.remove(&slot);
|
w_roots_tracker.previous_uncleaned_roots.remove(&slot);
|
||||||
(
|
(
|
||||||
|
@ -1334,9 +1335,6 @@ impl<T: 'static + Clone + IsCached + ZeroLamport> AccountsIndex<T> {
|
||||||
rooted_cleaned_count: 0,
|
rooted_cleaned_count: 0,
|
||||||
unrooted_cleaned_count: 0,
|
unrooted_cleaned_count: 0,
|
||||||
})
|
})
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn reset_uncleaned_roots(&self, max_clean_root: Option<Slot>) -> HashSet<Slot> {
|
pub fn reset_uncleaned_roots(&self, max_clean_root: Option<Slot>) -> HashSet<Slot> {
|
||||||
|
|
Loading…
Reference in New Issue