AcctIdx: when bg processing in multiple threads, avoid bin collisions (#20019)
This commit is contained in:
parent
d6d2840c94
commit
d842705622
|
@ -96,6 +96,7 @@ impl<T: IndexValue> AccountsIndexStorage<T> {
|
|||
exit: Arc<AtomicBool>,
|
||||
in_mem: Vec<Arc<InMemAccountsIndex<T>>>,
|
||||
) {
|
||||
let bins = in_mem.len();
|
||||
loop {
|
||||
// this will transition to waits and thread throttling
|
||||
storage
|
||||
|
@ -106,11 +107,11 @@ impl<T: IndexValue> AccountsIndexStorage<T> {
|
|||
}
|
||||
|
||||
storage.stats.active_threads.fetch_add(1, Ordering::Relaxed);
|
||||
for bucket in &in_mem {
|
||||
bucket.flush();
|
||||
}
|
||||
|
||||
for _ in 0..bins {
|
||||
let index = storage.next_bucket_to_flush();
|
||||
in_mem[index].flush();
|
||||
storage.stats.report_stats();
|
||||
}
|
||||
storage.stats.active_threads.fetch_sub(1, Ordering::Relaxed);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue