AccountsIndexConfig -> AccountsDbConfig (#19687)

This commit is contained in:
Jeff Washington (jwash) 2021-09-07 23:30:38 -05:00 committed by GitHub
parent 590e113f16
commit 456bf15012
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 83 additions and 66 deletions

View File

@ -61,8 +61,8 @@ use {
transaction_status_service::TransactionStatusService, transaction_status_service::TransactionStatusService,
}, },
solana_runtime::{ solana_runtime::{
accounts_db::AccountShrinkThreshold, accounts_db::{AccountShrinkThreshold, AccountsDbConfig},
accounts_index::{AccountSecondaryIndexes, AccountsIndexConfig}, accounts_index::AccountSecondaryIndexes,
bank::Bank, bank::Bank,
bank_forks::BankForks, bank_forks::BankForks,
commitment::BlockCommitmentCache, commitment::BlockCommitmentCache,
@ -149,7 +149,7 @@ pub struct ValidatorConfig {
pub poh_hashes_per_batch: u64, pub poh_hashes_per_batch: u64,
pub account_indexes: AccountSecondaryIndexes, pub account_indexes: AccountSecondaryIndexes,
pub accounts_db_caching_enabled: bool, pub accounts_db_caching_enabled: bool,
pub accounts_index_config: Option<AccountsIndexConfig>, pub accounts_db_config: Option<AccountsDbConfig>,
pub warp_slot: Option<Slot>, pub warp_slot: Option<Slot>,
pub accounts_db_test_hash_calculation: bool, pub accounts_db_test_hash_calculation: bool,
pub accounts_db_skip_shrink: bool, pub accounts_db_skip_shrink: bool,
@ -216,7 +216,7 @@ impl Default for ValidatorConfig {
validator_exit: Arc::new(RwLock::new(Exit::default())), validator_exit: Arc::new(RwLock::new(Exit::default())),
no_wait_for_vote_to_start_leader: true, no_wait_for_vote_to_start_leader: true,
accounts_shrink_ratio: AccountShrinkThreshold::default(), accounts_shrink_ratio: AccountShrinkThreshold::default(),
accounts_index_config: None, accounts_db_config: None,
} }
} }
} }
@ -1171,7 +1171,7 @@ fn new_banks_from_ledger(
debug_keys: config.debug_keys.clone(), debug_keys: config.debug_keys.clone(),
account_indexes: config.account_indexes.clone(), account_indexes: config.account_indexes.clone(),
accounts_db_caching_enabled: config.accounts_db_caching_enabled, accounts_db_caching_enabled: config.accounts_db_caching_enabled,
accounts_index_config: config.accounts_index_config.clone(), accounts_db_config: config.accounts_db_config.clone(),
shrink_ratio: config.accounts_shrink_ratio, shrink_ratio: config.accounts_shrink_ratio,
accounts_db_test_hash_calculation: config.accounts_db_test_hash_calculation, accounts_db_test_hash_calculation: config.accounts_db_test_hash_calculation,
accounts_db_skip_shrink: config.accounts_db_skip_shrink, accounts_db_skip_shrink: config.accounts_db_skip_shrink,

View File

@ -59,7 +59,7 @@ mod tests {
accounts_background_service::{ accounts_background_service::{
AbsRequestHandler, AbsRequestSender, AccountsBackgroundService, SnapshotRequestHandler, AbsRequestHandler, AbsRequestSender, AccountsBackgroundService, SnapshotRequestHandler,
}, },
accounts_db, accounts_db::{self, ACCOUNTS_DB_CONFIG_FOR_TESTING},
accounts_index::AccountSecondaryIndexes, accounts_index::AccountSecondaryIndexes,
bank::{Bank, BankSlotDelta}, bank::{Bank, BankSlotDelta},
bank_forks::BankForks, bank_forks::BankForks,
@ -209,7 +209,7 @@ mod tests {
check_hash_calculation, check_hash_calculation,
false, false,
false, false,
Some(solana_runtime::accounts_index::ACCOUNTS_INDEX_CONFIG_FOR_TESTING), Some(ACCOUNTS_DB_CONFIG_FOR_TESTING),
) )
.unwrap(); .unwrap();
@ -844,7 +844,7 @@ mod tests {
false, false,
false, false,
false, false,
Some(solana_runtime::accounts_index::ACCOUNTS_INDEX_CONFIG_FOR_TESTING), Some(ACCOUNTS_DB_CONFIG_FOR_TESTING),
)?; )?;
assert_eq!(bank, &deserialized_bank); assert_eq!(bank, &deserialized_bank);
@ -1020,7 +1020,7 @@ mod tests {
false, false,
false, false,
false, false,
Some(solana_runtime::accounts_index::ACCOUNTS_INDEX_CONFIG_FOR_TESTING), Some(ACCOUNTS_DB_CONFIG_FOR_TESTING),
) )
.unwrap(); .unwrap();

