Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add status logging while processing a ledger #3916

Merged
merged 1 commit into from
Apr 21, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions core/src/blocktree_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use solana_sdk::timing::MAX_RECENT_BLOCKHASHES;
use solana_sdk::transaction::{Result, TransactionError};
use std::result;
use std::sync::Arc;
use std::time::Instant;
use std::time::{Duration, Instant};

fn first_err(results: &[Result<()>]) -> Result<()> {
for r in results {
Expand Down Expand Up @@ -141,10 +141,16 @@ pub fn process_blocktree(
let leader_schedule_cache = LeaderScheduleCache::new(*pending_slots[0].2.epoch_schedule());

let mut fork_info = vec![];
let mut last_status_report = Instant::now();
while !pending_slots.is_empty() {
let (slot, meta, bank, mut entry_height, mut last_entry_hash) =
pending_slots.pop().unwrap();

if last_status_report.elapsed() > Duration::from_secs(2) {
info!("processing ledger...block {}", slot);
last_status_report = Instant::now();
}

// Fetch all entries for this slot
let mut entries = blocktree.get_slot_entries(slot, 0, None).map_err(|err| {
warn!("Failed to load entries for slot {}: {:?}", slot, err);
Expand Down Expand Up @@ -248,7 +254,7 @@ pub fn process_blocktree(
let (banks, bank_forks_info): (Vec<_>, Vec<_>) = fork_info.into_iter().unzip();
let bank_forks = BankForks::new_from_banks(&banks);
info!(
"processed ledger in {}ms, forks={}...",
"processing ledger...complete in {}ms, forks={}...",
duration_as_ms(&now.elapsed()),
bank_forks_info.len(),
);
Expand Down