add --accounts-index-scan-results-limit-mb to allow scans to abort (#21327)

* ScanConfig -> &ScanConfig

* add --accounts-index-scan-results-limit-mb to allow scans to abort

* feedback
This commit is contained in:
Jeff Washington (jwash)
2021-11-19 09:00:19 -06:00
committed by GitHub
parent 48dfdfb4d5
commit 79d21d6805
9 changed files with 161 additions and 75 deletions

View File

@ -1508,6 +1508,14 @@ pub fn main() {
.help("Enables faster starting of validators by skipping shrink. \
This option is for use during testing."),
)
.arg(
Arg::with_name("accounts_index_scan_results_limit_mb")
.long("accounts-index-scan-results-limit-mb")
.value_name("MEGABYTES")
.validator(is_parsable::<usize>)
.takes_value(true)
.help("How large accumulated results from an accounts index scan can become. If this is exceeded, the scan aborts."),
)
.arg(
Arg::with_name("accounts_index_memory_limit_mb")
.long("accounts-index-memory-limit-mb")
@ -2117,6 +2125,12 @@ pub fn main() {
accounts_index_config.drives = Some(accounts_index_paths);
}
const MB: usize = 1_024 * 1_024;
accounts_index_config.scan_results_limit_bytes =
value_t!(matches, "accounts_index_scan_results_limit_mb", usize)
.ok()
.map(|mb| mb * MB);
let filler_account_count = value_t!(matches, "accounts_filler_count", usize).ok();
let mut accounts_db_config = AccountsDbConfig {
index: Some(accounts_index_config),