Skip to content

Commit

Permalink
chore: apply review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
killme2008 committed Dec 10, 2024
1 parent c6f6d26 commit 2db232e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
5 changes: 1 addition & 4 deletions src/datanode/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
17 changes: 8 additions & 9 deletions src/datanode/src/datanode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
)
Expand All @@ -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<MitoEngine> {
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,
Expand Down

0 comments on commit 2db232e

Please sign in to comment.