Log how much data the ledger holds before processing it (#9079)

This commit is contained in:
Michael Vines 2020-03-25 21:41:50 -07:00 committed by GitHub
parent 2623c71ed3
commit b8fda9d730
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -433,7 +433,7 @@ impl Blockstore {
pub fn slot_meta_iterator<'a>(
&'a self,
slot: Slot,
) -> Result<impl Iterator<Item = (u64, SlotMeta)> + 'a> {
) -> Result<impl Iterator<Item = (Slot, SlotMeta)> + 'a> {
let meta_iter = self
.db
.iter::<cf::SlotMeta>(IteratorMode::From(slot, IteratorDirection::Forward))?;

View File

@ -310,7 +310,7 @@ pub fn process_blockstore_from_root(
opts: &ProcessOptions,
recyclers: &VerifyRecyclers,
) -> BlockstoreProcessorResult {
info!("processing ledger from root slot {}...", bank.slot());
info!("processing ledger from slot {}...", bank.slot());
let allocated = thread_mem_usage::Allocatedp::default();
let initial_allocation = allocated.get();
@ -345,6 +345,12 @@ pub fn process_blockstore_from_root(
.set_roots(&[start_slot])
.expect("Couldn't set root slot on startup");
if let Ok(metas) = blockstore.slot_meta_iterator(start_slot) {
if let Some((slot, _meta)) = metas.last() {
info!("ledger holds data through slot {}", slot);
}
}
let meta = blockstore.meta(start_slot).unwrap();
// Iterate and replay slots from blockstore starting from `start_slot`