Skip to content
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

Rename types and metrics from executed to processed #2435

Merged
merged 4 commits into from
Aug 9, 2024

Conversation

jstarry
Copy link

@jstarry jstarry commented Aug 5, 2024

Problem

Once we implement solana-foundation/solana-improvement-documents#82 we will need to distinguish between valid transactions that were executed and those that were not able to be executed (but still able valid for committing to a block).

Summary of Changes

  • Replaced usages of TransactionExecutionResult with a type alias TransactionProcessingResult which for now only wraps an ExecutedTransaction but in the future will wrap an enum that additionally has variants for valid transactions that were not executed.
  • Renamed consume worker and leader slot metric names to use "processed" instead of "executed"
  • Renamed other structs and variable names to use "processed" instead of "executed"

Fixes #

Comment on lines +80 to +81
pub(crate) processed_count: u64,
// Total number of the processed transactions that returned success/not
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can a processed transaction have failed? I think this parameter counts the number of transaction that succeeded (were executed).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can a processed transaction have failed?

Yes a processed transaction could have had "failure" result meaning that we definitely validated the fee payer but may or may not have executed it successfully.

I think this parameter counts the number of transaction that succeeded (were executed)

This parameter used to count the number of transactions that were executed (whether the execution result was success or failure, is irrelevant). Now it counts the number of transactions that were "processed" (meaning valid for including in a block) whether they were executed or not.

Ok(()) => {
execution_counts.executed_successfully_count += 1;
processed_counts.processed_successfully += 1;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related to my comment above, are you considering that a transaction whose execution has failed has been successfully processed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, only transactions that were executed with a successful result are considered to have been "processed successfully" here.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does "processed successfully" mean valid for including in a block?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it means that they were executed with a successful execution result

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I renamed to processed_with_successful_result_count

@@ -1665,9 +1666,9 @@ mod tests {
assert_eq!(
transaction_counts,
ExecuteAndCommitTransactionsCounts {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this struct not be renamed too?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah sure, I renamed to LeaderProcessedTransactionCounts

apfitzge
apfitzge previously approved these changes Aug 8, 2024
@@ -145,7 +147,7 @@ impl Committer {
let batch_transaction_indexes: Vec<_> = commit_results
.iter()
.map(|commit_result| {
if commit_result.was_executed() {
if commit_result.was_committed() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be was_processed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Committed implies processed. I think committed is more appropriate here

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, think that committed is probably more appropriate here. This is meant to gather and communicate state changes, which will only occur if the tx is committed.

@@ -71,15 +72,15 @@ pub struct ExecuteAndCommitTransactionsOutput {
}

#[derive(Debug, Default, PartialEq)]
pub struct ExecuteAndCommitTransactionsCounts {
pub struct LeaderProcessedTransactionCounts {
// Total number of transactions that were passed as candidates for execution
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Total number of transactions that were passed as candidates for execution
// Total number of transactions that were passed as candidates for processing

Comment on lines -640 to +642
if execution_result.was_executed() {
.filter_map(|(processing_result, tx)| {
if processing_result.was_processed() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case not only is the function name changing, but also the semantics. The was_executed() can be false even if the fee validation has passed, but was_processed() would be true in that case, right?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's correct

ExecuteAndCommitTransactionsCounts {
attempted_execution_count: 1,
LeaderProcessedTransactionCounts {
attempted_processing_count: 1,
// Transactions was still executed, just wasn't committed, so should be counted here.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Transactions was still executed, just wasn't committed, so should be counted here.
// Transaction was still processed, just wasn't committed, so should be counted here.

Comment on lines +17 to +20
fn was_processed(&self) -> bool {
self.is_ok()
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are considering not processed if self is err, but you also replaced NotExecuted by Err. Are you accounting for the case where a processed transaction may have not been executed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not yet in this change. That change to support processing transactions that may not have been executed will come next in #2425. See https://github.com/anza-xyz/agave/pull/2425/files#diff-5eb12bc3fc00b926c18e4204f316d650074ce4fe4bce7d664459c3cf340af5aeR21-R24

@jstarry jstarry force-pushed the refactor/rename-to-processed branch from d17ae1a to b94019a Compare August 9, 2024 00:48
@jstarry
Copy link
Author

jstarry commented Aug 9, 2024

force pushed to rebase on master in order to pick up new svm/examples which also had some things that needed to be renamed. See b94019a

@jstarry jstarry merged commit 935b45a into anza-xyz:master Aug 9, 2024
41 checks passed
@jstarry jstarry deleted the refactor/rename-to-processed branch August 9, 2024 18:03
ray-kast pushed a commit to abklabs/agave that referenced this pull request Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants