Skip to content

Commit

Permalink
Merge branch 'remove-thin-client-from-bench-tps' of github.com:gregcu…
Browse files Browse the repository at this point in the history
…sack/solana into remove-thin-client-from-bench-tps
  • Loading branch information
gregcusack committed Feb 29, 2024
2 parents 9eb34f2 + a31b9f6 commit ed2c800
Show file tree
Hide file tree
Showing 48 changed files with 1,645 additions and 620 deletions.
46 changes: 8 additions & 38 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ edition = "2021"
Inflector = "0.11.4"
aquamarine = "0.3.3"
aes-gcm-siv = "0.10.3"
ahash = "0.8.9"
ahash = "0.8.10"
anyhow = "1.0.80"
arbitrary = "1.3.2"
ark-bn254 = "0.4.0"
Expand Down Expand Up @@ -258,7 +258,6 @@ num-traits = "0.2"
num_cpus = "1.16.0"
num_enum = "0.7.2"
openssl = "0.10"
ouroboros = "0.15.6"
parking_lot = "0.12"
pbkdf2 = { version = "0.11.0", default-features = false }
pem = "1.1.1"
Expand Down Expand Up @@ -410,7 +409,7 @@ sysctl = "0.4.6"
systemstat = "0.2.3"
tar = "0.4.40"
tarpc = "0.29.0"
tempfile = "3.10.0"
tempfile = "3.10.1"
test-case = "3.3.1"
thiserror = "1.0.57"
tiny-bip39 = "0.8.2"
Expand Down
1 change: 0 additions & 1 deletion accounts-db/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ num-derive = { workspace = true }
num-traits = { workspace = true }
num_cpus = { workspace = true }
num_enum = { workspace = true }
ouroboros = { workspace = true }
percentage = { workspace = true }
qualifier_attr = { workspace = true }
rand = { workspace = true }
Expand Down
66 changes: 32 additions & 34 deletions accounts-db/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,10 @@ use {
ZeroLamportAccounts,
},
accounts_index::{
AccountIndexGetResult, AccountMapEntry, AccountSecondaryIndexes, AccountsIndex,
AccountsIndexConfig, AccountsIndexRootsStats, AccountsIndexScanResult, DiskIndexValue,
IndexKey, IndexValue, IsCached, RefCount, ScanConfig, ScanResult, SlotList,
UpsertReclaim, ZeroLamport, ACCOUNTS_INDEX_CONFIG_FOR_BENCHMARKS,
ACCOUNTS_INDEX_CONFIG_FOR_TESTING,
AccountMapEntry, AccountSecondaryIndexes, AccountsIndex, AccountsIndexConfig,
AccountsIndexRootsStats, AccountsIndexScanResult, DiskIndexValue, IndexKey, IndexValue,
IsCached, RefCount, ScanConfig, ScanResult, SlotList, UpsertReclaim, ZeroLamport,
ACCOUNTS_INDEX_CONFIG_FOR_BENCHMARKS, ACCOUNTS_INDEX_CONFIG_FOR_TESTING,
},
accounts_index_storage::Startup,
accounts_partition::RentPayingAccountsByPartition,
Expand Down Expand Up @@ -6864,28 +6863,20 @@ impl AccountsDb {
let result: Vec<Hash> = pubkeys
.iter()
.filter_map(|pubkey| {
if let AccountIndexGetResult::Found(lock, index) =
self.accounts_index.get(pubkey, config.ancestors, Some(max_slot))
{
let (slot, account_info) = &lock.slot_list()[index];
if !account_info.is_zero_lamport() {
// Because we're keeping the `lock' here, there is no need
// to use retry_to_get_account_accessor()
// In other words, flusher/shrinker/cleaner is blocked to
// cause any Accessor(None) situation.
// Anyway this race condition concern is currently a moot
// point because calculate_accounts_hash() should not
// currently race with clean/shrink because the full hash
// is synchronous with clean/shrink in
// AccountsBackgroundService
let index_entry = self.accounts_index.get_cloned(pubkey)?;
self.accounts_index.get_account_info_with_and_then(
&index_entry,
config.ancestors,
Some(max_slot),
|(slot, account_info)| {
if account_info.is_zero_lamport() { return None; }
self.get_account_accessor(
*slot,
slot,
pubkey,
&account_info.storage_location(),
)
.get_loaded_account()
.and_then(
|loaded_account| {
.and_then(|loaded_account| {
let mut loaded_hash = loaded_account.loaded_hash();
let balance = loaded_account.lamports();
let hash_is_missing = loaded_hash == AccountHash(Hash::default());
Expand All @@ -6905,14 +6896,10 @@ impl AccountsDb {

sum += balance as u128;
Some(loaded_hash.0)
},
)
} else {
None
}
} else {
None
}
})
},
)
.flatten()
})
.collect();
let mut total = total_lamports.lock().unwrap();
Expand Down Expand Up @@ -7443,6 +7430,11 @@ impl AccountsDb {
self.accounts_hashes.lock().unwrap().get(&slot).cloned()
}

/// Get all accounts hashes
pub fn get_accounts_hashes(&self) -> HashMap<Slot, (AccountsHash, /*capitalization*/ u64)> {
self.accounts_hashes.lock().unwrap().clone()
}

/// Set the incremental accounts hash for `slot`
///
/// returns the previous incremental accounts hash for `slot`
Expand Down Expand Up @@ -7479,6 +7471,13 @@ impl AccountsDb {
.cloned()
}

/// Get all incremental accounts hashes
pub fn get_incremental_accounts_hashes(
&self,
) -> HashMap<Slot, (IncrementalAccountsHash, /*capitalization*/ u64)> {
self.incremental_accounts_hashes.lock().unwrap().clone()
}

/// Purge accounts hashes that are older than `last_full_snapshot_slot`
///
/// Should only be called by AccountsHashVerifier, since it consumes the accounts hashes and
Expand Down Expand Up @@ -9081,11 +9080,10 @@ impl AccountsDb {
let mut lookup_time = Measure::start("lookup_time");
for account_info in storage.accounts.account_iter() {
let key = account_info.pubkey();
let lock = self.accounts_index.get_bin(key);
let x = lock.get(key).unwrap();
let sl = x.slot_list.read().unwrap();
let index_entry = self.accounts_index.get_cloned(key).unwrap();
let slot_list = index_entry.slot_list.read().unwrap();
let mut count = 0;
for (slot2, account_info2) in sl.iter() {
for (slot2, account_info2) in slot_list.iter() {
if slot2 == slot {
count += 1;
let ai = AccountInfo::new(
Expand Down
Loading

0 comments on commit ed2c800

Please sign in to comment.