add cli arg for choosing ancient append vec format (#30025)
This commit is contained in:
parent
ffc9c90cb4
commit
d5a7b5715c
|
@ -152,6 +152,15 @@ pub enum IncludeSlotInHash {
|
|||
IrrelevantAssertOnUse,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Clone, Copy)]
|
||||
pub enum CreateAncientStorage {
|
||||
/// ancient storages are created by appending
|
||||
#[default]
|
||||
Append,
|
||||
/// ancient storages are created by 1-shot write to pack multiple accounts together more efficiently with new formats
|
||||
Pack,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
/// hold alive accounts and bytes used by those accounts
|
||||
/// alive means in the accounts index
|
||||
|
@ -425,6 +434,7 @@ pub const ACCOUNTS_DB_CONFIG_FOR_TESTING: AccountsDbConfig = AccountsDbConfig {
|
|||
skip_initial_hash_calc: false,
|
||||
exhaustively_verify_refcounts: false,
|
||||
assert_stakes_cache_consistency: true,
|
||||
create_ancient_storage: CreateAncientStorage::Append,
|
||||
};
|
||||
pub const ACCOUNTS_DB_CONFIG_FOR_BENCHMARKS: AccountsDbConfig = AccountsDbConfig {
|
||||
index: Some(ACCOUNTS_INDEX_CONFIG_FOR_BENCHMARKS),
|
||||
|
@ -435,6 +445,7 @@ pub const ACCOUNTS_DB_CONFIG_FOR_BENCHMARKS: AccountsDbConfig = AccountsDbConfig
|
|||
skip_initial_hash_calc: false,
|
||||
exhaustively_verify_refcounts: false,
|
||||
assert_stakes_cache_consistency: false,
|
||||
create_ancient_storage: CreateAncientStorage::Append,
|
||||
};
|
||||
|
||||
pub type BinnedHashData = Vec<Vec<CalculateHashIntermediate>>;
|
||||
|
@ -494,6 +505,8 @@ pub struct AccountsDbConfig {
|
|||
pub exhaustively_verify_refcounts: bool,
|
||||
/// when stakes cache consistency check occurs, assert that cached accounts match accounts db
|
||||
pub assert_stakes_cache_consistency: bool,
|
||||
/// how to create ancient storages
|
||||
pub create_ancient_storage: CreateAncientStorage,
|
||||
}
|
||||
|
||||
#[cfg(not(test))]
|
||||
|
@ -1287,8 +1300,13 @@ pub struct AccountsDb {
|
|||
|
||||
pub(crate) storage: AccountStorage,
|
||||
|
||||
/// from AccountsDbConfig
|
||||
pub(crate) assert_stakes_cache_consistency: bool,
|
||||
|
||||
#[allow(dead_code)]
|
||||
/// from AccountsDbConfig
|
||||
create_ancient_storage: CreateAncientStorage,
|
||||
|
||||
pub accounts_cache: AccountsCache,
|
||||
|
||||
write_cache_limit_bytes: Option<u64>,
|
||||
|
@ -2306,6 +2324,7 @@ impl AccountsDb {
|
|||
|
||||
AccountsDb {
|
||||
assert_stakes_cache_consistency: false,
|
||||
create_ancient_storage: CreateAncientStorage::Append,
|
||||
verify_accounts_hash_in_bg: VerifyAccountsHashInBackground::default(),
|
||||
filler_accounts_per_slot: AtomicU64::default(),
|
||||
filler_account_slots_remaining: AtomicU64::default(),
|
||||
|
@ -2429,6 +2448,11 @@ impl AccountsDb {
|
|||
.map(|config| config.assert_stakes_cache_consistency)
|
||||
.unwrap_or_default();
|
||||
|
||||
let create_ancient_storage = accounts_db_config
|
||||
.as_ref()
|
||||
.map(|config| config.create_ancient_storage)
|
||||
.unwrap_or(CreateAncientStorage::Append);
|
||||
|
||||
let filler_account_suffix = if filler_accounts_config.count > 0 {
|
||||
Some(solana_sdk::pubkey::new_rand())
|
||||
} else {
|
||||
|
@ -2446,6 +2470,7 @@ impl AccountsDb {
|
|||
filler_accounts_config,
|
||||
filler_account_suffix,
|
||||
assert_stakes_cache_consistency,
|
||||
create_ancient_storage,
|
||||
write_cache_limit_bytes: accounts_db_config
|
||||
.as_ref()
|
||||
.and_then(|x| x.write_cache_limit_bytes),
|
||||
|
|
|
@ -1182,6 +1182,12 @@ pub fn app<'a>(version: &'a str, default_args: &'a DefaultArgs) -> App<'a, 'a> {
|
|||
.help("Enables faster starting of validators by skipping shrink. \
|
||||
This option is for use during testing."),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("accounts_db_create_ancient_storage_packed")
|
||||
.long("accounts-db-create-ancient-storage-packed")
|
||||
.help("Create ancient storages in one shot instead of appending.")
|
||||
.hidden(true),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("accounts_db_ancient_append_vecs")
|
||||
.long("accounts-db-ancient-append-vecs")
|
||||
|
|
|
@ -28,7 +28,10 @@ use {
|
|||
solana_rpc_client::rpc_client::RpcClient,
|
||||
solana_rpc_client_api::config::RpcLeaderScheduleConfig,
|
||||
solana_runtime::{
|
||||
accounts_db::{AccountShrinkThreshold, AccountsDb, AccountsDbConfig, FillerAccountsConfig},
|
||||
accounts_db::{
|
||||
AccountShrinkThreshold, AccountsDb, AccountsDbConfig, CreateAncientStorage,
|
||||
FillerAccountsConfig,
|
||||
},
|
||||
accounts_index::{
|
||||
AccountIndex, AccountSecondaryIndexes, AccountSecondaryIndexesIncludeExclude,
|
||||
AccountsIndexConfig, IndexLimitMb,
|
||||
|
@ -1046,6 +1049,10 @@ pub fn main() {
|
|||
.map(|mb| mb * MB as u64),
|
||||
ancient_append_vec_offset: value_t!(matches, "accounts_db_ancient_append_vecs", i64).ok(),
|
||||
exhaustively_verify_refcounts: matches.is_present("accounts_db_verify_refcounts"),
|
||||
create_ancient_storage: matches
|
||||
.is_present("accounts_db_create_ancient_storage_packed")
|
||||
.then_some(CreateAncientStorage::Pack)
|
||||
.unwrap_or_default(),
|
||||
..AccountsDbConfig::default()
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue