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

set_bank takes owned Arc<Bank> #31717

Merged

Conversation

apfitzge
Copy link
Contributor

Problem

set_bank is taking ownership of the Arc<Bank>.

Summary of Changes

Update function signature.

Fixes #

@codecov
Copy link

codecov bot commented May 18, 2023

Codecov Report

Merging #31717 (abbf96f) into master (16381d8) will decrease coverage by 0.1%.
The diff coverage is 93.9%.

@@            Coverage Diff            @@
##           master   #31717     +/-   ##
=========================================
- Coverage    81.9%    81.8%   -0.1%     
=========================================
  Files         737      737             
  Lines      205985   205985             
=========================================
- Hits       168719   168697     -22     
- Misses      37266    37288     +22     

@apfitzge apfitzge marked this pull request as ready for review May 18, 2023 21:22
@apfitzge apfitzge requested a review from ryoqun May 18, 2023 21:22
@@ -1948,7 +1948,7 @@ impl ReplayStage {
poh_recorder
.write()
.unwrap()
.set_bank(&tpu_bank, track_transaction_indexes);
.set_bank(tpu_bank, track_transaction_indexes);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yay, one less clone for block generation code path. :)

assert!(self.working_bank.is_none());
self.leader_bank_notifier.set_in_progress(bank);
self.leader_bank_notifier.set_in_progress(&bank);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hehe, set_in_progress seems to be a rare exception for this Arc<_> arg fixup saga... lol

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think the exception is justified as it does not take ownership of the Arc. It uses the arc to create a weak-reference.

(I know you know this, just making it clear for anyone else looking at the PR why this should be an exception)

Comment on lines +582 to +583
bank,
start: Arc::new(Instant::now()),
Copy link
Member

@ryoqun ryoqun May 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, unfortunate reordering due to unhappy borrow checker. ;)

Copy link
Member

@ryoqun ryoqun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm; thanks for cleaning up (no nits this time!)

@apfitzge apfitzge merged commit 02ac8a4 into solana-labs:master May 23, 2023
@apfitzge apfitzge deleted the refactor/poh_recorder_ref_arc_bank branch May 23, 2023 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants