mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-28 19:00:39 +00:00
feat: prefix option for timestamp index and value column (#7125)
* refactor: use GREPTIME_TIMESTAMP const Signed-off-by: shuiyisong <xixing.sys@gmail.com> * feat: add config for default ts col name Signed-off-by: shuiyisong <xixing.sys@gmail.com> * refactor: replace GREPTIME_TIMESTAMP with function get Signed-off-by: shuiyisong <xixing.sys@gmail.com> * chore: update config doc * fix: test Signed-off-by: shuiyisong <xixing.sys@gmail.com> * chore: remove opts on flownode and metasrv Signed-off-by: shuiyisong <xixing.sys@gmail.com> * chore: add validation for ts column name Signed-off-by: shuiyisong <xixing.sys@gmail.com> * chore: use get_or_init to avoid test error Signed-off-by: shuiyisong <xixing.sys@gmail.com> * chore: fmt Signed-off-by: shuiyisong <xixing.sys@gmail.com> * chore: update docs Signed-off-by: shuiyisong <xixing.sys@gmail.com> * chore: using empty string to disable prefix Signed-off-by: shuiyisong <xixing.sys@gmail.com> * chore: update comment Signed-off-by: shuiyisong <xixing.sys@gmail.com> * chore: address CR issues Signed-off-by: shuiyisong <xixing.sys@gmail.com> --------- Signed-off-by: shuiyisong <xixing.sys@gmail.com>
This commit is contained in:
@@ -66,6 +66,7 @@ impl Default for StorageConfig {
|
||||
#[serde(default)]
|
||||
pub struct DatanodeOptions {
|
||||
pub node_id: Option<u64>,
|
||||
pub default_column_prefix: Option<String>,
|
||||
pub workload_types: Vec<DatanodeWorkloadType>,
|
||||
pub require_lease_before_startup: bool,
|
||||
pub init_regions_in_background: bool,
|
||||
@@ -119,6 +120,7 @@ impl Default for DatanodeOptions {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
node_id: None,
|
||||
default_column_prefix: None,
|
||||
workload_types: vec![DatanodeWorkloadType::Hybrid],
|
||||
require_lease_before_startup: false,
|
||||
init_regions_in_background: false,
|
||||
|
||||
@@ -27,6 +27,7 @@ use common_meta::key::runtime_switch::RuntimeSwitchManager;
|
||||
use common_meta::key::{SchemaMetadataManager, SchemaMetadataManagerRef};
|
||||
use common_meta::kv_backend::KvBackendRef;
|
||||
pub use common_procedure::options::ProcedureConfig;
|
||||
use common_query::prelude::set_default_prefix;
|
||||
use common_stat::ResourceStatImpl;
|
||||
use common_telemetry::{error, info, warn};
|
||||
use common_wal::config::DatanodeWalConfig;
|
||||
@@ -59,9 +60,9 @@ use tokio::sync::Notify;
|
||||
|
||||
use crate::config::{DatanodeOptions, RegionEngineConfig, StorageConfig};
|
||||
use crate::error::{
|
||||
self, BuildMetricEngineSnafu, BuildMitoEngineSnafu, CreateDirSnafu, GetMetadataSnafu,
|
||||
MissingCacheSnafu, MissingNodeIdSnafu, OpenLogStoreSnafu, Result, ShutdownInstanceSnafu,
|
||||
ShutdownServerSnafu, StartServerSnafu,
|
||||
self, BuildDatanodeSnafu, BuildMetricEngineSnafu, BuildMitoEngineSnafu, CreateDirSnafu,
|
||||
GetMetadataSnafu, MissingCacheSnafu, MissingNodeIdSnafu, OpenLogStoreSnafu, Result,
|
||||
ShutdownInstanceSnafu, ShutdownServerSnafu, StartServerSnafu,
|
||||
};
|
||||
use crate::event_listener::{
|
||||
NoopRegionServerEventListener, RegionServerEventListenerRef, RegionServerEventReceiver,
|
||||
@@ -220,6 +221,9 @@ impl DatanodeBuilder {
|
||||
|
||||
pub async fn build(mut self) -> Result<Datanode> {
|
||||
let node_id = self.opts.node_id.context(MissingNodeIdSnafu)?;
|
||||
set_default_prefix(self.opts.default_column_prefix.as_deref())
|
||||
.map_err(BoxedError::new)
|
||||
.context(BuildDatanodeSnafu)?;
|
||||
|
||||
let meta_client = self.meta_client.take();
|
||||
|
||||
|
||||
@@ -165,6 +165,13 @@ pub enum Error {
|
||||
location: Location,
|
||||
},
|
||||
|
||||
#[snafu(display("Failed to build datanode"))]
|
||||
BuildDatanode {
|
||||
#[snafu(implicit)]
|
||||
location: Location,
|
||||
source: BoxedError,
|
||||
},
|
||||
|
||||
#[snafu(display("Failed to build http client"))]
|
||||
BuildHttpClient {
|
||||
#[snafu(implicit)]
|
||||
@@ -429,7 +436,8 @@ impl ErrorExt for Error {
|
||||
| MissingRequiredField { .. }
|
||||
| RegionEngineNotFound { .. }
|
||||
| ParseAddr { .. }
|
||||
| TomlFormat { .. } => StatusCode::InvalidArguments,
|
||||
| TomlFormat { .. }
|
||||
| BuildDatanode { .. } => StatusCode::InvalidArguments,
|
||||
|
||||
PayloadNotExist { .. }
|
||||
| Unexpected { .. }
|
||||
|
||||
Reference in New Issue
Block a user