Keep signal_receiver in scope (#31625)
This commit is contained in:
parent
5178d4d49b
commit
d2bd6c72aa
|
@ -84,11 +84,11 @@ fn create_consumer(poh_recorder: &RwLock<PohRecorder>) -> Consumer {
|
||||||
|
|
||||||
struct BenchFrame {
|
struct BenchFrame {
|
||||||
bank: Arc<Bank>,
|
bank: Arc<Bank>,
|
||||||
_ledger_path: TempDir,
|
ledger_path: TempDir,
|
||||||
exit: Arc<AtomicBool>,
|
exit: Arc<AtomicBool>,
|
||||||
poh_recorder: Arc<RwLock<PohRecorder>>,
|
poh_recorder: Arc<RwLock<PohRecorder>>,
|
||||||
poh_service: PohService,
|
poh_service: PohService,
|
||||||
_signal_receiver: Receiver<(Arc<Bank>, (Entry, u64))>,
|
signal_receiver: Receiver<(Arc<Bank>, (Entry, u64))>,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn setup() -> BenchFrame {
|
fn setup() -> BenchFrame {
|
||||||
|
@ -120,29 +120,34 @@ fn setup() -> BenchFrame {
|
||||||
|
|
||||||
BenchFrame {
|
BenchFrame {
|
||||||
bank,
|
bank,
|
||||||
_ledger_path: ledger_path,
|
ledger_path,
|
||||||
exit,
|
exit,
|
||||||
poh_recorder,
|
poh_recorder,
|
||||||
poh_service,
|
poh_service,
|
||||||
_signal_receiver: signal_receiver,
|
signal_receiver,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bench_process_and_record_transactions(bencher: &mut Bencher, batch_size: usize) {
|
fn bench_process_and_record_transactions(bencher: &mut Bencher, batch_size: usize) {
|
||||||
let BenchFrame {
|
let BenchFrame {
|
||||||
bank,
|
bank,
|
||||||
_ledger_path,
|
ledger_path: _ledger_path,
|
||||||
exit,
|
exit,
|
||||||
poh_recorder,
|
poh_recorder,
|
||||||
poh_service,
|
poh_service,
|
||||||
..
|
signal_receiver: _signal_receiver,
|
||||||
} = setup();
|
} = setup();
|
||||||
let consumer = create_consumer(&poh_recorder);
|
let consumer = create_consumer(&poh_recorder);
|
||||||
let transactions = create_transactions(&bank, 2_usize.pow(20));
|
let transactions = create_transactions(&bank, 2_usize.pow(20));
|
||||||
let mut transaction_iter = transactions.chunks(batch_size);
|
let mut transaction_iter = transactions.chunks(batch_size);
|
||||||
|
|
||||||
bencher.iter(move || {
|
bencher.iter(move || {
|
||||||
consumer.process_and_record_transactions(&bank, transaction_iter.next().unwrap(), 0);
|
let summary =
|
||||||
|
consumer.process_and_record_transactions(&bank, transaction_iter.next().unwrap(), 0);
|
||||||
|
assert!(summary
|
||||||
|
.execute_and_commit_transactions_output
|
||||||
|
.commit_transactions_result
|
||||||
|
.is_ok());
|
||||||
});
|
});
|
||||||
|
|
||||||
exit.store(true, Ordering::Relaxed);
|
exit.store(true, Ordering::Relaxed);
|
||||||
|
|
|
@ -43,7 +43,7 @@ pub struct ProcessTransactionBatchOutput {
|
||||||
cost_model_throttled_transactions_count: usize,
|
cost_model_throttled_transactions_count: usize,
|
||||||
// Amount of time spent running the cost model
|
// Amount of time spent running the cost model
|
||||||
cost_model_us: u64,
|
cost_model_us: u64,
|
||||||
execute_and_commit_transactions_output: ExecuteAndCommitTransactionsOutput,
|
pub execute_and_commit_transactions_output: ExecuteAndCommitTransactionsOutput,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ExecuteAndCommitTransactionsOutput {
|
pub struct ExecuteAndCommitTransactionsOutput {
|
||||||
|
@ -60,7 +60,7 @@ pub struct ExecuteAndCommitTransactionsOutput {
|
||||||
retryable_transaction_indexes: Vec<usize>,
|
retryable_transaction_indexes: Vec<usize>,
|
||||||
// A result that indicates whether transactions were successfully
|
// A result that indicates whether transactions were successfully
|
||||||
// committed into the Poh stream.
|
// committed into the Poh stream.
|
||||||
commit_transactions_result: Result<Vec<CommitTransactionDetails>, PohRecorderError>,
|
pub commit_transactions_result: Result<Vec<CommitTransactionDetails>, PohRecorderError>,
|
||||||
execute_and_commit_timings: LeaderExecuteAndCommitTimings,
|
execute_and_commit_timings: LeaderExecuteAndCommitTimings,
|
||||||
error_counters: TransactionErrorMetrics,
|
error_counters: TransactionErrorMetrics,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue