undo cost of executed-but-not-recorded transactions from cost_tracker

This commit is contained in:
Tao Zhu 2022-04-11 16:00:09 -05:00 committed by Tao Zhu
parent 23d365d02f
commit 810b1dff40
1 changed files with 11 additions and 6 deletions

View File

@ -118,7 +118,7 @@ pub struct ExecuteAndCommitTransactionsOutput {
commit_transactions_result: Result<(), PohRecorderError>,
execute_and_commit_timings: LeaderExecuteAndCommitTimings,
// True if transaction was-executed()
transactions_executed_status: Vec<bool>,
transactions_execute_and_record_status: Vec<bool>,
}
#[derive(Debug, Default)]
@ -1206,7 +1206,7 @@ impl BankingStage {
..
} = load_and_execute_transactions_output;
let transactions_executed_status = execution_results
let mut transactions_execute_and_record_status: Vec<bool> = execution_results
.iter()
.map(|execution_result| execution_result.was_executed())
.collect();
@ -1236,6 +1236,11 @@ impl BankingStage {
} = record_transactions_summary;
execute_and_commit_timings.record_transactions_timings = record_transactions_timings;
// mark transactions that were executed but not recorded
retryable_record_transaction_indexes.iter().for_each(|i| {
transactions_execute_and_record_status[*i] = false;
});
inc_new_counter_info!(
"banking_stage-record_transactions_num_to_commit",
*commit_transactions_result.as_ref().unwrap_or(&0)
@ -1254,7 +1259,7 @@ impl BankingStage {
retryable_transaction_indexes,
commit_transactions_result: Err(e),
execute_and_commit_timings,
transactions_executed_status,
transactions_execute_and_record_status,
};
}
@ -1341,7 +1346,7 @@ impl BankingStage {
retryable_transaction_indexes,
commit_transactions_result: Ok(()),
execute_and_commit_timings,
transactions_executed_status,
transactions_execute_and_record_status,
}
}
@ -1398,7 +1403,7 @@ impl BankingStage {
let ExecuteAndCommitTransactionsOutput {
ref mut retryable_transaction_indexes,
ref execute_and_commit_timings,
ref transactions_executed_status,
ref transactions_execute_and_record_status,
..
} = execute_and_commit_transactions_output;
@ -1408,7 +1413,7 @@ impl BankingStage {
QosService::update_or_remove_transaction_costs(
transaction_costs.iter(),
transactions_qos_results.iter(),
transactions_executed_status.iter(),
transactions_execute_and_record_status.iter(),
bank,
);