Skip to content

Commit

Permalink
feat: add new option allow skip disk cache check when cache in memory (
Browse files Browse the repository at this point in the history
  • Loading branch information
hengfeiyang committed Apr 17, 2024
1 parent 7e457c3 commit c2c2d50
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/config/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -793,10 +793,12 @@ pub struct MemoryCache {
// MB, when cache is full will release how many data once time, default is 1% of max_size
#[env_config(name = "ZO_MEMORY_CACHE_RELEASE_SIZE", default = 0)]
pub release_size: usize,
#[env_config(name = "ZO_MEMORY_CACHE_GC_SIZE", default = 10)] // MB
#[env_config(name = "ZO_MEMORY_CACHE_GC_SIZE", default = 50)] // MB
pub gc_size: usize,
#[env_config(name = "ZO_MEMORY_CACHE_GC_INTERVAL", default = 0)] // seconds
pub gc_interval: u64,
#[env_config(name = "ZO_MEMORY_CACHE_SKIP_DISK_CHECK", default = false)]
pub skip_disk_check: bool,
// MB, default is 50% of system memory
#[env_config(name = "ZO_MEMORY_CACHE_DATAFUSION_MAX_SIZE", default = 0)]
pub datafusion_max_size: usize,
Expand All @@ -821,7 +823,7 @@ pub struct DiskCache {
// MB, when cache is full will release how many data once time, default is 1% of max_size
#[env_config(name = "ZO_DISK_CACHE_RELEASE_SIZE", default = 0)]
pub release_size: usize,
#[env_config(name = "ZO_DISK_CACHE_GC_SIZE", default = 10)] // MB
#[env_config(name = "ZO_DISK_CACHE_GC_SIZE", default = 100)] // MB
pub gc_size: usize,
#[env_config(name = "ZO_DISK_CACHE_GC_INTERVAL", default = 0)] // seconds
pub gc_interval: u64,
Expand Down
3 changes: 2 additions & 1 deletion src/service/search/grpc/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,8 @@ async fn cache_parquet_files(
let ret = match cache_type {
file_data::CacheType::Memory => {
if !file_data::memory::exist(&file_name).await
&& !file_data::disk::exist(&file_name).await
&& (CONFIG.memory_cache.skip_disk_check
|| !file_data::disk::exist(&file_name).await)
{
file_data::memory::download(&trace_id, &file_name)
.await
Expand Down

0 comments on commit c2c2d50

Please sign in to comment.