validator option: accounts-db-skip-rewrites (#24504)
This commit is contained in:
parent
957849f4a5
commit
cfe2177e16
|
@ -963,6 +963,13 @@ fn main() {
|
|||
.validator(is_slot)
|
||||
.takes_value(true)
|
||||
.help("Halt processing at the given slot");
|
||||
let skip_rewrites_arg = Arg::with_name("accounts_db_skip_rewrites")
|
||||
.long("accounts-db-skip-rewrites")
|
||||
.help(
|
||||
"Accounts that are rent exempt and have no changes are not rewritten. \
|
||||
This produces snapshots that older versions cannot read.",
|
||||
)
|
||||
.hidden(true);
|
||||
let verify_index_arg = Arg::with_name("verify_accounts_index")
|
||||
.long("verify-accounts-index")
|
||||
.takes_value(false)
|
||||
|
@ -1295,6 +1302,7 @@ fn main() {
|
|||
.arg(&accounts_filler_count)
|
||||
.arg(&accounts_filler_size)
|
||||
.arg(&verify_index_arg)
|
||||
.arg(&skip_rewrites_arg)
|
||||
.arg(&hard_forks_arg)
|
||||
.arg(&no_accounts_db_caching_arg)
|
||||
.arg(&accounts_db_test_hash_calculation_arg)
|
||||
|
@ -2096,6 +2104,7 @@ fn main() {
|
|||
index: Some(accounts_index_config),
|
||||
accounts_hash_cache_path: Some(ledger_path.clone()),
|
||||
filler_accounts_config,
|
||||
skip_rewrites: matches.is_present("accounts_db_skip_rewrites"),
|
||||
..AccountsDbConfig::default()
|
||||
});
|
||||
|
||||
|
|
|
@ -134,6 +134,7 @@ pub const ACCOUNTS_DB_CONFIG_FOR_TESTING: AccountsDbConfig = AccountsDbConfig {
|
|||
filler_accounts_config: FillerAccountsConfig::const_default(),
|
||||
hash_calc_num_passes: None,
|
||||
write_cache_limit_bytes: None,
|
||||
skip_rewrites: false,
|
||||
};
|
||||
pub const ACCOUNTS_DB_CONFIG_FOR_BENCHMARKS: AccountsDbConfig = AccountsDbConfig {
|
||||
index: Some(ACCOUNTS_INDEX_CONFIG_FOR_BENCHMARKS),
|
||||
|
@ -141,6 +142,7 @@ pub const ACCOUNTS_DB_CONFIG_FOR_BENCHMARKS: AccountsDbConfig = AccountsDbConfig
|
|||
filler_accounts_config: FillerAccountsConfig::const_default(),
|
||||
hash_calc_num_passes: None,
|
||||
write_cache_limit_bytes: None,
|
||||
skip_rewrites: false,
|
||||
};
|
||||
|
||||
pub type BinnedHashData = Vec<Vec<CalculateHashIntermediate>>;
|
||||
|
@ -178,6 +180,7 @@ pub struct AccountsDbConfig {
|
|||
pub filler_accounts_config: FillerAccountsConfig,
|
||||
pub hash_calc_num_passes: Option<usize>,
|
||||
pub write_cache_limit_bytes: Option<u64>,
|
||||
pub skip_rewrites: bool,
|
||||
}
|
||||
|
||||
struct FoundStoredAccount<'a> {
|
||||
|
@ -1014,6 +1017,9 @@ pub struct AccountsDb {
|
|||
/// Keeps tracks of index into AppendVec on a per slot basis
|
||||
pub accounts_index: AccountInfoAccountsIndex,
|
||||
|
||||
/// true iff rent exempt accounts are not rewritten in their normal rent collection slot
|
||||
pub skip_rewrites: bool,
|
||||
|
||||
pub storage: AccountStorage,
|
||||
|
||||
pub accounts_cache: AccountsCache,
|
||||
|
@ -1624,6 +1630,7 @@ impl AccountsDb {
|
|||
|
||||
AccountsDb {
|
||||
active_stats: ActiveStats::default(),
|
||||
skip_rewrites: false,
|
||||
accounts_index,
|
||||
storage: AccountStorage::default(),
|
||||
accounts_cache: AccountsCache::default(),
|
||||
|
@ -1716,6 +1723,10 @@ impl AccountsDb {
|
|||
.as_ref()
|
||||
.map(|config| config.filler_accounts_config)
|
||||
.unwrap_or_default();
|
||||
let skip_rewrites = accounts_db_config
|
||||
.as_ref()
|
||||
.map(|config| config.skip_rewrites)
|
||||
.unwrap_or_default();
|
||||
|
||||
let filler_account_suffix = if filler_accounts_config.count > 0 {
|
||||
Some(solana_sdk::pubkey::new_rand())
|
||||
|
@ -1725,6 +1736,7 @@ impl AccountsDb {
|
|||
let paths_is_empty = paths.is_empty();
|
||||
let mut new = Self {
|
||||
paths,
|
||||
skip_rewrites,
|
||||
cluster_type: Some(*cluster_type),
|
||||
account_indexes,
|
||||
caching_enabled,
|
||||
|
|
|
@ -1540,6 +1540,13 @@ pub fn main() {
|
|||
.help("Enables faster starting of validators by skipping shrink. \
|
||||
This option is for use during testing."),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("accounts_db_skip_rewrites")
|
||||
.long("accounts-db-skip-rewrites")
|
||||
.help("Accounts that are rent exempt and have no changes are not rewritten. \
|
||||
This produces snapshots that older versions cannot read.")
|
||||
.hidden(true),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("accounts_db_cache_limit_mb")
|
||||
.long("accounts-db-cache-limit-mb")
|
||||
|
@ -2276,6 +2283,7 @@ pub fn main() {
|
|||
write_cache_limit_bytes: value_t!(matches, "accounts_db_cache_limit_mb", u64)
|
||||
.ok()
|
||||
.map(|mb| mb * MB as u64),
|
||||
skip_rewrites: matches.is_present("accounts_db_skip_rewrites"),
|
||||
..AccountsDbConfig::default()
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue