From 4c1870332c2286beec75d8e78a8dff3bd30e7374 Mon Sep 17 00:00:00 2001 From: zyy17 Date: Sat, 30 Aug 2025 18:03:16 -0700 Subject: [PATCH] refactor: if `cache_path` is empty and `enable_read_cache` is true, set the default cache dir Signed-off-by: zyy17 --- src/datanode/src/store.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/datanode/src/store.rs b/src/datanode/src/store.rs index c506a7e280..491408836e 100644 --- a/src/datanode/src/store.rs +++ b/src/datanode/src/store.rs @@ -131,10 +131,8 @@ async fn build_cache_layer( _ => unreachable!("Already checked above"), }; - // Enable object cache by default - // Set the cache_path to be `${data_home}` by default - // if it's not present - if cache_path.is_none() { + // If `cache_path` is unset or an empty string, default to use `${data_home}` as the local read cache directory. + if cache_path.as_ref().is_none_or(|p| p.is_empty()) { let read_cache_path = data_home.to_string(); tokio::fs::create_dir_all(Path::new(&read_cache_path)) .await