diff --git a/src/datanode/src/config.rs b/src/datanode/src/config.rs index 72fc7da491cc..4e1b4f3195a7 100644 --- a/src/datanode/src/config.rs +++ b/src/datanode/src/config.rs @@ -62,10 +62,7 @@ impl ObjectStoreConfig { /// Returns true when it's a remote object storage such as AWS s3 etc. pub fn is_object_storage(&self) -> bool { - matches!( - self, - Self::S3(_) | Self::Oss(_) | Self::Azblob(_) | Self::Gcs(_) - ) + !matches!(self, Self::File(_)) } /// Returns the object storage configuration name, return the provider name if it's empty. diff --git a/src/datanode/src/datanode.rs b/src/datanode/src/datanode.rs index a8170bbb696c..53a0cf9fd78b 100644 --- a/src/datanode/src/datanode.rs +++ b/src/datanode/src/datanode.rs @@ -399,17 +399,10 @@ impl DatanodeBuilder { for engine in &opts.region_engine { match engine { RegionEngineConfig::Mito(config) => { - let mut config = config.clone(); - if opts.storage.is_object_storage() { - // Enable the write cache when setting object storage - config.enable_experimental_write_cache = true; - info!("Configured 'enable_experimental_write_cache=true' for mito engine."); - } - let mito_engine = Self::build_mito_engine( opts, object_store_manager.clone(), - config, + config.clone(), schema_metadata_manager.clone(), plugins.clone(), ) @@ -435,10 +428,16 @@ impl DatanodeBuilder { async fn build_mito_engine( opts: &DatanodeOptions, object_store_manager: ObjectStoreManagerRef, - config: MitoConfig, + mut config: MitoConfig, schema_metadata_manager: SchemaMetadataManagerRef, plugins: Plugins, ) -> Result { + if opts.storage.is_object_storage() { + // Enable the write cache when setting object storage + config.enable_experimental_write_cache = true; + info!("Configured 'enable_experimental_write_cache=true' for mito engine."); + } + let mito_engine = match &opts.wal { DatanodeWalConfig::RaftEngine(raft_engine_config) => MitoEngine::new( &opts.storage.data_home,