diff --git a/runtime/src/accounts_db.rs b/runtime/src/accounts_db.rs index cb9e5ae940d36c..6e2d09665b2325 100644 --- a/runtime/src/accounts_db.rs +++ b/runtime/src/accounts_db.rs @@ -8513,7 +8513,7 @@ impl AccountsDb { ancestors: Option<&Ancestors>, ) -> (SnapshotStorages, Vec) { let mut m = Measure::start("get slots"); - let slots = self + let slots_and_storages = self .storage .iter() .filter_map(|entry| { @@ -8528,32 +8528,26 @@ impl AccountsDb { let chunk_size = 5_000; let wide = self.thread_pool_clean.install(|| { - slots + slots_and_storages .par_chunks(chunk_size) - .map(|slots| { - slots + .map(|slots_and_storages| { + slots_and_storages .iter() - .filter_map(|(slot, storages)| { - if self.accounts_index.is_alive_root(*slot) + .filter(|(slot, _)| { + self.accounts_index.is_alive_root(*slot) || ancestors .map(|ancestors| ancestors.contains_key(slot)) .unwrap_or_default() - { - let storages = storages - .read() - .unwrap() - .values() - .filter(|x| x.has_accounts()) - .cloned() - .collect::>(); - if !storages.is_empty() { - Some((storages, *slot)) - } else { - None - } - } else { - None - } + }) + .filter_map(|(slot, storages)| { + let storages = storages + .read() + .unwrap() + .values() + .filter(|x| x.has_accounts()) + .cloned() + .collect::>(); + (!storages.is_empty()).then_some((storages, *slot)) }) .collect::>() }) @@ -8563,7 +8557,7 @@ impl AccountsDb { let mut m3 = Measure::start("flatten"); // some slots we found above may not have been a root or met the slot # constraint. // So the resulting 'slots' vector we return will be a subset of the raw keys we got initially. - let mut slots = Vec::with_capacity(slots.len()); + let mut slots = Vec::with_capacity(slots_and_storages.len()); let result = wide .into_iter() .flatten() diff --git a/validator/src/cli.rs b/validator/src/cli.rs index 1b94dc180e995e..bc9b132e35bdb7 100644 --- a/validator/src/cli.rs +++ b/validator/src/cli.rs @@ -1181,13 +1181,6 @@ pub fn app<'a>(version: &'a str, default_args: &'a DefaultArgs) -> App<'a, 'a> { .help("Enables faster starting of validators by skipping shrink. \ This option is for use during testing."), ) - .arg( - Arg::with_name("accounts_db_skip_rewrites") - .long("accounts-db-skip-rewrites") - .help("Accounts that are rent exempt and have no changes are not rewritten. \ - This produces snapshots that older versions cannot read.") - .hidden(true), - ) .arg( Arg::with_name("accounts_db_ancient_append_vecs") .long("accounts-db-ancient-append-vecs")