fix race in get_exclusive_storage() and load() (#3941)

* Revert "Revert "account storage is not in sync with the index after gc (#3914)" (#3936)"

This reverts commit 4f47fc00bc.

* fix get_exclusive_storage

* clippy
This commit is contained in:
Rob Walker
2019-04-23 09:56:36 -07:00
committed by GitHub
parent de6af95061
commit 5406d82d89
3 changed files with 255 additions and 178 deletions

View File

@@ -9,7 +9,7 @@ pub struct AccountsIndex<T> {
account_maps: HashMap<Pubkey, Vec<(Fork, T)>>,
roots: HashSet<Fork>,
//This value that needs to be stored to recover the index from AppendVec
last_root: Fork,
pub last_root: Fork,
}
impl<T: Clone> AccountsIndex<T> {
@@ -59,7 +59,7 @@ impl<T: Clone> AccountsIndex<T> {
};
rv
}
fn is_purged(&self, fork: Fork) -> bool {
pub fn is_purged(&self, fork: Fork) -> bool {
!self.is_root(fork) && fork < self.last_root
}
pub fn is_root(&self, fork: Fork) -> bool {