Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moves 0 for write_version in geyser when restoring from a snapshot #979

Merged
merged 1 commit into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
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
18 changes: 2 additions & 16 deletions accounts-db/src/accounts_db/geyser_plugin_utils.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
use {
crate::{
account_storage::meta::{StoredAccountMeta, StoredMeta},
accounts_db::AccountsDb,
},
crate::{account_storage::meta::StoredAccountMeta, accounts_db::AccountsDb},
solana_measure::measure::Measure,
solana_metrics::*,
solana_sdk::{
Expand Down Expand Up @@ -146,18 +143,7 @@ impl AccountsDb {
) {
let notifier = self.accounts_update_notifier.as_ref().unwrap();
let mut measure_notify = Measure::start("accountsdb-plugin-notifying-accounts");
let local_write_version = 0;
for mut account in accounts_to_stream {
// 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.set_meta(&meta);
for account in accounts_to_stream {
let mut measure_pure_notify = Measure::start("accountsdb-plugin-notifying-accounts");
notifier.notify_account_restore_from_snapshot(slot, &account);
measure_pure_notify.stop();
Expand Down
9 changes: 8 additions & 1 deletion geyser-plugin-manager/src/accounts_update_notifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,21 @@ impl AccountsUpdateNotifierImpl {
&self,
stored_account_meta: &'a StoredAccountMeta,
) -> Option<ReplicaAccountInfoV3<'a>> {
// 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.
// 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 write_version = 0;
Some(ReplicaAccountInfoV3 {
pubkey: stored_account_meta.pubkey().as_ref(),
lamports: stored_account_meta.lamports(),
owner: stored_account_meta.owner().as_ref(),
executable: stored_account_meta.executable(),
rent_epoch: stored_account_meta.rent_epoch(),
data: stored_account_meta.data(),
write_version: stored_account_meta.write_version(),
write_version,
txn: None,
})
}
Expand Down
Loading