From bbe151e59429eff0ed549a98fcc356c9c9da8b7d Mon Sep 17 00:00:00 2001 From: "Jeff Washington (jwash)" <75863576+jeffwashington@users.noreply.github.com> Date: Tue, 21 Sep 2021 08:42:13 -0500 Subject: [PATCH] AcctIdx: only flush if disk index being used (#20045) --- runtime/src/accounts_index_storage.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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);