Skip to content

Commit

Permalink
AcctIdx: only flush if disk index being used (solana-labs#20045)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffwashington authored Sep 21, 2021
1 parent 38ea3aa commit bbe151e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions runtime/src/accounts_index_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ impl<T: IndexValue> AccountsIndexStorage<T> {
in_mem: Vec<Arc<InMemAccountsIndex<T>>>,
) {
let bins = in_mem.len();
let flush = storage.disk.is_some();
loop {
// this will transition to waits and thread throttling
storage
Expand All @@ -108,8 +109,10 @@ impl<T: IndexValue> AccountsIndexStorage<T> {

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);
Expand Down

0 comments on commit bbe151e

Please sign in to comment.