Documentation
¶
Index ¶
- Constants
- func GetTLSConfig(secretLister corelisterv1.SecretLister, namespace Namespace, secretName string) (*tls.Config, error)
- func IsTiKVNotBootstrappedError(err error) bool
- func TiKVNotBootstrappedErrorf(format string, a ...interface{}) error
- type Action
- type ActionType
- type CPURule
- type FakePDClient
- func (c *FakePDClient) AddReaction(actionType ActionType, reaction Reaction)
- func (c *FakePDClient) BeginEvictLeader(storeID uint64) error
- func (c *FakePDClient) DeleteMember(name string) error
- func (c *FakePDClient) DeleteMemberByID(id uint64) error
- func (c *FakePDClient) DeleteStore(id uint64) error
- func (c *FakePDClient) EndEvictLeader(storeID uint64) error
- func (c *FakePDClient) GetAutoscalingPlans(strategy Strategy) ([]Plan, error)
- func (c *FakePDClient) GetCluster() (*metapb.Cluster, error)
- func (c *FakePDClient) GetConfig() (*PDConfigFromAPI, error)
- func (c *FakePDClient) GetEvictLeaderSchedulers() ([]string, error)
- func (c *FakePDClient) GetEvictLeaderSchedulersForStores(storeIDs ...uint64) (map[uint64]string, error)
- func (c *FakePDClient) GetHealth() (*HealthInfo, error)
- func (c *FakePDClient) GetMembers() (*MembersInfo, error)
- func (c *FakePDClient) GetPDLeader() (*pdpb.Member, error)
- func (c *FakePDClient) GetRecoveringMark() (bool, error)
- func (c *FakePDClient) GetStore(id uint64) (*StoreInfo, error)
- func (c *FakePDClient) GetStores() (*StoresInfo, error)
- func (c *FakePDClient) GetTombStoneStores() (*StoresInfo, error)
- func (c *FakePDClient) SetStoreLabels(storeID uint64, labels map[string]string) (bool, error)
- func (c *FakePDClient) SetStoreState(id uint64, state string) error
- func (c *FakePDClient) TransferPDLeader(memberName string) error
- func (c *FakePDClient) UpdateReplicationConfig(config PDReplicationConfig) error
- type FakePDControl
- func (pdc *FakePDControl) GetEndpoints(namespace Namespace, tcName string, tlsEnabled bool, opts ...Option) (endpoints []string, tlsConfig *tls.Config, err error)
- func (pdc *FakePDControl) GetPDClient(namespace Namespace, tcName string, tlsEnabled bool, opts ...Option) PDClient
- func (pdc *FakePDControl) GetPDEtcdClient(namespace Namespace, tcName string, tlsEnabled bool, opts ...Option) (PDEtcdClient, error)
- func (fpc *FakePDControl) SetPDClient(namespace Namespace, tcName string, pdclient PDClient)
- func (fpc *FakePDControl) SetPDClientWithAddress(peerURL string, pdclient PDClient)
- func (fpc *FakePDControl) SetPDClientWithClusterDomain(namespace Namespace, tcName string, tcClusterDomain string, pdclient PDClient)
- type FileLogConfig
- type HealthInfo
- type KeyValue
- type MemberHealth
- type MembersInfo
- type MetaStore
- type Namespace
- type NotFoundReaction
- type Option
- type PDClient
- type PDConfigFromAPI
- type PDControlInterface
- type PDEtcdClient
- type PDLabelPropertyConfig
- type PDLogConfig
- type PDReplicationConfig
- type PDScheduleConfig
- type PDSchedulerConfig
- type PDSchedulerConfigs
- type PDStoreLabel
- type PDStoreLabels
- type Plan
- type Reaction
- type RecoveringMark
- type Resource
- type Rule
- type StorageRule
- type StoreInfo
- type StoreStatus
- type StoresInfo
- type Strategy
- type StringSlice
- type TiKVNotBootstrappedError
Constants ¶
const (
DefaultTimeout = 5 * time.Second
)
Variables ¶
This section is empty.
Functions ¶
func GetTLSConfig ¶ added in v1.1.0
func GetTLSConfig(secretLister corelisterv1.SecretLister, namespace Namespace, secretName string) (*tls.Config, error)
GetTLSConfig returns *tls.Config for given TiDB cluster.
func IsTiKVNotBootstrappedError ¶ added in v1.1.10
IsTiKVNotBootstrappedError returns whether err is a TiKVNotBootstrappedError
func TiKVNotBootstrappedErrorf ¶ added in v1.1.10
TiKVNotBootstrappedErrorf returns a TiKVNotBootstrappedError
Types ¶
type Action ¶
type Action struct {
ID uint64
Name string
Labels map[string]string
Replication PDReplicationConfig
}
type ActionType ¶
type ActionType string
const ( GetHealthActionType ActionType = "GetHealth" GetConfigActionType ActionType = "GetConfig" GetClusterActionType ActionType = "GetCluster" GetMembersActionType ActionType = "GetMembers" GetStoresActionType ActionType = "GetStores" GetTombStoneStoresActionType ActionType = "GetTombStoneStores" GetStoreActionType ActionType = "GetStore" DeleteStoreActionType ActionType = "DeleteStore" SetStoreStateActionType ActionType = "SetStoreState" DeleteMemberByIDActionType ActionType = "DeleteMemberByID" DeleteMemberActionType ActionType = "DeleteMember " SetStoreLabelsActionType ActionType = "SetStoreLabels" UpdateReplicationActionType ActionType = "UpdateReplicationConfig" BeginEvictLeaderActionType ActionType = "BeginEvictLeader" EndEvictLeaderActionType ActionType = "EndEvictLeader" GetEvictLeaderSchedulersActionType ActionType = "GetEvictLeaderSchedulers" GetEvictLeaderSchedulersForStoresActionType ActionType = "GetEvictLeaderSchedulersForStores" GetPDLeaderActionType ActionType = "GetPDLeader" TransferPDLeaderActionType ActionType = "TransferPDLeader" GetAutoscalingPlansActionType ActionType = "GetAutoscalingPlans" GetRecoveringMarkActionType ActionType = "GetRecoveringMark" )
type CPURule ¶ added in v1.2.0
type CPURule struct {
MaxThreshold float64 `json:"max_threshold"`
MinThreshold float64 `json:"min_threshold"`
ResourceTypes []string `json:"resource_types"`
}
CPURule is the constraints about CPU.
type FakePDClient ¶
type FakePDClient struct {
// contains filtered or unexported fields
}
FakePDClient implements a fake version of PDClient.
func NewFakePDClient ¶
func NewFakePDClient() *FakePDClient
func (*FakePDClient) AddReaction ¶
func (c *FakePDClient) AddReaction(actionType ActionType, reaction Reaction)
func (*FakePDClient) BeginEvictLeader ¶
func (c *FakePDClient) BeginEvictLeader(storeID uint64) error
func (*FakePDClient) DeleteMember ¶
func (c *FakePDClient) DeleteMember(name string) error
func (*FakePDClient) DeleteMemberByID ¶
func (c *FakePDClient) DeleteMemberByID(id uint64) error
func (*FakePDClient) DeleteStore ¶
func (c *FakePDClient) DeleteStore(id uint64) error
func (*FakePDClient) EndEvictLeader ¶
func (c *FakePDClient) EndEvictLeader(storeID uint64) error
func (*FakePDClient) GetAutoscalingPlans ¶ added in v1.2.0
func (c *FakePDClient) GetAutoscalingPlans(strategy Strategy) ([]Plan, error)
func (*FakePDClient) GetCluster ¶
func (c *FakePDClient) GetCluster() (*metapb.Cluster, error)
func (*FakePDClient) GetConfig ¶
func (c *FakePDClient) GetConfig() (*PDConfigFromAPI, error)
func (*FakePDClient) GetEvictLeaderSchedulers ¶
func (c *FakePDClient) GetEvictLeaderSchedulers() ([]string, error)
func (*FakePDClient) GetEvictLeaderSchedulersForStores ¶ added in v1.3.3
func (c *FakePDClient) GetEvictLeaderSchedulersForStores(storeIDs ...uint64) (map[uint64]string, error)
func (*FakePDClient) GetHealth ¶
func (c *FakePDClient) GetHealth() (*HealthInfo, error)
func (*FakePDClient) GetMembers ¶
func (c *FakePDClient) GetMembers() (*MembersInfo, error)
func (*FakePDClient) GetPDLeader ¶
func (c *FakePDClient) GetPDLeader() (*pdpb.Member, error)
func (*FakePDClient) GetRecoveringMark ¶ added in v1.4.4
func (c *FakePDClient) GetRecoveringMark() (bool, error)
func (*FakePDClient) GetStores ¶
func (c *FakePDClient) GetStores() (*StoresInfo, error)
func (*FakePDClient) GetTombStoneStores ¶
func (c *FakePDClient) GetTombStoneStores() (*StoresInfo, error)
func (*FakePDClient) SetStoreLabels ¶
SetStoreLabels sets TiKV labels
func (*FakePDClient) SetStoreState ¶ added in v1.1.0
func (c *FakePDClient) SetStoreState(id uint64, state string) error
func (*FakePDClient) TransferPDLeader ¶
func (c *FakePDClient) TransferPDLeader(memberName string) error
func (*FakePDClient) UpdateReplicationConfig ¶ added in v1.1.0
func (c *FakePDClient) UpdateReplicationConfig(config PDReplicationConfig) error
UpdateReplicationConfig updates the replication config
type FakePDControl ¶
type FakePDControl struct {
// contains filtered or unexported fields
}
FakePDControl implements a fake version of PDControlInterface.
func NewFakePDControl ¶
func NewFakePDControl(secretLister corelisterv1.SecretLister) *FakePDControl
func (*FakePDControl) GetEndpoints ¶ added in v1.2.0
func (*FakePDControl) GetPDClient ¶
func (pdc *FakePDControl) GetPDClient(namespace Namespace, tcName string, tlsEnabled bool, opts ...Option) PDClient
GetPDClient provides a PDClient of real pd cluster, if the PDClient not existing, it will create new one.
func (*FakePDControl) GetPDEtcdClient ¶ added in v1.1.1
func (*FakePDControl) SetPDClient ¶
func (fpc *FakePDControl) SetPDClient(namespace Namespace, tcName string, pdclient PDClient)
func (*FakePDControl) SetPDClientWithAddress ¶ added in v1.2.0
func (fpc *FakePDControl) SetPDClientWithAddress(peerURL string, pdclient PDClient)
func (*FakePDControl) SetPDClientWithClusterDomain ¶ added in v1.2.0
func (fpc *FakePDControl) SetPDClientWithClusterDomain(namespace Namespace, tcName string, tcClusterDomain string, pdclient PDClient)
type FileLogConfig ¶ added in v1.1.0
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"`
}
+k8s:openapi-gen=true
type HealthInfo ¶
type HealthInfo struct {
Healths []MemberHealth
}
HealthInfo define PD's healthy info
type MemberHealth ¶
type MemberHealth struct {
Name string `json:"name"`
MemberID uint64 `json:"member_id"`
ClientUrls []string `json:"client_urls"`
Health bool `json:"health"`
}
MemberHealth define a pd member's healthy info
type MembersInfo ¶
type MembersInfo struct {
Header *pdpb.ResponseHeader `json:"header,omitempty"`
Members []*pdpb.Member `json:"members,omitempty"`
Leader *pdpb.Member `json:"leader,omitempty"`
EtcdLeader *pdpb.Member `json:"etcd_leader,omitempty"`
}
MembersInfo is PD members info returned from PD RESTful interface type Members map[string][]*pdpb.Member
type NotFoundReaction ¶
type NotFoundReaction struct {
// contains filtered or unexported fields
}
func (*NotFoundReaction) Error ¶
func (nfr *NotFoundReaction) Error() string
type Option ¶ added in v1.3.0
type Option func(c *clientConfig)
Option configures the PDClient
func ClusterRef ¶ added in v1.3.0
ClusterRef sets the cluster domain of TC, it is used when generating the client address from TC.
func SpecifyClient ¶ added in v1.3.0
SpecifyClient specify client addr without generating
func TLSCertFromSecret ¶ added in v1.3.0
TLSCertFromTC indicates that clients use certs from specified secret.
func TLSCertFromTC ¶ added in v1.3.0
TLSCertFromTC indicates that the clients use certs from specified TC's secret.
func UseHeadlessService ¶ added in v1.3.0
UseHeadlessService indicates that the clients use headless service to connect to PD.
type PDClient ¶
type PDClient interface {
// GetHealth returns the PD's health info
GetHealth() (*HealthInfo, error)
// GetConfig returns PD's config
GetConfig() (*PDConfigFromAPI, error)
// GetCluster returns used when syncing pod labels.
GetCluster() (*metapb.Cluster, error)
// GetMembers returns all PD members from cluster
GetMembers() (*MembersInfo, error)
// GetStores lists all TiKV stores from cluster
GetStores() (*StoresInfo, error)
// GetTombStoneStores lists all tombstone stores from cluster
GetTombStoneStores() (*StoresInfo, error)
// GetStore gets a TiKV store for a specific store id from cluster
GetStore(storeID uint64) (*StoreInfo, error)
// storeLabelsEqualNodeLabels compares store labels with node labels
// for historic reasons, PD stores TiKV labels as []*StoreLabel which is a key-value pair slice
SetStoreLabels(storeID uint64, labels map[string]string) (bool, error)
// UpdateReplicationConfig updates the replication config
UpdateReplicationConfig(config PDReplicationConfig) error
// DeleteStore deletes a TiKV store from cluster
DeleteStore(storeID uint64) error
// SetStoreState sets store to specified state.
SetStoreState(storeID uint64, state string) error
// DeleteMember deletes a PD member from cluster
DeleteMember(name string) error
// DeleteMemberByID deletes a PD member from cluster
DeleteMemberByID(memberID uint64) error
// BeginEvictLeader initiates leader eviction for a storeID.
// This is used when upgrading a pod.
BeginEvictLeader(storeID uint64) error
// EndEvictLeader is used at the end of pod upgrade.
EndEvictLeader(storeID uint64) error
// GetEvictLeaderSchedulers gets schedulers of evict leader
GetEvictLeaderSchedulers() ([]string, error)
// GetEvictLeaderSchedulersForStores gets schedulers of evict leader for given stores
GetEvictLeaderSchedulersForStores(storeIDs ...uint64) (map[uint64]string, error)
// GetPDLeader returns pd leader
GetPDLeader() (*pdpb.Member, error)
// TransferPDLeader transfers pd leader to specified member
TransferPDLeader(name string) error
// GetAutoscalingPlans returns the scaling plan for the cluster
GetAutoscalingPlans(strategy Strategy) ([]Plan, error)
// GetRecoveringMark return the pd recovering mark
GetRecoveringMark() (bool, error)
}
PDClient provides pd server's api
type PDConfigFromAPI ¶ added in v1.1.0
type PDConfigFromAPI struct {
// Log related config.
Log *PDLogConfig `toml:"log,omitempty" json:"log,omitempty"`
// Immutable, change should be made through pd-ctl after cluster creation
Schedule *PDScheduleConfig `toml:"schedule,omitempty" json:"schedule,omitempty"`
// Immutable, change should be made through pd-ctl after cluster creation
Replication *PDReplicationConfig `toml:"replication,omitempty" json:"replication,omitempty"`
}
PDConfigFromAPI is the configuration from PD API +k8s:openapi-gen=true
type PDControlInterface ¶
type PDControlInterface interface {
// GetPDClient provides PDClient of the tidb cluster.
GetPDClient(namespace Namespace, tcName string, tlsEnabled bool, opts ...Option) PDClient
// GetPDEtcdClient provides PD etcd Client of the tidb cluster.
GetPDEtcdClient(namespace Namespace, tcName string, tlsEnabled bool, opts ...Option) (PDEtcdClient, error)
// GetEndpoints return the endpoints and client tls.Config to connection pd/etcd.
GetEndpoints(namespace Namespace, tcName string, tlsEnabled bool, opts ...Option) (endpoints []string, tlsConfig *tls.Config, err error)
}
PDControlInterface is an interface that knows how to manage and get tidb cluster's PD client
func NewDefaultPDControl ¶
func NewDefaultPDControl(secretLister corelisterv1.SecretLister) PDControlInterface
NewDefaultPDControl returns a defaultPDControl instance
func NewDefaultPDControlByCli ¶ added in v1.3.0
func NewDefaultPDControlByCli(kubeCli kubernetes.Interface) PDControlInterface
NewDefaultPDControl returns a defaultPDControl instance
type PDEtcdClient ¶ added in v1.1.1
type PDEtcdClient interface {
// Get the specific kvs.
// if prefix is true will return all kvs with the specified key as prefix
Get(key string, prefix bool) (kvs []*KeyValue, err error)
// PutKey will put key to the target pd etcd cluster
PutKey(key, value string) error
// PutKey will put key with ttl to the target pd etcd cluster
PutTTLKey(key, value string, ttl int64) error
// DeleteKey will delete key from the target pd etcd cluster
DeleteKey(key string) error
// Close will close the etcd connection
Close() error
}
func NewPdEtcdClient ¶ added in v1.1.0
type PDLabelPropertyConfig ¶ added in v1.1.0
type PDLabelPropertyConfig map[string]PDStoreLabels
type PDLogConfig ¶ added in v1.1.0
type PDLogConfig struct {
// Log level.
// Optional: Defaults to info
Level string `toml:"level,omitempty" json:"level,omitempty"`
// Log format. one of json, text, or console.
Format string `toml:"format,omitempty" json:"format,omitempty"`
// Disable automatic timestamps in output.
DisableTimestamp *bool `toml:"disable-timestamp,omitempty" json:"disable-timestamp,omitempty"`
// File log config.
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.
Development *bool `toml:"development,omitempty" json:"development,omitempty"`
// DisableCaller stops annotating logs with the calling function's file
// name and line number. By default, all logs are annotated.
DisableCaller *bool `toml:"disable-caller,omitempty" json:"disable-caller,omitempty"`
// DisableStacktrace completely disables automatic stacktrace capturing. By
// default, stacktraces are captured for WarnLevel and above logs in
// development and ErrorLevel and above in production.
DisableStacktrace *bool `toml:"disable-stacktrace,omitempty" json:"disable-stacktrace,omitempty"`
// DisableErrorVerbose stops annotating logs with the full verbose error
// message.
DisableErrorVerbose *bool `toml:"disable-error-verbose,omitempty" json:"disable-error-verbose,omitempty"`
}
PDLogConfig serializes log related config in toml/json. +k8s:openapi-gen=true
type PDReplicationConfig ¶ added in v1.1.0
type PDReplicationConfig struct {
// MaxReplicas is the number of replicas for each region.
// Immutable, change should be made through pd-ctl after cluster creation
// Optional: Defaults to 3
MaxReplicas *uint64 `toml:"max-replicas,omitempty" json:"max-replicas,omitempty"`
// The label keys specified the location of a store.
// The placement priorities is implied by the order of label keys.
// 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.
// Immutable, change should be made through pd-ctl after cluster creation
// +k8s:openapi-gen=false
LocationLabels StringSlice `toml:"location-labels,omitempty" json:"location-labels,omitempty"`
// StrictlyMatchLabel strictly checks if the label of TiKV is matched with LocaltionLabels.
// Immutable, change should be made through pd-ctl after cluster creation.
// Imported from v3.1.0
StrictlyMatchLabel *bool `toml:"strictly-match-label,omitempty" json:"strictly-match-label,string,omitempty"`
// When PlacementRules feature is enabled. MaxReplicas and LocationLabels are not used anymore.
EnablePlacementRules *bool `toml:"enable-placement-rules" json:"enable-placement-rules,string,omitempty"`
}
PDReplicationConfig is the replication configuration. +k8s:openapi-gen=true
type PDScheduleConfig ¶ added in v1.1.0
type PDScheduleConfig struct {
// If the snapshot count of one store is greater than this value,
// it will never be used as a source or target store.
// Immutable, change should be made through pd-ctl after cluster creation
// Optional: Defaults to 3
MaxSnapshotCount *uint64 `toml:"max-snapshot-count,omitempty" json:"max-snapshot-count,omitempty"`
// Immutable, change should be made through pd-ctl after cluster creation
// Optional: Defaults to 16
MaxPendingPeerCount *uint64 `toml:"max-pending-peer-count,omitempty" json:"max-pending-peer-count,omitempty"`
// If both the size of region is smaller than MaxMergeRegionSize
// and the number of rows in region is smaller than MaxMergeRegionKeys,
// it will try to merge with adjacent regions.
// Immutable, change should be made through pd-ctl after cluster creation
// Optional: Defaults to 20
MaxMergeRegionSize *uint64 `toml:"max-merge-region-size,omitempty" json:"max-merge-region-size,omitempty"`
// Immutable, change should be made through pd-ctl after cluster creation
// Optional: Defaults to 200000
MaxMergeRegionKeys *uint64 `toml:"max-merge-region-keys,omitempty" json:"max-merge-region-keys,omitempty"`
// SplitMergeInterval is the minimum interval time to permit merge after split.
// Immutable, change should be made through pd-ctl after cluster creation
// Optional: Defaults to 1h
SplitMergeInterval string `toml:"split-merge-interval,omitempty" json:"split-merge-interval,omitempty"`
// PatrolRegionInterval is the interval for scanning region during patrol.
// Immutable, change should be made through pd-ctl after cluster creation
PatrolRegionInterval string `toml:"patrol-region-interval,omitempty" json:"patrol-region-interval,omitempty"`
// MaxStoreDownTime is the max duration after which
// a store will be considered to be down if it hasn't reported heartbeats.
// Immutable, change should be made through pd-ctl after cluster creation
// Optional: Defaults to 30m
MaxStoreDownTime string `toml:"max-store-down-time,omitempty" json:"max-store-down-time,omitempty"`
// LeaderScheduleLimit is the max coexist leader schedules.
// Immutable, change should be made through pd-ctl after cluster creation.
// Optional: Defaults to 4.
// Imported from v3.1.0
LeaderScheduleLimit *uint64 `toml:"leader-schedule-limit,omitempty" json:"leader-schedule-limit,omitempty"`
// RegionScheduleLimit is the max coexist region schedules.
// Immutable, change should be made through pd-ctl after cluster creation
// Optional: Defaults to 2048
RegionScheduleLimit *uint64 `toml:"region-schedule-limit,omitempty" json:"region-schedule-limit,omitempty"`
// ReplicaScheduleLimit is the max coexist replica schedules.
// Immutable, change should be made through pd-ctl after cluster creation
// Optional: Defaults to 64
ReplicaScheduleLimit *uint64 `toml:"replica-schedule-limit,omitempty" json:"replica-schedule-limit,omitempty"`
// MergeScheduleLimit is the max coexist merge schedules.
// Immutable, change should be made through pd-ctl after cluster creation
// Optional: Defaults to 8
MergeScheduleLimit *uint64 `toml:"merge-schedule-limit,omitempty" json:"merge-schedule-limit,omitempty"`
// HotRegionScheduleLimit is the max coexist hot region schedules.
// Immutable, change should be made through pd-ctl after cluster creation
// Optional: Defaults to 4
HotRegionScheduleLimit *uint64 `toml:"hot-region-schedule-limit,omitempty" json:"hot-region-schedule-limit,omitempty"`
// HotRegionCacheHitThreshold is the cache hits threshold of the hot region.
// If the number of times a region hits the hot cache is greater than this
// threshold, it is considered a hot region.
// Immutable, change should be made through pd-ctl after cluster creation
HotRegionCacheHitsThreshold *uint64 `toml:"hot-region-cache-hits-threshold,omitempty" json:"hot-region-cache-hits-threshold,omitempty"`
// TolerantSizeRatio is the ratio of buffer size for balance scheduler.
// Immutable, change should be made through pd-ctl after cluster creation.
// Imported from v3.1.0
TolerantSizeRatio *float64 `toml:"tolerant-size-ratio,omitempty" json:"tolerant-size-ratio,omitempty"`
//
// high space stage transition stage low space stage
// |--------------------|-----------------------------|-------------------------|
// ^ ^ ^ ^
// 0 HighSpaceRatio * capacity LowSpaceRatio * capacity capacity
//
// LowSpaceRatio is the lowest usage ratio of store which regraded as low space.
// When in low space, store region score increases to very large and varies inversely with available size.
// Immutable, change should be made through pd-ctl after cluster creation
LowSpaceRatio *float64 `toml:"low-space-ratio,omitempty" json:"low-space-ratio,omitempty"`
// HighSpaceRatio is the highest usage ratio of store which regraded as high space.
// High space means there is a lot of spare capacity, and store region score varies directly with used size.
// Immutable, change should be made through pd-ctl after cluster creation
HighSpaceRatio *float64 `toml:"high-space-ratio,omitempty" json:"high-space-ratio,omitempty"`
// DisableLearner is the option to disable using AddLearnerNode instead of AddNode
// Immutable, change should be made through pd-ctl after cluster creation
DisableLearner *bool `toml:"disable-raft-learner,omitempty" json:"disable-raft-learner,string,omitempty"`
// DisableRemoveDownReplica is the option to prevent replica checker from
// removing down replicas.
// Immutable, change should be made through pd-ctl after cluster creation
DisableRemoveDownReplica *bool `toml:"disable-remove-down-replica,omitempty" json:"disable-remove-down-replica,string,omitempty"`
// DisableReplaceOfflineReplica is the option to prevent replica checker from
// repalcing offline replicas.
// Immutable, change should be made through pd-ctl after cluster creation
DisableReplaceOfflineReplica *bool `toml:"disable-replace-offline-replica,omitempty" json:"disable-replace-offline-replica,string,omitempty"`
// DisableMakeUpReplica is the option to prevent replica checker from making up
// replicas when replica count is less than expected.
// Immutable, change should be made through pd-ctl after cluster creation
DisableMakeUpReplica *bool `toml:"disable-make-up-replica,omitempty" json:"disable-make-up-replica,string,omitempty"`
// DisableRemoveExtraReplica is the option to prevent replica checker from
// removing extra replicas.
// Immutable, change should be made through pd-ctl after cluster creation
DisableRemoveExtraReplica *bool `toml:"disable-remove-extra-replica,omitempty" json:"disable-remove-extra-replica,string,omitempty"`
// DisableLocationReplacement is the option to prevent replica checker from
// moving replica to a better location.
// Immutable, change should be made through pd-ctl after cluster creation
DisableLocationReplacement *bool `toml:"disable-location-replacement,omitempty" json:"disable-location-replacement,string,omitempty"`
// DisableNamespaceRelocation is the option to prevent namespace checker
// from moving replica to the target namespace.
// Immutable, change should be made through pd-ctl after cluster creation
DisableNamespaceRelocation *bool `toml:"disable-namespace-relocation,omitempty" json:"disable-namespace-relocation,string,omitempty"`
// Schedulers support for loding customized schedulers
// Immutable, change should be made through pd-ctl after cluster creation
Schedulers *PDSchedulerConfigs `toml:"schedulers,omitempty" json:"schedulers-v2,omitempty"` // json v2 is for the sake of compatible upgrade
// Only used to display
SchedulersPayload map[string]interface{} `toml:"schedulers-payload" json:"schedulers-payload,omitempty"`
// EnableOneWayMerge is the option to enable one way merge. This means a Region can only be merged into the next region of it.
// Imported from v3.1.0
EnableOneWayMerge *bool `toml:"enable-one-way-merge" json:"enable-one-way-merge,string,omitempty"`
// EnableCrossTableMerge is the option to enable cross table merge. This means two Regions can be merged with different table IDs.
// This option only works when key type is "table".
// Imported from v3.1.0
EnableCrossTableMerge *bool `toml:"enable-cross-table-merge" json:"enable-cross-table-merge,string,omitempty"`
}
ScheduleConfig is the schedule configuration. +k8s:openapi-gen=true
type PDSchedulerConfig ¶ added in v1.1.0
type PDSchedulerConfig struct {
// Immutable, change should be made through pd-ctl after cluster creation
Type string `toml:"type,omitempty" json:"type,omitempty"`
// Immutable, change should be made through pd-ctl after cluster creation
Args []string `toml:"args,omitempty" json:"args,omitempty"`
// Immutable, change should be made through pd-ctl after cluster creation
Disable *bool `toml:"disable,omitempty" json:"disable,omitempty"`
}
PDSchedulerConfig is customized scheduler configuration +k8s:openapi-gen=true
type PDSchedulerConfigs ¶ added in v1.1.0
type PDSchedulerConfigs []PDSchedulerConfig
type PDStoreLabel ¶ added in v1.1.0
type PDStoreLabel struct {
Key string `toml:"key,omitempty" json:"key,omitempty"`
Value string `toml:"value,omitempty" json:"value,omitempty"`
}
PDStoreLabel is the config item of LabelPropertyConfig. +k8s:openapi-gen=true
type PDStoreLabels ¶ added in v1.1.0
type PDStoreLabels []PDStoreLabel
type Plan ¶ added in v1.2.0
type Plan struct {
Component string `json:"component"`
Count uint64 `json:"count"`
ResourceType string `json:"resource_type"`
Labels map[string]string `json:"labels"`
}
Plan is the final result of auto scaling, which indicates how to scale in or scale out.
type RecoveringMark ¶ added in v1.4.4
type RecoveringMark struct {
Mark bool `json:"marked"`
}
type Resource ¶ added in v1.2.0
type Resource struct {
ResourceType string `json:"resource_type"`
// The basic unit of CPU is milli-core.
CPU uint64 `json:"cpu"`
// The basic unit of memory is byte.
Memory uint64 `json:"memory"`
// The basic unit of storage is byte.
Storage uint64 `json:"storage"`
// If count is not set, it indicates no limit.
Count *uint64 `json:"count,omitempty"`
}
Resource represents a kind of resource set including CPU, memory, storage.
type Rule ¶ added in v1.2.0
type Rule struct {
Component string `json:"component"`
CPURule *CPURule `json:"cpu_rule,omitempty"`
StorageRule *StorageRule `json:"storage_rule,omitempty"`
}
Rule is a set of constraints for a kind of component.
type StorageRule ¶ added in v1.2.0
type StorageRule struct {
MinThreshold float64 `json:"min_threshold"`
ResourceTypes []string `json:"resource_types"`
}
StorageRule is the constraints about storage.
type StoreInfo ¶
type StoreInfo struct {
Store *MetaStore `json:"store"`
Status *StoreStatus `json:"status"`
}
StoreInfo is a single store info returned from PD RESTful interface
type StoreStatus ¶
type StoreStatus struct {
Capacity typeutil.ByteSize `json:"capacity"`
Available typeutil.ByteSize `json:"available"`
LeaderCount int `json:"leader_count"`
RegionCount int `json:"region_count"`
SendingSnapCount uint32 `json:"sending_snap_count"`
ReceivingSnapCount uint32 `json:"receiving_snap_count"`
ApplyingSnapCount uint32 `json:"applying_snap_count"`
IsBusy bool `json:"is_busy"`
StartTS time.Time `json:"start_ts"`
LastHeartbeatTS time.Time `json:"last_heartbeat_ts"`
Uptime typeutil.Duration `json:"uptime"`
}
StoreStatus is TiKV store status returned from PD RESTful interface
type StoresInfo ¶
StoresInfo is stores info returned from PD RESTful interface
type Strategy ¶ added in v1.2.0
Strategy within a HTTP request provides rules and resources to help make decision for auto scaling.
type StringSlice ¶ added in v1.1.0
type StringSlice []string
StringSlice is more friendly to json encode/decode
func (StringSlice) MarshalJSON ¶ added in v1.1.0
func (s StringSlice) MarshalJSON() ([]byte, error)
MarshalJSON returns the size as a JSON string.
func (*StringSlice) UnmarshalJSON ¶ added in v1.1.0
func (s *StringSlice) UnmarshalJSON(text []byte) error
UnmarshalJSON parses a JSON string into the bytesize.
type TiKVNotBootstrappedError ¶ added in v1.1.10
type TiKVNotBootstrappedError struct {
// contains filtered or unexported fields
}
TiKVNotBootstrappedError represents that TiKV cluster is not bootstrapped yet
func (*TiKVNotBootstrappedError) Error ¶ added in v1.1.10
func (e *TiKVNotBootstrappedError) Error() string