diff --git a/runtime/src/in_mem_accounts_index.rs b/runtime/src/in_mem_accounts_index.rs index a65a7d8b9..efc9f7a13 100644 --- a/runtime/src/in_mem_accounts_index.rs +++ b/runtime/src/in_mem_accounts_index.rs @@ -93,9 +93,15 @@ impl InMemAccountsIndex { result } + // only called in debug code paths pub fn keys(&self) -> Vec { Self::update_stat(&self.stats().keys, 1); - self.map().read().unwrap().keys().cloned().collect() + // easiest implementation is to load evrything from disk into cache and return the keys + self.start_stop_flush(true); + self.put_range_in_cache(None::<&RangeInclusive>); + let keys = self.map().read().unwrap().keys().cloned().collect(); + self.start_stop_flush(false); + keys } pub fn get(&self, key: &K) -> Option> {