mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2025-12-26 08:00:01 +00:00
chore: add default value to sparse_primary_key_encoding config item (#7273)
This commit is contained in:
@@ -17,13 +17,14 @@ use std::time::Duration;
|
||||
use common_telemetry::warn;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// The default flush interval of the metadata region.
|
||||
/// The default flush interval of the metadata region.
|
||||
pub(crate) const DEFAULT_FLUSH_METADATA_REGION_INTERVAL: Duration = Duration::from_secs(30);
|
||||
|
||||
/// Configuration for the metric engine.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||
pub struct EngineConfig {
|
||||
/// Whether to use sparse primary key encoding.
|
||||
#[serde(default = "EngineConfig::default_sparse_primary_key_encoding")]
|
||||
pub sparse_primary_key_encoding: bool,
|
||||
/// The flush interval of the metadata region.
|
||||
#[serde(
|
||||
@@ -37,7 +38,7 @@ impl Default for EngineConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
flush_metadata_region_interval: DEFAULT_FLUSH_METADATA_REGION_INTERVAL,
|
||||
sparse_primary_key_encoding: true,
|
||||
sparse_primary_key_encoding: Self::default_sparse_primary_key_encoding(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47,6 +48,10 @@ impl EngineConfig {
|
||||
DEFAULT_FLUSH_METADATA_REGION_INTERVAL
|
||||
}
|
||||
|
||||
fn default_sparse_primary_key_encoding() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
/// Sanitizes the configuration.
|
||||
pub fn sanitize(&mut self) {
|
||||
if self.flush_metadata_region_interval.is_zero() {
|
||||
|
||||
Reference in New Issue
Block a user