View File

@ -26,6 +26,7 @@ use solana_ledger::{
shred::Shred, shred::Shred,
}; };
use solana_runtime::{ use solana_runtime::{
accounts_db::AccountsDbConfig,
accounts_index::AccountsIndexConfig, accounts_index::AccountsIndexConfig,
bank::{Bank, RewardCalculationEvent}, bank::{Bank, RewardCalculationEvent},
bank_forks::BankForks, bank_forks::BankForks,
@ -1886,6 +1887,9 @@ fn main() {
.ok() .ok()
.map(|bins| AccountsIndexConfig { bins: Some(bins) }); .map(|bins| AccountsIndexConfig { bins: Some(bins) });
let accounts_db_config =
accounts_index_config.map(|x| AccountsDbConfig { index: Some(x) });
let process_options = ProcessOptions { let process_options = ProcessOptions {
dev_halt_at_slot: value_t!(arg_matches, "halt_at_slot", Slot).ok(), dev_halt_at_slot: value_t!(arg_matches, "halt_at_slot", Slot).ok(),
new_hard_forks: hardforks_of(arg_matches, "hard_forks"), new_hard_forks: hardforks_of(arg_matches, "hard_forks"),
@ -1898,7 +1902,7 @@ fn main() {
usize usize
) )
.ok(), .ok(),
accounts_index_config, accounts_db_config,
verify_index: arg_matches.is_present("verify_accounts_index"), verify_index: arg_matches.is_present("verify_accounts_index"),
allow_dead_slots: arg_matches.is_present("allow_dead_slots"), allow_dead_slots: arg_matches.is_present("allow_dead_slots"),
accounts_db_test_hash_calculation: arg_matches accounts_db_test_hash_calculation: arg_matches

View File

@ -157,7 +157,7 @@ fn load_from_snapshot(
process_options.accounts_db_test_hash_calculation, process_options.accounts_db_test_hash_calculation,
process_options.accounts_db_skip_shrink, process_options.accounts_db_skip_shrink,
process_options.verify_index, process_options.verify_index,
process_options.accounts_index_config.clone(), process_options.accounts_db_config.clone(),
) )
.expect("Load from snapshot failed"); .expect("Load from snapshot failed");

View File

@ -16,8 +16,8 @@ use solana_measure::measure::Measure;
use solana_metrics::{datapoint_error, inc_new_counter_debug}; use solana_metrics::{datapoint_error, inc_new_counter_debug};
use solana_rayon_threadlimit::get_thread_count; use solana_rayon_threadlimit::get_thread_count;
use solana_runtime::{ use solana_runtime::{
accounts_db::AccountShrinkThreshold, accounts_db::{AccountShrinkThreshold, AccountsDbConfig},
accounts_index::{AccountSecondaryIndexes, AccountsIndexConfig}, accounts_index::AccountSecondaryIndexes,
bank::{ bank::{
Bank, ExecuteTimings, InnerInstructionsList, RentDebits, TransactionBalancesSet, Bank, ExecuteTimings, InnerInstructionsList, RentDebits, TransactionBalancesSet,
TransactionExecutionResult, TransactionLogMessages, TransactionResults, TransactionExecutionResult, TransactionLogMessages, TransactionResults,
@ -470,7 +470,7 @@ pub struct ProcessOptions {
pub allow_dead_slots: bool, pub allow_dead_slots: bool,
pub accounts_db_test_hash_calculation: bool, pub accounts_db_test_hash_calculation: bool,
pub accounts_db_skip_shrink: bool, pub accounts_db_skip_shrink: bool,
pub accounts_index_config: Option<AccountsIndexConfig>, pub accounts_db_config: Option<AccountsDbConfig>,
pub verify_index: bool, pub verify_index: bool,
pub shrink_ratio: AccountShrinkThreshold, pub shrink_ratio: AccountShrinkThreshold,
} }
@ -504,7 +504,7 @@ pub fn process_blockstore(
opts.accounts_db_caching_enabled, opts.accounts_db_caching_enabled,
opts.shrink_ratio, opts.shrink_ratio,
false, false,
opts.accounts_index_config.clone(), opts.accounts_db_config.clone(),
); );
let bank0 = Arc::new(bank0); let bank0 = Arc::new(bank0);
info!("processing ledger for slot 0..."); info!("processing ledger for slot 0...");

View File

@ -58,7 +58,7 @@ pub fn safe_clone_config(config: &ValidatorConfig) -> ValidatorConfig {
poh_hashes_per_batch: config.poh_hashes_per_batch, poh_hashes_per_batch: config.poh_hashes_per_batch,
no_wait_for_vote_to_start_leader: config.no_wait_for_vote_to_start_leader, no_wait_for_vote_to_start_leader: config.no_wait_for_vote_to_start_leader,
accounts_shrink_ratio: config.accounts_shrink_ratio, accounts_shrink_ratio: config.accounts_shrink_ratio,
accounts_index_config: config.accounts_index_config.clone(), accounts_db_config: config.accounts_db_config.clone(),
} }
} }

View File

@ -134,7 +134,7 @@ fn initialize_from_snapshot(
process_options.accounts_db_test_hash_calculation, process_options.accounts_db_test_hash_calculation,
false, false,
process_options.verify_index, process_options.verify_index,
process_options.accounts_index_config, process_options.accounts_db_config,
) )
.unwrap(); .unwrap();

View File

@ -1,12 +1,10 @@
use crate::{ use crate::{
accounts_db::{ accounts_db::{
AccountShrinkThreshold, AccountsDb, BankHashInfo, ErrorCounters, LoadHint, LoadedAccount, AccountShrinkThreshold, AccountsDb, AccountsDbConfig, BankHashInfo, ErrorCounters,
ScanStorageResult, LoadHint, LoadedAccount, ScanStorageResult, ACCOUNTS_DB_CONFIG_FOR_BENCHMARKS,
}, ACCOUNTS_DB_CONFIG_FOR_TESTING,
accounts_index::{
AccountSecondaryIndexes, AccountsIndexConfig, IndexKey, ScanResult,
ACCOUNTS_INDEX_CONFIG_FOR_BENCHMARKS, ACCOUNTS_INDEX_CONFIG_FOR_TESTING,
}, },
accounts_index::{AccountSecondaryIndexes, IndexKey, ScanResult},
ancestors::Ancestors, ancestors::Ancestors,
bank::{ bank::{
NonceRollbackFull, NonceRollbackInfo, RentDebits, TransactionCheckResult, NonceRollbackFull, NonceRollbackInfo, RentDebits, TransactionCheckResult,
@ -140,7 +138,7 @@ impl Accounts {
account_indexes, account_indexes,
caching_enabled, caching_enabled,
shrink_ratio, shrink_ratio,
Some(ACCOUNTS_INDEX_CONFIG_FOR_TESTING), Some(ACCOUNTS_DB_CONFIG_FOR_TESTING),
) )
} }
@ -157,7 +155,7 @@ impl Accounts {
account_indexes, account_indexes,
caching_enabled, caching_enabled,
shrink_ratio, shrink_ratio,
Some(ACCOUNTS_INDEX_CONFIG_FOR_BENCHMARKS), Some(ACCOUNTS_DB_CONFIG_FOR_BENCHMARKS),
) )
} }
@ -167,7 +165,7 @@ impl Accounts {
account_indexes: AccountSecondaryIndexes, account_indexes: AccountSecondaryIndexes,
caching_enabled: bool, caching_enabled: bool,
shrink_ratio: AccountShrinkThreshold, shrink_ratio: AccountShrinkThreshold,
accounts_index_config: Option<AccountsIndexConfig>, accounts_db_config: Option<AccountsDbConfig>,
) -> Self { ) -> Self {
Self { Self {
accounts_db: Arc::new(AccountsDb::new_with_config( accounts_db: Arc::new(AccountsDb::new_with_config(
@ -176,7 +174,7 @@ impl Accounts {
account_indexes, account_indexes,
caching_enabled, caching_enabled,
shrink_ratio, shrink_ratio,
accounts_index_config, accounts_db_config,
)), )),
account_locks: Mutex::new(AccountLocks::default()), account_locks: Mutex::new(AccountLocks::default()),
} }

View File

@ -25,7 +25,7 @@ use crate::{
accounts_index::{ accounts_index::{
AccountIndexGetResult, AccountSecondaryIndexes, AccountsIndex, AccountsIndexConfig, AccountIndexGetResult, AccountSecondaryIndexes, AccountsIndex, AccountsIndexConfig,
AccountsIndexRootsStats, IndexKey, IsCached, RefCount, ScanResult, SlotList, SlotSlice, AccountsIndexRootsStats, IndexKey, IsCached, RefCount, ScanResult, SlotList, SlotSlice,
ZeroLamport, ACCOUNTS_INDEX_CONFIG_FOR_TESTING, ZeroLamport, ACCOUNTS_INDEX_CONFIG_FOR_BENCHMARKS, ACCOUNTS_INDEX_CONFIG_FOR_TESTING,
}, },
ancestors::Ancestors, ancestors::Ancestors,
append_vec::{AppendVec, StoredAccountMeta, StoredMeta, StoredMetaWriteVersion}, append_vec::{AppendVec, StoredAccountMeta, StoredMeta, StoredMetaWriteVersion},
@ -118,6 +118,18 @@ const CACHE_VIRTUAL_WRITE_VERSION: StoredMetaWriteVersion = 0;
const CACHE_VIRTUAL_OFFSET: usize = 0; const CACHE_VIRTUAL_OFFSET: usize = 0;
const CACHE_VIRTUAL_STORED_SIZE: usize = 0; const CACHE_VIRTUAL_STORED_SIZE: usize = 0;
pub const ACCOUNTS_DB_CONFIG_FOR_TESTING: AccountsDbConfig = AccountsDbConfig {
index: Some(ACCOUNTS_INDEX_CONFIG_FOR_TESTING),
};
pub const ACCOUNTS_DB_CONFIG_FOR_BENCHMARKS: AccountsDbConfig = AccountsDbConfig {
index: Some(ACCOUNTS_INDEX_CONFIG_FOR_BENCHMARKS),
};
#[derive(Debug, Default, Clone)]
pub struct AccountsDbConfig {
pub index: Option<AccountsIndexConfig>,
}
struct FoundStoredAccount<'a> { struct FoundStoredAccount<'a> {
pub account: StoredAccountMeta<'a>, pub account: StoredAccountMeta<'a>,
pub store_id: AppendVecId, pub store_id: AppendVecId,
@ -1458,7 +1470,7 @@ impl AccountsDb {
AccountSecondaryIndexes::default(), AccountSecondaryIndexes::default(),
false, false,
AccountShrinkThreshold::default(), AccountShrinkThreshold::default(),
Some(ACCOUNTS_INDEX_CONFIG_FOR_TESTING), Some(ACCOUNTS_DB_CONFIG_FOR_TESTING),
) )
} }
@ -1468,9 +1480,9 @@ impl AccountsDb {
account_indexes: AccountSecondaryIndexes, account_indexes: AccountSecondaryIndexes,
caching_enabled: bool, caching_enabled: bool,
shrink_ratio: AccountShrinkThreshold, shrink_ratio: AccountShrinkThreshold,
accounts_index_config: Option<AccountsIndexConfig>, accounts_db_config: Option<AccountsDbConfig>,
) -> Self { ) -> Self {
let accounts_index = AccountsIndex::new(accounts_index_config); let accounts_index = AccountsIndex::new(accounts_db_config.and_then(|x| x.index));
let mut new = if !paths.is_empty() { let mut new = if !paths.is_empty() {
Self { Self {
paths, paths,
@ -6498,7 +6510,7 @@ impl AccountsDb {
account_indexes, account_indexes,
caching_enabled, caching_enabled,
shrink_ratio, shrink_ratio,
Some(ACCOUNTS_INDEX_CONFIG_FOR_TESTING), Some(ACCOUNTS_DB_CONFIG_FOR_TESTING),
) )
} }

View File

@ -38,11 +38,11 @@ use crate::{
AccountAddressFilter, Accounts, TransactionAccounts, TransactionLoadResult, AccountAddressFilter, Accounts, TransactionAccounts, TransactionLoadResult,
TransactionLoaders, TransactionLoaders,
}, },
accounts_db::{AccountShrinkThreshold, ErrorCounters, SnapshotStorages}, accounts_db::{
accounts_index::{ AccountShrinkThreshold, AccountsDbConfig, ErrorCounters, SnapshotStorages,
AccountSecondaryIndexes, AccountsIndexConfig, IndexKey, ScanResult, ACCOUNTS_DB_CONFIG_FOR_BENCHMARKS, ACCOUNTS_DB_CONFIG_FOR_TESTING,
ACCOUNTS_INDEX_CONFIG_FOR_BENCHMARKS, ACCOUNTS_INDEX_CONFIG_FOR_TESTING,
}, },
accounts_index::{AccountSecondaryIndexes, IndexKey, ScanResult},
ancestors::{Ancestors, AncestorsForSerialization}, ancestors::{Ancestors, AncestorsForSerialization},
blockhash_queue::BlockhashQueue, blockhash_queue::BlockhashQueue,
builtins::{self, ActivationType, Builtin, Builtins}, builtins::{self, ActivationType, Builtin, Builtins},
@ -1140,7 +1140,7 @@ impl Bank {
accounts_db_caching_enabled, accounts_db_caching_enabled,
shrink_ratio, shrink_ratio,
debug_do_not_add_builtins, debug_do_not_add_builtins,
Some(ACCOUNTS_INDEX_CONFIG_FOR_TESTING), Some(ACCOUNTS_DB_CONFIG_FOR_TESTING),
) )
} }
@ -1165,7 +1165,7 @@ impl Bank {
accounts_db_caching_enabled, accounts_db_caching_enabled,
shrink_ratio, shrink_ratio,
debug_do_not_add_builtins, debug_do_not_add_builtins,
Some(ACCOUNTS_INDEX_CONFIG_FOR_BENCHMARKS), Some(ACCOUNTS_DB_CONFIG_FOR_BENCHMARKS),
) )
} }
@ -1180,7 +1180,7 @@ impl Bank {
accounts_db_caching_enabled: bool, accounts_db_caching_enabled: bool,
shrink_ratio: AccountShrinkThreshold, shrink_ratio: AccountShrinkThreshold,
debug_do_not_add_builtins: bool, debug_do_not_add_builtins: bool,
accounts_index_config: Option<AccountsIndexConfig>, accounts_db_config: Option<AccountsDbConfig>,
) -> Self { ) -> Self {
let accounts = Accounts::new_with_config( let accounts = Accounts::new_with_config(
paths, paths,
@ -1188,7 +1188,7 @@ impl Bank {
account_indexes, account_indexes,
accounts_db_caching_enabled, accounts_db_caching_enabled,
shrink_ratio, shrink_ratio,
accounts_index_config, accounts_db_config,
); );
let mut bank = Self::default_with_accounts(accounts); let mut bank = Self::default_with_accounts(accounts);
bank.ancestors = Ancestors::from(vec![bank.slot()]); bank.ancestors = Ancestors::from(vec![bank.slot()]);

View File

@ -2,9 +2,10 @@ use {
crate::{ crate::{
accounts::Accounts, accounts::Accounts,
accounts_db::{ accounts_db::{
AccountShrinkThreshold, AccountStorageEntry, AccountsDb, AppendVecId, BankHashInfo, AccountShrinkThreshold, AccountStorageEntry, AccountsDb, AccountsDbConfig, AppendVecId,
BankHashInfo,
}, },
accounts_index::{AccountSecondaryIndexes, AccountsIndexConfig}, accounts_index::AccountSecondaryIndexes,
ancestors::Ancestors, ancestors::Ancestors,
append_vec::{AppendVec, StoredMetaWriteVersion}, append_vec::{AppendVec, StoredMetaWriteVersion},
bank::{Bank, BankFieldsToDeserialize, BankRc}, bank::{Bank, BankFieldsToDeserialize, BankRc},
@ -198,7 +199,7 @@ pub(crate) fn bank_from_streams<R>(
limit_load_slot_count_from_snapshot: Option<usize>, limit_load_slot_count_from_snapshot: Option<usize>,
shrink_ratio: AccountShrinkThreshold, shrink_ratio: AccountShrinkThreshold,
verify_index: bool, verify_index: bool,
accounts_index_config: Option<AccountsIndexConfig>, accounts_db_config: Option<AccountsDbConfig>,
) -> std::result::Result<Bank, Error> ) -> std::result::Result<Bank, Error>
where where
R: Read, R: Read,
@ -236,7 +237,7 @@ where
limit_load_slot_count_from_snapshot, limit_load_slot_count_from_snapshot,
shrink_ratio, shrink_ratio,
verify_index, verify_index,
accounts_index_config, accounts_db_config,
)?; )?;
Ok(bank) Ok(bank)
}}; }};
@ -329,7 +330,7 @@ fn reconstruct_bank_from_fields<E>(
limit_load_slot_count_from_snapshot: Option<usize>, limit_load_slot_count_from_snapshot: Option<usize>,
shrink_ratio: AccountShrinkThreshold, shrink_ratio: AccountShrinkThreshold,
verify_index: bool, verify_index: bool,
accounts_index_config: Option<AccountsIndexConfig>, accounts_db_config: Option<AccountsDbConfig>,
) -> Result<Bank, Error> ) -> Result<Bank, Error>
where where
E: SerializableStorage + std::marker::Sync, E: SerializableStorage + std::marker::Sync,
@ -344,7 +345,7 @@ where
limit_load_slot_count_from_snapshot, limit_load_slot_count_from_snapshot,
shrink_ratio, shrink_ratio,
verify_index, verify_index,
accounts_index_config, accounts_db_config,
)?; )?;
accounts_db.freeze_accounts( accounts_db.freeze_accounts(
&Ancestors::from(&bank_fields.ancestors), &Ancestors::from(&bank_fields.ancestors),
@ -396,7 +397,7 @@ fn reconstruct_accountsdb_from_fields<E>(
limit_load_slot_count_from_snapshot: Option<usize>, limit_load_slot_count_from_snapshot: Option<usize>,
shrink_ratio: AccountShrinkThreshold, shrink_ratio: AccountShrinkThreshold,
verify_index: bool, verify_index: bool,
accounts_index_config: Option<AccountsIndexConfig>, accounts_db_config: Option<AccountsDbConfig>,
) -> Result<AccountsDb, Error> ) -> Result<AccountsDb, Error>
where where
E: SerializableStorage + std::marker::Sync, E: SerializableStorage + std::marker::Sync,
@ -407,7 +408,7 @@ where
account_secondary_indexes, account_secondary_indexes,
caching_enabled, caching_enabled,
shrink_ratio, shrink_ratio,
accounts_index_config, accounts_db_config,
); );
let AccountsDbFields( let AccountsDbFields(

View File

@ -83,7 +83,7 @@ where
None, None,
AccountShrinkThreshold::default(), AccountShrinkThreshold::default(),
false, false,
Some(crate::accounts_index::ACCOUNTS_INDEX_CONFIG_FOR_TESTING), Some(crate::accounts_db::ACCOUNTS_DB_CONFIG_FOR_TESTING),
) )
} }
@ -245,7 +245,7 @@ fn test_bank_serialize_style(serde_style: SerdeStyle) {
None, None,
AccountShrinkThreshold::default(), AccountShrinkThreshold::default(),
false, false,
Some(crate::accounts_index::ACCOUNTS_INDEX_CONFIG_FOR_TESTING), Some(crate::accounts_db::ACCOUNTS_DB_CONFIG_FOR_TESTING),
) )
.unwrap(); .unwrap();
dbank.src = ref_sc; dbank.src = ref_sc;

