Skip to content

Commit

Permalink
Merge branch 'master' into log_performance_improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
wkennedy authored Nov 11, 2024
2 parents 6526130 + b46c87e commit edfbdaa
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 17 deletions.
12 changes: 6 additions & 6 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ core_affinity = "0.5.10"
criterion = "0.5.1"
criterion-stats = "0.3.0"
crossbeam-channel = "0.5.13"
csv = "1.3.0"
csv = "1.3.1"
ctrlc = "3.4.5"
curve25519-dalek = { version = "4.1.3", features = ["digest", "rand_core"] }
dashmap = "5.5.3"
Expand Down Expand Up @@ -578,7 +578,7 @@ tar = "0.4.43"
tarpc = "0.29.0"
tempfile = "3.14.0"
test-case = "3.3.1"
thiserror = "1.0.68"
thiserror = "1.0.69"
tiny-bip39 = "0.8.2"
# Update solana-tokio patch below when updating this version
tokio = "1.29.1"
Expand Down
21 changes: 21 additions & 0 deletions accounts-db/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7452,6 +7452,27 @@ impl AccountsDb {
(hashes, scan.as_us(), accumulate)
}

/// Return all of the accounts for a given slot
pub fn get_pubkey_account_for_slot(&self, slot: Slot) -> Vec<(Pubkey, AccountSharedData)> {
let scan_result = self.scan_account_storage(
slot,
|loaded_account| {
// Cache only has one version per key, don't need to worry about versioning
Some((*loaded_account.pubkey(), loaded_account.take_account()))
},
|accum: &DashMap<_, _>, loaded_account, _data| {
// Storage may have duplicates so only keep the latest version for each key
accum.insert(*loaded_account.pubkey(), loaded_account.take_account());
},
ScanAccountStorageData::NoData,
);

match scan_result {
ScanStorageResult::Cached(cached_result) => cached_result,
ScanStorageResult::Stored(stored_result) => stored_result.into_iter().collect(),
}
}

/// Return all of the accounts for a given slot
pub fn get_pubkey_hash_account_for_slot(&self, slot: Slot) -> Vec<PubkeyHashAccount> {
type ScanResult =
Expand Down
8 changes: 4 additions & 4 deletions programs/sbf/Cargo.lock

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

7 changes: 2 additions & 5 deletions runtime/src/bank/accounts_lt_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl Bank {
self.rc
.accounts
.accounts_db
.get_pubkey_hash_account_for_slot(slot)
.get_pubkey_account_for_slot(slot)
});
let num_accounts_total = accounts_curr.len();

Expand Down Expand Up @@ -118,10 +118,7 @@ impl Bank {
.fold_chunks(
CHUNK_SIZE,
|| (LtHash::identity(), Stats::default()),
|mut accum, elem| {
let pubkey = &elem.pubkey;
let curr_account = &elem.account;

|mut accum, (pubkey, curr_account)| {
// load the initial state of the account
let (initial_state_of_account, measure_load) = meas_dur!({
match cache_for_accounts_lt_hash.get(pubkey) {
Expand Down

0 comments on commit edfbdaa

Please sign in to comment.