Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

[Incremental Snapshots] Filter account_storage_entries when serializing accounts_db_fields for an incremental snapshot #18813

Closed
Tracked by #17088
brooksprumo opened this issue Jul 21, 2021 · 2 comments
Assignees

Comments

@brooksprumo
Copy link
Contributor

brooksprumo commented Jul 21, 2021

During serialization of accounts_db for an incremental snapshot, filter out the storage entries for all slots less-than-or-equal-to the full snapshot slot.

Original code:

let entries =
serialize_iter_as_map(serializable_db.account_storage_entries.iter().map(|x| {
*entry_count.borrow_mut() += x.len();
(
x.first().unwrap().slot(),
serialize_iter_as_seq(
x.iter()
.map(|x| Self::SerializableAccountStorageEntry::from(x.as_ref())),
),
)
}));

So, instead of map(), can call filter_map() and do the same filtering that is done in Bank::get_incremental_snapshot_storages():

solana/runtime/src/bank.rs

Lines 4733 to 4744 in d048750

pub fn get_incremental_snapshot_storages(&self, full_snapshot_slot: Slot) -> SnapshotStorages {
self.get_snapshot_storages()
.into_iter()
.map(|storage| {
storage
.into_iter()
.filter(|entry| entry.slot() > full_snapshot_slot)
.collect::<SnapshotStorage>()
})
.filter(|storage| !storage.is_empty())
.collect()
}

Below is the original comment and context from the original PR

Should we filter here or just return an error? Since we checked earlier via check_are_snapshots_compatible that the incremental snapshot was based on this full snapshot, there should be no slots <= full snapshot slot right?

Originally posted by @carllin in #18504 (comment)

@brooksprumo
Copy link
Contributor Author

This issue has been resolved by PR #19348.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 1, 2022

This issue has been automatically locked since there has not been any activity in past 7 days after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant