From 54862eba0d18ddb66f2d6efe51a806fccb82a7b5 Mon Sep 17 00:00:00 2001 From: "Jeff Washington (jwash)" Date: Wed, 8 Dec 2021 19:47:25 -0600 Subject: [PATCH] AcctIdx: env var to enable testing of disk buckets (#21494) --- runtime/src/accounts_index.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/runtime/src/accounts_index.rs b/runtime/src/accounts_index.rs index 5a92c538e2..5f43c4e6a6 100644 --- a/runtime/src/accounts_index.rs +++ b/runtime/src/accounts_index.rs @@ -44,7 +44,7 @@ pub const ACCOUNTS_INDEX_CONFIG_FOR_TESTING: AccountsIndexConfig = AccountsIndex bins: Some(BINS_FOR_TESTING), flush_threads: Some(FLUSH_THREADS_TESTING), drives: None, - index_limit_mb: Some(1), + index_limit_mb: None, ages_to_stay_in_cache: None, scan_results_limit_bytes: None, }; @@ -849,7 +849,13 @@ pub struct AccountsIndex { impl AccountsIndex { pub fn default_for_tests() -> Self { - Self::new(Some(ACCOUNTS_INDEX_CONFIG_FOR_TESTING)) + let mut config = ACCOUNTS_INDEX_CONFIG_FOR_TESTING; + if let Ok(limit) = std::env::var("SOLANA_TEST_ACCOUNTS_INDEX_MEMORY_LIMIT_MB") { + // allocate with disk buckets + config.index_limit_mb = Some(limit.parse::().unwrap()); + } + + Self::new(Some(config)) } pub fn new(config: Option) -> Self {