Skip to content

Commit

Permalink
feat/inverted-index-cache:
Browse files Browse the repository at this point in the history
 Refactor cache configuration for inverted index

 - Moved `inverted_index_metadata_cache_size` and `inverted_index_cache_size` from `MitoConfig` to `InvertedIndexConfig`.
  • Loading branch information
v0y4g3r committed Jul 8, 2024
1 parent f1e3558 commit 9b457d9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions src/mito2/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,6 @@ pub struct MitoConfig {
pub vector_cache_size: ReadableSize,
/// Cache size for pages of SST row groups. Setting it to 0 to disable the cache.
pub page_cache_size: ReadableSize,
/// Cache size for metadata of inverted index. Setting it to 0 to disable the cache.
pub inverted_index_metadata_cache_size: ReadableSize,
/// Cache size for inverted index content. Setting it to 0 to disable the cache.
pub inverted_index_cache_size: ReadableSize,
/// Whether to enable the experimental write cache.
pub enable_experimental_write_cache: bool,
/// File system path for write cache, defaults to `{data_home}/write_cache`.
Expand Down Expand Up @@ -137,8 +133,6 @@ impl Default for MitoConfig {
sst_meta_cache_size: ReadableSize::mb(128),
vector_cache_size: ReadableSize::mb(512),
page_cache_size: ReadableSize::mb(512),
inverted_index_metadata_cache_size: ReadableSize::mb(32),
inverted_index_cache_size: ReadableSize::mb(32),
enable_experimental_write_cache: false,
experimental_write_cache_path: String::new(),
experimental_write_cache_size: ReadableSize::mb(512),
Expand Down Expand Up @@ -387,6 +381,11 @@ pub struct InvertedIndexConfig {
#[deprecated = "use [IndexConfig::write_buffer_size] instead"]
#[serde(skip_serializing)]
pub write_buffer_size: ReadableSize,

/// Cache size for metadata of inverted index. Setting it to 0 to disable the cache.
pub metadata_cache_size: ReadableSize,
/// Cache size for inverted index content. Setting it to 0 to disable the cache.
pub content_cache_size: ReadableSize,
}

impl Default for InvertedIndexConfig {
Expand All @@ -398,9 +397,10 @@ impl Default for InvertedIndexConfig {
apply_on_query: Mode::Auto,
mem_threshold_on_create: MemoryThreshold::Auto,
compress: true,

write_buffer_size: ReadableSize::mb(8),
intermediate_path: String::new(),
metadata_cache_size: ReadableSize::mb(32),
content_cache_size: ReadableSize::mb(32),
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/mito2/src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ impl WorkerGroup {
.sst_meta_cache_size(config.sst_meta_cache_size.as_bytes())
.vector_cache_size(config.vector_cache_size.as_bytes())
.page_cache_size(config.page_cache_size.as_bytes())
.index_metadata_size(config.inverted_index_metadata_cache_size.as_bytes())
.index_content_size(config.inverted_index_cache_size.as_bytes())
.index_metadata_size(config.inverted_index.metadata_cache_size.as_bytes())
.index_content_size(config.inverted_index.content_cache_size.as_bytes())
.write_cache(write_cache)
.build(),
);
Expand Down
4 changes: 2 additions & 2 deletions tests-integration/tests/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -820,8 +820,6 @@ manifest_checkpoint_distance = 10
compress_manifest = false
max_background_jobs = 4
auto_flush_interval = "30m"
inverted_index_metadata_cache_size = "32MiB"
inverted_index_cache_size = "32MiB"
enable_experimental_write_cache = false
experimental_write_cache_path = ""
experimental_write_cache_size = "512MiB"
Expand All @@ -841,6 +839,8 @@ create_on_compaction = "auto"
apply_on_query = "auto"
mem_threshold_on_create = "auto"
compress = true
metadata_cache_size = "32MiB"
content_cache_size = "32MiB"
[region_engine.mito.fulltext_index]
create_on_flush = "auto"
Expand Down

0 comments on commit 9b457d9

Please sign in to comment.