mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-15 12:30:38 +00:00
fix: remove metadata region options (#5852)
* fix/remove-metadata-region-options: ### Add `SKIP_WAL_KEY` Option to Metric Engine - **Enhancements**: - Introduced `SKIP_WAL_KEY` to the metric engine options in `create.rs` and `mito_engine_options.rs`. - Updated test cases in `create.rs` to include `skip_wal` option and ensure it is removed for metadata regions. - **Refactoring**: - Updated `requests.rs` to use `SKIP_WAL_KEY` from `store_api::mito_engine_options`. These changes enhance the metric engine by allowing the option to skip Write-Ahead Logging (WAL) and ensure consistent usage of option keys across modules. * fix/remove-metadata-region-options: Add note for new options in mito_engine_options.rs • Introduce a comment to remind developers to check if new options should be removed in region_options_for_metadata_region within metric_engine::engine::create. * empty
This commit is contained in:
@@ -34,7 +34,7 @@ use store_api::metric_engine_consts::{
|
||||
METADATA_SCHEMA_VALUE_COLUMN_INDEX, METADATA_SCHEMA_VALUE_COLUMN_NAME,
|
||||
};
|
||||
use store_api::mito_engine_options::{
|
||||
APPEND_MODE_KEY, MEMTABLE_PARTITION_TREE_PRIMARY_KEY_ENCODING, TTL_KEY,
|
||||
APPEND_MODE_KEY, MEMTABLE_PARTITION_TREE_PRIMARY_KEY_ENCODING, SKIP_WAL_KEY, TTL_KEY,
|
||||
};
|
||||
use store_api::region_engine::RegionEngine;
|
||||
use store_api::region_request::{AffectedRows, RegionCreateRequest, RegionRequest};
|
||||
@@ -549,6 +549,7 @@ pub(crate) fn region_options_for_metadata_region(
|
||||
// Don't allow to set primary key encoding for metadata region.
|
||||
original.remove(MEMTABLE_PARTITION_TREE_PRIMARY_KEY_ENCODING);
|
||||
original.insert(TTL_KEY.to_string(), FOREVER.to_string());
|
||||
original.remove(SKIP_WAL_KEY);
|
||||
original
|
||||
}
|
||||
|
||||
@@ -685,8 +686,12 @@ mod test {
|
||||
#[tokio::test]
|
||||
async fn test_create_request_for_physical_regions() {
|
||||
// original request
|
||||
let mut ttl_options = HashMap::new();
|
||||
ttl_options.insert("ttl".to_string(), "60m".to_string());
|
||||
let options: HashMap<_, _> = [
|
||||
("ttl".to_string(), "60m".to_string()),
|
||||
("skip_wal".to_string(), "true".to_string()),
|
||||
]
|
||||
.into_iter()
|
||||
.collect();
|
||||
let request = RegionCreateRequest {
|
||||
engine: METRIC_ENGINE_NAME.to_string(),
|
||||
column_metadatas: vec![
|
||||
@@ -710,7 +715,7 @@ mod test {
|
||||
},
|
||||
],
|
||||
primary_key: vec![0],
|
||||
options: ttl_options,
|
||||
options,
|
||||
region_dir: "/test_dir".to_string(),
|
||||
};
|
||||
|
||||
@@ -742,5 +747,6 @@ mod test {
|
||||
metadata_region_request.options.get("ttl").unwrap(),
|
||||
"forever"
|
||||
);
|
||||
assert!(!metadata_region_request.options.contains_key("skip_wal"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,6 +59,9 @@ pub const MEMTABLE_PARTITION_TREE_DATA_FREEZE_THRESHOLD: &str =
|
||||
/// Option key for memtable partition tree fork dictionary bytes.
|
||||
pub const MEMTABLE_PARTITION_TREE_FORK_DICTIONARY_BYTES: &str =
|
||||
"memtable.partition_tree.fork_dictionary_bytes";
|
||||
/// Option key for skipping WAL.
|
||||
pub const SKIP_WAL_KEY: &str = "skip_wal";
|
||||
// Note: Adding new options here should also check if this option should be removed in [metric_engine::engine::create::region_options_for_metadata_region].
|
||||
|
||||
/// Returns true if the `key` is a valid option key for the mito engine.
|
||||
pub fn is_mito_engine_option_key(key: &str) -> bool {
|
||||
|
||||
@@ -99,7 +99,7 @@ pub const TTL_KEY: &str = store_api::mito_engine_options::TTL_KEY;
|
||||
pub const STORAGE_KEY: &str = "storage";
|
||||
pub const COMMENT_KEY: &str = "comment";
|
||||
pub const AUTO_CREATE_TABLE_KEY: &str = "auto_create_table";
|
||||
pub const SKIP_WAL_KEY: &str = "skip_wal";
|
||||
pub const SKIP_WAL_KEY: &str = store_api::mito_engine_options::SKIP_WAL_KEY;
|
||||
|
||||
impl TableOptions {
|
||||
pub fn try_from_iter<T: ToString, U: IntoIterator<Item = (T, T)>>(
|
||||
|
||||
Reference in New Issue
Block a user