IndexLimitMb option adds 'Unspecified' state (#24249)

(cherry picked from commit 1bc49d219d)

# Conflicts:
#	ledger-tool/src/main.rs
This commit is contained in:
Jeff Washington (jwash)
2022-04-12 09:38:09 -05:00
committed by mergify-bot
parent d02bf12976
commit beb64387a0
5 changed files with 51 additions and 18 deletions

View File

@@ -46,7 +46,7 @@ use {
},
accounts_index::{
AccountIndex, AccountSecondaryIndexes, AccountSecondaryIndexesIncludeExclude,
AccountsIndexConfig,
AccountsIndexConfig, IndexLimitMb,
},
hardened_unpack::MAX_GENESIS_ARCHIVE_UNPACKED_SIZE,
snapshot_config::SnapshotConfig,
@@ -2194,11 +2194,14 @@ pub fn main() {
accounts_index_config.bins = Some(bins);
}
if let Some(limit) = value_t!(matches, "accounts_index_memory_limit_mb", usize).ok() {
accounts_index_config.index_limit_mb = Some(limit);
} else if matches.is_present("disable_accounts_disk_index") {
accounts_index_config.index_limit_mb = None;
}
accounts_index_config.index_limit_mb =
if let Some(limit) = value_t!(matches, "accounts_index_memory_limit_mb", usize).ok() {
IndexLimitMb::Limit(limit)
} else if matches.is_present("disable_accounts_disk_index") {
IndexLimitMb::InMemOnly
} else {
IndexLimitMb::Unspecified
};
{
let mut accounts_index_paths: Vec<PathBuf> = if matches.is_present("accounts_index_path") {