* type AccountSecondaryIndexes = HashSet (#17108)
(cherry picked from commit f39dda00e0
)
# Conflicts:
# runtime/benches/accounts.rs
# runtime/src/accounts.rs
# runtime/src/accounts_db.rs
# runtime/src/accounts_index.rs
* resolve merge errors
Co-authored-by: Jeff Washington (jwash) <75863576+jeffwashington@users.noreply.github.com>
Co-authored-by: Jeff Washington (jwash) <wash678@gmail.com>
This commit is contained in:
@ -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, thread_mem_usage};
|
|||||||
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,
|
||||||
}
|
}
|
||||||
@ -3042,7 +3042,7 @@ pub mod tests {
|
|||||||
&[],
|
&[],
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
HashSet::new(),
|
AccountSecondaryIndexes::default(),
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
*bank.epoch_schedule()
|
*bank.epoch_schedule()
|
||||||
|
@ -8,6 +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::AccountSecondaryIndexes,
|
||||||
bank::*,
|
bank::*,
|
||||||
};
|
};
|
||||||
use solana_sdk::{
|
use solana_sdk::{
|
||||||
@ -53,7 +54,7 @@ fn test_accounts_create(bencher: &mut Bencher) {
|
|||||||
&[],
|
&[],
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
HashSet::new(),
|
AccountSecondaryIndexes::default(),
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
bencher.iter(|| {
|
bencher.iter(|| {
|
||||||
@ -72,7 +73,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![];
|
||||||
@ -97,7 +98,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![];
|
||||||
@ -115,7 +116,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![];
|
||||||
@ -132,7 +133,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![];
|
||||||
@ -148,7 +149,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();
|
||||||
@ -181,7 +182,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;
|
||||||
@ -306,7 +307,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,
|
||||||
));
|
));
|
||||||
|
|
||||||
@ -357,8 +358,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,
|
||||||
);
|
);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
accounts_db::{AccountsDb, BankHashInfo, ErrorCounters, LoadedAccount, ScanStorageResult},
|
accounts_db::{AccountsDb, BankHashInfo, ErrorCounters, LoadedAccount, ScanStorageResult},
|
||||||
accounts_index::{AccountIndex, Ancestors, IndexKey},
|
accounts_index::{AccountSecondaryIndexes, Ancestors, IndexKey},
|
||||||
bank::{
|
bank::{
|
||||||
NonceRollbackFull, NonceRollbackInfo, TransactionCheckResult, TransactionExecutionResult,
|
NonceRollbackFull, NonceRollbackInfo, TransactionCheckResult, TransactionExecutionResult,
|
||||||
},
|
},
|
||||||
@ -113,13 +113,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 {
|
||||||
@ -1066,8 +1071,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);
|
||||||
}
|
}
|
||||||
@ -1599,8 +1608,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();
|
||||||
@ -1623,8 +1636,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();
|
||||||
|
|
||||||
@ -1642,8 +1659,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1659,8 +1680,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);
|
||||||
@ -1781,8 +1806,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);
|
||||||
@ -1925,8 +1954,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
|
||||||
@ -1973,8 +2006,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..");
|
||||||
@ -2016,8 +2053,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();
|
||||||
@ -2296,8 +2337,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,
|
||||||
@ -2407,8 +2452,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,
|
||||||
@ -2434,8 +2483,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},
|
accounts_hash::{AccountsHash, CalculateHashIntermediate, HashStats},
|
||||||
accounts_index::{
|
accounts_index::{
|
||||||
AccountIndex, AccountsIndex, AccountsIndexRootsStats, Ancestors, IndexKey, IsCached,
|
AccountSecondaryIndexes, AccountsIndex, AccountsIndexRootsStats, Ancestors, IndexKey,
|
||||||
SlotList, SlotSlice, ZeroLamport,
|
IsCached, SlotList, SlotSlice, ZeroLamport,
|
||||||
},
|
},
|
||||||
append_vec::{AppendVec, StoredAccountMeta, StoredMeta},
|
append_vec::{AppendVec, StoredAccountMeta, StoredMeta},
|
||||||
contains::Contains,
|
contains::Contains,
|
||||||
@ -740,7 +740,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,
|
||||||
|
|
||||||
@ -1092,7 +1092,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,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1100,13 +1100,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 new = if !paths.is_empty() {
|
let new = if !paths.is_empty() {
|
||||||
@ -7774,7 +7779,7 @@ pub mod tests {
|
|||||||
&key0,
|
&key0,
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
info0,
|
info0,
|
||||||
&mut reclaims,
|
&mut reclaims,
|
||||||
);
|
);
|
||||||
@ -7783,7 +7788,7 @@ pub mod tests {
|
|||||||
&key0,
|
&key0,
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
info1.clone(),
|
info1.clone(),
|
||||||
&mut reclaims,
|
&mut reclaims,
|
||||||
);
|
);
|
||||||
@ -7792,7 +7797,7 @@ pub mod tests {
|
|||||||
&key1,
|
&key1,
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
info1,
|
info1,
|
||||||
&mut reclaims,
|
&mut reclaims,
|
||||||
);
|
);
|
||||||
@ -7801,7 +7806,7 @@ pub mod tests {
|
|||||||
&key1,
|
&key1,
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
info2.clone(),
|
info2.clone(),
|
||||||
&mut reclaims,
|
&mut reclaims,
|
||||||
);
|
);
|
||||||
@ -7810,7 +7815,7 @@ pub mod tests {
|
|||||||
&key2,
|
&key2,
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
info2,
|
info2,
|
||||||
&mut reclaims,
|
&mut reclaims,
|
||||||
);
|
);
|
||||||
@ -7819,7 +7824,7 @@ pub mod tests {
|
|||||||
&key2,
|
&key2,
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
info3,
|
info3,
|
||||||
&mut reclaims,
|
&mut reclaims,
|
||||||
);
|
);
|
||||||
@ -8208,7 +8213,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,
|
||||||
));
|
));
|
||||||
|
|
||||||
@ -8244,7 +8249,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,
|
||||||
));
|
));
|
||||||
|
|
||||||
@ -8367,7 +8372,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();
|
||||||
@ -8451,7 +8456,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;
|
||||||
@ -8505,7 +8510,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();
|
||||||
@ -8893,7 +8898,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();
|
||||||
|
@ -72,6 +72,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,
|
||||||
@ -607,7 +609,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();
|
||||||
@ -709,7 +715,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>,
|
||||||
@ -818,7 +824,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;
|
||||||
@ -870,7 +876,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>,
|
||||||
) {
|
) {
|
||||||
@ -893,7 +899,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 {
|
||||||
@ -947,7 +953,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>,
|
||||||
{
|
{
|
||||||
@ -973,7 +979,7 @@ impl<T: 'static + Clone + IsCached + ZeroLamport> AccountsIndex<T> {
|
|||||||
list: &mut SlotList<T>,
|
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 max_root = Self::get_max_root(&roots_tracker.roots, &list, max_clean_root);
|
let max_root = Self::get_max_root(&roots_tracker.roots, &list, max_clean_root);
|
||||||
@ -997,7 +1003,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,
|
||||||
) {
|
) {
|
||||||
if let Some(mut locked_entry) = self.get_account_write_entry(pubkey) {
|
if let Some(mut locked_entry) = self.get_account_write_entry(pubkey) {
|
||||||
locked_entry.slot_list_mut(|slot_list| {
|
locked_entry.slot_list_mut(|slot_list| {
|
||||||
@ -1158,19 +1164,19 @@ 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
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
@ -1180,7 +1186,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();
|
||||||
@ -1217,7 +1223,7 @@ pub mod tests {
|
|||||||
&key.pubkey(),
|
&key.pubkey(),
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
true,
|
true,
|
||||||
&mut gc,
|
&mut gc,
|
||||||
);
|
);
|
||||||
@ -1242,7 +1248,7 @@ pub mod tests {
|
|||||||
&key.pubkey(),
|
&key.pubkey(),
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
true,
|
true,
|
||||||
&mut gc,
|
&mut gc,
|
||||||
);
|
);
|
||||||
@ -1266,7 +1272,7 @@ pub mod tests {
|
|||||||
&key.pubkey(),
|
&key.pubkey(),
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
true,
|
true,
|
||||||
&mut gc,
|
&mut gc,
|
||||||
);
|
);
|
||||||
@ -1299,7 +1305,7 @@ pub mod tests {
|
|||||||
&new_pubkey,
|
&new_pubkey,
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
true,
|
true,
|
||||||
&mut vec![],
|
&mut vec![],
|
||||||
);
|
);
|
||||||
@ -1315,7 +1321,7 @@ pub mod tests {
|
|||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
true,
|
true,
|
||||||
&mut vec![],
|
&mut vec![],
|
||||||
);
|
);
|
||||||
@ -1446,7 +1452,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,
|
||||||
);
|
);
|
||||||
@ -1471,7 +1477,7 @@ pub mod tests {
|
|||||||
&key.pubkey(),
|
&key.pubkey(),
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
true,
|
true,
|
||||||
&mut gc,
|
&mut gc,
|
||||||
);
|
);
|
||||||
@ -1585,7 +1591,7 @@ pub mod tests {
|
|||||||
&key.pubkey(),
|
&key.pubkey(),
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
true,
|
true,
|
||||||
&mut gc,
|
&mut gc,
|
||||||
);
|
);
|
||||||
@ -1600,7 +1606,7 @@ pub mod tests {
|
|||||||
&key.pubkey(),
|
&key.pubkey(),
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
false,
|
false,
|
||||||
&mut gc,
|
&mut gc,
|
||||||
);
|
);
|
||||||
@ -1621,7 +1627,7 @@ pub mod tests {
|
|||||||
&key.pubkey(),
|
&key.pubkey(),
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
true,
|
true,
|
||||||
&mut gc,
|
&mut gc,
|
||||||
);
|
);
|
||||||
@ -1631,7 +1637,7 @@ pub mod tests {
|
|||||||
&key.pubkey(),
|
&key.pubkey(),
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
false,
|
false,
|
||||||
&mut gc,
|
&mut gc,
|
||||||
);
|
);
|
||||||
@ -1653,7 +1659,7 @@ pub mod tests {
|
|||||||
&key.pubkey(),
|
&key.pubkey(),
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
true,
|
true,
|
||||||
&mut gc,
|
&mut gc,
|
||||||
);
|
);
|
||||||
@ -1663,7 +1669,7 @@ pub mod tests {
|
|||||||
&key.pubkey(),
|
&key.pubkey(),
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
false,
|
false,
|
||||||
&mut gc,
|
&mut gc,
|
||||||
);
|
);
|
||||||
@ -1672,7 +1678,7 @@ pub mod tests {
|
|||||||
&key.pubkey(),
|
&key.pubkey(),
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
true,
|
true,
|
||||||
&mut gc,
|
&mut gc,
|
||||||
);
|
);
|
||||||
@ -1681,7 +1687,7 @@ pub mod tests {
|
|||||||
&key.pubkey(),
|
&key.pubkey(),
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
true,
|
true,
|
||||||
&mut gc,
|
&mut gc,
|
||||||
);
|
);
|
||||||
@ -1693,7 +1699,7 @@ pub mod tests {
|
|||||||
&key.pubkey(),
|
&key.pubkey(),
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
true,
|
true,
|
||||||
&mut gc,
|
&mut gc,
|
||||||
);
|
);
|
||||||
@ -1727,7 +1733,7 @@ pub mod tests {
|
|||||||
&key.pubkey(),
|
&key.pubkey(),
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
12,
|
12,
|
||||||
&mut gc
|
&mut gc
|
||||||
));
|
));
|
||||||
@ -1737,7 +1743,7 @@ pub mod tests {
|
|||||||
&key.pubkey(),
|
&key.pubkey(),
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
10,
|
10,
|
||||||
&mut gc
|
&mut gc
|
||||||
));
|
));
|
||||||
@ -1754,7 +1760,7 @@ pub mod tests {
|
|||||||
&key.pubkey(),
|
&key.pubkey(),
|
||||||
&Pubkey::default(),
|
&Pubkey::default(),
|
||||||
&[],
|
&[],
|
||||||
&HashSet::new(),
|
&AccountSecondaryIndexes::default(),
|
||||||
9,
|
9,
|
||||||
&mut gc
|
&mut gc
|
||||||
));
|
));
|
||||||
@ -1810,7 +1816,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];
|
||||||
@ -1899,7 +1905,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)]);
|
||||||
@ -1915,7 +1921,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)]);
|
||||||
@ -1929,7 +1935,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)]);
|
||||||
@ -1943,7 +1949,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)]);
|
||||||
@ -1956,7 +1962,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)]);
|
||||||
@ -1970,7 +1976,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)]);
|
||||||
@ -1984,7 +1990,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)]);
|
||||||
@ -1998,7 +2004,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)]);
|
||||||
@ -2037,7 +2043,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();
|
||||||
@ -2127,7 +2133,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();
|
||||||
|
@ -8,7 +8,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},
|
||||||
@ -900,7 +900,7 @@ impl Bank {
|
|||||||
&[],
|
&[],
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
HashSet::new(),
|
AccountSecondaryIndexes::default(),
|
||||||
false,
|
false,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -912,7 +912,7 @@ impl Bank {
|
|||||||
&[],
|
&[],
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
HashSet::new(),
|
AccountSecondaryIndexes::default(),
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -923,7 +923,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(
|
||||||
@ -943,7 +943,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();
|
||||||
@ -5031,7 +5031,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,
|
||||||
@ -8903,7 +8905,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,
|
||||||
@ -10357,7 +10359,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();
|
||||||
@ -10388,7 +10390,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();
|
||||||
@ -11568,7 +11574,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},
|
||||||
@ -592,7 +592,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()
|
||||||
@ -771,7 +771,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);
|
||||||
|
Reference in New Issue
Block a user