From 2698a5c70512a88fe139a41f2ed27373d9078f5b Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 9 Dec 2021 23:39:06 +0000 Subject: [PATCH] AcctIdx: env var to enable testing of disk buckets (#21494) (#21723) (cherry picked from commit 54862eba0d18ddb66f2d6efe51a806fccb82a7b5) Co-authored-by: Jeff Washington (jwash) --- 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 18b03c8c0a..4a71f07412 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, }; @@ -840,7 +840,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 {