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

Group DB commit paramenters to ChunkToCommit #14988

Merged
merged 5 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Aptos Foundation
// SPDX-License-Identifier: Apache-2.0

use aptos_executor_types::{ExecutorResult, StateComputeResult};
use aptos_executor_types::{state_compute_result::StateComputeResult, ExecutorResult};
use aptos_types::transaction::SignedTransaction;
use derivative::Derivative;
use futures::future::BoxFuture;
Expand Down
2 changes: 1 addition & 1 deletion consensus/consensus-types/src/pipelined_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::{
vote_proposal::VoteProposal,
};
use aptos_crypto::hash::{HashValue, ACCUMULATOR_PLACEHOLDER_HASH};
use aptos_executor_types::{ExecutorResult, StateComputeResult};
use aptos_executor_types::{state_compute_result::StateComputeResult, ExecutorResult};
use aptos_infallible::Mutex;
use aptos_logger::{error, warn};
use aptos_types::{
Expand Down
2 changes: 1 addition & 1 deletion consensus/src/block_storage/block_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use aptos_consensus_types::{
wrapped_ledger_info::WrappedLedgerInfo,
};
use aptos_crypto::{hash::ACCUMULATOR_PLACEHOLDER_HASH, HashValue};
use aptos_executor_types::StateComputeResult;
use aptos_executor_types::state_compute_result::StateComputeResult;
use aptos_infallible::{Mutex, RwLock};
use aptos_logger::prelude::*;
use aptos_types::{
Expand Down
2 changes: 1 addition & 1 deletion consensus/src/dag/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use aptos_consensus_types::{
quorum_cert::QuorumCert,
};
use aptos_crypto::HashValue;
use aptos_executor_types::StateComputeResult;
use aptos_executor_types::state_compute_result::StateComputeResult;
use aptos_infallible::RwLock;
use aptos_logger::{error, info};
use aptos_storage_interface::DbReader;
Expand Down
13 changes: 4 additions & 9 deletions consensus/src/execution_pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ use crate::{
use aptos_consensus_types::{block::Block, pipeline_execution_result::PipelineExecutionResult};
use aptos_crypto::HashValue;
use aptos_executor_types::{
state_checkpoint_output::StateCheckpointOutput, BlockExecutorTrait, ExecutorError,
ExecutorResult, StateComputeResult,
state_checkpoint_output::StateCheckpointOutput, state_compute_result::StateComputeResult,
BlockExecutorTrait, ExecutorError, ExecutorResult,
};
use aptos_experimental_runtimes::thread_manager::optimal_min_len;
use aptos_logger::{debug, warn};
Expand Down Expand Up @@ -293,7 +293,7 @@ impl ExecutionPipeline {
let executor = executor.clone();
Box::pin(async move {
tokio::task::spawn_blocking(move || {
executor.pre_commit_block(block_id, parent_block_id)
executor.pre_commit_block(block_id)
})
.await
.expect("failed to spawn_blocking")?;
Expand All @@ -307,7 +307,6 @@ impl ExecutionPipeline {
pre_commit_tx
.send(PreCommitCommand {
block_id,
parent_block_id,
pre_commit_hook_fut,
result_tx: pre_commit_result_tx,
lifetime_guard,
Expand Down Expand Up @@ -335,7 +334,6 @@ impl ExecutionPipeline {
) {
while let Some(PreCommitCommand {
block_id,
parent_block_id,
pre_commit_hook_fut,
result_tx,
lifetime_guard,
Expand All @@ -346,9 +344,7 @@ impl ExecutionPipeline {
let executor = executor.clone();
monitor!(
"pre_commit",
tokio::task::spawn_blocking(move || {
executor.pre_commit_block(block_id, parent_block_id)
})
tokio::task::spawn_blocking(move || { executor.pre_commit_block(block_id) })
)
.await
.expect("Failed to spawn_blocking().")?;
Expand Down Expand Up @@ -402,7 +398,6 @@ struct LedgerApplyCommand {

struct PreCommitCommand {
block_id: HashValue,
parent_block_id: HashValue,
pre_commit_hook_fut: BoxFuture<'static, ()>,
result_tx: oneshot::Sender<ExecutorResult<()>>,
lifetime_guard: CountedRequest<()>,
Expand Down
2 changes: 1 addition & 1 deletion consensus/src/pipeline/buffer_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ mod test {
use super::*;
use aptos_consensus_types::{block::Block, block_data::BlockData};
use aptos_crypto::HashValue;
use aptos_executor_types::StateComputeResult;
use aptos_executor_types::state_compute_result::StateComputeResult;
use aptos_types::{
aggregate_signature::AggregateSignature,
ledger_info::LedgerInfo,
Expand Down
2 changes: 1 addition & 1 deletion consensus/src/pipeline/tests/execution_phase_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use aptos_consensus_types::{
quorum_cert::QuorumCert,
};
use aptos_crypto::HashValue;
use aptos_executor_types::{ExecutorError, StateComputeResult};
use aptos_executor_types::{state_compute_result::StateComputeResult, ExecutorError};
use aptos_types::{ledger_info::LedgerInfo, validator_verifier::random_validator_verifier};
use async_trait::async_trait;
use std::sync::{
Expand Down
2 changes: 1 addition & 1 deletion consensus/src/pipeline/tests/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use aptos_consensus_types::{
vote_proposal::VoteProposal,
};
use aptos_crypto::{hash::ACCUMULATOR_PLACEHOLDER_HASH, HashValue};
use aptos_executor_types::StateComputeResult;
use aptos_executor_types::state_compute_result::StateComputeResult;
use aptos_infallible::Mutex;
use aptos_safety_rules::{
test_utils::{make_proposal_with_parent, make_proposal_with_qc},
Expand Down
2 changes: 1 addition & 1 deletion consensus/src/rand/rand_gen/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use aptos_consensus_types::{
quorum_cert::QuorumCert,
};
use aptos_crypto::HashValue;
use aptos_executor_types::StateComputeResult;
use aptos_executor_types::state_compute_result::StateComputeResult;
use aptos_types::{
aggregate_signature::AggregateSignature,
ledger_info::{LedgerInfo, LedgerInfoWithSignatures},
Expand Down
14 changes: 5 additions & 9 deletions consensus/src/state_computer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ use aptos_consensus_types::{
pipelined_block::PipelinedBlock,
};
use aptos_crypto::HashValue;
use aptos_executor_types::{BlockExecutorTrait, ExecutorResult, StateComputeResult};
use aptos_executor_types::{
state_compute_result::StateComputeResult, BlockExecutorTrait, ExecutorResult,
};
use aptos_infallible::RwLock;
use aptos_logger::prelude::*;
use aptos_metrics_core::IntGauge;
Expand Down Expand Up @@ -462,9 +464,7 @@ async fn test_commit_sync_race() {
};
use aptos_config::config::transaction_filter_type::Filter;
use aptos_consensus_notifications::Error;
use aptos_executor_types::{
state_checkpoint_output::StateCheckpointOutput, StateComputeResult,
};
use aptos_executor_types::state_checkpoint_output::StateCheckpointOutput;
use aptos_infallible::Mutex;
use aptos_types::{
aggregate_signature::AggregateSignature,
Expand Down Expand Up @@ -516,11 +516,7 @@ async fn test_commit_sync_race() {
todo!()
}

fn pre_commit_block(
&self,
_block_id: HashValue,
_parent_block_id: HashValue,
) -> ExecutorResult<()> {
fn pre_commit_block(&self, _block_id: HashValue) -> ExecutorResult<()> {
todo!()
}

Expand Down
10 changes: 3 additions & 7 deletions consensus/src/state_computer_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ use aptos_consensus_notifications::{ConsensusNotificationSender, Error};
use aptos_consensus_types::{block::Block, block_data::BlockData};
use aptos_crypto::HashValue;
use aptos_executor_types::{
state_checkpoint_output::StateCheckpointOutput, BlockExecutorTrait, ExecutorResult,
StateComputeResult,
state_checkpoint_output::StateCheckpointOutput, state_compute_result::StateComputeResult,
BlockExecutorTrait, ExecutorResult,
};
use aptos_infallible::Mutex;
use aptos_types::{
Expand Down Expand Up @@ -144,11 +144,7 @@ impl BlockExecutorTrait for DummyBlockExecutor {
Ok(StateComputeResult::new_dummy_with_input_txns(txns))
}

fn pre_commit_block(
&self,
_block_id: HashValue,
_parent_block_id: HashValue,
) -> ExecutorResult<()> {
fn pre_commit_block(&self, _block_id: HashValue) -> ExecutorResult<()> {
Ok(())
}

Expand Down
4 changes: 3 additions & 1 deletion consensus/src/test_utils/mock_state_computer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ use aptos_consensus_types::{
pipelined_block::PipelinedBlock,
};
use aptos_crypto::HashValue;
use aptos_executor_types::{ExecutorError, ExecutorResult, StateComputeResult};
use aptos_executor_types::{
state_compute_result::StateComputeResult, ExecutorError, ExecutorResult,
};
use aptos_logger::debug;
use aptos_types::{
block_executor::config::BlockExecutorConfigFromOnchain, epoch_state::EpochState,
Expand Down
5 changes: 1 addition & 4 deletions execution/executor-benchmark/src/ledger_update_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,7 @@ where
output.root_hash(),
self.version,
);
let parent_block_id = self.executor.committed_block_id();
self.executor
.pre_commit_block(block_id, parent_block_id)
.unwrap();
self.executor.pre_commit_block(block_id).unwrap();
self.executor.commit_ledger(ledger_info_with_sigs).unwrap();
},
CommitProcessing::Skip => {},
Expand Down
7 changes: 2 additions & 5 deletions execution/executor-benchmark/src/transaction_committer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,9 @@ where
.inc_by(num_txns as u64);

self.version += num_txns as u64;
let commit_start = std::time::Instant::now();
let commit_start = Instant::now();
let ledger_info_with_sigs = gen_li_with_sigs(block_id, root_hash, self.version);
let parent_block_id = self.executor.committed_block_id();
self.executor
.pre_commit_block(block_id, parent_block_id)
.unwrap();
self.executor.pre_commit_block(block_id).unwrap();
self.executor.commit_ledger(ledger_info_with_sigs).unwrap();

report_block(
Expand Down
2 changes: 1 addition & 1 deletion execution/executor-test-helpers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use aptos_crypto::{
HashValue,
};
use aptos_executor::db_bootstrapper::{generate_waypoint, maybe_bootstrap};
use aptos_executor_types::StateComputeResult;
use aptos_executor_types::state_compute_result::StateComputeResult;
use aptos_storage_interface::DbReaderWriter;
use aptos_types::{
account_address::AccountAddress,
Expand Down
22 changes: 0 additions & 22 deletions execution/executor-types/src/ledger_update_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@

#![forbid(unsafe_code)]

use crate::StateComputeResult;
use anyhow::{ensure, Result};
use aptos_crypto::HashValue;
use aptos_drop_helper::DropHelper;
use aptos_storage_interface::cached_state_view::ShardedStateCache;
use aptos_types::{
contract_event::ContractEvent,
epoch_state::EpochState,
proof::accumulator::InMemoryTransactionAccumulator,
state_store::ShardedStateUpdates,
transaction::{
Expand Down Expand Up @@ -38,11 +36,6 @@ impl LedgerUpdateOutput {
Self::new_impl(Inner::new_dummy_with_input_txns(txns))
}

#[cfg(any(test, feature = "fuzzing"))]
pub fn new_dummy_with_txns_to_commit(txns: Vec<TransactionToCommit>) -> Self {
Self::new_impl(Inner::new_dummy_with_txns_to_commit(txns))
}

pub fn new_dummy_with_root_hash(root_hash: HashValue) -> Self {
Self::new_impl(Inner::new_dummy_with_root_hash(root_hash))
}
Expand Down Expand Up @@ -80,13 +73,6 @@ impl LedgerUpdateOutput {
inner: Arc::new(DropHelper::new(inner)),
}
}

pub fn as_state_compute_result(
&self,
next_epoch_state: Option<EpochState>,
) -> StateComputeResult {
StateComputeResult::new(self.clone(), next_epoch_state)
}
}

#[derive(Default, Debug)]
Expand Down Expand Up @@ -135,14 +121,6 @@ impl Inner {
}
}

#[cfg(any(test, feature = "fuzzing"))]
pub fn new_dummy_with_txns_to_commit(txns: Vec<TransactionToCommit>) -> Self {
Self {
to_commit: txns,
..Default::default()
}
}

pub fn new_dummy_with_root_hash(root_hash: HashValue) -> Self {
let transaction_accumulator = Arc::new(
InMemoryTransactionAccumulator::new_empty_with_root_hash(root_hash),
Expand Down
Loading
Loading