Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ShredFetchStage::modify_packets to drop root bank quicker #33105

Merged
merged 3 commits into from
Sep 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions core/src/shred_fetch_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,24 +50,25 @@ impl ShredFetchStage {
.as_ref()
.map(|(_, cluster_info)| cluster_info.keypair().clone());

// Only need root bank in order to check feature statuses later on;
// can demote to only fetching root slot once those features go away.
let (mut root_bank, mut last_slot) = {
let (mut last_root, mut last_slot, mut slots_per_epoch) = {
let bank_forks_r = bank_forks.read().unwrap();
(bank_forks_r.root_bank(), bank_forks_r.highest_slot())
let root_bank = bank_forks_r.root_bank();
(
root_bank.slot(),
root_bank.get_slots_in_epoch(root_bank.epoch()),
bank_forks_r.highest_slot(),
steviez marked this conversation as resolved.
Show resolved Hide resolved
)
};
let mut last_root = root_bank.slot();
let mut slots_per_epoch = root_bank.get_slots_in_epoch(root_bank.epoch());
let mut stats = ShredFetchStats::default();

for mut packet_batch in recvr {
if last_updated.elapsed().as_millis() as u64 > DEFAULT_MS_PER_SLOT {
last_updated = Instant::now();
{
let root_bank = {
let bank_forks_r = bank_forks.read().unwrap();
root_bank = bank_forks_r.root_bank();
last_slot = bank_forks_r.highest_slot();
}
bank_forks_r.root_bank()
};
last_root = root_bank.slot();
slots_per_epoch = root_bank.get_slots_in_epoch(root_bank.epoch());
keypair = repair_context
Expand Down