add --accounts-db-ancient-append-vecs (#25125)

This commit is contained in:
Jeff Washington (jwash) 2022-05-11 08:47:07 -05:00 committed by GitHub
parent 542a14d9b7
commit a8930ee14b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 0 deletions

View File

@ -991,6 +991,10 @@ fn main() {
This produces snapshots that older versions cannot read.",
)
.hidden(true);
let ancient_append_vecs = Arg::with_name("accounts_db_ancient_append_vecs")
.long("accounts-db-ancient-append-vecs")
.help("AppendVecs that are older than an epoch are squashed together.")
.hidden(true);
let verify_index_arg = Arg::with_name("verify_accounts_index")
.long("verify-accounts-index")
.takes_value(false)
@ -1332,6 +1336,7 @@ fn main() {
.arg(&accounts_filler_size)
.arg(&verify_index_arg)
.arg(&skip_rewrites_arg)
.arg(&ancient_append_vecs)
.arg(&hard_forks_arg)
.arg(&no_accounts_db_caching_arg)
.arg(&accounts_db_test_hash_calculation_arg)
@ -2126,6 +2131,7 @@ fn main() {
accounts_hash_cache_path: Some(ledger_path.clone()),
filler_accounts_config,
skip_rewrites: matches.is_present("accounts_db_skip_rewrites"),
ancient_append_vecs: matches.is_present("accounts_db_ancient_append_vecs"),
..AccountsDbConfig::default()
});

View File

@ -135,6 +135,7 @@ pub const ACCOUNTS_DB_CONFIG_FOR_TESTING: AccountsDbConfig = AccountsDbConfig {
hash_calc_num_passes: None,
write_cache_limit_bytes: None,
skip_rewrites: false,
ancient_append_vecs: false,
};
pub const ACCOUNTS_DB_CONFIG_FOR_BENCHMARKS: AccountsDbConfig = AccountsDbConfig {
index: Some(ACCOUNTS_INDEX_CONFIG_FOR_BENCHMARKS),
@ -143,6 +144,7 @@ pub const ACCOUNTS_DB_CONFIG_FOR_BENCHMARKS: AccountsDbConfig = AccountsDbConfig
hash_calc_num_passes: None,
write_cache_limit_bytes: None,
skip_rewrites: false,
ancient_append_vecs: false,
};
pub type BinnedHashData = Vec<Vec<CalculateHashIntermediate>>;
@ -181,6 +183,7 @@ pub struct AccountsDbConfig {
pub hash_calc_num_passes: Option<usize>,
pub write_cache_limit_bytes: Option<u64>,
pub skip_rewrites: bool,
pub ancient_append_vecs: bool,
}
pub struct FoundStoredAccount<'a> {
@ -999,6 +1002,9 @@ pub struct AccountsDb {
/// true iff rent exempt accounts are not rewritten in their normal rent collection slot
pub skip_rewrites: bool,
/// true iff we want to squash old append vecs together into 'ancient append vecs'
pub ancient_append_vecs: bool,
pub storage: AccountStorage,
pub accounts_cache: AccountsCache,
@ -1606,6 +1612,7 @@ impl AccountsDb {
AccountsDb {
active_stats: ActiveStats::default(),
skip_rewrites: false,
ancient_append_vecs: false,
accounts_index,
storage: AccountStorage::default(),
accounts_cache: AccountsCache::default(),
@ -1702,6 +1709,10 @@ impl AccountsDb {
.as_ref()
.map(|config| config.skip_rewrites)
.unwrap_or_default();
let ancient_append_vecs = accounts_db_config
.as_ref()
.map(|config| config.ancient_append_vecs)
.unwrap_or_default();
let filler_account_suffix = if filler_accounts_config.count > 0 {
Some(solana_sdk::pubkey::new_rand())
@ -1712,6 +1723,7 @@ impl AccountsDb {
let mut new = Self {
paths,
skip_rewrites,
ancient_append_vecs,
cluster_type: Some(*cluster_type),
account_indexes,
caching_enabled,

View File

@ -1597,6 +1597,12 @@ pub fn main() {
This produces snapshots that older versions cannot read.")
.hidden(true),
)
.arg(
Arg::with_name("accounts_db_ancient_append_vecs")
.long("accounts-db-ancient-append-vecs")
.help("AppendVecs that are older than an epoch are squashed together.")
.hidden(true),
)
.arg(
Arg::with_name("accounts_db_cache_limit_mb")
.long("accounts-db-cache-limit-mb")
@ -2334,6 +2340,7 @@ pub fn main() {
.ok()
.map(|mb| mb * MB as u64),
skip_rewrites: matches.is_present("accounts_db_skip_rewrites"),
ancient_append_vecs: matches.is_present("accounts_db_ancient_append_vecs"),
..AccountsDbConfig::default()
};