Remove filter_snapshot_storages_for_incremental_snapshot() (#19349)

Now that we can get just the subset of snapshot storages we want, the extra
filtering afterwards is redundant.
This commit is contained in:
Brooks Prumo 2021-08-23 09:45:29 -05:00 committed by GitHub
parent 86ef147ec2
commit 1a4bede918
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 26 deletions

View File

@ -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,

View File

@ -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(
@ -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::*;