decouple geyser's write_version from append vec on snapshot load (#29623)
This commit is contained in:
parent
1d6999914a
commit
0ee9993632
|
@ -1,5 +1,8 @@
|
||||||
use {
|
use {
|
||||||
crate::{accounts_db::AccountsDb, append_vec::StoredAccountMeta},
|
crate::{
|
||||||
|
accounts_db::AccountsDb,
|
||||||
|
append_vec::{StoredAccountMeta, StoredMeta},
|
||||||
|
},
|
||||||
solana_measure::measure::Measure,
|
solana_measure::measure::Measure,
|
||||||
solana_metrics::*,
|
solana_metrics::*,
|
||||||
solana_sdk::{account::AccountSharedData, clock::Slot, pubkey::Pubkey, signature::Signature},
|
solana_sdk::{account::AccountSharedData, clock::Slot, pubkey::Pubkey, signature::Signature},
|
||||||
|
@ -112,14 +115,14 @@ impl AccountsDb {
|
||||||
measure_filter.stop();
|
measure_filter.stop();
|
||||||
notify_stats.elapsed_filtering_us += measure_filter.as_us() as usize;
|
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(
|
fn notify_filtered_accounts(
|
||||||
&self,
|
&self,
|
||||||
slot: Slot,
|
slot: Slot,
|
||||||
notified_accounts: &mut HashSet<Pubkey>,
|
notified_accounts: &mut HashSet<Pubkey>,
|
||||||
accounts_to_stream: &HashMap<Pubkey, StoredAccountMeta>,
|
mut accounts_to_stream: HashMap<Pubkey, StoredAccountMeta>,
|
||||||
notify_stats: &mut GeyserPluginNotifyAtSnapshotRestoreStats,
|
notify_stats: &mut GeyserPluginNotifyAtSnapshotRestoreStats,
|
||||||
) {
|
) {
|
||||||
let notifier = self
|
let notifier = self
|
||||||
|
@ -130,9 +133,20 @@ impl AccountsDb {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let mut measure_notify = Measure::start("accountsdb-plugin-notifying-accounts");
|
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");
|
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();
|
measure_pure_notify.stop();
|
||||||
|
|
||||||
notify_stats.total_pure_notify += measure_pure_notify.as_us() as usize;
|
notify_stats.total_pure_notify += measure_pure_notify.as_us() as usize;
|
||||||
|
|
Loading…
Reference in New Issue