Add more logging while unpacking snapshots (#10266)

This commit is contained in:
Michael Vines
2020-05-27 10:41:05 -07:00
committed by GitHub
parent 7d42d529af
commit e3b444834f
4 changed files with 33 additions and 3 deletions

View File

@ -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<Slot> = 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<HashMap<Pubkey, Vec<(u64, AccountInfo)>>> = self
.scan_account_storage(
*slot,

View File

@ -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());