diff --git a/go.mod b/go.mod index 0716745323..37df01a041 100644 --- a/go.mod +++ b/go.mod @@ -48,9 +48,9 @@ require ( github.com/opentracing/opentracing-go v1.1.0 // indirect github.com/pierrec/lz4 v2.0.5+incompatible // indirect github.com/pingcap/advanced-statefulset v0.1.0 + github.com/pingcap/check v0.0.0-20190102082844-67f458068fc8 // indirect github.com/pingcap/errors v0.11.0 github.com/pingcap/kvproto v0.0.0-20190516013202-4cf58ad90b6c - github.com/pingcap/log v0.0.0-20190715063458-479153f07ebd github.com/pingcap/pd v2.1.17+incompatible github.com/pingcap/tidb v2.1.0-beta+incompatible github.com/prometheus/client_golang v0.9.2 diff --git a/go.sum b/go.sum index 4c77327928..a02db1a48a 100644 --- a/go.sum +++ b/go.sum @@ -599,8 +599,6 @@ github.com/pingcap/errors v0.11.0 h1:DCJQB8jrHbQ1VVlMFIrbj2ApScNNotVmkSNplu2yUt4 github.com/pingcap/errors v0.11.0/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= github.com/pingcap/kvproto v0.0.0-20190516013202-4cf58ad90b6c h1:pY/MQQ5UajEHfSnQS8rFAM9gw9bBKzqBl414cdfhpRQ= github.com/pingcap/kvproto v0.0.0-20190516013202-4cf58ad90b6c/go.mod h1:QMdbTAXCHzzygQzqcG9uVUgU2fKeSN1GmfMiykdSzzY= -github.com/pingcap/log v0.0.0-20190715063458-479153f07ebd h1:hWDol43WY5PGhsh3+8794bFHY1bPrmu6bTalpssCrGg= -github.com/pingcap/log v0.0.0-20190715063458-479153f07ebd/go.mod h1:WpHUKhNZ18v116SvGrmjkA9CBhYmuUTKL+p8JC9ANEw= github.com/pingcap/pd v2.1.17+incompatible h1:mpfJYffRC14jeAfiq0jbHkqXVc8ZGNV0Lr2xG1sJslw= github.com/pingcap/pd v2.1.17+incompatible/go.mod h1:nD3+EoYes4+aNNODO99ES59V83MZSI+dFbhyr667a0E= github.com/pingcap/tidb v2.1.0-beta+incompatible h1:SQUmscnvvjHLjaIycQqtHujBahUnlKwTz6dQQhqgGSc= diff --git a/manifests/crd.yaml b/manifests/crd.yaml index 4cb58e5be3..dd46c4cdcd 100644 --- a/manifests/crd.yaml +++ b/manifests/crd.yaml @@ -776,7 +776,28 @@ spec: disable-timestamp: description: Disable automatic timestamps in output. type: boolean - file: {} + file: + properties: + filename: + description: Log filename, leave empty to disable file + log. + type: string + log-rotate: + description: Is log rotate enabled. + type: boolean + max-backups: + description: Maximum number of old log files to retain. + format: int32 + type: integer + max-days: + description: Max log keep days, default is never deleting. + format: int32 + type: integer + max-size: + description: Max size for a single file, in MB. + format: int32 + type: integer + type: object format: description: Log format. one of json, text, or console. type: string @@ -789,7 +810,15 @@ spec: type: string log-level: type: string - metric: {} + metric: + properties: + address: + type: string + interval: + type: string + job: + type: string + type: object name: type: string namespace: @@ -1101,7 +1130,28 @@ spec: expensive-threshold: format: int32 type: integer - file: {} + file: + properties: + filename: + description: Log filename, leave empty to disable file + log. + type: string + log-rotate: + description: Is log rotate enabled. + type: boolean + max-backups: + description: Maximum number of old log files to retain. + format: int32 + type: integer + max-days: + description: Max log keep days, default is never deleting. + format: int32 + type: integer + max-size: + description: Max size for a single file, in MB. + format: int32 + type: integer + type: object format: description: Log format. one of json, text, or console. type: string @@ -1440,6 +1490,7 @@ spec: concurrent-send-snap-limit: format: int32 type: integer + coprocessor: {} end-point-batch-row-limit: format: int32 type: integer diff --git a/pkg/apis/pingcap/v1alpha1/openapi_generated.go b/pkg/apis/pingcap/v1alpha1/openapi_generated.go index 249caf2708..5949cfc00d 100644 --- a/pkg/apis/pingcap/v1alpha1/openapi_generated.go +++ b/pkg/apis/pingcap/v1alpha1/openapi_generated.go @@ -35,6 +35,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.BackupSpec": schema_pkg_apis_pingcap_v1alpha1_BackupSpec(ref), "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.Binlog": schema_pkg_apis_pingcap_v1alpha1_Binlog(ref), "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.ComponentSpec": schema_pkg_apis_pingcap_v1alpha1_ComponentSpec(ref), + "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.FileLogConfig": schema_pkg_apis_pingcap_v1alpha1_FileLogConfig(ref), "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.GcsStorageProvider": schema_pkg_apis_pingcap_v1alpha1_GcsStorageProvider(ref), "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.HelperSpec": schema_pkg_apis_pingcap_v1alpha1_HelperSpec(ref), "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.Log": schema_pkg_apis_pingcap_v1alpha1_Log(ref), @@ -44,6 +45,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.OpenTracingSampler": schema_pkg_apis_pingcap_v1alpha1_OpenTracingSampler(ref), "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.PDConfig": schema_pkg_apis_pingcap_v1alpha1_PDConfig(ref), "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.PDLogConfig": schema_pkg_apis_pingcap_v1alpha1_PDLogConfig(ref), + "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.PDMetricConfig": schema_pkg_apis_pingcap_v1alpha1_PDMetricConfig(ref), "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.PDNamespaceConfig": schema_pkg_apis_pingcap_v1alpha1_PDNamespaceConfig(ref), "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.PDReplicationConfig": schema_pkg_apis_pingcap_v1alpha1_PDReplicationConfig(ref), "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.PDScheduleConfig": schema_pkg_apis_pingcap_v1alpha1_PDScheduleConfig(ref), @@ -788,6 +790,53 @@ func schema_pkg_apis_pingcap_v1alpha1_ComponentSpec(ref common.ReferenceCallback } } +func schema_pkg_apis_pingcap_v1alpha1_FileLogConfig(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "filename": { + SchemaProps: spec.SchemaProps{ + Description: "Log filename, leave empty to disable file log.", + Type: []string{"string"}, + Format: "", + }, + }, + "log-rotate": { + SchemaProps: spec.SchemaProps{ + Description: "Is log rotate enabled.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "max-size": { + SchemaProps: spec.SchemaProps{ + Description: "Max size for a single file, in MB.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "max-days": { + SchemaProps: spec.SchemaProps{ + Description: "Max log keep days, default is never deleting.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "max-backups": { + SchemaProps: spec.SchemaProps{ + Description: "Maximum number of old log files to retain.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + }, + }, + } +} + func schema_pkg_apis_pingcap_v1alpha1_GcsStorageProvider(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -916,7 +965,7 @@ func schema_pkg_apis_pingcap_v1alpha1_Log(ref common.ReferenceCallback) common.O "file": { SchemaProps: spec.SchemaProps{ Description: "File log config.", - Ref: ref("github.com/pingcap/log.FileLogConfig"), + Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.FileLogConfig"), }, }, "slow-query-file": { @@ -953,7 +1002,7 @@ func schema_pkg_apis_pingcap_v1alpha1_Log(ref common.ReferenceCallback) common.O }, }, Dependencies: []string{ - "github.com/pingcap/log.FileLogConfig"}, + "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.FileLogConfig"}, } } @@ -1214,7 +1263,7 @@ func schema_pkg_apis_pingcap_v1alpha1_PDConfig(ref common.ReferenceCallback) com }, "metric": { SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/pingcap/pd/pkg/metricutil.MetricConfig"), + Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.PDMetricConfig"), }, }, "schedule": { @@ -1329,7 +1378,7 @@ func schema_pkg_apis_pingcap_v1alpha1_PDConfig(ref common.ReferenceCallback) com }, }, Dependencies: []string{ - "github.com/pingcap/pd/pkg/metricutil.MetricConfig", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.PDLogConfig", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.PDNamespaceConfig", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.PDReplicationConfig", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.PDScheduleConfig", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.PDSecurityConfig", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.PDServerConfig", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.PDStoreLabel"}, + "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.PDLogConfig", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.PDMetricConfig", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.PDNamespaceConfig", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.PDReplicationConfig", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.PDScheduleConfig", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.PDSecurityConfig", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.PDServerConfig", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.PDStoreLabel"}, } } @@ -1364,7 +1413,7 @@ func schema_pkg_apis_pingcap_v1alpha1_PDLogConfig(ref common.ReferenceCallback) "file": { SchemaProps: spec.SchemaProps{ Description: "File log config.", - Ref: ref("github.com/pingcap/log.FileLogConfig"), + Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.FileLogConfig"), }, }, "development": { @@ -1399,7 +1448,37 @@ func schema_pkg_apis_pingcap_v1alpha1_PDLogConfig(ref common.ReferenceCallback) }, }, Dependencies: []string{ - "github.com/pingcap/log.FileLogConfig"}, + "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.FileLogConfig"}, + } +} + +func schema_pkg_apis_pingcap_v1alpha1_PDMetricConfig(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "job": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "address": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "interval": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, } } @@ -3549,11 +3628,16 @@ func schema_pkg_apis_pingcap_v1alpha1_TiKVConfig(ref common.ReferenceCallback) c Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiKVDbConfig"), }, }, + "coprocessor": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiKVCoprocessorConfig"), + }, + }, }, }, }, Dependencies: []string{ - "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiKVDbConfig", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiKVRaftstoreConfig", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiKVServerConfig", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiKVStorageConfig"}, + "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiKVCoprocessorConfig", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiKVDbConfig", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiKVRaftstoreConfig", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiKVServerConfig", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiKVStorageConfig"}, } } diff --git a/pkg/apis/pingcap/v1alpha1/pd_config.go b/pkg/apis/pingcap/v1alpha1/pd_config.go index 60e7e1f86c..8006218f9a 100644 --- a/pkg/apis/pingcap/v1alpha1/pd_config.go +++ b/pkg/apis/pingcap/v1alpha1/pd_config.go @@ -14,9 +14,8 @@ package v1alpha1 import ( - "github.com/pingcap/log" - "github.com/pingcap/pd/pkg/metricutil" - "github.com/pingcap/pd/pkg/typeutil" + "strconv" + "strings" ) // Maintain a copy of PDConfig to make it more friendly with the kubernetes API: @@ -88,7 +87,7 @@ type PDConfig struct { TsoSaveInterval string `toml:"tso-save-interval,omitempty" json:"tso-save-interval,omitempty"` // +optional - Metric *metricutil.MetricConfig `toml:"metric,omitempty" json:"metric,omitempty"` + Metric *PDMetricConfig `toml:"metric,omitempty" json:"metric,omitempty"` // +optional Schedule *PDScheduleConfig `toml:"schedule,omitempty" json:"schedule,omitempty"` @@ -160,7 +159,7 @@ type PDLogConfig struct { DisableTimestamp *bool `toml:"disable-timestamp,omitempty" json:"disable-timestamp,omitempty"` // File log config. // +optional - File log.FileLogConfig `toml:"file,omitempty" json:"file,omitempty"` + File *FileLogConfig `toml:"file,omitempty" json:"file,omitempty"` // Development puts the logger in development mode, which changes the // behavior of DPanicLevel and takes stacktraces more liberally. // +optional @@ -192,7 +191,7 @@ type PDReplicationConfig struct { // For example, ["zone", "rack"] means that we should place replicas to // different zones first, then to different racks if we don't have enough zones. // +optional - LocationLabels typeutil.StringSlice `toml:"location-labels,omitempty" json:"location-labels,omitempty"` + LocationLabels StringSlice `toml:"location-labels,omitempty" json:"location-labels,omitempty"` // StrictlyMatchLabel strictly checks if the label of TiKV is matched with LocaltionLabels. // +optional StrictlyMatchLabel *bool `toml:"strictly-match-label,omitempty" json:"strictly-match-label,string,omitempty"` @@ -203,22 +202,22 @@ type PDReplicationConfig struct { type PDNamespaceConfig struct { // LeaderScheduleLimit is the max coexist leader schedules. // +optional - LeaderScheduleLimit *uint64 `json:"leader-schedule-limit,omitempty"` + LeaderScheduleLimit *uint64 `json:"leader-schedule-limit,omitempty" toml:"leader-schedule-limit,omitempty"` // RegionScheduleLimit is the max coexist region schedules. // +optional - RegionScheduleLimit *uint64 `json:"region-schedule-limit,omitempty"` + RegionScheduleLimit *uint64 `json:"region-schedule-limit,omitempty" toml:"region-schedule-limit,omitempty"` // ReplicaScheduleLimit is the max coexist replica schedules. // +optional - ReplicaScheduleLimit *uint64 `json:"replica-schedule-limit,omitempty"` + ReplicaScheduleLimit *uint64 `json:"replica-schedule-limit,omitempty" toml:"replica-schedule-limit,omitempty"` // MergeScheduleLimit is the max coexist merge schedules. // +optional - MergeScheduleLimit *uint64 `json:"merge-schedule-limit,omitempty"` + MergeScheduleLimit *uint64 `json:"merge-schedule-limit,omitempty" toml:"merge-schedule-limit,omitempty"` // HotRegionScheduleLimit is the max coexist hot region schedules. // +optional - HotRegionScheduleLimit *uint64 `json:"hot-region-schedule-limit,omitempty"` + HotRegionScheduleLimit *uint64 `json:"hot-region-schedule-limit,omitempty" toml:"hot-region-schedule-limit,omitempty"` // MaxReplicas is the number of replicas for each region. // +optional - MaxReplicas *uint64 `json:"max-replicas,omitempty"` + MaxReplicas *uint64 `json:"max-replicas,omitempty" toml:"max-replicas,omitempty"` } // ScheduleConfig is the schedule configuration. @@ -365,3 +364,46 @@ type PDServerConfig struct { // +optional UseRegionStorage *bool `toml:"use-region-storage,omitempty" json:"use-region-storage,string,omitempty"` } + +// +k8s:openapi-gen=true +type PDMetricConfig struct { + PushJob string `toml:"job,omitempty" json:"job,omitempty"` + PushAddress string `toml:"address,omitempty" json:"address,omitempty"` + PushInterval string `toml:"interval,omitempty" json:"interval,omitempty"` +} + +// +k8s:openapi-gen=true +type FileLogConfig struct { + // Log filename, leave empty to disable file log. + Filename string `toml:"filename,omitempty" json:"filename,omitempty"` + // Is log rotate enabled. + LogRotate bool `toml:"log-rotate,omitempty" json:"log-rotate,omitempty"` + // Max size for a single file, in MB. + MaxSize int `toml:"max-size,omitempty" json:"max-size,omitempty"` + // Max log keep days, default is never deleting. + MaxDays int `toml:"max-days,omitempty" json:"max-days,omitempty"` + // Maximum number of old log files to retain. + MaxBackups int `toml:"max-backups,omitempty" json:"max-backups,omitempty"` +} + +//StringSlice is more friendly to json encode/decode +type StringSlice []string + +// MarshalJSON returns the size as a JSON string. +func (s StringSlice) MarshalJSON() ([]byte, error) { + return []byte(strconv.Quote(strings.Join(s, ","))), nil +} + +// UnmarshalJSON parses a JSON string into the bytesize. +func (s *StringSlice) UnmarshalJSON(text []byte) error { + data, err := strconv.Unquote(string(text)) + if err != nil { + return err + } + if len(data) == 0 { + *s = nil + return nil + } + *s = strings.Split(data, ",") + return nil +} diff --git a/pkg/apis/pingcap/v1alpha1/tidb_config.go b/pkg/apis/pingcap/v1alpha1/tidb_config.go index b2a809cb98..c6fcb6fd73 100644 --- a/pkg/apis/pingcap/v1alpha1/tidb_config.go +++ b/pkg/apis/pingcap/v1alpha1/tidb_config.go @@ -15,8 +15,6 @@ package v1alpha1 import ( "time" - - zaplog "github.com/pingcap/log" ) // Maintain a copy of TiDBConfig to make it more friendly with the kubernetes API: @@ -120,7 +118,7 @@ type Log struct { DisableTimestamp bool `toml:"disable-timestamp,omitempty" json:"disable-timestamp,omitempty"` // File log config. // +optional - File zaplog.FileLogConfig `toml:"file,omitempty" json:"file,omitempty"` + File *FileLogConfig `toml:"file,omitempty" json:"file,omitempty"` // +optional SlowQueryFile string `toml:"slow-query-file,omitempty" json:"slow-query-file,omitempty"` // +optional diff --git a/pkg/apis/pingcap/v1alpha1/tikv_config.go b/pkg/apis/pingcap/v1alpha1/tikv_config.go index f162ca591a..41b3dd57b0 100644 --- a/pkg/apis/pingcap/v1alpha1/tikv_config.go +++ b/pkg/apis/pingcap/v1alpha1/tikv_config.go @@ -84,6 +84,8 @@ type TiKVConfig struct { Raftstore *TiKVRaftstoreConfig `json:"raftstore,omitempty" toml:"raftstore,omitempty"` // +optional Rocksdb *TiKVDbConfig `json:"rocksdb,omitempty" toml:"rocksdb,omitempty"` + // +optional + Coprocessor *TiKVCoprocessorConfig `json:"coprocessor,omitempty" toml:"coprocessor,omitempty"` } // TiKVDbConfig is the rocksdb config. @@ -486,3 +488,40 @@ type TiKVRaftstoreConfig struct { // +optional HibernateRegions *bool `json:"hibernate-regions,omitempty" toml:"hibernate-regions,omitempty"` } + +type TiKVCoprocessorConfig struct { + // When it is set to `true`, TiKV will try to split a Region with table prefix if that Region + // crosses tables. + // It is recommended to turn off this option if there will be a large number of tables created. + // optional + SplitRegionOnTable *bool `json:"split-region-on-table,omitempty" toml:"split-region-on-table,omitempty"` + + // One split check produces several split keys in batch. This config limits the number of produced + // split keys in one batch. + // optional + BatchSplitLimit *int64 `json:"batch-split-limit,omitempty" toml:"batch-split-limit,omitempty"` + + // When Region [a,e) size exceeds `region_max_size`, it will be split into several Regions [a,b), + // [b,c), [c,d), [d,e) and the size of [a,b), [b,c), [c,d) will be `region_split_size` (or a + // little larger). See also: region-split-size + // optional + RegionMaxSize string `json:"region-max-size,omitempty" toml:"region-max-size,omitempty"` + + // When Region [a,e) size exceeds `region_max_size`, it will be split into several Regions [a,b), + // [b,c), [c,d), [d,e) and the size of [a,b), [b,c), [c,d) will be `region_split_size` (or a + // little larger). See also: region-max-size + // optional + RegionSplitSize string `json:"region-split-size,omitempty" toml:"region-split-size,omitempty"` + + // When the number of keys in Region [a,e) exceeds the `region_max_keys`, it will be split into + // several Regions [a,b), [b,c), [c,d), [d,e) and the number of keys in [a,b), [b,c), [c,d) will be + // `region_split_keys`. See also: region-split-keys + // optional + RegionMaxKeys *int64 `json:"region-max-keys,omitempty" toml:"region-max-keys,omitempty"` + + // When the number of keys in Region [a,e) exceeds the `region_max_keys`, it will be split into + // several Regions [a,b), [b,c), [c,d), [d,e) and the number of keys in [a,b), [b,c), [c,d) will be + // `region_split_keys`. See also: region-max-keys + // optional + RegionSplitKeys *int64 `json:"region-split-keys,omitempty" toml:"region-split-keys,omitempty"` +} diff --git a/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go index 30526a7adf..499dd135ad 100644 --- a/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go @@ -18,8 +18,6 @@ package v1alpha1 import ( - metricutil "github.com/pingcap/pd/pkg/metricutil" - typeutil "github.com/pingcap/pd/pkg/typeutil" appsv1 "k8s.io/api/apps/v1" v1 "k8s.io/api/core/v1" v1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" @@ -443,6 +441,22 @@ func (in *DataResourceList) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FileLogConfig) DeepCopyInto(out *FileLogConfig) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FileLogConfig. +func (in *FileLogConfig) DeepCopy() *FileLogConfig { + if in == nil { + return nil + } + out := new(FileLogConfig) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GcsStorageProvider) DeepCopyInto(out *GcsStorageProvider) { *out = *in @@ -532,7 +546,11 @@ func (in *InitializerSpec) DeepCopy() *InitializerSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Log) DeepCopyInto(out *Log) { *out = *in - out.File = in.File + if in.File != nil { + in, out := &in.File, &out.File + *out = new(FileLogConfig) + **out = **in + } if in.SlowThreshold != nil { in, out := &in.SlowThreshold, &out.SlowThreshold *out = new(uint64) @@ -683,7 +701,7 @@ func (in *PDConfig) DeepCopyInto(out *PDConfig) { } if in.Metric != nil { in, out := &in.Metric, &out.Metric - *out = new(metricutil.MetricConfig) + *out = new(PDMetricConfig) **out = **in } if in.Schedule != nil { @@ -805,7 +823,11 @@ func (in *PDLogConfig) DeepCopyInto(out *PDLogConfig) { *out = new(bool) **out = **in } - out.File = in.File + if in.File != nil { + in, out := &in.File, &out.File + *out = new(FileLogConfig) + **out = **in + } if in.Development != nil { in, out := &in.Development, &out.Development *out = new(bool) @@ -856,6 +878,22 @@ func (in *PDMember) DeepCopy() *PDMember { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PDMetricConfig) DeepCopyInto(out *PDMetricConfig) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PDMetricConfig. +func (in *PDMetricConfig) DeepCopy() *PDMetricConfig { + if in == nil { + return nil + } + out := new(PDMetricConfig) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PDNamespaceConfig) DeepCopyInto(out *PDNamespaceConfig) { *out = *in @@ -912,7 +950,7 @@ func (in *PDReplicationConfig) DeepCopyInto(out *PDReplicationConfig) { } if in.LocationLabels != nil { in, out := &in.LocationLabels, &out.LocationLabels - *out = make(typeutil.StringSlice, len(*in)) + *out = make(StringSlice, len(*in)) copy(*out, *in) } if in.StrictlyMatchLabel != nil { @@ -1783,6 +1821,26 @@ func (in *StorageProvider) DeepCopy() *StorageProvider { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in StringSlice) DeepCopyInto(out *StringSlice) { + { + in := &in + *out = make(StringSlice, len(*in)) + copy(*out, *in) + return + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StringSlice. +func (in StringSlice) DeepCopy() StringSlice { + if in == nil { + return nil + } + out := new(StringSlice) + in.DeepCopyInto(out) + return *out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TiDBAccessConfig) DeepCopyInto(out *TiDBAccessConfig) { *out = *in @@ -2380,6 +2438,11 @@ func (in *TiKVConfig) DeepCopyInto(out *TiKVConfig) { *out = new(TiKVDbConfig) (*in).DeepCopyInto(*out) } + if in.Coprocessor != nil { + in, out := &in.Coprocessor, &out.Coprocessor + *out = new(TiKVCoprocessorConfig) + (*in).DeepCopyInto(*out) + } return } @@ -2393,6 +2456,42 @@ func (in *TiKVConfig) DeepCopy() *TiKVConfig { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TiKVCoprocessorConfig) DeepCopyInto(out *TiKVCoprocessorConfig) { + *out = *in + if in.SplitRegionOnTable != nil { + in, out := &in.SplitRegionOnTable, &out.SplitRegionOnTable + *out = new(bool) + **out = **in + } + if in.BatchSplitLimit != nil { + in, out := &in.BatchSplitLimit, &out.BatchSplitLimit + *out = new(int64) + **out = **in + } + if in.RegionMaxKeys != nil { + in, out := &in.RegionMaxKeys, &out.RegionMaxKeys + *out = new(int64) + **out = **in + } + if in.RegionSplitKeys != nil { + in, out := &in.RegionSplitKeys, &out.RegionSplitKeys + *out = new(int64) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TiKVCoprocessorConfig. +func (in *TiKVCoprocessorConfig) DeepCopy() *TiKVCoprocessorConfig { + if in == nil { + return nil + } + out := new(TiKVCoprocessorConfig) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TiKVDbConfig) DeepCopyInto(out *TiKVDbConfig) { *out = *in diff --git a/pkg/manager/member/pd_member_manager_test.go b/pkg/manager/member/pd_member_manager_test.go index 6460679092..a4a24c6b11 100644 --- a/pkg/manager/member/pd_member_manager_test.go +++ b/pkg/manager/member/pd_member_manager_test.go @@ -21,7 +21,6 @@ import ( "github.com/google/go-cmp/cmp" . "github.com/onsi/gomega" "github.com/pingcap/kvproto/pkg/metapb" - "github.com/pingcap/pd/pkg/typeutil" "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" "github.com/pingcap/tidb-operator/pkg/client/clientset/versioned/fake" informers "github.com/pingcap/tidb-operator/pkg/client/informers/externalversions" @@ -1061,7 +1060,7 @@ func TestGetPDConfigMap(t *testing.T) { }, Replication: &v1alpha1.PDReplicationConfig{ MaxReplicas: func() *uint64 { i := uint64(5); return &i }(), - LocationLabels: typeutil.StringSlice{"node", "rack"}, + LocationLabels: v1alpha1.StringSlice{"node", "rack"}, }, }, }, diff --git a/pkg/manager/member/tikv_member_manager_test.go b/pkg/manager/member/tikv_member_manager_test.go index 2cbac2b74f..0c2dc35b34 100644 --- a/pkg/manager/member/tikv_member_manager_test.go +++ b/pkg/manager/member/tikv_member_manager_test.go @@ -22,7 +22,6 @@ import ( "github.com/google/go-cmp/cmp" . "github.com/onsi/gomega" "github.com/pingcap/kvproto/pkg/metapb" - "github.com/pingcap/pd/pkg/typeutil" "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" "github.com/pingcap/tidb-operator/pkg/client/clientset/versioned/fake" informers "github.com/pingcap/tidb-operator/pkg/client/informers/externalversions" @@ -79,7 +78,7 @@ func TestTiKVMemberManagerSyncCreate(t *testing.T) { pdClient.AddReaction(pdapi.GetConfigActionType, func(action *pdapi.Action) (interface{}, error) { return &v1alpha1.PDConfig{ Replication: &v1alpha1.PDReplicationConfig{ - LocationLabels: typeutil.StringSlice{"region", "zone", "rack", "host"}, + LocationLabels: v1alpha1.StringSlice{"region", "zone", "rack", "host"}, }, }, nil }) @@ -234,7 +233,7 @@ func TestTiKVMemberManagerSyncUpdate(t *testing.T) { pdClient.AddReaction(pdapi.GetConfigActionType, func(action *pdapi.Action) (interface{}, error) { return &v1alpha1.PDConfig{ Replication: &v1alpha1.PDReplicationConfig{ - LocationLabels: typeutil.StringSlice{"region", "zone", "rack", "host"}, + LocationLabels: v1alpha1.StringSlice{"region", "zone", "rack", "host"}, }, }, nil }) @@ -510,7 +509,7 @@ func TestTiKVMemberManagerSetStoreLabelsForTiKV(t *testing.T) { pdClient.AddReaction(pdapi.GetConfigActionType, func(action *pdapi.Action) (interface{}, error) { return &v1alpha1.PDConfig{ Replication: &v1alpha1.PDReplicationConfig{ - LocationLabels: typeutil.StringSlice{"region", "zone", "rack", "host"}, + LocationLabels: v1alpha1.StringSlice{"region", "zone", "rack", "host"}, }, }, nil })