Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Set a global fork graph in program cache #33776

Merged
merged 3 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions core/src/replay_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3859,6 +3859,7 @@ impl ReplayStage {
epoch_slots_frozen_slots: &mut EpochSlotsFrozenSlots,
drop_bank_sender: &Sender<Vec<Arc<Bank>>>,
) {
bank_forks.read().unwrap().prune_program_cache(new_root);
let removed_banks = bank_forks.write().unwrap().set_root(
new_root,
accounts_background_request_sender,
Expand Down
9 changes: 9 additions & 0 deletions ledger/src/bank_forks_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,15 @@ pub fn load_bank_forks(
(bank_forks, None)
};

bank_forks
.read()
.expect("Failed to read lock the bank forks")
.root_bank()
.loaded_programs_cache
.write()
.expect("Failed to write lock the program cache")
.set_fork_graph(bank_forks.clone());

let mut leader_schedule_cache =
LeaderScheduleCache::new_from_bank(&bank_forks.read().unwrap().root_bank());
if process_options.full_leader_cache {
Expand Down
5 changes: 5 additions & 0 deletions ledger/src/blockstore_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1555,6 +1555,11 @@ fn load_frozen_forks(
root = new_root_bank.slot();

leader_schedule_cache.set_root(new_root_bank);
new_root_bank
.loaded_programs_cache
.write()
.unwrap()
.prune(root, new_root_bank.epoch());
let _ = bank_forks.write().unwrap().set_root(
root,
accounts_background_request_sender,
Expand Down
Loading