Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
add --accounts-db-ancient-append-vecs (#25125)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffwashington authored May 11, 2022
1 parent 542a14d commit a8930ee
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ledger-tool/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()
});

Expand Down
12 changes: 12 additions & 0 deletions runtime/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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>>;
Expand Down Expand Up @@ -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> {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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())
Expand All @@ -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,
Expand Down
7 changes: 7 additions & 0 deletions validator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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()
};

Expand Down

0 comments on commit a8930ee

Please sign in to comment.