-
Notifications
You must be signed in to change notification settings - Fork 256
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
Support tx poh recording in unified scheduler #4150
base: master
Are you sure you want to change the base?
Changes from 1 commit
427736f
08536f0
3b852f6
a59e39a
36f8537
23159ff
68cff74
73686a2
447bdb6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -140,7 +140,7 @@ pub struct RecordTransactionsSummary { | |
pub starting_transaction_index: Option<usize>, | ||
} | ||
|
||
#[derive(Clone)] | ||
#[derive(Clone, Debug)] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we really need There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm, i think |
||
pub struct TransactionRecorder { | ||
// shared by all users of PohRecorder | ||
pub record_sender: Sender<Record>, | ||
|
@@ -1144,11 +1144,12 @@ impl PohRecorder { | |
} | ||
} | ||
|
||
pub fn create_test_recorder( | ||
fn do_create_test_recorder( | ||
bank: Arc<Bank>, | ||
blockstore: Arc<Blockstore>, | ||
poh_config: Option<PohConfig>, | ||
leader_schedule_cache: Option<Arc<LeaderScheduleCache>>, | ||
track_transaction_indexes: bool, | ||
) -> ( | ||
Arc<AtomicBool>, | ||
Arc<RwLock<PohRecorder>>, | ||
|
@@ -1174,7 +1175,10 @@ pub fn create_test_recorder( | |
); | ||
let ticks_per_slot = bank.ticks_per_slot(); | ||
|
||
poh_recorder.set_bank(BankWithScheduler::new_without_scheduler(bank), false); | ||
poh_recorder.set_bank( | ||
BankWithScheduler::new_without_scheduler(bank), | ||
track_transaction_indexes, | ||
); | ||
let poh_recorder = Arc::new(RwLock::new(poh_recorder)); | ||
let poh_service = PohService::new( | ||
poh_recorder.clone(), | ||
|
@@ -1189,6 +1193,34 @@ pub fn create_test_recorder( | |
(exit, poh_recorder, poh_service, entry_receiver) | ||
} | ||
|
||
pub fn create_test_recorder( | ||
bank: Arc<Bank>, | ||
blockstore: Arc<Blockstore>, | ||
poh_config: Option<PohConfig>, | ||
leader_schedule_cache: Option<Arc<LeaderScheduleCache>>, | ||
) -> ( | ||
Arc<AtomicBool>, | ||
Arc<RwLock<PohRecorder>>, | ||
PohService, | ||
Receiver<WorkingBankEntry>, | ||
) { | ||
do_create_test_recorder(bank, blockstore, poh_config, leader_schedule_cache, false) | ||
} | ||
|
||
pub fn create_test_recorder_with_index_tracking( | ||
bank: Arc<Bank>, | ||
blockstore: Arc<Blockstore>, | ||
poh_config: Option<PohConfig>, | ||
leader_schedule_cache: Option<Arc<LeaderScheduleCache>>, | ||
) -> ( | ||
Arc<AtomicBool>, | ||
Arc<RwLock<PohRecorder>>, | ||
PohService, | ||
Receiver<WorkingBankEntry>, | ||
) { | ||
do_create_test_recorder(bank, blockstore, poh_config, leader_schedule_cache, true) | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use { | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: adding a clone here here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if we can remove this clone and simplify the callback interface.
What if the callback itself did an allocation (only if necessary) returning the transaction index in that case.
I also really don't like the
Option<Option<usize>>
that is there now because it hides the meaning. It's not clear from just this code that the outer option means that recording/pre-commit failed.If I were to do this, I'd take one of these two approaches:
Lean towards 1 since it's simpler, and not sure an additional enum would benefit too much here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch.. done: 08536f0
I think Cow is enough. I'd like to remain the closure agnostic from allocation at all for separation of concern.
this is done: 3b852f6