Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(metric-engine): set ttl also on opening metadata regions #5051

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions src/metric-engine/src/engine/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -456,11 +456,7 @@ impl MetricEngineInner {
// concat region dir
let metadata_region_dir = join_dir(&request.region_dir, METADATA_REGION_SUBDIR);

// remove TTL and APPEND_MODE option
let mut options = request.options.clone();
options.insert(TTL_KEY.to_string(), "10000 years".to_string());
options.remove(APPEND_MODE_KEY);

let options = region_options_for_metadata_region(request.options.clone());
RegionCreateRequest {
engine: MITO_ENGINE_NAME.to_string(),
column_metadatas: vec![
Expand Down Expand Up @@ -539,6 +535,15 @@ impl MetricEngineInner {
}
}

/// Creates the region options for metadata region in metric engine.
pub(crate) fn region_options_for_metadata_region(
mut original: HashMap<String, String>,
) -> HashMap<String, String> {
original.remove(APPEND_MODE_KEY);
original.insert(TTL_KEY.to_string(), "10000 years".to_string());
original
}

#[cfg(test)]
mod test {
use store_api::metric_engine_consts::{METRIC_ENGINE_NAME, PHYSICAL_TABLE_METADATA_KEY};
Expand Down
4 changes: 3 additions & 1 deletion src/metric-engine/src/engine/open.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use store_api::region_request::{AffectedRows, RegionOpenRequest, RegionRequest};
use store_api::storage::RegionId;

use super::MetricEngineInner;
use crate::engine::create::region_options_for_metadata_region;
use crate::engine::options::set_data_region_options;
use crate::error::{OpenMitoRegionSnafu, Result};
use crate::metrics::{LOGICAL_REGION_COUNT, PHYSICAL_REGION_COUNT};
Expand Down Expand Up @@ -68,9 +69,10 @@ impl MetricEngineInner {
let metadata_region_dir = join_dir(&request.region_dir, METADATA_REGION_SUBDIR);
let data_region_dir = join_dir(&request.region_dir, DATA_REGION_SUBDIR);

let metadata_region_options = region_options_for_metadata_region(request.options.clone());
let open_metadata_region_request = RegionOpenRequest {
region_dir: metadata_region_dir,
options: request.options.clone(),
options: metadata_region_options,
engine: MITO_ENGINE_NAME.to_string(),
skip_wal_replay: request.skip_wal_replay,
};
Expand Down
3 changes: 2 additions & 1 deletion typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ extend-exclude = [
"tests-fuzz/src/data/lorem_words",
"*.sql",
"*.result",
"src/pipeline/benches/data.log"
"src/pipeline/benches/data.log",
"cyborg/pnpm-lock.yaml"
]