diff --git a/runtime/src/accounts_index_storage.rs b/runtime/src/accounts_index_storage.rs index 3d3878f49..eb53c01be 100644 --- a/runtime/src/accounts_index_storage.rs +++ b/runtime/src/accounts_index_storage.rs @@ -97,6 +97,7 @@ impl AccountsIndexStorage { in_mem: Vec>>, ) { let bins = in_mem.len(); + let flush = storage.disk.is_some(); loop { // this will transition to waits and thread throttling storage @@ -108,8 +109,10 @@ impl AccountsIndexStorage { storage.stats.active_threads.fetch_add(1, Ordering::Relaxed); for _ in 0..bins { - let index = storage.next_bucket_to_flush(); - in_mem[index].flush(); + if flush { + let index = storage.next_bucket_to_flush(); + in_mem[index].flush(); + } storage.stats.report_stats(&storage); } storage.stats.active_threads.fetch_sub(1, Ordering::Relaxed);