diff --git a/ledger/src/hardened_unpack.rs b/ledger/src/hardened_unpack.rs index 997e02707..67d325a7d 100644 --- a/ledger/src/hardened_unpack.rs +++ b/ledger/src/hardened_unpack.rs @@ -77,6 +77,8 @@ where let mut total_size: u64 = 0; let mut total_count: u64 = 0; + let mut total_entries = 0; + let mut last_log_update = Instant::now(); for entry in archive.entries()? { let mut entry = entry?; let path = entry.path()?; @@ -110,8 +112,15 @@ where // unpack_in does its own sanitization // ref: https://docs.rs/tar/*/tar/struct.Entry.html#method.unpack_in - check_unpack_result(entry.unpack_in(&unpack_dir)?, path_str)? + check_unpack_result(entry.unpack_in(&unpack_dir)?, path_str)?; + total_entries += 1; + let now = Instant::now(); + if now.duration_since(last_log_update).as_secs() >= 10 { + info!("unpacked {} entries so far...", total_entries); + last_log_update = now; + } } + info!("unpacked {} entries total", total_entries); Ok(()) } diff --git a/ledger/src/snapshot_utils.rs b/ledger/src/snapshot_utils.rs index 9028f4114..68cf1446e 100644 --- a/ledger/src/snapshot_utils.rs +++ b/ledger/src/snapshot_utils.rs @@ -17,6 +17,7 @@ use solana_runtime::{ use solana_sdk::{clock::Slot, genesis_config::GenesisConfig, hash::Hash, pubkey::Pubkey}; use std::{ cmp::Ordering, + fmt, fs::{self, File}, io::{BufReader, BufWriter, Error as IOError, ErrorKind, Read, Seek, SeekFrom, Write}, path::{Path, PathBuf}, @@ -295,7 +296,7 @@ pub fn archive_snapshot_package(snapshot_package: &AccountsPackage) -> Result<() pub fn get_snapshot_paths>(snapshot_path: P) -> Vec where - P: std::fmt::Debug, + P: fmt::Debug, { match fs::read_dir(&snapshot_path) { Ok(paths) => { diff --git a/runtime/src/accounts_db.rs b/runtime/src/accounts_db.rs index 63f3ec307..d844bfacc 100644 --- a/runtime/src/accounts_db.rs +++ b/runtime/src/accounts_db.rs @@ -43,6 +43,7 @@ use std::{ path::{Path, PathBuf}, sync::atomic::{AtomicBool, AtomicU64, AtomicUsize, Ordering}, sync::{Arc, Mutex, RwLock}, + time::Instant, }; use tempfile::TempDir; @@ -1816,7 +1817,15 @@ impl AccountsDB { let mut slots: Vec = storage.0.keys().cloned().collect(); slots.sort(); let mut accounts_index = self.accounts_index.write().unwrap(); - for slot in slots.iter() { + + let mut last_log_update = Instant::now(); + for (index, slot) in slots.iter().enumerate() { + let now = Instant::now(); + if now.duration_since(last_log_update).as_secs() >= 10 { + info!("generating index: {}/{} slots...", index, slots.len()); + last_log_update = now; + } + let accumulator: Vec>> = self .scan_account_storage( *slot, diff --git a/runtime/src/serde_snapshot.rs b/runtime/src/serde_snapshot.rs index 6b344a984..c856a9377 100644 --- a/runtime/src/serde_snapshot.rs +++ b/runtime/src/serde_snapshot.rs @@ -26,6 +26,7 @@ use { path::{Path, PathBuf}, result::Result, sync::{atomic::Ordering, Arc}, + time::Instant, }, }; @@ -212,10 +213,20 @@ where map }; + let mut last_log_update = Instant::now(); + let mut remaining_slots_to_process = storage.len(); + // Remap the deserialized AppendVec paths to point to correct local paths let mut storage = storage .into_iter() .map(|(slot, mut slot_storage)| { + let now = Instant::now(); + if now.duration_since(last_log_update).as_secs() >= 10 { + info!("{} slots remaining...", remaining_slots_to_process); + last_log_update = now; + } + remaining_slots_to_process -= 1; + let mut new_slot_storage = HashMap::new(); for (id, storage_entry) in slot_storage.drain() { let path_index = thread_rng().gen_range(0, accounts_db.paths.len());