remove some write_version checking (#29733)
This commit is contained in:
parent
4bfe4091b4
commit
71a746f10e
|
@ -83,7 +83,7 @@ use {
|
||||||
std::{
|
std::{
|
||||||
borrow::{Borrow, Cow},
|
borrow::{Borrow, Cow},
|
||||||
boxed::Box,
|
boxed::Box,
|
||||||
collections::{hash_map::Entry, BTreeSet, HashMap, HashSet},
|
collections::{BTreeSet, HashMap, HashSet},
|
||||||
hash::{Hash as StdHash, Hasher as StdHasher},
|
hash::{Hash as StdHash, Hasher as StdHasher},
|
||||||
io::{Error as IoError, Result as IoResult},
|
io::{Error as IoError, Result as IoResult},
|
||||||
ops::{Range, RangeBounds},
|
ops::{Range, RangeBounds},
|
||||||
|
@ -3608,18 +3608,7 @@ impl AccountsDb {
|
||||||
let mut stored_accounts: HashMap<Pubkey, StoredAccountMeta> = HashMap::new();
|
let mut stored_accounts: HashMap<Pubkey, StoredAccountMeta> = HashMap::new();
|
||||||
let original_bytes = store.total_bytes();
|
let original_bytes = store.total_bytes();
|
||||||
store.accounts.account_iter().for_each(|account| {
|
store.accounts.account_iter().for_each(|account| {
|
||||||
match stored_accounts.entry(*account.pubkey()) {
|
stored_accounts.insert(*account.pubkey(), account);
|
||||||
Entry::Occupied(mut occupied_entry) => {
|
|
||||||
assert!(
|
|
||||||
account.meta.write_version_obsolete
|
|
||||||
> occupied_entry.get().meta.write_version_obsolete
|
|
||||||
);
|
|
||||||
occupied_entry.insert(account);
|
|
||||||
}
|
|
||||||
Entry::Vacant(vacant_entry) => {
|
|
||||||
vacant_entry.insert(account);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// sort by pubkey to keep account index lookups close
|
// sort by pubkey to keep account index lookups close
|
||||||
|
@ -8298,24 +8287,14 @@ impl AccountsDb {
|
||||||
let this_version = stored_account.meta.write_version_obsolete;
|
let this_version = stored_account.meta.write_version_obsolete;
|
||||||
let pubkey = stored_account.pubkey();
|
let pubkey = stored_account.pubkey();
|
||||||
assert!(!self.is_filler_account(pubkey));
|
assert!(!self.is_filler_account(pubkey));
|
||||||
match accounts_map.entry(*pubkey) {
|
accounts_map.insert(
|
||||||
Entry::Vacant(entry) => {
|
*pubkey,
|
||||||
entry.insert(IndexAccountMapEntry {
|
IndexAccountMapEntry {
|
||||||
write_version: this_version,
|
write_version: this_version,
|
||||||
store_id: storage.append_vec_id(),
|
store_id: storage.append_vec_id(),
|
||||||
stored_account,
|
stored_account,
|
||||||
});
|
},
|
||||||
}
|
);
|
||||||
Entry::Occupied(mut entry) => {
|
|
||||||
let occupied_version = entry.get().write_version;
|
|
||||||
assert!(occupied_version < this_version);
|
|
||||||
entry.insert(IndexAccountMapEntry {
|
|
||||||
write_version: this_version,
|
|
||||||
store_id: storage.append_vec_id(),
|
|
||||||
stored_account,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
accounts_map
|
accounts_map
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue