Skip to content

Commit

Permalink
faet: add StoreKeyPrefix in metasrv
Browse files Browse the repository at this point in the history
  • Loading branch information
daviderli614 committed Jan 2, 2024
1 parent b8ccaba commit 2ea4396
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 1 deletion.
4 changes: 4 additions & 0 deletions apis/v1alpha1/greptimedbcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,10 @@ type MetaSpec struct {
// +optional
EnableRegionFailover bool `json:"enableRegionFailover,omitempty"`

// The meta will store data with this key prefix.
// +optional
StoreKeyPrefix string `json:"storeKeyPrefix,omitempty"`

// More meta settings can be added here...
}

Expand Down
2 changes: 2 additions & 0 deletions config/crd/resources/greptime.io_greptimedbclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8050,6 +8050,8 @@ spec:
servicePort:
format: int32
type: integer
storeKeyPrefix:
type: string
template:
properties:
activeDeadlineSeconds:
Expand Down
2 changes: 1 addition & 1 deletion config/samples/cluster-with-monitor/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ spec:
prometheusMonitor:
enabled: true
interval: "30s"
labelsSelector:
labels:
release: prometheus
2 changes: 2 additions & 0 deletions manifests/greptimedb-operator-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8049,6 +8049,8 @@ spec:
servicePort:
format: int32
type: integer
storeKeyPrefix:
type: string
template:
properties:
activeDeadlineSeconds:
Expand Down
2 changes: 2 additions & 0 deletions manifests/greptimedb-operator-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8056,6 +8056,8 @@ spec:
servicePort:
format: int32
type: integer
storeKeyPrefix:
type: string
template:
properties:
activeDeadlineSeconds:
Expand Down
6 changes: 6 additions & 0 deletions pkg/dbconfig/metasrv_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,19 @@ type MetasrvConfig struct {
EnableTelemetry *bool `toml:"enable_telemetry,omitempty"`

DataHome string `toml:"data_home,omitempty"`

StoreKeyPrefix string `toml:"store_key_prefix,omitempty"`
}

// ConfigureByCluster configures the metasrv config by the given cluster.
func (c *MetasrvConfig) ConfigureByCluster(cluster *v1alpha1.GreptimeDBCluster) error {
if cluster.Spec.Meta != nil {
c.EnableRegionFailover = &cluster.Spec.Meta.EnableRegionFailover

if len(cluster.Spec.Meta.StoreKeyPrefix) > 0 {
c.StoreKeyPrefix = cluster.Spec.Meta.StoreKeyPrefix
}

if len(cluster.Spec.Meta.Config) > 0 {
if err := Merge([]byte(cluster.Spec.Meta.Config), c); err != nil {
return err
Expand Down

0 comments on commit 2ea4396

Please sign in to comment.