View File

@ -1,7 +1,7 @@
use { use {
crate::{ crate::{
accounts_db::AccountShrinkThreshold, accounts_db::{AccountShrinkThreshold, AccountsDbConfig},
accounts_index::{AccountSecondaryIndexes, AccountsIndexConfig}, accounts_index::AccountSecondaryIndexes,
bank::{Bank, BankSlotDelta}, bank::{Bank, BankSlotDelta},
builtins::Builtins, builtins::Builtins,
hardened_unpack::{unpack_snapshot, ParallelSelector, UnpackError, UnpackedAppendVecMap}, hardened_unpack::{unpack_snapshot, ParallelSelector, UnpackError, UnpackedAppendVecMap},
@ -732,7 +732,7 @@ pub fn bank_from_snapshot_archives(
test_hash_calculation: bool, test_hash_calculation: bool,
accounts_db_skip_shrink: bool, accounts_db_skip_shrink: bool,
verify_index: bool, verify_index: bool,
accounts_index_config: Option<AccountsIndexConfig>, accounts_db_config: Option<AccountsDbConfig>,
) -> Result<(Bank, BankFromArchiveTimings)> { ) -> Result<(Bank, BankFromArchiveTimings)> {
check_are_snapshots_compatible( check_are_snapshots_compatible(
full_snapshot_archive_info, full_snapshot_archive_info,
@ -796,7 +796,7 @@ pub fn bank_from_snapshot_archives(
limit_load_slot_count_from_snapshot, limit_load_slot_count_from_snapshot,
shrink_ratio, shrink_ratio,
verify_index, verify_index,
accounts_index_config, accounts_db_config,
)?; )?;
measure_rebuild.stop(); measure_rebuild.stop();
info!("{}", measure_rebuild); info!("{}", measure_rebuild);
@ -842,7 +842,7 @@ pub fn bank_from_latest_snapshot_archives(
test_hash_calculation: bool, test_hash_calculation: bool,
accounts_db_skip_shrink: bool, accounts_db_skip_shrink: bool,
verify_index: bool, verify_index: bool,
accounts_index_config: Option<AccountsIndexConfig>, accounts_db_config: Option<AccountsDbConfig>,
) -> Result<( ) -> Result<(
Bank, Bank,
BankFromArchiveTimings, BankFromArchiveTimings,
@ -885,7 +885,7 @@ pub fn bank_from_latest_snapshot_archives(
test_hash_calculation, test_hash_calculation,
accounts_db_skip_shrink, accounts_db_skip_shrink,
verify_index, verify_index,
accounts_index_config, accounts_db_config,
)?; )?;
verify_bank_against_expected_slot_hash( verify_bank_against_expected_slot_hash(
@ -1421,7 +1421,7 @@ fn rebuild_bank_from_snapshots(
limit_load_slot_count_from_snapshot: Option<usize>, limit_load_slot_count_from_snapshot: Option<usize>,
shrink_ratio: AccountShrinkThreshold, shrink_ratio: AccountShrinkThreshold,
verify_index: bool, verify_index: bool,
accounts_index_config: Option<AccountsIndexConfig>, accounts_db_config: Option<AccountsDbConfig>,
) -> Result<Bank> { ) -> Result<Bank> {
let (full_snapshot_version, full_snapshot_root_paths) = let (full_snapshot_version, full_snapshot_root_paths) =
verify_unpacked_snapshots_dir_and_version( verify_unpacked_snapshots_dir_and_version(
@ -1469,7 +1469,7 @@ fn rebuild_bank_from_snapshots(
limit_load_slot_count_from_snapshot, limit_load_slot_count_from_snapshot,
shrink_ratio, shrink_ratio,
verify_index, verify_index,
accounts_index_config, accounts_db_config,
), ),
}?, }?,
) )
@ -1814,6 +1814,7 @@ pub fn should_take_incremental_snapshot(
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use crate::accounts_db::ACCOUNTS_DB_CONFIG_FOR_TESTING;
use assert_matches::assert_matches; use assert_matches::assert_matches;
use bincode::{deserialize_from, serialize_into}; use bincode::{deserialize_from, serialize_into};
use solana_sdk::{ use solana_sdk::{
@ -2606,7 +2607,7 @@ mod tests {
false, false,
false, false,
false, false,
Some(crate::accounts_index::ACCOUNTS_INDEX_CONFIG_FOR_TESTING), Some(ACCOUNTS_DB_CONFIG_FOR_TESTING),
) )
.unwrap(); .unwrap();
@ -2697,7 +2698,7 @@ mod tests {
false, false,
false, false,
false, false,
Some(crate::accounts_index::ACCOUNTS_INDEX_CONFIG_FOR_TESTING), Some(ACCOUNTS_DB_CONFIG_FOR_TESTING),
) )
.unwrap(); .unwrap();
@ -2807,7 +2808,7 @@ mod tests {
false, false,
false, false,
false, false,
Some(crate::accounts_index::ACCOUNTS_INDEX_CONFIG_FOR_TESTING), Some(ACCOUNTS_DB_CONFIG_FOR_TESTING),
) )
.unwrap(); .unwrap();
@ -2906,7 +2907,7 @@ mod tests {
false, false,
false, false,
false, false,
Some(crate::accounts_index::ACCOUNTS_INDEX_CONFIG_FOR_TESTING), Some(ACCOUNTS_DB_CONFIG_FOR_TESTING),
) )
.unwrap(); .unwrap();
@ -3047,7 +3048,7 @@ mod tests {
false, false,
false, false,
false, false,
Some(crate::accounts_index::ACCOUNTS_INDEX_CONFIG_FOR_TESTING), Some(ACCOUNTS_DB_CONFIG_FOR_TESTING),
) )
.unwrap(); .unwrap();
assert_eq!( assert_eq!(
@ -3109,7 +3110,7 @@ mod tests {
false, false,
false, false,
false, false,
Some(crate::accounts_index::ACCOUNTS_INDEX_CONFIG_FOR_TESTING), Some(ACCOUNTS_DB_CONFIG_FOR_TESTING),
) )
.unwrap(); .unwrap();
assert_eq!( assert_eq!(

View File

@ -39,7 +39,7 @@ use {
solana_rpc::{rpc::JsonRpcConfig, rpc_pubsub_service::PubSubConfig}, solana_rpc::{rpc::JsonRpcConfig, rpc_pubsub_service::PubSubConfig},
solana_runtime::{ solana_runtime::{
accounts_db::{ accounts_db::{
AccountShrinkThreshold, DEFAULT_ACCOUNTS_SHRINK_OPTIMIZE_TOTAL_SPACE, AccountShrinkThreshold, AccountsDbConfig, DEFAULT_ACCOUNTS_SHRINK_OPTIMIZE_TOTAL_SPACE,
DEFAULT_ACCOUNTS_SHRINK_RATIO, DEFAULT_ACCOUNTS_SHRINK_RATIO,
}, },
accounts_index::{ accounts_index::{
@ -2444,6 +2444,7 @@ pub fn main() {
let accounts_index_config = value_t!(matches, "accounts_index_bins", usize) let accounts_index_config = value_t!(matches, "accounts_index_bins", usize)
.ok() .ok()
.map(|bins| AccountsIndexConfig { bins: Some(bins) }); .map(|bins| AccountsIndexConfig { bins: Some(bins) });
let accounts_db_config = accounts_index_config.map(|x| AccountsDbConfig { index: Some(x) });
let accountsdb_repl_service_config = if matches.is_present("enable_accountsdb_repl") { let accountsdb_repl_service_config = if matches.is_present("enable_accountsdb_repl") {
let accountsdb_repl_bind_address = if matches.is_present("accountsdb_repl_bind_address") { let accountsdb_repl_bind_address = if matches.is_present("accountsdb_repl_bind_address") {
@ -2563,7 +2564,7 @@ pub fn main() {
account_indexes, account_indexes,
accounts_db_caching_enabled: !matches.is_present("no_accounts_db_caching"), accounts_db_caching_enabled: !matches.is_present("no_accounts_db_caching"),
accounts_db_test_hash_calculation: matches.is_present("accounts_db_test_hash_calculation"), accounts_db_test_hash_calculation: matches.is_present("accounts_db_test_hash_calculation"),
accounts_index_config, accounts_db_config,
accounts_db_skip_shrink: matches.is_present("accounts_db_skip_shrink"), accounts_db_skip_shrink: matches.is_present("accounts_db_skip_shrink"),
accounts_db_use_index_hash_calculation: matches.is_present("accounts_db_index_hashing"), accounts_db_use_index_hash_calculation: matches.is_present("accounts_db_index_hashing"),
tpu_coalesce_ms, tpu_coalesce_ms,