Skip to content

Commit

Permalink
Revert "Removed assert on write_version ordering (solana-labs#29530)"
Browse files Browse the repository at this point in the history
This reverts commit a6b492b.
  • Loading branch information
jeffwashington committed Jan 10, 2023
1 parent a5106e1 commit 471a861
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions runtime/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8483,8 +8483,14 @@ impl AccountsDb {
) -> GenerateIndexAccountsMap<'a> {
let num_accounts = storage.approx_stored_count();
let mut accounts_map = GenerateIndexAccountsMap::with_capacity(num_accounts);
let mut previous_write_version = None;
storage.accounts.account_iter().for_each(|stored_account| {
let this_version = stored_account.meta.write_version_obsolete;
if let Some(previous_write_version) = previous_write_version {
assert!(previous_write_version < this_version);
}
previous_write_version = Some(this_version);

let pubkey = stored_account.pubkey();
assert!(!self.is_filler_account(pubkey));
match accounts_map.entry(*pubkey) {
Expand Down
5 changes: 5 additions & 0 deletions runtime/src/accounts_db/geyser_plugin_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,15 @@ impl AccountsDb {

let mut accounts_to_stream: HashMap<Pubkey, StoredAccountMeta> = HashMap::default();
let mut measure_filter = Measure::start("accountsdb-plugin-filtering-accounts");
let mut previous_write_version = None;
let accounts = storage_entry.accounts.account_iter();
let mut account_len = 0;
accounts.for_each(|account| {
account_len += 1;
if let Some(previous_write_version) = previous_write_version {
assert!(previous_write_version < account.meta.write_version_obsolete);
}
previous_write_version = Some(account.meta.write_version_obsolete);
if notified_accounts.contains(&account.meta.pubkey) {
notify_stats.skipped_accounts += 1;
return;
Expand Down

0 comments on commit 471a861

Please sign in to comment.