From b8fda9d7300c832189ce28b09716b2d887ad191a Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Wed, 25 Mar 2020 21:41:50 -0700 Subject: [PATCH] Log how much data the ledger holds before processing it (#9079) --- ledger/src/blockstore.rs | 2 +- ledger/src/blockstore_processor.rs | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ledger/src/blockstore.rs b/ledger/src/blockstore.rs index 085d024da8..366fec4d8d 100644 --- a/ledger/src/blockstore.rs +++ b/ledger/src/blockstore.rs @@ -433,7 +433,7 @@ impl Blockstore { pub fn slot_meta_iterator<'a>( &'a self, slot: Slot, - ) -> Result + 'a> { + ) -> Result + 'a> { let meta_iter = self .db .iter::(IteratorMode::From(slot, IteratorDirection::Forward))?; diff --git a/ledger/src/blockstore_processor.rs b/ledger/src/blockstore_processor.rs index f74bcd0c85..403d5c69cc 100644 --- a/ledger/src/blockstore_processor.rs +++ b/ledger/src/blockstore_processor.rs @@ -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`