Skip to content

Commit

Permalink
Remove PassthroughCache as an option. (It is still present so that no…
Browse files Browse the repository at this point in the history
…des currently using it do not break)
  • Loading branch information
mystenmark committed Nov 20, 2024
1 parent 9521492 commit 59b8d2f
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions crates/sui-core/src/execution_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

use crate::authority::authority_per_epoch_store::AuthorityPerEpochStore;
use crate::authority::authority_store::{ExecutionLockWriteGuard, SuiLockResult};
use crate::authority::epoch_start_configuration::EpochFlag;
use crate::authority::epoch_start_configuration::EpochStartConfiguration;
use crate::authority::epoch_start_configuration::{EpochFlag, EpochStartConfigTrait};
use crate::authority::AuthorityStore;
use crate::state_accumulator::AccumulatorStore;
use crate::transaction_outputs::TransactionOutputs;
Expand Down Expand Up @@ -35,7 +35,7 @@ use sui_types::{
object::Owner,
storage::InputKey,
};
use tracing::instrument;
use tracing::{error, instrument};

pub(crate) mod cache_types;
pub mod metrics;
Expand Down Expand Up @@ -112,7 +112,7 @@ pub enum ExecutionCacheConfigType {
PassthroughCache,
}

pub fn choose_execution_cache(config: &ExecutionCacheConfig) -> ExecutionCacheConfigType {
pub fn choose_execution_cache(_: &ExecutionCacheConfig) -> ExecutionCacheConfigType {
#[cfg(msim)]
{
let mut use_random_cache = None;
Expand All @@ -130,13 +130,11 @@ pub fn choose_execution_cache(config: &ExecutionCacheConfig) -> ExecutionCacheCo
}
}

if std::env::var(DISABLE_WRITEBACK_CACHE_ENV_VAR).is_ok()
|| matches!(config, ExecutionCacheConfig::PassthroughCache)
{
ExecutionCacheConfigType::PassthroughCache
} else {
ExecutionCacheConfigType::WritebackCache
if std::env::var(DISABLE_WRITEBACK_CACHE_ENV_VAR).is_ok() {
error!("DISABLE_WRITEBACK_CACHE is no longer respected. WritebackCache is the default.");
}

ExecutionCacheConfigType::WritebackCache
}

pub fn build_execution_cache(
Expand All @@ -145,9 +143,19 @@ pub fn build_execution_cache(
store: &Arc<AuthorityStore>,
) -> ExecutionCacheTraitPointers {
let execution_cache_metrics = Arc::new(ExecutionCacheMetrics::new(prometheus_registry));
ExecutionCacheTraitPointers::new(
ProxyCache::new(epoch_start_config, store.clone(), execution_cache_metrics).into(),
)

if matches!(
epoch_start_config.execution_cache_type(),
ExecutionCacheConfigType::WritebackCache
) {
ExecutionCacheTraitPointers::new(
WritebackCache::new(store.clone(), execution_cache_metrics).into(),
)
} else {
ExecutionCacheTraitPointers::new(
ProxyCache::new(epoch_start_config, store.clone(), execution_cache_metrics).into(),
)
}
}

/// Should only be used for sui-tool or tests. Nodes must use build_execution_cache which
Expand Down

0 comments on commit 59b8d2f

Please sign in to comment.