-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Add base_slot to get_snapshot_storages() #19348
Add base_slot to get_snapshot_storages() #19348
Conversation
@@ -788,7 +788,7 @@ mod tests { | |||
.find(|elem| elem.slot == slot) | |||
.ok_or_else(|| Error::new(ErrorKind::Other, "did not find snapshot with this path"))?; | |||
let storages = { | |||
let mut storages = bank.get_snapshot_storages(); | |||
let mut storages = bank.get_snapshot_storages(Some(incremental_snapshot_base_slot)); | |||
snapshot_utils::filter_snapshot_storages_for_incremental_snapshot( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The call to filter_snapshot_storages_for_incremental_snapshot()
will be removed in the next PR (#19349). I am trying to keep PRs as minimal as possible :)
pub fn get_snapshot_storages(&self, slot: Slot) -> SnapshotStorages { | ||
self.accounts | ||
.accounts_db | ||
.get_snapshot_storages(slot, None) | ||
.0 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is never called, except by Bank
below, so I've just moved it there.
@@ -1636,7 +1636,7 @@ pub fn bank_to_incremental_snapshot_archive( | |||
|
|||
let temp_dir = tempfile::tempdir_in(snapshots_dir)?; | |||
let storages = { | |||
let mut storages = bank.get_snapshot_storages(); | |||
let mut storages = bank.get_snapshot_storages(Some(full_snapshot_slot)); | |||
filter_snapshot_storages_for_incremental_snapshot(&mut storages, full_snapshot_slot); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The call to filter_snapshot_storages_for_incremental_snapshot()
will be removed in the next PR (#19349).
Codecov Report
@@ Coverage Diff @@
## master #19348 +/- ##
=========================================
- Coverage 82.8% 82.8% -0.1%
=========================================
Files 457 457
Lines 130654 130690 +36
=========================================
+ Hits 108282 108290 +8
- Misses 22372 22400 +28 |
Problem
When taking a bank snapshot that is destined to be an incremental snapshot, we collect all the snapshot storages, then immediately filter/throw out the ones below the incremental snapshot base slot (aka last full snapshot slot). Ideally, we'd only collect the snapshot storages that we needed in the first place.
Summary of Changes
Add a
snapshot_base_slot
optional parameter toget_snapshot_storages()
, and filter/retain only slots higher.Related to #17088