From d461aba6a4356f13832eda373cb1b3c52a9f5d83 Mon Sep 17 00:00:00 2001 From: "Jeff Washington (jwash)" <75863576+jeffwashington@users.noreply.github.com> Date: Mon, 17 May 2021 17:21:15 -0500 Subject: [PATCH] don't try to build secondary indexes if we don't need them (#17246) --- runtime/src/accounts_db.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/runtime/src/accounts_db.rs b/runtime/src/accounts_db.rs index d99fff5c29..0b18684c86 100644 --- a/runtime/src/accounts_db.rs +++ b/runtime/src/accounts_db.rs @@ -5054,14 +5054,16 @@ impl AccountsDb { } } drop(lock); - for (pubkey, account_infos) in accounts_map.into_iter() { - for (_, (_store_id, stored_account)) in account_infos.iter() { - self.accounts_index.update_secondary_indexes( - &pubkey, - &stored_account.account_meta.owner, - &stored_account.data, - &self.account_indexes, - ); + if !self.account_indexes.is_empty() { + for (pubkey, account_infos) in accounts_map.into_iter() { + for (_, (_store_id, stored_account)) in account_infos.iter() { + self.accounts_index.update_secondary_indexes( + &pubkey, + &stored_account.account_meta.owner, + &stored_account.data, + &self.account_indexes, + ); + } } } }