1. Added both options for measuring space usage using total accounts usage and for individual store shrink ratio using an enum. Validator CLI options: --accounts-shrink-optimize-total-space and --accounts-shrink-ratio 2. Added code for selecting candidates based on total usage in a separate function select_candidates_by_total_usage 3. Added unit tests for the new functions added 4. The default implementations is kept at 0.8 shrink ratio with --accounts-shrink-optimize-total-space set to true Fixes #17544
This commit is contained in:
@ -142,6 +142,7 @@ fn load_from_snapshot(
|
||||
process_options.account_indexes.clone(),
|
||||
process_options.accounts_db_caching_enabled,
|
||||
process_options.limit_load_slot_count_from_snapshot,
|
||||
process_options.shrink_ratio,
|
||||
)
|
||||
.expect("Load from snapshot failed");
|
||||
if let Some(shrink_paths) = shrink_paths {
|
||||
|
@ -16,6 +16,7 @@ use solana_measure::measure::Measure;
|
||||
use solana_metrics::{datapoint_error, inc_new_counter_debug};
|
||||
use solana_rayon_threadlimit::get_thread_count;
|
||||
use solana_runtime::{
|
||||
accounts_db::AccountShrinkThreshold,
|
||||
accounts_index::AccountSecondaryIndexes,
|
||||
bank::{
|
||||
Bank, ExecuteTimings, InnerInstructionsList, RentDebits, TransactionBalancesSet,
|
||||
@ -373,6 +374,7 @@ pub struct ProcessOptions {
|
||||
pub limit_load_slot_count_from_snapshot: Option<usize>,
|
||||
pub allow_dead_slots: bool,
|
||||
pub accounts_db_test_hash_calculation: bool,
|
||||
pub shrink_ratio: AccountShrinkThreshold,
|
||||
}
|
||||
|
||||
pub fn process_blockstore(
|
||||
@ -400,6 +402,7 @@ pub fn process_blockstore(
|
||||
Some(&crate::builtins::get(opts.bpf_jit)),
|
||||
opts.account_indexes.clone(),
|
||||
opts.accounts_db_caching_enabled,
|
||||
opts.shrink_ratio,
|
||||
);
|
||||
let bank0 = Arc::new(bank0);
|
||||
info!("processing ledger for slot 0...");
|
||||
@ -3064,6 +3067,7 @@ pub mod tests {
|
||||
None,
|
||||
AccountSecondaryIndexes::default(),
|
||||
false,
|
||||
AccountShrinkThreshold::default(),
|
||||
);
|
||||
*bank.epoch_schedule()
|
||||
}
|
||||
|
Reference in New Issue
Block a user