Skip to content

Commit 76c5c94

Browse files
jeffwashingtonTyera Eulberg
andauthored
remove store_cached stall (solana-labs#21323)
* Bump tokio * remove store_cached stall Co-authored-by: Tyera Eulberg <tyera@solana.com>
1 parent c3b1906 commit 76c5c94

File tree

1 file changed

+1
-24
lines changed

1 file changed

+1
-24
lines changed

runtime/src/accounts_db.rs

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ use std::{
7171
};
7272
use tempfile::TempDir;
7373

74+
#[cfg(test)]
7475
use std::{thread::sleep, time::Duration};
7576

7677
const PAGE_SIZE: u64 = 4 * 1024;
@@ -5503,31 +5504,7 @@ impl AccountsDb {
55035504
}
55045505
}
55055506

5506-
/// sleep while accounts cache size has grown too large, up to a max wait
5507-
fn maybe_stall_store_cached(&self, accounts: &[(&Pubkey, &AccountSharedData)]) {
5508-
const MAX_DELAY_US: u128 = 10_000;
5509-
const CACHE_SIZE_TO_STALL: u64 = 10_000_000_000;
5510-
const DELAY_US: u64 = 1_000;
5511-
let start = Instant::now();
5512-
let mut waited = false;
5513-
while self.accounts_cache.size() > CACHE_SIZE_TO_STALL {
5514-
waited = true;
5515-
sleep(Duration::from_micros(DELAY_US));
5516-
if start.elapsed().as_micros() > MAX_DELAY_US {
5517-
break;
5518-
}
5519-
}
5520-
if waited {
5521-
datapoint_info!(
5522-
"accounts_db_store_cached_stall",
5523-
("num_accounts", accounts.len(), i64),
5524-
("delay_us", start.elapsed().as_micros(), i64),
5525-
);
5526-
}
5527-
}
5528-
55295507
pub fn store_cached(&self, slot: Slot, accounts: &[(&Pubkey, &AccountSharedData)]) {
5530-
self.maybe_stall_store_cached(accounts);
55315508
self.store(slot, accounts, self.caching_enabled);
55325509
}
55335510

0 commit comments

Comments
 (0)