Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions runtime/src/accounts_db/geyser_plugin_utils.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use {
crate::{accounts_db::AccountsDb, append_vec::StoredAccountMeta},
crate::{
accounts_db::AccountsDb,
append_vec::{StoredAccountMeta, StoredMeta},
},
solana_measure::measure::Measure,
solana_metrics::*,
solana_sdk::{account::AccountSharedData, clock::Slot, pubkey::Pubkey, signature::Signature},
Expand Down Expand Up @@ -112,14 +115,14 @@ impl AccountsDb {
measure_filter.stop();
notify_stats.elapsed_filtering_us += measure_filter.as_us() as usize;

self.notify_filtered_accounts(slot, notified_accounts, &accounts_to_stream, notify_stats);
self.notify_filtered_accounts(slot, notified_accounts, accounts_to_stream, notify_stats);
}

fn notify_filtered_accounts(
&self,
slot: Slot,
notified_accounts: &mut HashSet<Pubkey>,
accounts_to_stream: &HashMap<Pubkey, StoredAccountMeta>,
mut accounts_to_stream: HashMap<Pubkey, StoredAccountMeta>,
notify_stats: &mut GeyserPluginNotifyAtSnapshotRestoreStats,
) {
let notifier = self
Expand All @@ -130,9 +133,20 @@ impl AccountsDb {
.unwrap();

let mut measure_notify = Measure::start("accountsdb-plugin-notifying-accounts");
for account in accounts_to_stream.values() {
let local_write_version = 0;
for (_, mut account) in accounts_to_stream.drain() {
// We do not need to rely on the specific write_version read from the append vec.
// So, overwrite the write_version with something that works.
// 'accounts_to_stream' is already a hashmap, so there is already only entry per pubkey.
// write_version is only used to order multiple entries with the same pubkey, so it doesn't matter what value it gets here.
// Passing 0 for everyone's write_version is sufficiently correct.
let meta = StoredMeta {
write_version_obsolete: local_write_version,
..*account.meta
};
account.meta = &meta;
let mut measure_pure_notify = Measure::start("accountsdb-plugin-notifying-accounts");
notifier.notify_account_restore_from_snapshot(slot, account);
notifier.notify_account_restore_from_snapshot(slot, &account);
measure_pure_notify.stop();

notify_stats.total_pure_notify += measure_pure_notify.as_us() as usize;
Expand Down