Get transactions from LockedAccountsResults when possible (#5923)

This commit is contained in:
Michael Vines
2019-09-17 08:41:56 -07:00
committed by GitHub
parent 39ba9cb489
commit e26f68fe62
4 changed files with 18 additions and 19 deletions

View File

@ -480,7 +480,6 @@ impl BankingStage {
fn process_and_record_transactions_locked(
bank: &Bank,
txs: &[Transaction],
poh: &Arc<Mutex<PohRecorder>>,
lock_results: &LockedAccountsResults,
) -> (Result<usize>, Vec<usize>) {
@ -489,8 +488,9 @@ impl BankingStage {
// the likelihood of any single thread getting starved and processing old ids.
// TODO: Banking stage threads should be prioritized to complete faster then this queue
// expires.
let txs = lock_results.transactions();
let (mut loaded_accounts, results, mut retryable_txs, tx_count, signature_count) =
bank.load_and_execute_transactions(txs, lock_results, MAX_PROCESSING_AGE);
bank.load_and_execute_transactions(lock_results, MAX_PROCESSING_AGE);
load_execute_time.stop();
let freeze_lock = bank.freeze_lock();
@ -547,7 +547,7 @@ impl BankingStage {
lock_time.stop();
let (result, mut retryable_txs) =
Self::process_and_record_transactions_locked(bank, txs, poh, &lock_results);
Self::process_and_record_transactions_locked(bank, poh, &lock_results);
retryable_txs.iter_mut().for_each(|x| *x += chunk_offset);
let mut unlock_time = Measure::start("unlock_time");

View File

@ -43,23 +43,22 @@ fn par_execute_entries(bank: &Bank, entries: &[(&Entry, LockedAccountsResults)])
thread_pool.borrow().install(|| {
entries
.into_par_iter()
.map(|(e, locked_accounts)| {
.map(|(entry, locked_accounts)| {
let results = bank.load_execute_and_commit_transactions(
&e.transactions,
locked_accounts,
MAX_RECENT_BLOCKHASHES,
);
let mut first_err = None;
for (r, tx) in results.iter().zip(e.transactions.iter()) {
if let Err(ref e) = r {
for (r, tx) in results.iter().zip(entry.transactions.iter()) {
if let Err(ref entry) = r {
if first_err.is_none() {
first_err = Some(r.clone());
}
if !Bank::can_commit(&r) {
warn!("Unexpected validator error: {:?}, tx: {:?}", e, tx);
warn!("Unexpected validator error: {:?}, tx: {:?}", entry, tx);
datapoint_error!(
"validator_process_entry_error",
("error", format!("error: {:?}, tx: {:?}", e, tx), String)
("error", format!("error: {:?}, tx: {:?}", entry, tx), String)
);
}
}