Skip to content

Commit

Permalink
Remove filter_snapshot_storages_for_incremental_snapshot() (solana-la…
Browse files Browse the repository at this point in the history
…bs#19349)

Now that we can get just the subset of snapshot storages we want, the extra
filtering afterwards is redundant.
  • Loading branch information
brooksprumo authored Aug 23, 2021
1 parent 86ef147 commit 1a4bede
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 26 deletions.
9 changes: 1 addition & 8 deletions core/tests/snapshots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -799,14 +799,7 @@ mod tests {
"did not find bank snapshot with this path",
)
})?;
let storages = {
let mut storages = bank.get_snapshot_storages(Some(incremental_snapshot_base_slot));
snapshot_utils::filter_snapshot_storages_for_incremental_snapshot(
&mut storages,
incremental_snapshot_base_slot,
);
storages
};
let storages = bank.get_snapshot_storages(Some(incremental_snapshot_base_slot));
snapshot_utils::package_process_and_archive_incremental_snapshot(
bank,
incremental_snapshot_base_slot,
Expand Down
19 changes: 1 addition & 18 deletions runtime/src/snapshot_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1635,11 +1635,7 @@ pub fn bank_to_incremental_snapshot_archive(
bank.rehash(); // Bank accounts may have been manually modified by the caller

let temp_dir = tempfile::tempdir_in(bank_snapshots_dir)?;
let storages = {
let mut storages = bank.get_snapshot_storages(Some(full_snapshot_slot));
filter_snapshot_storages_for_incremental_snapshot(&mut storages, full_snapshot_slot);
storages
};
let storages = bank.get_snapshot_storages(Some(full_snapshot_slot));
let bank_snapshot_info = add_bank_snapshot(&temp_dir, bank, &storages, snapshot_version)?;

package_process_and_archive_incremental_snapshot(
Expand Down Expand Up @@ -1815,19 +1811,6 @@ pub fn process_accounts_package(
)
}

/// Filter snapshot storages and retain only the ones with slots _higher than_
/// `incremental_snapshot_base_slot`.
pub fn filter_snapshot_storages_for_incremental_snapshot(
snapshot_storages: &mut SnapshotStorages,
incremental_snapshot_base_slot: Slot,
) {
snapshot_storages.retain(|storage| {
storage
.first()
.map_or(false, |entry| entry.slot() > incremental_snapshot_base_slot)
});
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down

0 comments on commit 1a4bede

Please sign in to comment.