* Make account shrink configurable #17544 (#17778)
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
(cherry picked from commit 269d995832
)
# Conflicts:
# core/tests/snapshots.rs
# ledger/src/bank_forks_utils.rs
# runtime/src/accounts_db.rs
# runtime/src/snapshot_utils.rs
* fix some merge errors
Co-authored-by: Lijun Wang <83639177+lijunwangs@users.noreply.github.com>
Co-authored-by: Jeff Washington (jwash) <wash678@gmail.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use {
|
||||
crate::{
|
||||
accounts_db::AccountsDb,
|
||||
accounts_db::{AccountShrinkThreshold, AccountsDb},
|
||||
accounts_index::AccountSecondaryIndexes,
|
||||
bank::{Bank, BankSlotDelta, Builtins},
|
||||
bank_forks::ArchiveFormat,
|
||||
@@ -612,6 +612,7 @@ pub fn bank_from_archive<P: AsRef<Path>>(
|
||||
account_indexes: AccountSecondaryIndexes,
|
||||
accounts_db_caching_enabled: bool,
|
||||
limit_load_slot_count_from_snapshot: Option<usize>,
|
||||
shrink_ratio: AccountShrinkThreshold,
|
||||
test_hash_calculation: bool,
|
||||
) -> Result<(Bank, BankFromArchiveTimings)> {
|
||||
let unpack_dir = tempfile::Builder::new()
|
||||
@@ -646,6 +647,7 @@ pub fn bank_from_archive<P: AsRef<Path>>(
|
||||
account_indexes,
|
||||
accounts_db_caching_enabled,
|
||||
limit_load_slot_count_from_snapshot,
|
||||
shrink_ratio,
|
||||
)?;
|
||||
measure.stop();
|
||||
|
||||
@@ -814,6 +816,7 @@ fn rebuild_bank_from_snapshots(
|
||||
account_indexes: AccountSecondaryIndexes,
|
||||
accounts_db_caching_enabled: bool,
|
||||
limit_load_slot_count_from_snapshot: Option<usize>,
|
||||
shrink_ratio: AccountShrinkThreshold,
|
||||
) -> Result<Bank> {
|
||||
info!("snapshot version: {}", snapshot_version);
|
||||
|
||||
@@ -850,6 +853,7 @@ fn rebuild_bank_from_snapshots(
|
||||
account_indexes,
|
||||
accounts_db_caching_enabled,
|
||||
limit_load_slot_count_from_snapshot,
|
||||
shrink_ratio,
|
||||
),
|
||||
}?)
|
||||
})?;
|
||||
|
Reference in New Issue
Block a user