use write cache by default in some tests (#28876)
This commit is contained in:
parent
aa1d319d48
commit
f22104d46b
|
@ -63,6 +63,7 @@ fn test_bench_tps_local_cluster(config: Config) {
|
|||
cluster_lamports: 200_000_000,
|
||||
validator_configs: make_identical_validator_configs(
|
||||
&ValidatorConfig {
|
||||
accounts_db_caching_enabled: true,
|
||||
rpc_config: JsonRpcConfig {
|
||||
faucet_addr: Some(faucet_addr),
|
||||
..JsonRpcConfig::default_for_test()
|
||||
|
|
|
@ -14,7 +14,7 @@ use {
|
|||
accounts_db::AccountShrinkThreshold,
|
||||
accounts_hash::CalcAccountsHashConfig,
|
||||
accounts_index::AccountSecondaryIndexes,
|
||||
bank::Bank,
|
||||
bank::{bank_test_config_caching_enabled, Bank},
|
||||
bank_forks::BankForks,
|
||||
epoch_accounts_hash::{self, EpochAccountsHash},
|
||||
genesis_utils::{self, GenesisConfigInfo},
|
||||
|
@ -107,8 +107,10 @@ impl TestEnvironment {
|
|||
..snapshot_config
|
||||
};
|
||||
|
||||
let mut bank_forks =
|
||||
BankForks::new(Bank::new_for_tests(&genesis_config_info.genesis_config));
|
||||
let mut bank_forks = BankForks::new(Bank::new_for_tests_with_config(
|
||||
&genesis_config_info.genesis_config,
|
||||
bank_test_config_caching_enabled(),
|
||||
));
|
||||
bank_forks.set_snapshot_config(Some(snapshot_config.clone()));
|
||||
bank_forks.set_accounts_hash_interval_slots(Self::ACCOUNTS_HASH_INTERVAL);
|
||||
let bank_forks = Arc::new(RwLock::new(bank_forks));
|
||||
|
@ -219,7 +221,7 @@ impl BackgroundServices {
|
|||
snapshot_request_handler,
|
||||
pruned_banks_request_handler,
|
||||
},
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
None,
|
||||
);
|
||||
|
@ -581,6 +583,14 @@ fn test_epoch_accounts_hash_and_warping() {
|
|||
let eah_stop_offset = epoch_accounts_hash::calculation_offset_stop(&bank);
|
||||
let eah_stop_slot_in_next_epoch =
|
||||
epoch_schedule.get_first_slot_in_epoch(bank.epoch() + 1) + eah_stop_offset;
|
||||
// have to set root here so that we can flush the write cache
|
||||
bank_forks.write().unwrap().set_root(
|
||||
bank.slot(),
|
||||
&test_environment
|
||||
.background_services
|
||||
.accounts_background_request_sender,
|
||||
None,
|
||||
);
|
||||
let bank = bank_forks.write().unwrap().insert(Bank::warp_from_parent(
|
||||
&bank,
|
||||
&Pubkey::default(),
|
||||
|
|
|
@ -101,7 +101,7 @@ impl SnapshotTestConfig {
|
|||
Arc::<RuntimeConfig>::default(),
|
||||
vec![accounts_dir.path().to_path_buf()],
|
||||
AccountSecondaryIndexes::default(),
|
||||
false,
|
||||
true,
|
||||
accounts_db::AccountShrinkThreshold::default(),
|
||||
);
|
||||
bank0.freeze();
|
||||
|
@ -252,7 +252,7 @@ fn run_bank_forks_snapshot_n<F>(
|
|||
// set_root should send a snapshot request
|
||||
bank_forks.set_root(bank.slot(), &request_sender, None);
|
||||
bank.update_accounts_hash_for_tests();
|
||||
snapshot_request_handler.handle_snapshot_requests(false, false, 0, &mut None);
|
||||
snapshot_request_handler.handle_snapshot_requests(true, false, 0, &mut None);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -784,7 +784,7 @@ fn test_bank_forks_incremental_snapshot(
|
|||
bank_forks.set_root(bank.slot(), &request_sender, None);
|
||||
bank.update_accounts_hash_for_tests();
|
||||
snapshot_request_handler.handle_snapshot_requests(
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
0,
|
||||
&mut last_full_snapshot_slot,
|
||||
|
@ -1041,7 +1041,7 @@ fn test_snapshots_with_background_services(
|
|||
bank_forks.clone(),
|
||||
&exit,
|
||||
abs_request_handler,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
None,
|
||||
);
|
||||
|
|
|
@ -4791,6 +4791,7 @@ pub mod tests {
|
|||
let (bank_forks, mint_keypair, leader_vote_keypair) =
|
||||
new_bank_forks_with_config(BankTestConfig {
|
||||
secondary_indexes: config.account_indexes.clone(),
|
||||
accounts_db_caching_enabled: true,
|
||||
});
|
||||
|
||||
let ledger_path = get_tmp_ledger_path!();
|
||||
|
|
|
@ -1150,6 +1150,14 @@ pub struct NewBankOptions {
|
|||
#[derive(Debug, Default)]
|
||||
pub struct BankTestConfig {
|
||||
pub secondary_indexes: AccountSecondaryIndexes,
|
||||
pub accounts_db_caching_enabled: bool,
|
||||
}
|
||||
|
||||
pub fn bank_test_config_caching_enabled() -> BankTestConfig {
|
||||
BankTestConfig {
|
||||
accounts_db_caching_enabled: true,
|
||||
..BankTestConfig::default()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -1224,7 +1232,7 @@ impl Bank {
|
|||
Self::new_with_config_for_tests(
|
||||
genesis_config,
|
||||
test_config.secondary_indexes,
|
||||
false,
|
||||
test_config.accounts_db_caching_enabled,
|
||||
AccountShrinkThreshold::default(),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@ impl Default for TestValidatorGenesis {
|
|||
max_ledger_shreds: Option::<u64>::default(),
|
||||
max_genesis_archive_unpacked_size: Option::<u64>::default(),
|
||||
geyser_plugin_config_files: Option::<Vec<PathBuf>>::default(),
|
||||
accounts_db_caching_enabled: bool::default(),
|
||||
accounts_db_caching_enabled: true,
|
||||
deactivate_feature_set: HashSet::<Pubkey>::default(),
|
||||
compute_unit_limit: Option::<u64>::default(),
|
||||
log_messages_bytes_limit: Option::<usize>::default(),
|
||||
|
|
Loading…
Reference in New Issue