type AccountSecondaryIndexes = HashSet (#17108)
This commit is contained in:
parent
a6a1355b80
commit
f39dda00e0
|
@ -6,10 +6,10 @@ use rayon::prelude::*;
|
||||||
use solana_measure::measure::Measure;
|
use solana_measure::measure::Measure;
|
||||||
use solana_runtime::{
|
use solana_runtime::{
|
||||||
accounts::{create_test_accounts, update_accounts_bench, Accounts},
|
accounts::{create_test_accounts, update_accounts_bench, Accounts},
|
||||||
accounts_index::Ancestors,
|
accounts_index::{AccountSecondaryIndexes, Ancestors},
|
||||||
};
|
};
|
||||||
use solana_sdk::{genesis_config::ClusterType, pubkey::Pubkey};
|
use solana_sdk::{genesis_config::ClusterType, pubkey::Pubkey};
|
||||||
use std::{collections::HashSet, env, fs, path::PathBuf};
|
use std::{env, fs, path::PathBuf};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
solana_logger::setup();
|
solana_logger::setup();
|
||||||
|
@ -58,8 +58,12 @@ fn main() {
|
||||||
if fs::remove_dir_all(path.clone()).is_err() {
|
if fs::remove_dir_all(path.clone()).is_err() {
|
||||||
println!("Warning: Couldn't remove {:?}", path);
|
println!("Warning: Couldn't remove {:?}", path);
|
||||||
}
|
}
|
||||||
let accounts =
|
let accounts = Accounts::new_with_config(
|
||||||
Accounts::new_with_config(vec![path], &ClusterType::Testnet, HashSet::new(), false);
|
vec![path],
|
||||||
|
&ClusterType::Testnet,
|
||||||
|
AccountSecondaryIndexes::default(),
|
||||||
|
false,
|
||||||
|
);
|
||||||
println!("Creating {} accounts", num_accounts);
|
println!("Creating {} accounts", num_accounts);
|
||||||
let mut create_time = Measure::start("create accounts");
|
let mut create_time = Measure::start("create accounts");
|
||||||
let pubkeys: Vec<_> = (0..num_slots)
|
let pubkeys: Vec<_> = (0..num_slots)
|
||||||
|
|
|
@ -46,7 +46,7 @@ use solana_ledger::{
|
||||||
use solana_measure::measure::Measure;
|
use solana_measure::measure::Measure;
|
||||||
use solana_metrics::datapoint_info;
|
use solana_metrics::datapoint_info;
|
||||||
use solana_runtime::{
|
use solana_runtime::{
|
||||||
accounts_index::AccountIndex,
|
accounts_index::AccountSecondaryIndexes,
|
||||||
bank::Bank,
|
bank::Bank,
|
||||||
bank_forks::{BankForks, SnapshotConfig},
|
bank_forks::{BankForks, SnapshotConfig},
|
||||||
commitment::BlockCommitmentCache,
|
commitment::BlockCommitmentCache,
|
||||||
|
@ -125,7 +125,7 @@ pub struct ValidatorConfig {
|
||||||
pub no_poh_speed_test: bool,
|
pub no_poh_speed_test: bool,
|
||||||
pub poh_pinned_cpu_core: usize,
|
pub poh_pinned_cpu_core: usize,
|
||||||
pub poh_hashes_per_batch: u64,
|
pub poh_hashes_per_batch: u64,
|
||||||
pub account_indexes: HashSet<AccountIndex>,
|
pub account_indexes: AccountSecondaryIndexes,
|
||||||
pub accounts_db_caching_enabled: bool,
|
pub accounts_db_caching_enabled: bool,
|
||||||
pub warp_slot: Option<Slot>,
|
pub warp_slot: Option<Slot>,
|
||||||
pub accounts_db_test_hash_calculation: bool,
|
pub accounts_db_test_hash_calculation: bool,
|
||||||
|
@ -181,7 +181,7 @@ impl Default for ValidatorConfig {
|
||||||
no_poh_speed_test: true,
|
no_poh_speed_test: true,
|
||||||
poh_pinned_cpu_core: poh_service::DEFAULT_PINNED_CPU_CORE,
|
poh_pinned_cpu_core: poh_service::DEFAULT_PINNED_CPU_CORE,
|
||||||
poh_hashes_per_batch: poh_service::DEFAULT_HASHES_PER_BATCH,
|
poh_hashes_per_batch: poh_service::DEFAULT_HASHES_PER_BATCH,
|
||||||
account_indexes: HashSet::new(),
|
account_indexes: AccountSecondaryIndexes::default(),
|
||||||
accounts_db_caching_enabled: false,
|
accounts_db_caching_enabled: false,
|
||||||
warp_slot: None,
|
warp_slot: None,
|
||||||
accounts_db_test_hash_calculation: false,
|
accounts_db_test_hash_calculation: false,
|
||||||
|
|
|
@ -47,6 +47,7 @@ mod tests {
|
||||||
use solana_runtime::{
|
use solana_runtime::{
|
||||||
accounts_background_service::{AbsRequestSender, SnapshotRequestHandler},
|
accounts_background_service::{AbsRequestSender, SnapshotRequestHandler},
|
||||||
accounts_db,
|
accounts_db,
|
||||||
|
accounts_index::AccountSecondaryIndexes,
|
||||||
bank::{Bank, BankSlotDelta},
|
bank::{Bank, BankSlotDelta},
|
||||||
bank_forks::{ArchiveFormat, BankForks, SnapshotConfig},
|
bank_forks::{ArchiveFormat, BankForks, SnapshotConfig},
|
||||||
genesis_utils::{create_genesis_config, GenesisConfigInfo},
|
genesis_utils::{create_genesis_config, GenesisConfigInfo},
|
||||||
|
@ -106,7 +107,7 @@ mod tests {
|
||||||
&[],
|
&[],
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
HashSet::new(),
|
AccountSecondaryIndexes::default(),
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
bank0.freeze();
|
bank0.freeze();
|
||||||
|
@ -163,7 +164,7 @@ mod tests {
|
||||||
old_genesis_config,
|
old_genesis_config,
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
HashSet::new(),
|
AccountSecondaryIndexes::default(),
|
||||||
false,
|
false,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
|
@ -16,7 +16,7 @@ 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_index::AccountIndex,
|
accounts_index::AccountSecondaryIndexes,
|
||||||
bank::{
|
bank::{
|
||||||
Bank, ExecuteTimings, InnerInstructionsList, TransactionBalancesSet,
|
Bank, ExecuteTimings, InnerInstructionsList, TransactionBalancesSet,
|
||||||
TransactionExecutionResult, TransactionLogMessages, TransactionResults,
|
TransactionExecutionResult, TransactionLogMessages, TransactionResults,
|
||||||
|
@ -366,7 +366,7 @@ pub struct ProcessOptions {
|
||||||
pub new_hard_forks: Option<Vec<Slot>>,
|
pub new_hard_forks: Option<Vec<Slot>>,
|
||||||
pub frozen_accounts: Vec<Pubkey>,
|
pub frozen_accounts: Vec<Pubkey>,
|
||||||
pub debug_keys: Option<Arc<HashSet<Pubkey>>>,
|
pub debug_keys: Option<Arc<HashSet<Pubkey>>>,
|
||||||
pub account_indexes: HashSet<AccountIndex>,
|
pub account_indexes: AccountSecondaryIndexes,
|
||||||
pub accounts_db_caching_enabled: bool,
|
pub accounts_db_caching_enabled: bool,
|
||||||
pub allow_dead_slots: bool,
|
pub allow_dead_slots: bool,
|
||||||
}
|
}
|
||||||
|
@ -2990,7 +2990,7 @@ pub mod tests {
|
||||||
&[],
|
&[],
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
HashSet::new(),
|
AccountSecondaryIndexes::default(),
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
*bank.epoch_schedule()
|
*bank.epoch_schedule()
|
||||||
|
|
|
@ -8,7 +8,7 @@ use rand::Rng;
|
||||||
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};
|
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};
|
||||||
use solana_runtime::{
|
use solana_runtime::{
|
||||||
accounts::{create_test_accounts, AccountAddressFilter, Accounts},
|
accounts::{create_test_accounts, AccountAddressFilter, Accounts},
|
||||||
accounts_index::Ancestors,
|
accounts_index::{AccountSecondaryIndexes, Ancestors},
|
||||||
bank::*,
|
bank::*,
|
||||||
};
|
};
|
||||||
use solana_sdk::{
|
use solana_sdk::{
|
||||||
|
@ -56,7 +56,7 @@ fn test_accounts_create(bencher: &mut Bencher) {
|
||||||
&[],
|
&[],
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
HashSet::new(),
|
AccountSecondaryIndexes::default(),
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
bencher.iter(|| {
|
bencher.iter(|| {
|
||||||
|
@ -75,7 +75,7 @@ fn test_accounts_squash(bencher: &mut Bencher) {
|
||||||
&[],
|
&[],
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
HashSet::new(),
|
AccountSecondaryIndexes::default(),
|
||||||
false,
|
false,
|
||||||
));
|
));
|
||||||
let mut pubkeys: Vec<Pubkey> = vec![];
|
let mut pubkeys: Vec<Pubkey> = vec![];
|
||||||
|
@ -100,7 +100,7 @@ fn test_accounts_hash_bank_hash(bencher: &mut Bencher) {
|
||||||
let accounts = Accounts::new_with_config(
|
let accounts = Accounts::new_with_config(
|
||||||
vec![PathBuf::from("bench_accounts_hash_internal")],
|
vec![PathBuf::from("bench_accounts_hash_internal")],
|
||||||
&ClusterType::Development,
|
&ClusterType::Development,
|
||||||
HashSet::new(),
|
AccountSecondaryIndexes::default(),
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
let mut pubkeys: Vec<Pubkey> = vec![];
|
let mut pubkeys: Vec<Pubkey> = vec![];
|
||||||
|
@ -118,7 +118,7 @@ fn test_update_accounts_hash(bencher: &mut Bencher) {
|
||||||
let accounts = Accounts::new_with_config(
|
let accounts = Accounts::new_with_config(
|
||||||
vec![PathBuf::from("update_accounts_hash")],
|
vec![PathBuf::from("update_accounts_hash")],
|
||||||
&ClusterType::Development,
|
&ClusterType::Development,
|
||||||
HashSet::new(),
|
AccountSecondaryIndexes::default(),
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
let mut pubkeys: Vec<Pubkey> = vec![];
|
let mut pubkeys: Vec<Pubkey> = vec![];
|
||||||
|
@ -135,7 +135,7 @@ fn test_accounts_delta_hash(bencher: &mut Bencher) {
|
||||||
let accounts = Accounts::new_with_config(
|
let accounts = Accounts::new_with_config(
|
||||||
vec![PathBuf::from("accounts_delta_hash")],
|
vec![PathBuf::from("accounts_delta_hash")],
|
||||||
&ClusterType::Development,
|
&ClusterType::Development,
|
||||||
HashSet::new(),
|
AccountSecondaryIndexes::default(),
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
let mut pubkeys: Vec<Pubkey> = vec![];
|
let mut pubkeys: Vec<Pubkey> = vec![];
|
||||||
|
@ -151,7 +151,7 @@ fn bench_delete_dependencies(bencher: &mut Bencher) {
|
||||||
let accounts = Accounts::new_with_config(
|
let accounts = Accounts::new_with_config(
|
||||||
vec![PathBuf::from("accounts_delete_deps")],
|
vec![PathBuf::from("accounts_delete_deps")],
|
||||||
&ClusterType::Development,
|
&ClusterType::Development,
|
||||||
HashSet::new(),
|
AccountSecondaryIndexes::default(),
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
let mut old_pubkey = Pubkey::default();
|
let mut old_pubkey = Pubkey::default();
|
||||||
|
@ -184,7 +184,7 @@ fn store_accounts_with_possible_contention<F: 'static>(
|
||||||
.join(bench_name),
|
.join(bench_name),
|
||||||
],
|
],
|
||||||
&ClusterType::Development,
|
&ClusterType::Development,
|
||||||
HashSet::new(),
|
AccountSecondaryIndexes::default(),
|
||||||
false,
|
false,
|
||||||
));
|
));
|
||||||
let num_keys = 1000;
|
let num_keys = 1000;
|
||||||
|
@ -313,7 +313,7 @@ fn setup_bench_dashmap_iter() -> (Arc<Accounts>, DashMap<Pubkey, (AccountSharedD
|
||||||
.join("bench_dashmap_par_iter"),
|
.join("bench_dashmap_par_iter"),
|
||||||
],
|
],
|
||||||
&ClusterType::Development,
|
&ClusterType::Development,
|
||||||
HashSet::new(),
|
AccountSecondaryIndexes::default(),
|
||||||
false,
|
false,
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -364,8 +364,12 @@ fn bench_dashmap_iter(bencher: &mut Bencher) {
|
||||||
|
|
||||||
#[bench]
|
#[bench]
|
||||||
fn bench_load_largest_accounts(b: &mut Bencher) {
|
fn bench_load_largest_accounts(b: &mut Bencher) {
|
||||||
let accounts =
|
let accounts = Accounts::new_with_config(
|
||||||
Accounts::new_with_config(Vec::new(), &ClusterType::Development, HashSet::new(), false);
|
Vec::new(),
|
||||||
|
&ClusterType::Development,
|
||||||
|
AccountSecondaryIndexes::default(),
|
||||||
|
false,
|
||||||
|
);
|
||||||
let mut rng = rand::thread_rng();
|
let mut rng = rand::thread_rng();
|
||||||
for _ in 0..10_000 {
|
for _ in 0..10_000 {
|
||||||
let lamports = rng.gen();
|
let lamports = rng.gen();
|
||||||
|
|
|
@ -3,9 +3,11 @@
|
||||||
extern crate test;
|
extern crate test;
|
||||||
|
|
||||||
use rand::{thread_rng, Rng};
|
use rand::{thread_rng, Rng};
|
||||||
use solana_runtime::{accounts_db::AccountInfo, accounts_index::AccountsIndex};
|
use solana_runtime::{
|
||||||
|
accounts_db::AccountInfo,
|
||||||
|
accounts_index::{AccountSecondaryIndexes, AccountsIndex},
|
||||||
|
};
|
||||||
use solana_sdk::pubkey::{self, Pubkey};
|
use solana_sdk::pubkey::{self, Pubkey};
|
||||||
use std::collections::HashSet;
|
|
||||||
use test::Bencher;
|
use test::Bencher;
|
||||||
|
|
||||||
#[bench]
|
#[bench]
|
||||||
|
@ -24,7 +26,7 @@ fn bench_accounts_index(bencher: &mut Bencher) {
|
||||||
pubkey,
|
pubkey,
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
AccountInfo::default(),
|
AccountInfo::default(),
|
||||||
&mut reclaims,
|
&mut reclaims,
|
||||||
);
|
);
|
||||||
|
@ -41,7 +43,7 @@ fn bench_accounts_index(bencher: &mut Bencher) {
|
||||||
&pubkeys[pubkey],
|
&pubkeys[pubkey],
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
AccountInfo::default(),
|
AccountInfo::default(),
|
||||||
&mut reclaims,
|
&mut reclaims,
|
||||||
);
|
);
|
||||||
|
|
|
@ -2,7 +2,7 @@ use crate::{
|
||||||
accounts_db::{
|
accounts_db::{
|
||||||
AccountsDb, BankHashInfo, ErrorCounters, LoadHint, LoadedAccount, ScanStorageResult,
|
AccountsDb, BankHashInfo, ErrorCounters, LoadHint, LoadedAccount, ScanStorageResult,
|
||||||
},
|
},
|
||||||
accounts_index::{AccountIndex, Ancestors, IndexKey},
|
accounts_index::{AccountSecondaryIndexes, Ancestors, IndexKey},
|
||||||
bank::{
|
bank::{
|
||||||
NonceRollbackFull, NonceRollbackInfo, TransactionCheckResult, TransactionExecutionResult,
|
NonceRollbackFull, NonceRollbackInfo, TransactionCheckResult, TransactionExecutionResult,
|
||||||
},
|
},
|
||||||
|
@ -115,13 +115,18 @@ pub enum AccountAddressFilter {
|
||||||
|
|
||||||
impl Accounts {
|
impl Accounts {
|
||||||
pub fn new(paths: Vec<PathBuf>, cluster_type: &ClusterType) -> Self {
|
pub fn new(paths: Vec<PathBuf>, cluster_type: &ClusterType) -> Self {
|
||||||
Self::new_with_config(paths, cluster_type, HashSet::new(), false)
|
Self::new_with_config(
|
||||||
|
paths,
|
||||||
|
cluster_type,
|
||||||
|
AccountSecondaryIndexes::default(),
|
||||||
|
false,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_with_config(
|
pub fn new_with_config(
|
||||||
paths: Vec<PathBuf>,
|
paths: Vec<PathBuf>,
|
||||||
cluster_type: &ClusterType,
|
cluster_type: &ClusterType,
|
||||||
account_indexes: HashSet<AccountIndex>,
|
account_indexes: AccountSecondaryIndexes,
|
||||||
caching_enabled: bool,
|
caching_enabled: bool,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
@ -1088,8 +1093,12 @@ mod tests {
|
||||||
) -> Vec<TransactionLoadResult> {
|
) -> Vec<TransactionLoadResult> {
|
||||||
let mut hash_queue = BlockhashQueue::new(100);
|
let mut hash_queue = BlockhashQueue::new(100);
|
||||||
hash_queue.register_hash(&tx.message().recent_blockhash, &fee_calculator);
|
hash_queue.register_hash(&tx.message().recent_blockhash, &fee_calculator);
|
||||||
let accounts =
|
let accounts = Accounts::new_with_config(
|
||||||
Accounts::new_with_config(Vec::new(), &ClusterType::Development, HashSet::new(), false);
|
Vec::new(),
|
||||||
|
&ClusterType::Development,
|
||||||
|
AccountSecondaryIndexes::default(),
|
||||||
|
false,
|
||||||
|
);
|
||||||
for ka in ka.iter() {
|
for ka in ka.iter() {
|
||||||
accounts.store_slow_uncached(0, &ka.0, &ka.1);
|
accounts.store_slow_uncached(0, &ka.0, &ka.1);
|
||||||
}
|
}
|
||||||
|
@ -1621,8 +1630,12 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_load_by_program_slot() {
|
fn test_load_by_program_slot() {
|
||||||
let accounts =
|
let accounts = Accounts::new_with_config(
|
||||||
Accounts::new_with_config(Vec::new(), &ClusterType::Development, HashSet::new(), false);
|
Vec::new(),
|
||||||
|
&ClusterType::Development,
|
||||||
|
AccountSecondaryIndexes::default(),
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
|
||||||
// Load accounts owned by various programs into AccountsDb
|
// Load accounts owned by various programs into AccountsDb
|
||||||
let pubkey0 = solana_sdk::pubkey::new_rand();
|
let pubkey0 = solana_sdk::pubkey::new_rand();
|
||||||
|
@ -1645,8 +1658,12 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_accounts_account_not_found() {
|
fn test_accounts_account_not_found() {
|
||||||
let accounts =
|
let accounts = Accounts::new_with_config(
|
||||||
Accounts::new_with_config(Vec::new(), &ClusterType::Development, HashSet::new(), false);
|
Vec::new(),
|
||||||
|
&ClusterType::Development,
|
||||||
|
AccountSecondaryIndexes::default(),
|
||||||
|
false,
|
||||||
|
);
|
||||||
let mut error_counters = ErrorCounters::default();
|
let mut error_counters = ErrorCounters::default();
|
||||||
let ancestors = vec![(0, 0)].into_iter().collect();
|
let ancestors = vec![(0, 0)].into_iter().collect();
|
||||||
|
|
||||||
|
@ -1664,8 +1681,12 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic]
|
#[should_panic]
|
||||||
fn test_accounts_empty_bank_hash() {
|
fn test_accounts_empty_bank_hash() {
|
||||||
let accounts =
|
let accounts = Accounts::new_with_config(
|
||||||
Accounts::new_with_config(Vec::new(), &ClusterType::Development, HashSet::new(), false);
|
Vec::new(),
|
||||||
|
&ClusterType::Development,
|
||||||
|
AccountSecondaryIndexes::default(),
|
||||||
|
false,
|
||||||
|
);
|
||||||
accounts.bank_hash_at(1);
|
accounts.bank_hash_at(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1681,8 +1702,12 @@ mod tests {
|
||||||
let account2 = AccountSharedData::new(3, 0, &Pubkey::default());
|
let account2 = AccountSharedData::new(3, 0, &Pubkey::default());
|
||||||
let account3 = AccountSharedData::new(4, 0, &Pubkey::default());
|
let account3 = AccountSharedData::new(4, 0, &Pubkey::default());
|
||||||
|
|
||||||
let accounts =
|
let accounts = Accounts::new_with_config(
|
||||||
Accounts::new_with_config(Vec::new(), &ClusterType::Development, HashSet::new(), false);
|
Vec::new(),
|
||||||
|
&ClusterType::Development,
|
||||||
|
AccountSecondaryIndexes::default(),
|
||||||
|
false,
|
||||||
|
);
|
||||||
accounts.store_slow_uncached(0, &keypair0.pubkey(), &account0);
|
accounts.store_slow_uncached(0, &keypair0.pubkey(), &account0);
|
||||||
accounts.store_slow_uncached(0, &keypair1.pubkey(), &account1);
|
accounts.store_slow_uncached(0, &keypair1.pubkey(), &account1);
|
||||||
accounts.store_slow_uncached(0, &keypair2.pubkey(), &account2);
|
accounts.store_slow_uncached(0, &keypair2.pubkey(), &account2);
|
||||||
|
@ -1803,8 +1828,12 @@ mod tests {
|
||||||
let account1 = AccountSharedData::new(2, 0, &Pubkey::default());
|
let account1 = AccountSharedData::new(2, 0, &Pubkey::default());
|
||||||
let account2 = AccountSharedData::new(3, 0, &Pubkey::default());
|
let account2 = AccountSharedData::new(3, 0, &Pubkey::default());
|
||||||
|
|
||||||
let accounts =
|
let accounts = Accounts::new_with_config(
|
||||||
Accounts::new_with_config(Vec::new(), &ClusterType::Development, HashSet::new(), false);
|
Vec::new(),
|
||||||
|
&ClusterType::Development,
|
||||||
|
AccountSecondaryIndexes::default(),
|
||||||
|
false,
|
||||||
|
);
|
||||||
accounts.store_slow_uncached(0, &keypair0.pubkey(), &account0);
|
accounts.store_slow_uncached(0, &keypair0.pubkey(), &account0);
|
||||||
accounts.store_slow_uncached(0, &keypair1.pubkey(), &account1);
|
accounts.store_slow_uncached(0, &keypair1.pubkey(), &account1);
|
||||||
accounts.store_slow_uncached(0, &keypair2.pubkey(), &account2);
|
accounts.store_slow_uncached(0, &keypair2.pubkey(), &account2);
|
||||||
|
@ -1947,8 +1976,12 @@ mod tests {
|
||||||
|
|
||||||
let mut loaded = vec![loaded0, loaded1];
|
let mut loaded = vec![loaded0, loaded1];
|
||||||
|
|
||||||
let accounts =
|
let accounts = Accounts::new_with_config(
|
||||||
Accounts::new_with_config(Vec::new(), &ClusterType::Development, HashSet::new(), false);
|
Vec::new(),
|
||||||
|
&ClusterType::Development,
|
||||||
|
AccountSecondaryIndexes::default(),
|
||||||
|
false,
|
||||||
|
);
|
||||||
{
|
{
|
||||||
accounts
|
accounts
|
||||||
.account_locks
|
.account_locks
|
||||||
|
@ -1995,8 +2028,12 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn huge_clean() {
|
fn huge_clean() {
|
||||||
solana_logger::setup();
|
solana_logger::setup();
|
||||||
let accounts =
|
let accounts = Accounts::new_with_config(
|
||||||
Accounts::new_with_config(Vec::new(), &ClusterType::Development, HashSet::new(), false);
|
Vec::new(),
|
||||||
|
&ClusterType::Development,
|
||||||
|
AccountSecondaryIndexes::default(),
|
||||||
|
false,
|
||||||
|
);
|
||||||
let mut old_pubkey = Pubkey::default();
|
let mut old_pubkey = Pubkey::default();
|
||||||
let zero_account = AccountSharedData::new(0, 0, AccountSharedData::default().owner());
|
let zero_account = AccountSharedData::new(0, 0, AccountSharedData::default().owner());
|
||||||
info!("storing..");
|
info!("storing..");
|
||||||
|
@ -2038,8 +2075,12 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_instructions() {
|
fn test_instructions() {
|
||||||
solana_logger::setup();
|
solana_logger::setup();
|
||||||
let accounts =
|
let accounts = Accounts::new_with_config(
|
||||||
Accounts::new_with_config(Vec::new(), &ClusterType::Development, HashSet::new(), false);
|
Vec::new(),
|
||||||
|
&ClusterType::Development,
|
||||||
|
AccountSecondaryIndexes::default(),
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
|
||||||
let instructions_key = solana_sdk::sysvar::instructions::id();
|
let instructions_key = solana_sdk::sysvar::instructions::id();
|
||||||
let keypair = Keypair::new();
|
let keypair = Keypair::new();
|
||||||
|
@ -2318,8 +2359,12 @@ mod tests {
|
||||||
let mut loaded = vec![loaded];
|
let mut loaded = vec![loaded];
|
||||||
|
|
||||||
let next_blockhash = Hash::new_unique();
|
let next_blockhash = Hash::new_unique();
|
||||||
let accounts =
|
let accounts = Accounts::new_with_config(
|
||||||
Accounts::new_with_config(Vec::new(), &ClusterType::Development, HashSet::new(), false);
|
Vec::new(),
|
||||||
|
&ClusterType::Development,
|
||||||
|
AccountSecondaryIndexes::default(),
|
||||||
|
false,
|
||||||
|
);
|
||||||
let collected_accounts = accounts.collect_accounts_to_store(
|
let collected_accounts = accounts.collect_accounts_to_store(
|
||||||
txs.iter(),
|
txs.iter(),
|
||||||
&loaders,
|
&loaders,
|
||||||
|
@ -2432,8 +2477,12 @@ mod tests {
|
||||||
let mut loaded = vec![loaded];
|
let mut loaded = vec![loaded];
|
||||||
|
|
||||||
let next_blockhash = Hash::new_unique();
|
let next_blockhash = Hash::new_unique();
|
||||||
let accounts =
|
let accounts = Accounts::new_with_config(
|
||||||
Accounts::new_with_config(Vec::new(), &ClusterType::Development, HashSet::new(), false);
|
Vec::new(),
|
||||||
|
&ClusterType::Development,
|
||||||
|
AccountSecondaryIndexes::default(),
|
||||||
|
false,
|
||||||
|
);
|
||||||
let collected_accounts = accounts.collect_accounts_to_store(
|
let collected_accounts = accounts.collect_accounts_to_store(
|
||||||
txs.iter(),
|
txs.iter(),
|
||||||
&loaders,
|
&loaders,
|
||||||
|
@ -2462,8 +2511,12 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_load_largest_accounts() {
|
fn test_load_largest_accounts() {
|
||||||
let accounts =
|
let accounts = Accounts::new_with_config(
|
||||||
Accounts::new_with_config(Vec::new(), &ClusterType::Development, HashSet::new(), false);
|
Vec::new(),
|
||||||
|
&ClusterType::Development,
|
||||||
|
AccountSecondaryIndexes::default(),
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
|
||||||
let pubkey0 = Pubkey::new_unique();
|
let pubkey0 = Pubkey::new_unique();
|
||||||
let account0 = AccountSharedData::new(42, 0, &Pubkey::default());
|
let account0 = AccountSharedData::new(42, 0, &Pubkey::default());
|
||||||
|
|
|
@ -22,8 +22,8 @@ use crate::{
|
||||||
accounts_cache::{AccountsCache, CachedAccount, SlotCache},
|
accounts_cache::{AccountsCache, CachedAccount, SlotCache},
|
||||||
accounts_hash::{AccountsHash, CalculateHashIntermediate, HashStats, PreviousPass},
|
accounts_hash::{AccountsHash, CalculateHashIntermediate, HashStats, PreviousPass},
|
||||||
accounts_index::{
|
accounts_index::{
|
||||||
AccountIndex, AccountIndexGetResult, AccountsIndex, AccountsIndexRootsStats, Ancestors,
|
AccountIndexGetResult, AccountSecondaryIndexes, AccountsIndex, AccountsIndexRootsStats,
|
||||||
IndexKey, IsCached, SlotList, SlotSlice, ZeroLamport,
|
Ancestors, IndexKey, IsCached, SlotList, SlotSlice, ZeroLamport,
|
||||||
},
|
},
|
||||||
append_vec::{AppendVec, StoredAccountMeta, StoredMeta},
|
append_vec::{AppendVec, StoredAccountMeta, StoredMeta},
|
||||||
contains::Contains,
|
contains::Contains,
|
||||||
|
@ -813,7 +813,7 @@ pub struct AccountsDb {
|
||||||
|
|
||||||
pub cluster_type: Option<ClusterType>,
|
pub cluster_type: Option<ClusterType>,
|
||||||
|
|
||||||
pub account_indexes: HashSet<AccountIndex>,
|
pub account_indexes: AccountSecondaryIndexes,
|
||||||
|
|
||||||
pub caching_enabled: bool,
|
pub caching_enabled: bool,
|
||||||
|
|
||||||
|
@ -1220,7 +1220,7 @@ impl Default for AccountsDb {
|
||||||
shrink_stats: ShrinkStats::default(),
|
shrink_stats: ShrinkStats::default(),
|
||||||
stats: AccountsStats::default(),
|
stats: AccountsStats::default(),
|
||||||
cluster_type: None,
|
cluster_type: None,
|
||||||
account_indexes: HashSet::new(),
|
account_indexes: AccountSecondaryIndexes::default(),
|
||||||
caching_enabled: false,
|
caching_enabled: false,
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
load_delay: u64::default(),
|
load_delay: u64::default(),
|
||||||
|
@ -1232,13 +1232,18 @@ impl Default for AccountsDb {
|
||||||
|
|
||||||
impl AccountsDb {
|
impl AccountsDb {
|
||||||
pub fn new(paths: Vec<PathBuf>, cluster_type: &ClusterType) -> Self {
|
pub fn new(paths: Vec<PathBuf>, cluster_type: &ClusterType) -> Self {
|
||||||
AccountsDb::new_with_config(paths, cluster_type, HashSet::new(), false)
|
AccountsDb::new_with_config(
|
||||||
|
paths,
|
||||||
|
cluster_type,
|
||||||
|
AccountSecondaryIndexes::default(),
|
||||||
|
false,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_with_config(
|
pub fn new_with_config(
|
||||||
paths: Vec<PathBuf>,
|
paths: Vec<PathBuf>,
|
||||||
cluster_type: &ClusterType,
|
cluster_type: &ClusterType,
|
||||||
account_indexes: HashSet<AccountIndex>,
|
account_indexes: AccountSecondaryIndexes,
|
||||||
caching_enabled: bool,
|
caching_enabled: bool,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let mut new = if !paths.is_empty() {
|
let mut new = if !paths.is_empty() {
|
||||||
|
@ -8664,7 +8669,7 @@ pub mod tests {
|
||||||
&key0,
|
&key0,
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
info0,
|
info0,
|
||||||
&mut reclaims,
|
&mut reclaims,
|
||||||
);
|
);
|
||||||
|
@ -8673,7 +8678,7 @@ pub mod tests {
|
||||||
&key0,
|
&key0,
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
info1.clone(),
|
info1.clone(),
|
||||||
&mut reclaims,
|
&mut reclaims,
|
||||||
);
|
);
|
||||||
|
@ -8682,7 +8687,7 @@ pub mod tests {
|
||||||
&key1,
|
&key1,
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
info1,
|
info1,
|
||||||
&mut reclaims,
|
&mut reclaims,
|
||||||
);
|
);
|
||||||
|
@ -8691,7 +8696,7 @@ pub mod tests {
|
||||||
&key1,
|
&key1,
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
info2.clone(),
|
info2.clone(),
|
||||||
&mut reclaims,
|
&mut reclaims,
|
||||||
);
|
);
|
||||||
|
@ -8700,7 +8705,7 @@ pub mod tests {
|
||||||
&key2,
|
&key2,
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
info2,
|
info2,
|
||||||
&mut reclaims,
|
&mut reclaims,
|
||||||
);
|
);
|
||||||
|
@ -8709,7 +8714,7 @@ pub mod tests {
|
||||||
&key2,
|
&key2,
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
info3,
|
info3,
|
||||||
&mut reclaims,
|
&mut reclaims,
|
||||||
);
|
);
|
||||||
|
@ -9063,7 +9068,7 @@ pub mod tests {
|
||||||
let db = Arc::new(AccountsDb::new_with_config(
|
let db = Arc::new(AccountsDb::new_with_config(
|
||||||
Vec::new(),
|
Vec::new(),
|
||||||
&ClusterType::Development,
|
&ClusterType::Development,
|
||||||
HashSet::new(),
|
AccountSecondaryIndexes::default(),
|
||||||
caching_enabled,
|
caching_enabled,
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -9110,7 +9115,7 @@ pub mod tests {
|
||||||
let db = Arc::new(AccountsDb::new_with_config(
|
let db = Arc::new(AccountsDb::new_with_config(
|
||||||
Vec::new(),
|
Vec::new(),
|
||||||
&ClusterType::Development,
|
&ClusterType::Development,
|
||||||
HashSet::new(),
|
AccountSecondaryIndexes::default(),
|
||||||
caching_enabled,
|
caching_enabled,
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -9158,7 +9163,7 @@ pub mod tests {
|
||||||
let db = Arc::new(AccountsDb::new_with_config(
|
let db = Arc::new(AccountsDb::new_with_config(
|
||||||
Vec::new(),
|
Vec::new(),
|
||||||
&ClusterType::Development,
|
&ClusterType::Development,
|
||||||
HashSet::new(),
|
AccountSecondaryIndexes::default(),
|
||||||
caching_enabled,
|
caching_enabled,
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -9289,7 +9294,7 @@ pub mod tests {
|
||||||
let db = Arc::new(AccountsDb::new_with_config(
|
let db = Arc::new(AccountsDb::new_with_config(
|
||||||
Vec::new(),
|
Vec::new(),
|
||||||
&ClusterType::Development,
|
&ClusterType::Development,
|
||||||
HashSet::new(),
|
AccountSecondaryIndexes::default(),
|
||||||
caching_enabled,
|
caching_enabled,
|
||||||
));
|
));
|
||||||
let account_key = Pubkey::new_unique();
|
let account_key = Pubkey::new_unique();
|
||||||
|
@ -9393,7 +9398,7 @@ pub mod tests {
|
||||||
let accounts_db = AccountsDb::new_with_config(
|
let accounts_db = AccountsDb::new_with_config(
|
||||||
Vec::new(),
|
Vec::new(),
|
||||||
&ClusterType::Development,
|
&ClusterType::Development,
|
||||||
HashSet::new(),
|
AccountSecondaryIndexes::default(),
|
||||||
caching_enabled,
|
caching_enabled,
|
||||||
);
|
);
|
||||||
let slot: Slot = 0;
|
let slot: Slot = 0;
|
||||||
|
@ -9447,7 +9452,7 @@ pub mod tests {
|
||||||
let accounts_db = Arc::new(AccountsDb::new_with_config(
|
let accounts_db = Arc::new(AccountsDb::new_with_config(
|
||||||
Vec::new(),
|
Vec::new(),
|
||||||
&ClusterType::Development,
|
&ClusterType::Development,
|
||||||
HashSet::new(),
|
AccountSecondaryIndexes::default(),
|
||||||
caching_enabled,
|
caching_enabled,
|
||||||
));
|
));
|
||||||
let slots: Vec<_> = (0..num_slots as Slot).into_iter().collect();
|
let slots: Vec<_> = (0..num_slots as Slot).into_iter().collect();
|
||||||
|
@ -9845,7 +9850,7 @@ pub mod tests {
|
||||||
let db = AccountsDb::new_with_config(
|
let db = AccountsDb::new_with_config(
|
||||||
Vec::new(),
|
Vec::new(),
|
||||||
&ClusterType::Development,
|
&ClusterType::Development,
|
||||||
HashSet::default(),
|
AccountSecondaryIndexes::default(),
|
||||||
caching_enabled,
|
caching_enabled,
|
||||||
);
|
);
|
||||||
let account_key1 = Pubkey::new_unique();
|
let account_key1 = Pubkey::new_unique();
|
||||||
|
@ -10107,7 +10112,7 @@ pub mod tests {
|
||||||
let mut db = AccountsDb::new_with_config(
|
let mut db = AccountsDb::new_with_config(
|
||||||
Vec::new(),
|
Vec::new(),
|
||||||
&ClusterType::Development,
|
&ClusterType::Development,
|
||||||
HashSet::new(),
|
AccountSecondaryIndexes::default(),
|
||||||
caching_enabled,
|
caching_enabled,
|
||||||
);
|
);
|
||||||
db.load_delay = RACY_SLEEP_MS;
|
db.load_delay = RACY_SLEEP_MS;
|
||||||
|
@ -10178,7 +10183,7 @@ pub mod tests {
|
||||||
let mut db = AccountsDb::new_with_config(
|
let mut db = AccountsDb::new_with_config(
|
||||||
Vec::new(),
|
Vec::new(),
|
||||||
&ClusterType::Development,
|
&ClusterType::Development,
|
||||||
HashSet::new(),
|
AccountSecondaryIndexes::default(),
|
||||||
caching_enabled,
|
caching_enabled,
|
||||||
);
|
);
|
||||||
db.load_delay = RACY_SLEEP_MS;
|
db.load_delay = RACY_SLEEP_MS;
|
||||||
|
@ -10252,7 +10257,7 @@ pub mod tests {
|
||||||
let mut db = AccountsDb::new_with_config(
|
let mut db = AccountsDb::new_with_config(
|
||||||
Vec::new(),
|
Vec::new(),
|
||||||
&ClusterType::Development,
|
&ClusterType::Development,
|
||||||
HashSet::new(),
|
AccountSecondaryIndexes::default(),
|
||||||
caching_enabled,
|
caching_enabled,
|
||||||
);
|
);
|
||||||
db.load_delay = RACY_SLEEP_MS;
|
db.load_delay = RACY_SLEEP_MS;
|
||||||
|
|
|
@ -74,6 +74,8 @@ pub enum AccountIndex {
|
||||||
SplTokenOwner,
|
SplTokenOwner,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub type AccountSecondaryIndexes = HashSet<AccountIndex>;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct AccountMapEntryInner<T> {
|
pub struct AccountMapEntryInner<T> {
|
||||||
ref_count: AtomicU64,
|
ref_count: AtomicU64,
|
||||||
|
@ -819,7 +821,11 @@ impl<T: 'static + Clone + IsCached + ZeroLamport> AccountsIndex<T> {
|
||||||
(w_account_entry.unwrap(), is_newly_inserted)
|
(w_account_entry.unwrap(), is_newly_inserted)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn handle_dead_keys(&self, dead_keys: &[&Pubkey], account_indexes: &HashSet<AccountIndex>) {
|
pub fn handle_dead_keys(
|
||||||
|
&self,
|
||||||
|
dead_keys: &[&Pubkey],
|
||||||
|
account_indexes: &AccountSecondaryIndexes,
|
||||||
|
) {
|
||||||
if !dead_keys.is_empty() {
|
if !dead_keys.is_empty() {
|
||||||
for key in dead_keys.iter() {
|
for key in dead_keys.iter() {
|
||||||
let mut w_index = self.account_maps.write().unwrap();
|
let mut w_index = self.account_maps.write().unwrap();
|
||||||
|
@ -923,7 +929,7 @@ impl<T: 'static + Clone + IsCached + ZeroLamport> AccountsIndex<T> {
|
||||||
pubkey: &Pubkey,
|
pubkey: &Pubkey,
|
||||||
slots_to_purge: &'a C,
|
slots_to_purge: &'a C,
|
||||||
reclaims: &mut SlotList<T>,
|
reclaims: &mut SlotList<T>,
|
||||||
account_indexes: &HashSet<AccountIndex>,
|
account_indexes: &AccountSecondaryIndexes,
|
||||||
) -> bool
|
) -> bool
|
||||||
where
|
where
|
||||||
C: Contains<'a, Slot>,
|
C: Contains<'a, Slot>,
|
||||||
|
@ -1051,7 +1057,7 @@ impl<T: 'static + Clone + IsCached + ZeroLamport> AccountsIndex<T> {
|
||||||
slot: Slot,
|
slot: Slot,
|
||||||
account_owner: &Pubkey,
|
account_owner: &Pubkey,
|
||||||
account_data: &[u8],
|
account_data: &[u8],
|
||||||
account_indexes: &HashSet<AccountIndex>,
|
account_indexes: &AccountSecondaryIndexes,
|
||||||
) {
|
) {
|
||||||
if account_indexes.is_empty() {
|
if account_indexes.is_empty() {
|
||||||
return;
|
return;
|
||||||
|
@ -1103,7 +1109,7 @@ impl<T: 'static + Clone + IsCached + ZeroLamport> AccountsIndex<T> {
|
||||||
pubkey: &Pubkey,
|
pubkey: &Pubkey,
|
||||||
account_owner: &Pubkey,
|
account_owner: &Pubkey,
|
||||||
account_data: &[u8],
|
account_data: &[u8],
|
||||||
account_indexes: &HashSet<AccountIndex>,
|
account_indexes: &AccountSecondaryIndexes,
|
||||||
account_info: T,
|
account_info: T,
|
||||||
reclaims: &mut SlotList<T>,
|
reclaims: &mut SlotList<T>,
|
||||||
) {
|
) {
|
||||||
|
@ -1126,7 +1132,7 @@ impl<T: 'static + Clone + IsCached + ZeroLamport> AccountsIndex<T> {
|
||||||
pubkey: &Pubkey,
|
pubkey: &Pubkey,
|
||||||
account_owner: &Pubkey,
|
account_owner: &Pubkey,
|
||||||
account_data: &[u8],
|
account_data: &[u8],
|
||||||
account_indexes: &HashSet<AccountIndex>,
|
account_indexes: &AccountSecondaryIndexes,
|
||||||
account_info: T,
|
account_info: T,
|
||||||
reclaims: &mut SlotList<T>,
|
reclaims: &mut SlotList<T>,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
|
@ -1180,7 +1186,7 @@ impl<T: 'static + Clone + IsCached + ZeroLamport> AccountsIndex<T> {
|
||||||
&'a self,
|
&'a self,
|
||||||
inner_key: &Pubkey,
|
inner_key: &Pubkey,
|
||||||
slots_to_remove: Option<&'a C>,
|
slots_to_remove: Option<&'a C>,
|
||||||
account_indexes: &HashSet<AccountIndex>,
|
account_indexes: &AccountSecondaryIndexes,
|
||||||
) where
|
) where
|
||||||
C: Contains<'a, Slot>,
|
C: Contains<'a, Slot>,
|
||||||
{
|
{
|
||||||
|
@ -1206,7 +1212,7 @@ impl<T: 'static + Clone + IsCached + ZeroLamport> AccountsIndex<T> {
|
||||||
slot_list: &mut SlotList<T>,
|
slot_list: &mut SlotList<T>,
|
||||||
reclaims: &mut SlotList<T>,
|
reclaims: &mut SlotList<T>,
|
||||||
max_clean_root: Option<Slot>,
|
max_clean_root: Option<Slot>,
|
||||||
account_indexes: &HashSet<AccountIndex>,
|
account_indexes: &AccountSecondaryIndexes,
|
||||||
) {
|
) {
|
||||||
let roots_tracker = &self.roots_tracker.read().unwrap();
|
let roots_tracker = &self.roots_tracker.read().unwrap();
|
||||||
let newest_root_in_slot_list =
|
let newest_root_in_slot_list =
|
||||||
|
@ -1233,7 +1239,7 @@ impl<T: 'static + Clone + IsCached + ZeroLamport> AccountsIndex<T> {
|
||||||
pubkey: &Pubkey,
|
pubkey: &Pubkey,
|
||||||
reclaims: &mut SlotList<T>,
|
reclaims: &mut SlotList<T>,
|
||||||
max_clean_root: Option<Slot>,
|
max_clean_root: Option<Slot>,
|
||||||
account_indexes: &HashSet<AccountIndex>,
|
account_indexes: &AccountSecondaryIndexes,
|
||||||
) {
|
) {
|
||||||
let mut is_slot_list_empty = false;
|
let mut is_slot_list_empty = false;
|
||||||
if let Some(mut locked_entry) = self.get_account_write_entry(pubkey) {
|
if let Some(mut locked_entry) = self.get_account_write_entry(pubkey) {
|
||||||
|
@ -1438,13 +1444,13 @@ pub mod tests {
|
||||||
DashMap(&'a SecondaryIndex<DashMapSecondaryIndexEntry>),
|
DashMap(&'a SecondaryIndex<DashMapSecondaryIndexEntry>),
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn spl_token_mint_index_enabled() -> HashSet<AccountIndex> {
|
pub fn spl_token_mint_index_enabled() -> AccountSecondaryIndexes {
|
||||||
let mut account_indexes = HashSet::new();
|
let mut account_indexes = HashSet::new();
|
||||||
account_indexes.insert(AccountIndex::SplTokenMint);
|
account_indexes.insert(AccountIndex::SplTokenMint);
|
||||||
account_indexes
|
account_indexes
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn spl_token_owner_index_enabled() -> HashSet<AccountIndex> {
|
pub fn spl_token_owner_index_enabled() -> AccountSecondaryIndexes {
|
||||||
let mut account_indexes = HashSet::new();
|
let mut account_indexes = HashSet::new();
|
||||||
account_indexes.insert(AccountIndex::SplTokenOwner);
|
account_indexes.insert(AccountIndex::SplTokenOwner);
|
||||||
account_indexes
|
account_indexes
|
||||||
|
@ -1476,7 +1482,7 @@ pub mod tests {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_dashmap_secondary_index_state() -> (usize, usize, HashSet<AccountIndex>) {
|
fn create_dashmap_secondary_index_state() -> (usize, usize, AccountSecondaryIndexes) {
|
||||||
{
|
{
|
||||||
// Check that we're actually testing the correct variant
|
// Check that we're actually testing the correct variant
|
||||||
let index = AccountsIndex::<bool>::default();
|
let index = AccountsIndex::<bool>::default();
|
||||||
|
@ -1486,7 +1492,7 @@ pub mod tests {
|
||||||
(0, PUBKEY_BYTES, spl_token_mint_index_enabled())
|
(0, PUBKEY_BYTES, spl_token_mint_index_enabled())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_rwlock_secondary_index_state() -> (usize, usize, HashSet<AccountIndex>) {
|
fn create_rwlock_secondary_index_state() -> (usize, usize, AccountSecondaryIndexes) {
|
||||||
{
|
{
|
||||||
// Check that we're actually testing the correct variant
|
// Check that we're actually testing the correct variant
|
||||||
let index = AccountsIndex::<bool>::default();
|
let index = AccountsIndex::<bool>::default();
|
||||||
|
@ -2074,7 +2080,7 @@ pub mod tests {
|
||||||
&key.pubkey(),
|
&key.pubkey(),
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
true,
|
true,
|
||||||
&mut gc,
|
&mut gc,
|
||||||
);
|
);
|
||||||
|
@ -2099,7 +2105,7 @@ pub mod tests {
|
||||||
&key.pubkey(),
|
&key.pubkey(),
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
true,
|
true,
|
||||||
&mut gc,
|
&mut gc,
|
||||||
);
|
);
|
||||||
|
@ -2123,7 +2129,7 @@ pub mod tests {
|
||||||
&key.pubkey(),
|
&key.pubkey(),
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
true,
|
true,
|
||||||
&mut gc,
|
&mut gc,
|
||||||
);
|
);
|
||||||
|
@ -2156,7 +2162,7 @@ pub mod tests {
|
||||||
&new_pubkey,
|
&new_pubkey,
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
true,
|
true,
|
||||||
&mut vec![],
|
&mut vec![],
|
||||||
);
|
);
|
||||||
|
@ -2172,7 +2178,7 @@ pub mod tests {
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
true,
|
true,
|
||||||
&mut vec![],
|
&mut vec![],
|
||||||
);
|
);
|
||||||
|
@ -2303,7 +2309,7 @@ pub mod tests {
|
||||||
&solana_sdk::pubkey::new_rand(),
|
&solana_sdk::pubkey::new_rand(),
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
true,
|
true,
|
||||||
&mut gc,
|
&mut gc,
|
||||||
);
|
);
|
||||||
|
@ -2328,7 +2334,7 @@ pub mod tests {
|
||||||
&key.pubkey(),
|
&key.pubkey(),
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
true,
|
true,
|
||||||
&mut gc,
|
&mut gc,
|
||||||
);
|
);
|
||||||
|
@ -2442,7 +2448,7 @@ pub mod tests {
|
||||||
&key.pubkey(),
|
&key.pubkey(),
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
true,
|
true,
|
||||||
&mut gc,
|
&mut gc,
|
||||||
);
|
);
|
||||||
|
@ -2457,7 +2463,7 @@ pub mod tests {
|
||||||
&key.pubkey(),
|
&key.pubkey(),
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
false,
|
false,
|
||||||
&mut gc,
|
&mut gc,
|
||||||
);
|
);
|
||||||
|
@ -2478,7 +2484,7 @@ pub mod tests {
|
||||||
&key.pubkey(),
|
&key.pubkey(),
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
true,
|
true,
|
||||||
&mut gc,
|
&mut gc,
|
||||||
);
|
);
|
||||||
|
@ -2488,7 +2494,7 @@ pub mod tests {
|
||||||
&key.pubkey(),
|
&key.pubkey(),
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
false,
|
false,
|
||||||
&mut gc,
|
&mut gc,
|
||||||
);
|
);
|
||||||
|
@ -2510,7 +2516,7 @@ pub mod tests {
|
||||||
&key.pubkey(),
|
&key.pubkey(),
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
true,
|
true,
|
||||||
&mut gc,
|
&mut gc,
|
||||||
);
|
);
|
||||||
|
@ -2520,7 +2526,7 @@ pub mod tests {
|
||||||
&key.pubkey(),
|
&key.pubkey(),
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
false,
|
false,
|
||||||
&mut gc,
|
&mut gc,
|
||||||
);
|
);
|
||||||
|
@ -2529,7 +2535,7 @@ pub mod tests {
|
||||||
&key.pubkey(),
|
&key.pubkey(),
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
true,
|
true,
|
||||||
&mut gc,
|
&mut gc,
|
||||||
);
|
);
|
||||||
|
@ -2538,7 +2544,7 @@ pub mod tests {
|
||||||
&key.pubkey(),
|
&key.pubkey(),
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
true,
|
true,
|
||||||
&mut gc,
|
&mut gc,
|
||||||
);
|
);
|
||||||
|
@ -2550,7 +2556,7 @@ pub mod tests {
|
||||||
&key.pubkey(),
|
&key.pubkey(),
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
true,
|
true,
|
||||||
&mut gc,
|
&mut gc,
|
||||||
);
|
);
|
||||||
|
@ -2584,7 +2590,7 @@ pub mod tests {
|
||||||
&key.pubkey(),
|
&key.pubkey(),
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
12,
|
12,
|
||||||
&mut gc
|
&mut gc
|
||||||
));
|
));
|
||||||
|
@ -2594,7 +2600,7 @@ pub mod tests {
|
||||||
&key.pubkey(),
|
&key.pubkey(),
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
10,
|
10,
|
||||||
&mut gc
|
&mut gc
|
||||||
));
|
));
|
||||||
|
@ -2611,7 +2617,7 @@ pub mod tests {
|
||||||
&key.pubkey(),
|
&key.pubkey(),
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
9,
|
9,
|
||||||
&mut gc
|
&mut gc
|
||||||
));
|
));
|
||||||
|
@ -2667,7 +2673,7 @@ pub mod tests {
|
||||||
secondary_index: &SecondaryIndex<SecondaryIndexEntryType>,
|
secondary_index: &SecondaryIndex<SecondaryIndexEntryType>,
|
||||||
key_start: usize,
|
key_start: usize,
|
||||||
key_end: usize,
|
key_end: usize,
|
||||||
account_index: &HashSet<AccountIndex>,
|
account_index: &AccountSecondaryIndexes,
|
||||||
) {
|
) {
|
||||||
// No roots, should be no reclaims
|
// No roots, should be no reclaims
|
||||||
let slots = vec![1, 2, 5, 9];
|
let slots = vec![1, 2, 5, 9];
|
||||||
|
@ -2756,7 +2762,7 @@ pub mod tests {
|
||||||
&mut slot_list,
|
&mut slot_list,
|
||||||
&mut reclaims,
|
&mut reclaims,
|
||||||
None,
|
None,
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
);
|
);
|
||||||
assert!(reclaims.is_empty());
|
assert!(reclaims.is_empty());
|
||||||
assert_eq!(slot_list, vec![(1, true), (2, true), (5, true), (9, true)]);
|
assert_eq!(slot_list, vec![(1, true), (2, true), (5, true), (9, true)]);
|
||||||
|
@ -2772,7 +2778,7 @@ pub mod tests {
|
||||||
&mut slot_list,
|
&mut slot_list,
|
||||||
&mut reclaims,
|
&mut reclaims,
|
||||||
None,
|
None,
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
);
|
);
|
||||||
assert_eq!(reclaims, vec![(1, true), (2, true)]);
|
assert_eq!(reclaims, vec![(1, true), (2, true)]);
|
||||||
assert_eq!(slot_list, vec![(5, true), (9, true)]);
|
assert_eq!(slot_list, vec![(5, true), (9, true)]);
|
||||||
|
@ -2786,7 +2792,7 @@ pub mod tests {
|
||||||
&mut slot_list,
|
&mut slot_list,
|
||||||
&mut reclaims,
|
&mut reclaims,
|
||||||
None,
|
None,
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
);
|
);
|
||||||
assert_eq!(reclaims, vec![(1, true), (2, true)]);
|
assert_eq!(reclaims, vec![(1, true), (2, true)]);
|
||||||
assert_eq!(slot_list, vec![(5, true), (9, true)]);
|
assert_eq!(slot_list, vec![(5, true), (9, true)]);
|
||||||
|
@ -2800,7 +2806,7 @@ pub mod tests {
|
||||||
&mut slot_list,
|
&mut slot_list,
|
||||||
&mut reclaims,
|
&mut reclaims,
|
||||||
Some(6),
|
Some(6),
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
);
|
);
|
||||||
assert_eq!(reclaims, vec![(1, true), (2, true)]);
|
assert_eq!(reclaims, vec![(1, true), (2, true)]);
|
||||||
assert_eq!(slot_list, vec![(5, true), (9, true)]);
|
assert_eq!(slot_list, vec![(5, true), (9, true)]);
|
||||||
|
@ -2813,7 +2819,7 @@ pub mod tests {
|
||||||
&mut slot_list,
|
&mut slot_list,
|
||||||
&mut reclaims,
|
&mut reclaims,
|
||||||
Some(5),
|
Some(5),
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
);
|
);
|
||||||
assert_eq!(reclaims, vec![(1, true), (2, true)]);
|
assert_eq!(reclaims, vec![(1, true), (2, true)]);
|
||||||
assert_eq!(slot_list, vec![(5, true), (9, true)]);
|
assert_eq!(slot_list, vec![(5, true), (9, true)]);
|
||||||
|
@ -2827,7 +2833,7 @@ pub mod tests {
|
||||||
&mut slot_list,
|
&mut slot_list,
|
||||||
&mut reclaims,
|
&mut reclaims,
|
||||||
Some(2),
|
Some(2),
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
);
|
);
|
||||||
assert!(reclaims.is_empty());
|
assert!(reclaims.is_empty());
|
||||||
assert_eq!(slot_list, vec![(1, true), (2, true), (5, true), (9, true)]);
|
assert_eq!(slot_list, vec![(1, true), (2, true), (5, true), (9, true)]);
|
||||||
|
@ -2841,7 +2847,7 @@ pub mod tests {
|
||||||
&mut slot_list,
|
&mut slot_list,
|
||||||
&mut reclaims,
|
&mut reclaims,
|
||||||
Some(1),
|
Some(1),
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
);
|
);
|
||||||
assert!(reclaims.is_empty());
|
assert!(reclaims.is_empty());
|
||||||
assert_eq!(slot_list, vec![(1, true), (2, true), (5, true), (9, true)]);
|
assert_eq!(slot_list, vec![(1, true), (2, true), (5, true), (9, true)]);
|
||||||
|
@ -2855,7 +2861,7 @@ pub mod tests {
|
||||||
&mut slot_list,
|
&mut slot_list,
|
||||||
&mut reclaims,
|
&mut reclaims,
|
||||||
Some(7),
|
Some(7),
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
);
|
);
|
||||||
assert_eq!(reclaims, vec![(1, true), (2, true)]);
|
assert_eq!(reclaims, vec![(1, true), (2, true)]);
|
||||||
assert_eq!(slot_list, vec![(5, true), (9, true)]);
|
assert_eq!(slot_list, vec![(5, true), (9, true)]);
|
||||||
|
@ -2894,7 +2900,7 @@ pub mod tests {
|
||||||
secondary_index: &SecondaryIndex<SecondaryIndexEntryType>,
|
secondary_index: &SecondaryIndex<SecondaryIndexEntryType>,
|
||||||
key_start: usize,
|
key_start: usize,
|
||||||
key_end: usize,
|
key_end: usize,
|
||||||
account_index: &HashSet<AccountIndex>,
|
account_index: &AccountSecondaryIndexes,
|
||||||
) {
|
) {
|
||||||
let account_key = Pubkey::new_unique();
|
let account_key = Pubkey::new_unique();
|
||||||
let index_key = Pubkey::new_unique();
|
let index_key = Pubkey::new_unique();
|
||||||
|
@ -2988,7 +2994,7 @@ pub mod tests {
|
||||||
secondary_index: &SecondaryIndex<SecondaryIndexEntryType>,
|
secondary_index: &SecondaryIndex<SecondaryIndexEntryType>,
|
||||||
index_key_start: usize,
|
index_key_start: usize,
|
||||||
index_key_end: usize,
|
index_key_end: usize,
|
||||||
account_index: &HashSet<AccountIndex>,
|
account_index: &AccountSecondaryIndexes,
|
||||||
) {
|
) {
|
||||||
let account_key = Pubkey::new_unique();
|
let account_key = Pubkey::new_unique();
|
||||||
let secondary_key1 = Pubkey::new_unique();
|
let secondary_key1 = Pubkey::new_unique();
|
||||||
|
|
|
@ -39,7 +39,7 @@ use crate::{
|
||||||
TransactionLoadResult, TransactionLoaders,
|
TransactionLoadResult, TransactionLoaders,
|
||||||
},
|
},
|
||||||
accounts_db::{ErrorCounters, SnapshotStorages},
|
accounts_db::{ErrorCounters, SnapshotStorages},
|
||||||
accounts_index::{AccountIndex, Ancestors, IndexKey},
|
accounts_index::{AccountSecondaryIndexes, Ancestors, IndexKey},
|
||||||
blockhash_queue::BlockhashQueue,
|
blockhash_queue::BlockhashQueue,
|
||||||
builtins::{self, ActivationType},
|
builtins::{self, ActivationType},
|
||||||
epoch_stakes::{EpochStakes, NodeVoteAccounts},
|
epoch_stakes::{EpochStakes, NodeVoteAccounts},
|
||||||
|
@ -932,7 +932,7 @@ impl Bank {
|
||||||
&[],
|
&[],
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
HashSet::new(),
|
AccountSecondaryIndexes::default(),
|
||||||
false,
|
false,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -944,7 +944,7 @@ impl Bank {
|
||||||
&[],
|
&[],
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
HashSet::new(),
|
AccountSecondaryIndexes::default(),
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -955,7 +955,7 @@ impl Bank {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub(crate) fn new_with_config(
|
pub(crate) fn new_with_config(
|
||||||
genesis_config: &GenesisConfig,
|
genesis_config: &GenesisConfig,
|
||||||
account_indexes: HashSet<AccountIndex>,
|
account_indexes: AccountSecondaryIndexes,
|
||||||
accounts_db_caching_enabled: bool,
|
accounts_db_caching_enabled: bool,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self::new_with_paths(
|
Self::new_with_paths(
|
||||||
|
@ -975,7 +975,7 @@ impl Bank {
|
||||||
frozen_account_pubkeys: &[Pubkey],
|
frozen_account_pubkeys: &[Pubkey],
|
||||||
debug_keys: Option<Arc<HashSet<Pubkey>>>,
|
debug_keys: Option<Arc<HashSet<Pubkey>>>,
|
||||||
additional_builtins: Option<&Builtins>,
|
additional_builtins: Option<&Builtins>,
|
||||||
account_indexes: HashSet<AccountIndex>,
|
account_indexes: AccountSecondaryIndexes,
|
||||||
accounts_db_caching_enabled: bool,
|
accounts_db_caching_enabled: bool,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let mut bank = Self::default();
|
let mut bank = Self::default();
|
||||||
|
@ -5157,7 +5157,9 @@ pub(crate) mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::{
|
use crate::{
|
||||||
accounts_db::SHRINK_RATIO,
|
accounts_db::SHRINK_RATIO,
|
||||||
accounts_index::{AccountMap, Ancestors, ITER_BATCH_SIZE},
|
accounts_index::{
|
||||||
|
AccountIndex, AccountMap, AccountSecondaryIndexes, Ancestors, ITER_BATCH_SIZE,
|
||||||
|
},
|
||||||
genesis_utils::{
|
genesis_utils::{
|
||||||
activate_all_features, bootstrap_validator_stake_lamports,
|
activate_all_features, bootstrap_validator_stake_lamports,
|
||||||
create_genesis_config_with_leader, create_genesis_config_with_vote_accounts,
|
create_genesis_config_with_leader, create_genesis_config_with_vote_accounts,
|
||||||
|
@ -9043,7 +9045,7 @@ pub(crate) mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_get_filtered_indexed_accounts() {
|
fn test_get_filtered_indexed_accounts() {
|
||||||
let (genesis_config, _mint_keypair) = create_genesis_config(500);
|
let (genesis_config, _mint_keypair) = create_genesis_config(500);
|
||||||
let mut account_indexes = HashSet::new();
|
let mut account_indexes = AccountSecondaryIndexes::default();
|
||||||
account_indexes.insert(AccountIndex::ProgramId);
|
account_indexes.insert(AccountIndex::ProgramId);
|
||||||
let bank = Arc::new(Bank::new_with_config(
|
let bank = Arc::new(Bank::new_with_config(
|
||||||
&genesis_config,
|
&genesis_config,
|
||||||
|
@ -10496,7 +10498,7 @@ pub(crate) mod tests {
|
||||||
// of the storage for this slot
|
// of the storage for this slot
|
||||||
let mut bank0 = Arc::new(Bank::new_with_config(
|
let mut bank0 = Arc::new(Bank::new_with_config(
|
||||||
&genesis_config,
|
&genesis_config,
|
||||||
HashSet::new(),
|
AccountSecondaryIndexes::default(),
|
||||||
false,
|
false,
|
||||||
));
|
));
|
||||||
bank0.restore_old_behavior_for_fragile_tests();
|
bank0.restore_old_behavior_for_fragile_tests();
|
||||||
|
@ -10527,7 +10529,11 @@ pub(crate) mod tests {
|
||||||
let pubkey2 = solana_sdk::pubkey::new_rand();
|
let pubkey2 = solana_sdk::pubkey::new_rand();
|
||||||
|
|
||||||
// Set root for bank 0, with caching enabled
|
// Set root for bank 0, with caching enabled
|
||||||
let mut bank0 = Arc::new(Bank::new_with_config(&genesis_config, HashSet::new(), true));
|
let mut bank0 = Arc::new(Bank::new_with_config(
|
||||||
|
&genesis_config,
|
||||||
|
AccountSecondaryIndexes::default(),
|
||||||
|
true,
|
||||||
|
));
|
||||||
bank0.restore_old_behavior_for_fragile_tests();
|
bank0.restore_old_behavior_for_fragile_tests();
|
||||||
|
|
||||||
let pubkey0_size = get_shrink_account_size();
|
let pubkey0_size = get_shrink_account_size();
|
||||||
|
@ -11706,7 +11712,7 @@ pub(crate) mod tests {
|
||||||
genesis_config.rent = Rent::free();
|
genesis_config.rent = Rent::free();
|
||||||
let bank0 = Arc::new(Bank::new_with_config(
|
let bank0 = Arc::new(Bank::new_with_config(
|
||||||
&genesis_config,
|
&genesis_config,
|
||||||
HashSet::new(),
|
AccountSecondaryIndexes::default(),
|
||||||
accounts_db_caching_enabled,
|
accounts_db_caching_enabled,
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ use {
|
||||||
crate::{
|
crate::{
|
||||||
accounts::Accounts,
|
accounts::Accounts,
|
||||||
accounts_db::{AccountStorageEntry, AccountsDb, AppendVecId, BankHashInfo},
|
accounts_db::{AccountStorageEntry, AccountsDb, AppendVecId, BankHashInfo},
|
||||||
accounts_index::{AccountIndex, Ancestors},
|
accounts_index::{AccountSecondaryIndexes, Ancestors},
|
||||||
append_vec::AppendVec,
|
append_vec::AppendVec,
|
||||||
bank::{Bank, BankFieldsToDeserialize, BankRc, Builtins},
|
bank::{Bank, BankFieldsToDeserialize, BankRc, Builtins},
|
||||||
blockhash_queue::BlockhashQueue,
|
blockhash_queue::BlockhashQueue,
|
||||||
|
@ -127,7 +127,7 @@ pub(crate) fn bank_from_stream<R>(
|
||||||
frozen_account_pubkeys: &[Pubkey],
|
frozen_account_pubkeys: &[Pubkey],
|
||||||
debug_keys: Option<Arc<HashSet<Pubkey>>>,
|
debug_keys: Option<Arc<HashSet<Pubkey>>>,
|
||||||
additional_builtins: Option<&Builtins>,
|
additional_builtins: Option<&Builtins>,
|
||||||
account_indexes: HashSet<AccountIndex>,
|
account_indexes: AccountSecondaryIndexes,
|
||||||
caching_enabled: bool,
|
caching_enabled: bool,
|
||||||
) -> std::result::Result<Bank, Error>
|
) -> std::result::Result<Bank, Error>
|
||||||
where
|
where
|
||||||
|
@ -235,7 +235,7 @@ fn reconstruct_bank_from_fields<E>(
|
||||||
unpacked_append_vec_map: UnpackedAppendVecMap,
|
unpacked_append_vec_map: UnpackedAppendVecMap,
|
||||||
debug_keys: Option<Arc<HashSet<Pubkey>>>,
|
debug_keys: Option<Arc<HashSet<Pubkey>>>,
|
||||||
additional_builtins: Option<&Builtins>,
|
additional_builtins: Option<&Builtins>,
|
||||||
account_indexes: HashSet<AccountIndex>,
|
account_indexes: AccountSecondaryIndexes,
|
||||||
caching_enabled: bool,
|
caching_enabled: bool,
|
||||||
) -> Result<Bank, Error>
|
) -> Result<Bank, Error>
|
||||||
where
|
where
|
||||||
|
@ -268,7 +268,7 @@ fn reconstruct_accountsdb_from_fields<E>(
|
||||||
account_paths: &[PathBuf],
|
account_paths: &[PathBuf],
|
||||||
unpacked_append_vec_map: UnpackedAppendVecMap,
|
unpacked_append_vec_map: UnpackedAppendVecMap,
|
||||||
cluster_type: &ClusterType,
|
cluster_type: &ClusterType,
|
||||||
account_indexes: HashSet<AccountIndex>,
|
account_indexes: AccountSecondaryIndexes,
|
||||||
caching_enabled: bool,
|
caching_enabled: bool,
|
||||||
) -> Result<AccountsDb, Error>
|
) -> Result<AccountsDb, Error>
|
||||||
where
|
where
|
||||||
|
|
|
@ -71,7 +71,7 @@ where
|
||||||
account_paths,
|
account_paths,
|
||||||
unpacked_append_vec_map,
|
unpacked_append_vec_map,
|
||||||
&ClusterType::Development,
|
&ClusterType::Development,
|
||||||
HashSet::new(),
|
AccountSecondaryIndexes::default(),
|
||||||
false,
|
false,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -123,8 +123,12 @@ where
|
||||||
fn test_accounts_serialize_style(serde_style: SerdeStyle) {
|
fn test_accounts_serialize_style(serde_style: SerdeStyle) {
|
||||||
solana_logger::setup();
|
solana_logger::setup();
|
||||||
let (_accounts_dir, paths) = get_temp_accounts_paths(4).unwrap();
|
let (_accounts_dir, paths) = get_temp_accounts_paths(4).unwrap();
|
||||||
let accounts =
|
let accounts = Accounts::new_with_config(
|
||||||
Accounts::new_with_config(paths, &ClusterType::Development, HashSet::new(), false);
|
paths,
|
||||||
|
&ClusterType::Development,
|
||||||
|
AccountSecondaryIndexes::default(),
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
|
||||||
let mut pubkeys: Vec<Pubkey> = vec![];
|
let mut pubkeys: Vec<Pubkey> = vec![];
|
||||||
create_test_accounts(&accounts, &mut pubkeys, 100, 0);
|
create_test_accounts(&accounts, &mut pubkeys, 100, 0);
|
||||||
|
@ -220,7 +224,7 @@ fn test_bank_serialize_style(serde_style: SerdeStyle) {
|
||||||
&[],
|
&[],
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
HashSet::new(),
|
AccountSecondaryIndexes::default(),
|
||||||
false,
|
false,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{
|
||||||
accounts_db::AccountsDb,
|
accounts_db::AccountsDb,
|
||||||
accounts_index::AccountIndex,
|
accounts_index::AccountSecondaryIndexes,
|
||||||
bank::{Bank, BankSlotDelta, Builtins},
|
bank::{Bank, BankSlotDelta, Builtins},
|
||||||
bank_forks::ArchiveFormat,
|
bank_forks::ArchiveFormat,
|
||||||
hardened_unpack::{unpack_snapshot, UnpackError, UnpackedAppendVecMap},
|
hardened_unpack::{unpack_snapshot, UnpackError, UnpackedAppendVecMap},
|
||||||
|
@ -593,7 +593,7 @@ pub fn bank_from_archive<P: AsRef<Path>>(
|
||||||
genesis_config: &GenesisConfig,
|
genesis_config: &GenesisConfig,
|
||||||
debug_keys: Option<Arc<HashSet<Pubkey>>>,
|
debug_keys: Option<Arc<HashSet<Pubkey>>>,
|
||||||
additional_builtins: Option<&Builtins>,
|
additional_builtins: Option<&Builtins>,
|
||||||
account_indexes: HashSet<AccountIndex>,
|
account_indexes: AccountSecondaryIndexes,
|
||||||
accounts_db_caching_enabled: bool,
|
accounts_db_caching_enabled: bool,
|
||||||
) -> Result<Bank> {
|
) -> Result<Bank> {
|
||||||
let unpack_dir = tempfile::Builder::new()
|
let unpack_dir = tempfile::Builder::new()
|
||||||
|
@ -772,7 +772,7 @@ fn rebuild_bank_from_snapshots(
|
||||||
genesis_config: &GenesisConfig,
|
genesis_config: &GenesisConfig,
|
||||||
debug_keys: Option<Arc<HashSet<Pubkey>>>,
|
debug_keys: Option<Arc<HashSet<Pubkey>>>,
|
||||||
additional_builtins: Option<&Builtins>,
|
additional_builtins: Option<&Builtins>,
|
||||||
account_indexes: HashSet<AccountIndex>,
|
account_indexes: AccountSecondaryIndexes,
|
||||||
accounts_db_caching_enabled: bool,
|
accounts_db_caching_enabled: bool,
|
||||||
) -> Result<Bank> {
|
) -> Result<Bank> {
|
||||||
info!("snapshot version: {}", snapshot_version);
|
info!("snapshot version: {}", snapshot_version);
|
||||||
|
|
Loading…
Reference in New Issue