Skip to content

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jstarry committed Aug 8, 2024
1 parent 919a5b5 commit 8567b7e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
19 changes: 10 additions & 9 deletions core/src/banking_stage/consumer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pub struct ProcessTransactionBatchOutput {
pub struct ExecuteAndCommitTransactionsOutput {
// Transactions counts reported to `ConsumeWorkerMetrics` and then
// accumulated later for `LeaderSlotMetrics`
pub(crate) transaction_counts: ExecuteAndCommitTransactionsCounts,
pub(crate) transaction_counts: LeaderProcessedTransactionCounts,
// Transactions that either were not executed, or were executed and failed to be committed due
// to the block ending.
pub(crate) retryable_transaction_indexes: Vec<usize>,
Expand All @@ -72,7 +72,7 @@ pub struct ExecuteAndCommitTransactionsOutput {
}

#[derive(Debug, Default, PartialEq)]
pub struct ExecuteAndCommitTransactionsCounts {
pub struct LeaderProcessedTransactionCounts {
// Total number of transactions that were passed as candidates for execution
pub(crate) attempted_processing_count: u64,
// The number of transactions of that were processed. See description of in `ProcessTransactionsSummary`
Expand Down Expand Up @@ -627,9 +627,10 @@ impl Consumer {
processed_counts,
} = load_and_execute_transactions_output;

let transaction_counts = ExecuteAndCommitTransactionsCounts {
let transaction_counts = LeaderProcessedTransactionCounts {
processed_count: processed_counts.processed_transactions_count,
processed_with_successful_result_count: processed_counts.processed_successfully,
processed_with_successful_result_count: processed_counts
.processed_with_successful_result_count,
attempted_processing_count: processing_results.len() as u64,
};

Expand Down Expand Up @@ -1121,7 +1122,7 @@ mod tests {

assert_eq!(
transaction_counts,
ExecuteAndCommitTransactionsCounts {
LeaderProcessedTransactionCounts {
attempted_processing_count: 1,
processed_count: 1,
processed_with_successful_result_count: 1,
Expand Down Expand Up @@ -1169,7 +1170,7 @@ mod tests {
} = process_transactions_batch_output.execute_and_commit_transactions_output;
assert_eq!(
transaction_counts,
ExecuteAndCommitTransactionsCounts {
LeaderProcessedTransactionCounts {
attempted_processing_count: 1,
// Transactions was still executed, just wasn't committed, so should be counted here.
processed_count: 1,
Expand Down Expand Up @@ -1310,7 +1311,7 @@ mod tests {

assert_eq!(
transaction_counts,
ExecuteAndCommitTransactionsCounts {
LeaderProcessedTransactionCounts {
attempted_processing_count: 1,
processed_count: 1,
processed_with_successful_result_count: 0,
Expand Down Expand Up @@ -1416,7 +1417,7 @@ mod tests {

assert_eq!(
transaction_counts,
ExecuteAndCommitTransactionsCounts {
LeaderProcessedTransactionCounts {
attempted_processing_count: 1,
processed_count: 0,
processed_with_successful_result_count: 0,
Expand Down Expand Up @@ -1665,7 +1666,7 @@ mod tests {

assert_eq!(
transaction_counts,
ExecuteAndCommitTransactionsCounts {
LeaderProcessedTransactionCounts {
attempted_processing_count: 2,
processed_count: 1,
processed_with_successful_result_count: 1,
Expand Down
4 changes: 2 additions & 2 deletions core/src/banking_stage/leader_slot_metrics.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use {
super::{
consumer::ExecuteAndCommitTransactionsCounts,
consumer::LeaderProcessedTransactionCounts,
leader_slot_timing_metrics::{LeaderExecuteAndCommitTimings, LeaderSlotTimingMetrics},
packet_deserializer::PacketReceiverStats,
unprocessed_transaction_storage::{
Expand Down Expand Up @@ -69,7 +69,7 @@ pub struct CommittedTransactionsCounts {
impl CommittedTransactionsCounts {
pub fn accumulate(
&mut self,
transaction_counts: &ExecuteAndCommitTransactionsCounts,
transaction_counts: &LeaderProcessedTransactionCounts,
committed: bool,
) {
saturating_add_assign!(
Expand Down
14 changes: 7 additions & 7 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,10 +321,10 @@ impl BankRc {
}

pub struct LoadAndExecuteTransactionsOutput {
// Vector of results indicating whether a transaction was executed or could not
// be executed. Note executed transactions can still have failed!
// Vector of results indicating whether a transaction was processed or could not
// be processed. Note processed transactions can still have failed!
pub processing_results: Vec<TransactionProcessingResult>,
// Executed transaction counts used to update bank transaction counts and
// Processed transaction counts used to update bank transaction counts and
// for metrics reporting.
pub processed_counts: ProcessedTransactionCounts,
}
Expand Down Expand Up @@ -892,7 +892,7 @@ struct PrevEpochInflationRewards {
pub struct ProcessedTransactionCounts {
pub processed_transactions_count: u64,
pub processed_non_vote_transactions_count: u64,
pub processed_successfully: u64,
pub processed_with_successful_result_count: u64,
pub signature_count: u64,
}

Expand Down Expand Up @@ -3665,7 +3665,7 @@ impl Bank {

match processing_result.flattened_result() {
Ok(()) => {
processed_counts.processed_successfully += 1;
processed_counts.processed_with_successful_result_count += 1;
}
Err(err) => {
if *err_count == 0 {
Expand Down Expand Up @@ -3897,7 +3897,7 @@ impl Bank {
let ProcessedTransactionCounts {
processed_transactions_count,
processed_non_vote_transactions_count,
processed_successfully,
processed_with_successful_result_count,
signature_count,
} = *processed_counts;

Expand All @@ -3908,7 +3908,7 @@ impl Bank {
self.increment_signature_count(signature_count);

let processed_with_failure_result_count =
processed_transactions_count.saturating_sub(processed_successfully);
processed_transactions_count.saturating_sub(processed_with_successful_result_count);
self.transaction_error_count
.fetch_add(processed_with_failure_result_count, Relaxed);

Expand Down

0 comments on commit 8567b7e

Please sign in to comment.