diff --git a/src/mito2/src/compaction/compactor.rs b/src/mito2/src/compaction/compactor.rs index 9153fd39c3db..c7e4f67c29dd 100644 --- a/src/mito2/src/compaction/compactor.rs +++ b/src/mito2/src/compaction/compactor.rs @@ -19,6 +19,7 @@ use std::time::Duration; use api::v1::region::compact_request; use common_telemetry::info; use object_store::manager::ObjectStoreManager; +use serde::{Deserialize, Serialize}; use smallvec::SmallVec; use snafu::{OptionExt, ResultExt}; use store_api::metadata::RegionMetadataRef; @@ -174,7 +175,7 @@ pub async fn open_compaction_region( } /// `[MergeOutput]` represents the output of merging SST files. -#[derive(Default, Clone, Debug)] +#[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct MergeOutput { pub files_to_add: Vec, pub files_to_remove: Vec, diff --git a/src/mito2/src/region/options.rs b/src/mito2/src/region/options.rs index 5a2df0d8cc56..d4a27fca3e39 100644 --- a/src/mito2/src/region/options.rs +++ b/src/mito2/src/region/options.rs @@ -22,7 +22,7 @@ use std::time::Duration; use common_base::readable_size::ReadableSize; use common_wal::options::{WalOptions, WAL_OPTIONS_KEY}; use serde::de::Error as _; -use serde::{Deserialize, Deserializer}; +use serde::{Deserialize, Deserializer, Serialize}; use serde_json::Value; use serde_with::{serde_as, with_prefix, DisplayFromStr}; use snafu::{ensure, ResultExt}; @@ -36,7 +36,7 @@ const DEFAULT_INDEX_SEGMENT_ROW_COUNT: usize = 1024; /// Options that affect the entire region. /// /// Users need to specify the options while creating/opening a region. -#[derive(Debug, Default, Clone, PartialEq, Eq, Deserialize)] +#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)] #[serde(default)] pub struct RegionOptions { /// Region SST files TTL. @@ -102,7 +102,7 @@ impl TryFrom<&HashMap> for RegionOptions { } /// Options for compactions -#[derive(Debug, Clone, PartialEq, Eq, Deserialize)] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] #[serde(tag = "compaction.type")] #[serde(rename_all = "snake_case")] pub enum CompactionOptions { @@ -127,7 +127,7 @@ impl Default for CompactionOptions { /// Time window compaction options. #[serde_as] -#[derive(Debug, Clone, PartialEq, Eq, Deserialize)] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] #[serde(default)] pub struct TwcsOptions { /// Max num of files that can be kept in active writing time window. @@ -195,7 +195,7 @@ impl Default for RegionOptionsWithoutEnum { with_prefix!(prefix_inverted_index "index.inverted_index."); /// Options for index. -#[derive(Debug, Clone, PartialEq, Eq, Default, Deserialize)] +#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)] #[serde(default)] pub struct IndexOptions { /// Options for the inverted index. @@ -205,7 +205,7 @@ pub struct IndexOptions { /// Options for the inverted index. #[serde_as] -#[derive(Debug, Clone, PartialEq, Eq, Deserialize)] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] #[serde(default)] pub struct InvertedIndexOptions { /// The column ids that should be ignored when building the inverted index. @@ -228,7 +228,7 @@ impl Default for InvertedIndexOptions { } /// Options for region level memtable. -#[derive(Debug, Clone, PartialEq, Eq, Deserialize)] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] #[serde(tag = "memtable.type", rename_all = "snake_case")] pub enum MemtableOptions { TimeSeries, @@ -240,7 +240,7 @@ with_prefix!(prefix_partition_tree "memtable.partition_tree."); /// Partition tree memtable options. #[serde_as] -#[derive(Debug, Clone, PartialEq, Eq, Deserialize)] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] #[serde(default)] pub struct PartitionTreeOptions { /// Max keys in an index shard.