config

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2023 License: Apache-2.0 Imports: 46 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// DefaultMinResolvedTSPersistenceInterval is the default value of min resolved ts persistent interval.
	DefaultMinResolvedTSPersistenceInterval = time.Second
)
View Source
const (
	// ZoneLabel is the name of the key which indicates DC location of this PD server.
	ZoneLabel = "zone"
)

Special keys for Labels

Variables

View Source
var (

	// DefaultStoreLimit is the default store limit of add peer and remove peer.
	DefaultStoreLimit = StoreLimit{AddPeer: 15, RemovePeer: 15}
	// DefaultTiFlashStoreLimit is the default TiFlash store limit of add peer and remove peer.
	DefaultTiFlashStoreLimit = StoreLimit{AddPeer: 30, RemovePeer: 30}
)
View Source
var DefaultSchedulers = SchedulerConfigs{
	{Type: "balance-region"},
	{Type: "balance-leader"},
	{Type: "balance-witness"},
	{Type: "hot-region"},
	{Type: "transfer-witness-leader"},
}

DefaultSchedulers are the schedulers be created by default. If these schedulers are not in the persistent configuration, they will be created automatically when reloading.

Functions

func IsDefaultScheduler

func IsDefaultScheduler(typ string) bool

IsDefaultScheduler checks whether the scheduler is enable by default.

func IsSupportedTTLConfig

func IsSupportedTTLConfig(key string) bool

IsSupportedTTLConfig checks whether a key is a supported config item with ttl

func NormalizeReplicationMode

func NormalizeReplicationMode(m string) string

NormalizeReplicationMode converts user's input mode to internal use. It returns "" if failed to convert.

func ValidateLabelKey

func ValidateLabelKey(key string) error

ValidateLabelKey checks the legality of the label key.

func ValidateLabels

func ValidateLabels(labels []*metapb.StoreLabel) error

ValidateLabels checks the legality of the labels.

func ValidateURLWithScheme

func ValidateURLWithScheme(rawURL string) error

ValidateURLWithScheme checks the format of the URL.

Types

type AuditConfig

type AuditConfig struct {
	// EnableAudit controls the switch of the audit middleware
	EnableAudit bool `json:"enable-audit,string"`
}

AuditConfig is the configuration for audit

func (*AuditConfig) Clone

func (c *AuditConfig) Clone() *AuditConfig

Clone returns a cloned audit config.

type Config

type Config struct {
	ClientUrls          string `toml:"client-urls" json:"client-urls"`
	PeerUrls            string `toml:"peer-urls" json:"peer-urls"`
	AdvertiseClientUrls string `toml:"advertise-client-urls" json:"advertise-client-urls"`
	AdvertisePeerUrls   string `toml:"advertise-peer-urls" json:"advertise-peer-urls"`

	Name              string `toml:"name" json:"name"`
	DataDir           string `toml:"data-dir" json:"data-dir"`
	ForceNewCluster   bool   `json:"force-new-cluster"`
	EnableGRPCGateway bool   `json:"enable-grpc-gateway"`

	InitialCluster      string `toml:"initial-cluster" json:"initial-cluster"`
	InitialClusterState string `toml:"initial-cluster-state" json:"initial-cluster-state"`
	InitialClusterToken string `toml:"initial-cluster-token" json:"initial-cluster-token"`

	// Join to an existing pd cluster, a string of endpoints.
	Join string `toml:"join" json:"join"`

	// LeaderLease time, if leader doesn't update its TTL
	// in etcd after lease time, etcd will expire the leader key
	// and other servers can campaign the leader again.
	// Etcd only supports seconds TTL, so here is second too.
	LeaderLease int64 `toml:"lease" json:"lease"`

	// Log related config.
	Log log.Config `toml:"log" json:"log"`

	// Backward compatibility.
	LogFileDeprecated  string `toml:"log-file" json:"log-file,omitempty"`
	LogLevelDeprecated string `toml:"log-level" json:"log-level,omitempty"`

	// TSOSaveInterval is the interval to save timestamp.
	TSOSaveInterval typeutil.Duration `toml:"tso-save-interval" json:"tso-save-interval"`

	// The interval to update physical part of timestamp. Usually, this config should not be set.
	// At most 1<<18 (262144) TSOs can be generated in the interval. The smaller the value, the
	// more TSOs provided, and at the same time consuming more CPU time.
	// This config is only valid in 1ms to 10s. If it's configured too long or too short, it will
	// be automatically clamped to the range.
	TSOUpdatePhysicalInterval typeutil.Duration `toml:"tso-update-physical-interval" json:"tso-update-physical-interval"`

	// EnableLocalTSO is used to enable the Local TSO Allocator feature,
	// which allows the PD server to generate Local TSO for certain DC-level transactions.
	// To make this feature meaningful, user has to set the "zone" label for the PD server
	// to indicate which DC this PD belongs to.
	EnableLocalTSO bool `toml:"enable-local-tso" json:"enable-local-tso"`

	Metric metricutil.MetricConfig `toml:"metric" json:"metric"`

	Schedule ScheduleConfig `toml:"schedule" json:"schedule"`

	Replication ReplicationConfig `toml:"replication" json:"replication"`

	PDServerCfg PDServerConfig `toml:"pd-server" json:"pd-server"`

	ClusterVersion semver.Version `toml:"cluster-version" json:"cluster-version"`

	// Labels indicates the labels set for **this** PD server. The labels describe some specific properties
	// like `zone`/`rack`/`host`. Currently, labels won't affect the PD server except for some special
	// label keys. Now we have following special keys:
	// 1. 'zone' is a special key that indicates the DC location of this PD server. If it is set, the value for this
	// will be used to determine which DC's Local TSO service this PD will provide with if EnableLocalTSO is true.
	Labels map[string]string `toml:"labels" json:"labels"`

	// QuotaBackendBytes Raise alarms when backend size exceeds the given quota. 0 means use the default quota.
	// the default size is 2GB, the maximum is 8GB.
	QuotaBackendBytes typeutil.ByteSize `toml:"quota-backend-bytes" json:"quota-backend-bytes"`
	// AutoCompactionMode is either 'periodic' or 'revision'. The default value is 'periodic'.
	AutoCompactionMode string `toml:"auto-compaction-mode" json:"auto-compaction-mode"`
	// AutoCompactionRetention is either duration string with time unit
	// (e.g. '5m' for 5-minute), or revision unit (e.g. '5000').
	// If no time unit is provided and compaction mode is 'periodic',
	// the unit defaults to hour. For example, '5' translates into 5-hour.
	// The default retention is 1 hour.
	// Before etcd v3.3.x, the type of retention is int. We add 'v2' suffix to make it backward compatible.
	AutoCompactionRetention string `toml:"auto-compaction-retention" json:"auto-compaction-retention-v2"`

	// TickInterval is the interval for etcd Raft tick.
	TickInterval typeutil.Duration `toml:"tick-interval"`
	// ElectionInterval is the interval for etcd Raft election.
	ElectionInterval typeutil.Duration `toml:"election-interval"`
	// Prevote is true to enable Raft Pre-Vote.
	// If enabled, Raft runs an additional election phase
	// to check whether it would get enough votes to win
	// an election, thus minimizing disruptions.
	PreVote bool `toml:"enable-prevote"`

	MaxRequestBytes uint `toml:"max-request-bytes" json:"max-request-bytes"`

	Security configutil.SecurityConfig `toml:"security" json:"security"`

	LabelProperty LabelPropertyConfig `toml:"label-property" json:"label-property"`

	// For all warnings during parsing.
	WarningMsgs []string

	DisableStrictReconfigCheck bool

	HeartbeatStreamBindInterval typeutil.Duration
	LeaderPriorityCheckInterval typeutil.Duration

	Logger   *zap.Logger        `json:"-"`
	LogProps *log.ZapProperties `json:"-"`

	Dashboard DashboardConfig `toml:"dashboard" json:"dashboard"`

	ReplicationMode ReplicationModeConfig `toml:"replication-mode" json:"replication-mode"`

	Keyspace KeyspaceConfig `toml:"keyspace" json:"keyspace"`

	Controller rm.ControllerConfig `toml:"controller" json:"controller"`
}

Config is the pd server configuration. NOTE: This type is exported by HTTP API. Please pay more attention when modifying it.

func NewConfig

func NewConfig() *Config

NewConfig creates a new config.

func (*Config) Adjust

func (c *Config) Adjust(meta *toml.MetaData, reloading bool) error

Adjust is used to adjust the PD configurations.

func (*Config) Clone

func (c *Config) Clone() *Config

Clone returns a cloned configuration.

func (*Config) GenEmbedEtcdConfig

func (c *Config) GenEmbedEtcdConfig() (*embed.Config, error)

GenEmbedEtcdConfig generates a configuration for embedded etcd.

func (*Config) GetLeaderLease

func (c *Config) GetLeaderLease() int64

GetLeaderLease returns the leader lease.

func (*Config) GetTLSConfig

func (c *Config) GetTLSConfig() *grpcutil.TLSConfig

GetTLSConfig returns the TLS config.

func (*Config) GetTSOSaveInterval

func (c *Config) GetTSOSaveInterval() time.Duration

GetTSOSaveInterval returns TSO save interval.

func (*Config) GetTSOUpdatePhysicalInterval

func (c *Config) GetTSOUpdatePhysicalInterval() time.Duration

GetTSOUpdatePhysicalInterval returns TSO update physical interval.

func (*Config) IsLocalTSOEnabled

func (c *Config) IsLocalTSOEnabled() bool

IsLocalTSOEnabled returns if the local TSO is enabled.

func (*Config) Parse

func (c *Config) Parse(flagSet *pflag.FlagSet) error

Parse parses flag definitions from the argument list.

func (*Config) String

func (c *Config) String() string

func (*Config) Validate

func (c *Config) Validate() error

Validate is used to validate if some configurations are right.

type Coprocessor

type Coprocessor struct {
	// RegionMaxSize is the max size of a region, if the region size is larger than this value, region will be
	// split by RegionSplitSize.
	RegionMaxSize string `json:"region-max-size"`
	// RegionSplitSize is the split size of a region, region will according to this value to split.
	RegionSplitSize    string `json:"region-split-size"`
	RegionMaxKeys      int    `json:"region-max-keys"`
	RegionSplitKeys    int    `json:"region-split-keys"`
	EnableRegionBucket bool   `json:"enable-region-bucket"`
	RegionBucketSize   string `json:"region-bucket-size"`
}

Coprocessor is the config of coprocessor.

type DRAutoSyncReplicationConfig

type DRAutoSyncReplicationConfig struct {
	LabelKey         string            `toml:"label-key" json:"label-key"`
	Primary          string            `toml:"primary" json:"primary"`
	DR               string            `toml:"dr" json:"dr"`
	PrimaryReplicas  int               `toml:"primary-replicas" json:"primary-replicas"`
	DRReplicas       int               `toml:"dr-replicas" json:"dr-replicas"`
	WaitStoreTimeout typeutil.Duration `toml:"wait-store-timeout" json:"wait-store-timeout"`
	PauseRegionSplit bool              `toml:"pause-region-split" json:"pause-region-split,string"`
}

DRAutoSyncReplicationConfig is the configuration for auto sync mode between 2 data centers.

type DashboardConfig

type DashboardConfig struct {
	TiDBCAPath         string `toml:"tidb-cacert-path" json:"tidb-cacert-path"`
	TiDBCertPath       string `toml:"tidb-cert-path" json:"tidb-cert-path"`
	TiDBKeyPath        string `toml:"tidb-key-path" json:"tidb-key-path"`
	PublicPathPrefix   string `toml:"public-path-prefix" json:"public-path-prefix"`
	InternalProxy      bool   `toml:"internal-proxy" json:"internal-proxy"`
	EnableTelemetry    bool   `toml:"enable-telemetry" json:"enable-telemetry"`
	EnableExperimental bool   `toml:"enable-experimental" json:"enable-experimental"`
}

DashboardConfig is the configuration for tidb-dashboard.

func (*DashboardConfig) ToTiDBTLSConfig

func (c *DashboardConfig) ToTiDBTLSConfig() (*tls.Config, error)

ToTiDBTLSConfig generates tls config for connecting to TiDB, used by tidb-dashboard.

type FakeSource

type FakeSource struct {
	// contains filtered or unexported fields
}

FakeSource is used to test.

func (*FakeSource) GetConfig

func (f *FakeSource) GetConfig(url string) (*StoreConfig, error)

GetConfig returns the config.

type KeyspaceConfig

type KeyspaceConfig struct {
	// PreAlloc contains the keyspace to be allocated during keyspace manager initialization.
	PreAlloc []string `toml:"pre-alloc" json:"pre-alloc"`
}

KeyspaceConfig is the configuration for keyspace management.

func (*KeyspaceConfig) GetPreAlloc

func (c *KeyspaceConfig) GetPreAlloc() []string

GetPreAlloc returns the keyspace to be allocated during keyspace manager initialization.

type LabelPropertyConfig

type LabelPropertyConfig map[string][]StoreLabel

LabelPropertyConfig is the config section to set properties to store labels. NOTE: This type is exported by HTTP API. Please pay more attention when modifying it.

func (LabelPropertyConfig) Clone

Clone returns a cloned label property configuration.

type PDServerConfig

type PDServerConfig struct {
	// UseRegionStorage enables the independent region storage.
	UseRegionStorage bool `toml:"use-region-storage" json:"use-region-storage,string"`
	// MaxResetTSGap is the max gap to reset the TSO.
	MaxResetTSGap typeutil.Duration `toml:"max-gap-reset-ts" json:"max-gap-reset-ts"`
	// KeyType is option to specify the type of keys.
	// There are some types supported: ["table", "raw", "txn"], default: "table"
	KeyType string `toml:"key-type" json:"key-type"`
	// RuntimeServices is the running the running extension services.
	RuntimeServices typeutil.StringSlice `toml:"runtime-services" json:"runtime-services"`
	// MetricStorage is the cluster metric storage.
	// Currently we use prometheus as metric storage, we may use PD/TiKV as metric storage later.
	MetricStorage string `toml:"metric-storage" json:"metric-storage"`
	// There are some values supported: "auto", "none", or a specific address, default: "auto"
	DashboardAddress string `toml:"dashboard-address" json:"dashboard-address"`
	// TraceRegionFlow the option to update flow information of regions.
	// WARN: TraceRegionFlow is deprecated.
	TraceRegionFlow bool `toml:"trace-region-flow" json:"trace-region-flow,string,omitempty"`
	// FlowRoundByDigit used to discretization processing flow information.
	FlowRoundByDigit int `toml:"flow-round-by-digit" json:"flow-round-by-digit"`
	// MinResolvedTSPersistenceInterval is the interval to save the min resolved ts.
	MinResolvedTSPersistenceInterval typeutil.Duration `toml:"min-resolved-ts-persistence-interval" json:"min-resolved-ts-persistence-interval"`
	// ServerMemoryLimit indicates the memory limit of current process.
	ServerMemoryLimit float64 `toml:"server-memory-limit" json:"server-memory-limit"`
	// ServerMemoryLimitGCTrigger indicates the gc percentage of the ServerMemoryLimit.
	ServerMemoryLimitGCTrigger float64 `toml:"server-memory-limit-gc-trigger" json:"server-memory-limit-gc-trigger"`
	// EnableGOGCTuner is to enable GOGC tuner. it can tuner GOGC
	EnableGOGCTuner bool `toml:"enable-gogc-tuner" json:"enable-gogc-tuner,string"`
	// GCTunerThreshold is the threshold of GC tuner.
	GCTunerThreshold float64 `toml:"gc-tuner-threshold" json:"gc-tuner-threshold"`
}

PDServerConfig is the configuration for pd server. NOTE: This type is exported by HTTP API. Please pay more attention when modifying it.

func (*PDServerConfig) Clone

func (c *PDServerConfig) Clone() *PDServerConfig

Clone returns a cloned PD server config.

func (*PDServerConfig) MigrateDeprecatedFlags

func (c *PDServerConfig) MigrateDeprecatedFlags()

MigrateDeprecatedFlags updates new flags according to deprecated flags.

func (*PDServerConfig) Validate

func (c *PDServerConfig) Validate() error

Validate is used to validate if some pd-server configurations are right.

type PersistOptions

type PersistOptions struct {
	// contains filtered or unexported fields
}

PersistOptions wraps all configurations that need to persist to storage and allows to access them safely.

func NewPersistOptions

func NewPersistOptions(cfg *Config) *PersistOptions

NewPersistOptions creates a new PersistOptions instance.

func (*PersistOptions) AddSchedulerCfg

func (o *PersistOptions) AddSchedulerCfg(tp string, args []string)

AddSchedulerCfg adds the scheduler configurations.

func (*PersistOptions) CASClusterVersion

func (o *PersistOptions) CASClusterVersion(old, new *semver.Version) bool

CASClusterVersion sets the cluster version.

func (*PersistOptions) CheckLabelProperty

func (o *PersistOptions) CheckLabelProperty(typ string, labels []*metapb.StoreLabel) bool

CheckLabelProperty checks the label property.

func (*PersistOptions) DeleteLabelProperty

func (o *PersistOptions) DeleteLabelProperty(typ, labelKey, labelValue string)

DeleteLabelProperty deletes the label property.

func (*PersistOptions) GetAllStoresLimit

func (o *PersistOptions) GetAllStoresLimit() map[uint64]StoreLimitConfig

GetAllStoresLimit returns the limit of all stores.

func (*PersistOptions) GetClusterVersion

func (o *PersistOptions) GetClusterVersion() *semver.Version

GetClusterVersion returns the cluster version.

func (*PersistOptions) GetDashboardAddress

func (o *PersistOptions) GetDashboardAddress() string

GetDashboardAddress gets dashboard address.

func (*PersistOptions) GetEnableGOGCTuner

func (o *PersistOptions) GetEnableGOGCTuner() bool

GetEnableGOGCTuner gets the EnableGOGCTuner config.

func (*PersistOptions) GetGCTunerThreshold

func (o *PersistOptions) GetGCTunerThreshold() float64

GetGCTunerThreshold gets the GC tuner threshold.

func (*PersistOptions) GetHighSpaceRatio

func (o *PersistOptions) GetHighSpaceRatio() float64

GetHighSpaceRatio returns the high space ratio.

func (*PersistOptions) GetHotRegionCacheHitsThreshold

func (o *PersistOptions) GetHotRegionCacheHitsThreshold() int

GetHotRegionCacheHitsThreshold is a threshold to decide if a region is hot.

func (*PersistOptions) GetHotRegionScheduleLimit

func (o *PersistOptions) GetHotRegionScheduleLimit() uint64

GetHotRegionScheduleLimit returns the limit for hot region schedule.

func (*PersistOptions) GetHotRegionsReservedDays

func (o *PersistOptions) GetHotRegionsReservedDays() uint64

GetHotRegionsReservedDays gets days hot region information is kept.

func (*PersistOptions) GetHotRegionsWriteInterval

func (o *PersistOptions) GetHotRegionsWriteInterval() time.Duration

GetHotRegionsWriteInterval gets interval for PD to store Hot Region information.

func (*PersistOptions) GetIsolationLevel

func (o *PersistOptions) GetIsolationLevel() string

GetIsolationLevel returns the isolation label for each region.

func (*PersistOptions) GetKeyType

func (o *PersistOptions) GetKeyType() constant.KeyType

GetKeyType is to get key type.

func (*PersistOptions) GetLabelPropertyConfig

func (o *PersistOptions) GetLabelPropertyConfig() LabelPropertyConfig

GetLabelPropertyConfig returns the label property.

func (*PersistOptions) GetLeaderScheduleLimit

func (o *PersistOptions) GetLeaderScheduleLimit() uint64

GetLeaderScheduleLimit returns the limit for leader schedule.

func (*PersistOptions) GetLeaderSchedulePolicy

func (o *PersistOptions) GetLeaderSchedulePolicy() constant.SchedulePolicy

GetLeaderSchedulePolicy is to get leader schedule policy.

func (*PersistOptions) GetLocationLabels

func (o *PersistOptions) GetLocationLabels() []string

GetLocationLabels returns the location labels for each region.

func (*PersistOptions) GetLowSpaceRatio

func (o *PersistOptions) GetLowSpaceRatio() float64

GetLowSpaceRatio returns the low space ratio.

func (*PersistOptions) GetMaxMergeRegionKeys

func (o *PersistOptions) GetMaxMergeRegionKeys() uint64

GetMaxMergeRegionKeys returns the max number of keys. It returns size * 10000 if the key of max-merge-region-Keys doesn't exist.

func (*PersistOptions) GetMaxMergeRegionSize

func (o *PersistOptions) GetMaxMergeRegionSize() uint64

GetMaxMergeRegionSize returns the max region size.

func (*PersistOptions) GetMaxMovableHotPeerSize

func (o *PersistOptions) GetMaxMovableHotPeerSize() int64

GetMaxMovableHotPeerSize returns the max movable hot peer size.

func (*PersistOptions) GetMaxPendingPeerCount

func (o *PersistOptions) GetMaxPendingPeerCount() uint64

GetMaxPendingPeerCount returns the number of the max pending peers.

func (*PersistOptions) GetMaxReplicas

func (o *PersistOptions) GetMaxReplicas() int

GetMaxReplicas returns the number of replicas for each region.

func (*PersistOptions) GetMaxResetTSGap

func (o *PersistOptions) GetMaxResetTSGap() time.Duration

GetMaxResetTSGap gets the max gap to reset the tso.

func (*PersistOptions) GetMaxSnapshotCount

func (o *PersistOptions) GetMaxSnapshotCount() uint64

GetMaxSnapshotCount returns the number of the max snapshot which is allowed to send.

func (*PersistOptions) GetMaxStoreDownTime

func (o *PersistOptions) GetMaxStoreDownTime() time.Duration

GetMaxStoreDownTime returns the max down time of a store.

func (*PersistOptions) GetMaxStorePreparingTime

func (o *PersistOptions) GetMaxStorePreparingTime() time.Duration

GetMaxStorePreparingTime returns the max preparing time of a store.

func (*PersistOptions) GetMergeScheduleLimit

func (o *PersistOptions) GetMergeScheduleLimit() uint64

GetMergeScheduleLimit returns the limit for merge schedule.

func (*PersistOptions) GetMinResolvedTSPersistenceInterval

func (o *PersistOptions) GetMinResolvedTSPersistenceInterval() time.Duration

GetMinResolvedTSPersistenceInterval gets the interval for PD to save min resolved ts.

func (*PersistOptions) GetPDServerConfig

func (o *PersistOptions) GetPDServerConfig() *PDServerConfig

GetPDServerConfig returns pd server configurations.

func (*PersistOptions) GetPatrolRegionInterval

func (o *PersistOptions) GetPatrolRegionInterval() time.Duration

GetPatrolRegionInterval returns the interval of patrolling region.

func (*PersistOptions) GetRegionScheduleLimit

func (o *PersistOptions) GetRegionScheduleLimit() uint64

GetRegionScheduleLimit returns the limit for region schedule.

func (*PersistOptions) GetRegionScoreFormulaVersion

func (o *PersistOptions) GetRegionScoreFormulaVersion() string

GetRegionScoreFormulaVersion returns the formula version config.

func (*PersistOptions) GetReplicaScheduleLimit

func (o *PersistOptions) GetReplicaScheduleLimit() uint64

GetReplicaScheduleLimit returns the limit for replica schedule.

func (*PersistOptions) GetReplicationConfig

func (o *PersistOptions) GetReplicationConfig() *ReplicationConfig

GetReplicationConfig returns replication configurations.

func (*PersistOptions) GetReplicationModeConfig

func (o *PersistOptions) GetReplicationModeConfig() *ReplicationModeConfig

GetReplicationModeConfig returns the replication mode config.

func (*PersistOptions) GetScheduleConfig

func (o *PersistOptions) GetScheduleConfig() *ScheduleConfig

GetScheduleConfig returns scheduling configurations.

func (*PersistOptions) GetSchedulerMaxWaitingOperator

func (o *PersistOptions) GetSchedulerMaxWaitingOperator() uint64

GetSchedulerMaxWaitingOperator returns the number of the max waiting operators.

func (*PersistOptions) GetSchedulers

func (o *PersistOptions) GetSchedulers() SchedulerConfigs

GetSchedulers gets the scheduler configurations.

func (*PersistOptions) GetServerMemoryLimit

func (o *PersistOptions) GetServerMemoryLimit() float64

GetServerMemoryLimit gets ServerMemoryLimit config.

func (*PersistOptions) GetServerMemoryLimitGCTrigger

func (o *PersistOptions) GetServerMemoryLimitGCTrigger() float64

GetServerMemoryLimitGCTrigger gets the ServerMemoryLimitGCTrigger config.

func (*PersistOptions) GetSlowStoreEvictingAffectedStoreRatioThreshold

func (o *PersistOptions) GetSlowStoreEvictingAffectedStoreRatioThreshold() float64

GetSlowStoreEvictingAffectedStoreRatioThreshold returns the affected ratio threshold when judging a store is slow.

func (*PersistOptions) GetSplitMergeInterval

func (o *PersistOptions) GetSplitMergeInterval() time.Duration

GetSplitMergeInterval returns the interval between finishing split and starting to merge.

func (*PersistOptions) GetStoreLimit

func (o *PersistOptions) GetStoreLimit(storeID uint64) (returnSC StoreLimitConfig)

GetStoreLimit returns the limit of a store.

func (*PersistOptions) GetStoreLimitByType

func (o *PersistOptions) GetStoreLimitByType(storeID uint64, typ storelimit.Type) (returned float64)

GetStoreLimitByType returns the limit of a store with a given type.

func (*PersistOptions) GetStoreLimitMode

func (o *PersistOptions) GetStoreLimitMode() string

GetStoreLimitMode returns the limit mode of store.

func (*PersistOptions) GetStoreLimitVersion

func (o *PersistOptions) GetStoreLimitVersion() string

GetStoreLimitVersion returns the limit version of store.

func (*PersistOptions) GetStoresLimit

func (o *PersistOptions) GetStoresLimit() map[uint64]StoreLimitConfig

GetStoresLimit gets the stores' limit.

func (*PersistOptions) GetStrictlyMatchLabel

func (o *PersistOptions) GetStrictlyMatchLabel() bool

GetStrictlyMatchLabel returns whether check label strict.

func (*PersistOptions) GetSwitchWitnessInterval

func (o *PersistOptions) GetSwitchWitnessInterval() time.Duration

GetSwitchWitnessInterval returns the interval between promote to non-witness and starting to switch to witness.

func (*PersistOptions) GetTTLData

func (o *PersistOptions) GetTTLData(key string) (string, bool)

GetTTLData returns if there is a TTL data for a given key.

func (*PersistOptions) GetTolerantSizeRatio

func (o *PersistOptions) GetTolerantSizeRatio() float64

GetTolerantSizeRatio gets the tolerant size ratio.

func (*PersistOptions) GetWitnessScheduleLimit

func (o *PersistOptions) GetWitnessScheduleLimit() uint64

GetWitnessScheduleLimit returns the limit for region schedule.

func (*PersistOptions) IsCrossTableMergeEnabled

func (o *PersistOptions) IsCrossTableMergeEnabled() bool

IsCrossTableMergeEnabled returns if across table merge is enabled.

func (*PersistOptions) IsDebugMetricsEnabled

func (o *PersistOptions) IsDebugMetricsEnabled() bool

IsDebugMetricsEnabled returns if debug metrics is enabled.

func (*PersistOptions) IsDiagnosticAllowed

func (o *PersistOptions) IsDiagnosticAllowed() bool

IsDiagnosticAllowed returns whether is enable to use diagnostic.

func (*PersistOptions) IsLocationReplacementEnabled

func (o *PersistOptions) IsLocationReplacementEnabled() bool

IsLocationReplacementEnabled returns if location replace is enabled.

func (*PersistOptions) IsMakeUpReplicaEnabled

func (o *PersistOptions) IsMakeUpReplicaEnabled() bool

IsMakeUpReplicaEnabled returns if make up replica is enabled.

func (*PersistOptions) IsOneWayMergeEnabled

func (o *PersistOptions) IsOneWayMergeEnabled() bool

IsOneWayMergeEnabled returns if a region can only be merged into the next region of it.

func (*PersistOptions) IsPlacementRulesCacheEnabled

func (o *PersistOptions) IsPlacementRulesCacheEnabled() bool

IsPlacementRulesCacheEnabled returns if the placement rules cache is enabled

func (*PersistOptions) IsPlacementRulesEnabled

func (o *PersistOptions) IsPlacementRulesEnabled() bool

IsPlacementRulesEnabled returns if the placement rules is enabled.

func (*PersistOptions) IsRemoveDownReplicaEnabled

func (o *PersistOptions) IsRemoveDownReplicaEnabled() bool

IsRemoveDownReplicaEnabled returns if remove down replica is enabled.

func (*PersistOptions) IsRemoveExtraReplicaEnabled

func (o *PersistOptions) IsRemoveExtraReplicaEnabled() bool

IsRemoveExtraReplicaEnabled returns if remove extra replica is enabled.

func (*PersistOptions) IsReplaceOfflineReplicaEnabled

func (o *PersistOptions) IsReplaceOfflineReplicaEnabled() bool

IsReplaceOfflineReplicaEnabled returns if replace offline replica is enabled.

func (*PersistOptions) IsTikvRegionSplitEnabled

func (o *PersistOptions) IsTikvRegionSplitEnabled() bool

IsTikvRegionSplitEnabled returns whether tikv split region is disabled.

func (*PersistOptions) IsTraceRegionFlow

func (o *PersistOptions) IsTraceRegionFlow() bool

IsTraceRegionFlow returns if the region flow is tracing. If the accuracy cannot reach 0.1 MB, it is considered not.

func (*PersistOptions) IsUseJointConsensus

func (o *PersistOptions) IsUseJointConsensus() bool

IsUseJointConsensus returns if using joint consensus as a operator step is enabled.

func (*PersistOptions) IsUseRegionStorage

func (o *PersistOptions) IsUseRegionStorage() bool

IsUseRegionStorage returns if the independent region storage is enabled.

func (*PersistOptions) IsWitnessAllowed

func (o *PersistOptions) IsWitnessAllowed() bool

IsWitnessAllowed returns whether is enable to use witness.

func (*PersistOptions) LoadTTLFromEtcd

func (o *PersistOptions) LoadTTLFromEtcd(ctx context.Context, client *clientv3.Client) error

LoadTTLFromEtcd loads temporary configuration which was persisted into etcd

func (*PersistOptions) Persist

func (o *PersistOptions) Persist(storage endpoint.ConfigStorage) error

Persist saves the configuration to the storage.

func (*PersistOptions) Reload

func (o *PersistOptions) Reload(storage endpoint.ConfigStorage) error

Reload reloads the configuration from the storage.

func (*PersistOptions) SetAllStoresLimit

func (o *PersistOptions) SetAllStoresLimit(typ storelimit.Type, ratePerMin float64)

SetAllStoresLimit sets all store limit for a given type and rate.

func (*PersistOptions) SetAllStoresLimitTTL

func (o *PersistOptions) SetAllStoresLimitTTL(ctx context.Context, client *clientv3.Client, typ storelimit.Type, ratePerMin float64, ttl time.Duration) error

SetAllStoresLimitTTL sets all store limit for a given type and rate with ttl.

func (*PersistOptions) SetClusterVersion

func (o *PersistOptions) SetClusterVersion(v *semver.Version)

SetClusterVersion sets the cluster version.

func (*PersistOptions) SetEnableDiagnostic

func (o *PersistOptions) SetEnableDiagnostic(enable bool)

SetEnableDiagnostic to set the option for diagnose. It's only used to test.

func (*PersistOptions) SetEnableUseJointConsensus

func (o *PersistOptions) SetEnableUseJointConsensus(enable bool)

SetEnableUseJointConsensus to set the option for using joint consensus. It's only used to test.

func (*PersistOptions) SetEnableWitness

func (o *PersistOptions) SetEnableWitness(enable bool)

SetEnableWitness to set the option for witness. It's only used to test.

func (*PersistOptions) SetLabelProperty

func (o *PersistOptions) SetLabelProperty(typ, labelKey, labelValue string)

SetLabelProperty sets the label property.

func (*PersistOptions) SetLabelPropertyConfig

func (o *PersistOptions) SetLabelPropertyConfig(cfg LabelPropertyConfig)

SetLabelPropertyConfig sets the label property configuration.

func (*PersistOptions) SetLocationLabels

func (o *PersistOptions) SetLocationLabels(labels []string)

SetLocationLabels sets the location labels.

func (*PersistOptions) SetMaxMergeRegionKeys

func (o *PersistOptions) SetMaxMergeRegionKeys(maxMergeRegionKeys uint64)

SetMaxMergeRegionKeys sets the max merge region keys.

func (*PersistOptions) SetMaxMergeRegionSize

func (o *PersistOptions) SetMaxMergeRegionSize(maxMergeRegionSize uint64)

SetMaxMergeRegionSize sets the max merge region size.

func (*PersistOptions) SetMaxReplicas

func (o *PersistOptions) SetMaxReplicas(replicas int)

SetMaxReplicas sets the number of replicas for each region.

func (*PersistOptions) SetPDServerConfig

func (o *PersistOptions) SetPDServerConfig(cfg *PDServerConfig)

SetPDServerConfig sets the PD configuration.

func (*PersistOptions) SetPlacementRuleEnabled

func (o *PersistOptions) SetPlacementRuleEnabled(enabled bool)

SetPlacementRuleEnabled set PlacementRuleEnabled

func (*PersistOptions) SetPlacementRulesCacheEnabled

func (o *PersistOptions) SetPlacementRulesCacheEnabled(enabled bool)

SetPlacementRulesCacheEnabled set EnablePlacementRulesCache

func (*PersistOptions) SetReplicationConfig

func (o *PersistOptions) SetReplicationConfig(cfg *ReplicationConfig)

SetReplicationConfig sets the PD replication configuration.

func (*PersistOptions) SetReplicationModeConfig

func (o *PersistOptions) SetReplicationModeConfig(cfg *ReplicationModeConfig)

SetReplicationModeConfig sets the replication mode config.

func (*PersistOptions) SetScheduleConfig

func (o *PersistOptions) SetScheduleConfig(cfg *ScheduleConfig)

SetScheduleConfig sets the PD scheduling configuration.

func (*PersistOptions) SetSplitMergeInterval

func (o *PersistOptions) SetSplitMergeInterval(splitMergeInterval time.Duration)

SetSplitMergeInterval to set the interval between finishing split and starting to merge. It's only used to test.

func (*PersistOptions) SetStoreLimit

func (o *PersistOptions) SetStoreLimit(storeID uint64, typ storelimit.Type, ratePerMin float64)

SetStoreLimit sets a store limit for a given type and rate.

func (*PersistOptions) SetTTLData

func (o *PersistOptions) SetTTLData(parCtx context.Context, client *clientv3.Client, key string, value string, ttl time.Duration) error

SetTTLData set temporary configuration

func (*PersistOptions) SetWitnessEnabled

func (o *PersistOptions) SetWitnessEnabled(enabled bool)

SetWitnessEnabled set EanbleWitness

func (*PersistOptions) UseRaftV2

func (o *PersistOptions) UseRaftV2()

UseRaftV2 set some config for raft store v2 by default temporary. todo: remove this after raft store support this. disable merge check

type RateLimitConfig

type RateLimitConfig struct {
	// EnableRateLimit controls the switch of the rate limit middleware
	EnableRateLimit bool `json:"enable-rate-limit,string"`
	// RateLimitConfig is the config of rate limit middleware
	LimiterConfig map[string]ratelimit.DimensionConfig `json:"limiter-config"`
}

RateLimitConfig is the configuration for rate limit

func (*RateLimitConfig) Clone

func (c *RateLimitConfig) Clone() *RateLimitConfig

Clone returns a cloned rate limit config.

type ReplicationConfig

type ReplicationConfig struct {
	// MaxReplicas is the number of replicas for each region.
	MaxReplicas uint64 `toml:"max-replicas" json:"max-replicas"`

	// 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.
	LocationLabels typeutil.StringSlice `toml:"location-labels" json:"location-labels"`
	// StrictlyMatchLabel strictly checks if the label of TiKV is matched with LocationLabels.
	StrictlyMatchLabel bool `toml:"strictly-match-label" json:"strictly-match-label,string"`

	// When PlacementRules feature is enabled. MaxReplicas, LocationLabels and IsolationLabels are not used any more.
	EnablePlacementRules bool `toml:"enable-placement-rules" json:"enable-placement-rules,string"`

	// EnablePlacementRuleCache controls whether use cache during rule checker
	EnablePlacementRulesCache bool `toml:"enable-placement-rules-cache" json:"enable-placement-rules-cache,string"`

	// IsolationLevel is used to isolate replicas explicitly and forcibly if it's not empty.
	// Its value must be empty or one of LocationLabels.
	// Example:
	// location-labels = ["zone", "rack", "host"]
	// isolation-level = "zone"
	// With configuration like above, PD ensure that all replicas be placed in different zones.
	// Even if a zone is down, PD will not try to make up replicas in other zone
	// because other zones already have replicas on it.
	IsolationLevel string `toml:"isolation-level" json:"isolation-level"`
}

ReplicationConfig is the replication configuration. NOTE: This type is exported by HTTP API. Please pay more attention when modifying it.

func (*ReplicationConfig) Clone

Clone makes a deep copy of the config.

func (*ReplicationConfig) Validate

func (c *ReplicationConfig) Validate() error

Validate is used to validate if some replication configurations are right.

type ReplicationModeConfig

type ReplicationModeConfig struct {
	ReplicationMode string                      `toml:"replication-mode" json:"replication-mode"` // can be 'dr-auto-sync' or 'majority', default value is 'majority'
	DRAutoSync      DRAutoSyncReplicationConfig `toml:"dr-auto-sync" json:"dr-auto-sync"`         // used when ReplicationMode is 'dr-auto-sync'
}

ReplicationModeConfig is the configuration for the replication policy. NOTE: This type is exported by HTTP API. Please pay more attention when modifying it.

func (*ReplicationModeConfig) Clone

Clone returns a copy of replication mode config.

type ScheduleConfig

type ScheduleConfig struct {
	// If the snapshot count of one store is greater than this value,
	// it will never be used as a source or target store.
	MaxSnapshotCount    uint64 `toml:"max-snapshot-count" json:"max-snapshot-count"`
	MaxPendingPeerCount uint64 `toml:"max-pending-peer-count" json:"max-pending-peer-count"`
	// 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.
	MaxMergeRegionSize uint64 `toml:"max-merge-region-size" json:"max-merge-region-size"`
	MaxMergeRegionKeys uint64 `toml:"max-merge-region-keys" json:"max-merge-region-keys"`
	// SplitMergeInterval is the minimum interval time to permit merge after split.
	SplitMergeInterval typeutil.Duration `toml:"split-merge-interval" json:"split-merge-interval"`
	// SwitchWitnessInterval is the minimum interval that allows a peer to become a witness again after it is promoted to non-witness.
	SwitchWitnessInterval typeutil.Duration `toml:"switch-witness-interval" json:"swtich-witness-interval"`
	// EnableOneWayMerge is the option to enable one way merge. This means a Region can only be merged into the next region of it.
	EnableOneWayMerge bool `toml:"enable-one-way-merge" json:"enable-one-way-merge,string"`
	// 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".
	EnableCrossTableMerge bool `toml:"enable-cross-table-merge" json:"enable-cross-table-merge,string"`
	// PatrolRegionInterval is the interval for scanning region during patrol.
	PatrolRegionInterval typeutil.Duration `toml:"patrol-region-interval" json:"patrol-region-interval"`
	// MaxStoreDownTime is the max duration after which
	// a store will be considered to be down if it hasn't reported heartbeats.
	MaxStoreDownTime typeutil.Duration `toml:"max-store-down-time" json:"max-store-down-time"`
	// MaxStorePreparingTime is the max duration after which
	// a store will be considered to be preparing.
	MaxStorePreparingTime typeutil.Duration `toml:"max-store-preparing-time" json:"max-store-preparing-time"`
	// LeaderScheduleLimit is the max coexist leader schedules.
	LeaderScheduleLimit uint64 `toml:"leader-schedule-limit" json:"leader-schedule-limit"`
	// LeaderSchedulePolicy is the option to balance leader, there are some policies supported: ["count", "size"], default: "count"
	LeaderSchedulePolicy string `toml:"leader-schedule-policy" json:"leader-schedule-policy"`
	// RegionScheduleLimit is the max coexist region schedules.
	RegionScheduleLimit uint64 `toml:"region-schedule-limit" json:"region-schedule-limit"`
	// WitnessScheduleLimit is the max coexist witness schedules.
	WitnessScheduleLimit uint64 `toml:"witness-schedule-limit" json:"witness-schedule-limit"`
	// ReplicaScheduleLimit is the max coexist replica schedules.
	ReplicaScheduleLimit uint64 `toml:"replica-schedule-limit" json:"replica-schedule-limit"`
	// MergeScheduleLimit is the max coexist merge schedules.
	MergeScheduleLimit uint64 `toml:"merge-schedule-limit" json:"merge-schedule-limit"`
	// HotRegionScheduleLimit is the max coexist hot region schedules.
	HotRegionScheduleLimit uint64 `toml:"hot-region-schedule-limit" json:"hot-region-schedule-limit"`
	// 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.
	HotRegionCacheHitsThreshold uint64 `toml:"hot-region-cache-hits-threshold" json:"hot-region-cache-hits-threshold"`
	// StoreBalanceRate is the maximum of balance rate for each store.
	// WARN: StoreBalanceRate is deprecated.
	StoreBalanceRate float64 `toml:"store-balance-rate" json:"store-balance-rate,omitempty"`
	// StoreLimit is the limit of scheduling for stores.
	StoreLimit map[uint64]StoreLimitConfig `toml:"store-limit" json:"store-limit"`
	// TolerantSizeRatio is the ratio of buffer size for balance scheduler.
	TolerantSizeRatio float64 `toml:"tolerant-size-ratio" json:"tolerant-size-ratio"`
	//
	//      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.
	LowSpaceRatio float64 `toml:"low-space-ratio" json:"low-space-ratio"`
	// 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.
	HighSpaceRatio float64 `toml:"high-space-ratio" json:"high-space-ratio"`
	// RegionScoreFormulaVersion is used to control the formula used to calculate region score.
	RegionScoreFormulaVersion string `toml:"region-score-formula-version" json:"region-score-formula-version"`
	// SchedulerMaxWaitingOperator is the max coexist operators for each scheduler.
	SchedulerMaxWaitingOperator uint64 `toml:"scheduler-max-waiting-operator" json:"scheduler-max-waiting-operator"`
	// WARN: DisableLearner is deprecated.
	// DisableLearner is the option to disable using AddLearnerNode instead of AddNode.
	DisableLearner bool `toml:"disable-raft-learner" json:"disable-raft-learner,string,omitempty"`
	// DisableRemoveDownReplica is the option to prevent replica checker from
	// removing down replicas.
	// WARN: DisableRemoveDownReplica is deprecated.
	DisableRemoveDownReplica bool `toml:"disable-remove-down-replica" json:"disable-remove-down-replica,string,omitempty"`
	// DisableReplaceOfflineReplica is the option to prevent replica checker from
	// replacing offline replicas.
	// WARN: DisableReplaceOfflineReplica is deprecated.
	DisableReplaceOfflineReplica bool `toml:"disable-replace-offline-replica" 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.
	// WARN: DisableMakeUpReplica is deprecated.
	DisableMakeUpReplica bool `toml:"disable-make-up-replica" json:"disable-make-up-replica,string,omitempty"`
	// DisableRemoveExtraReplica is the option to prevent replica checker from
	// removing extra replicas.
	// WARN: DisableRemoveExtraReplica is deprecated.
	DisableRemoveExtraReplica bool `toml:"disable-remove-extra-replica" json:"disable-remove-extra-replica,string,omitempty"`
	// DisableLocationReplacement is the option to prevent replica checker from
	// moving replica to a better location.
	// WARN: DisableLocationReplacement is deprecated.
	DisableLocationReplacement bool `toml:"disable-location-replacement" json:"disable-location-replacement,string,omitempty"`

	// EnableRemoveDownReplica is the option to enable replica checker to remove down replica.
	EnableRemoveDownReplica bool `toml:"enable-remove-down-replica" json:"enable-remove-down-replica,string"`
	// EnableReplaceOfflineReplica is the option to enable replica checker to replace offline replica.
	EnableReplaceOfflineReplica bool `toml:"enable-replace-offline-replica" json:"enable-replace-offline-replica,string"`
	// EnableMakeUpReplica is the option to enable replica checker to make up replica.
	EnableMakeUpReplica bool `toml:"enable-make-up-replica" json:"enable-make-up-replica,string"`
	// EnableRemoveExtraReplica is the option to enable replica checker to remove extra replica.
	EnableRemoveExtraReplica bool `toml:"enable-remove-extra-replica" json:"enable-remove-extra-replica,string"`
	// EnableLocationReplacement is the option to enable replica checker to move replica to a better location.
	EnableLocationReplacement bool `toml:"enable-location-replacement" json:"enable-location-replacement,string"`
	// EnableDebugMetrics is the option to enable debug metrics.
	EnableDebugMetrics bool `toml:"enable-debug-metrics" json:"enable-debug-metrics,string"`
	// EnableJointConsensus is the option to enable using joint consensus as a operator step.
	EnableJointConsensus bool `toml:"enable-joint-consensus" json:"enable-joint-consensus,string"`
	// EnableTiKVSplitRegion is the option to enable tikv split region.
	// on ebs-based BR we need to disable it with TTL
	EnableTiKVSplitRegion bool `toml:"enable-tikv-split-region" json:"enable-tikv-split-region,string"`

	// Schedulers support for loading customized schedulers
	Schedulers SchedulerConfigs `toml:"schedulers" json:"schedulers-v2"` // json v2 is for the sake of compatible upgrade

	// Only used to display
	SchedulersPayload map[string]interface{} `toml:"schedulers-payload" json:"schedulers-payload"`

	// StoreLimitMode can be auto or manual, when set to auto,
	// PD tries to change the store limit values according to
	// the load state of the cluster dynamically. User can
	// overwrite the auto-tuned value by pd-ctl, when the value
	// is overwritten, the value is fixed until it is deleted.
	// Default: manual
	StoreLimitMode string `toml:"store-limit-mode" json:"store-limit-mode"`

	// Controls the time interval between write hot regions info into leveldb.
	HotRegionsWriteInterval typeutil.Duration `toml:"hot-regions-write-interval" json:"hot-regions-write-interval"`

	// The day of hot regions data to be reserved. 0 means close.
	HotRegionsReservedDays uint64 `toml:"hot-regions-reserved-days" json:"hot-regions-reserved-days"`

	// MaxMovableHotPeerSize is the threshold of region size for balance hot region and split bucket scheduler.
	// Hot region must be split before moved if it's region size is greater than MaxMovableHotPeerSize.
	MaxMovableHotPeerSize int64 `toml:"max-movable-hot-peer-size" json:"max-movable-hot-peer-size,omitempty"`

	// EnableDiagnostic is the the option to enable using diagnostic
	EnableDiagnostic bool `toml:"enable-diagnostic" json:"enable-diagnostic,string"`

	// EnableWitness is the option to enable using witness
	EnableWitness bool `toml:"enable-witness" json:"enable-witness,string"`

	// SlowStoreEvictingAffectedStoreRatioThreshold is the affected ratio threshold when judging a store is slow
	// A store's slowness must affected more than `store-count * SlowStoreEvictingAffectedStoreRatioThreshold` to trigger evicting.
	SlowStoreEvictingAffectedStoreRatioThreshold float64 `toml:"slow-store-evicting-affected-store-ratio-threshold" json:"slow-store-evicting-affected-store-ratio-threshold,omitempty"`

	// StoreLimitVersion is the version of store limit.
	// v1: which is based on the region count by rate limit.
	// v2: which is based on region size by window size.
	StoreLimitVersion string `toml:"store-limit-version" json:"store-limit-version,omitempty"`
}

ScheduleConfig is the schedule configuration. NOTE: This type is exported by HTTP API. Please pay more attention when modifying it.

func (*ScheduleConfig) Clone

func (c *ScheduleConfig) Clone() *ScheduleConfig

Clone returns a cloned scheduling configuration.

func (*ScheduleConfig) Deprecated

func (c *ScheduleConfig) Deprecated() error

Deprecated is used to find if there is an option has been deprecated.

func (*ScheduleConfig) GetMaxMergeRegionKeys

func (c *ScheduleConfig) GetMaxMergeRegionKeys() uint64

GetMaxMergeRegionKeys returns the max merge keys. it should keep consistent with tikv: https://github.com/tikv/tikv/pull/12484

func (*ScheduleConfig) MigrateDeprecatedFlags

func (c *ScheduleConfig) MigrateDeprecatedFlags()

MigrateDeprecatedFlags updates new flags according to deprecated flags.

func (*ScheduleConfig) Validate

func (c *ScheduleConfig) Validate() error

Validate is used to validate if some scheduling configurations are right.

type SchedulerConfig

type SchedulerConfig struct {
	Type        string   `toml:"type" json:"type"`
	Args        []string `toml:"args" json:"args"`
	Disable     bool     `toml:"disable" json:"disable"`
	ArgsPayload string   `toml:"args-payload" json:"args-payload"`
}

SchedulerConfig is customized scheduler configuration

type SchedulerConfigs

type SchedulerConfigs []SchedulerConfig

SchedulerConfigs is a slice of customized scheduler configuration.

type ServiceMiddlewareConfig

type ServiceMiddlewareConfig struct {
	AuditConfig     `json:"audit"`
	RateLimitConfig `json:"rate-limit"`
}

ServiceMiddlewareConfig is the configuration for PD Service middleware.

func NewServiceMiddlewareConfig

func NewServiceMiddlewareConfig() *ServiceMiddlewareConfig

NewServiceMiddlewareConfig returns a new service middleware config

func (*ServiceMiddlewareConfig) Clone

Clone returns a cloned service middleware configuration.

type ServiceMiddlewarePersistOptions

type ServiceMiddlewarePersistOptions struct {
	// contains filtered or unexported fields
}

ServiceMiddlewarePersistOptions wraps all service middleware configurations that need to persist to storage and allows to access them safely.

func NewServiceMiddlewarePersistOptions

func NewServiceMiddlewarePersistOptions(cfg *ServiceMiddlewareConfig) *ServiceMiddlewarePersistOptions

NewServiceMiddlewarePersistOptions creates a new ServiceMiddlewarePersistOptions instance.

func (*ServiceMiddlewarePersistOptions) GetAuditConfig

func (o *ServiceMiddlewarePersistOptions) GetAuditConfig() *AuditConfig

GetAuditConfig returns pd service middleware configurations.

func (*ServiceMiddlewarePersistOptions) GetRateLimitConfig

func (o *ServiceMiddlewarePersistOptions) GetRateLimitConfig() *RateLimitConfig

GetRateLimitConfig returns pd service middleware configurations.

func (*ServiceMiddlewarePersistOptions) IsAuditEnabled

func (o *ServiceMiddlewarePersistOptions) IsAuditEnabled() bool

IsAuditEnabled returns whether audit middleware is enabled

func (*ServiceMiddlewarePersistOptions) IsRateLimitEnabled

func (o *ServiceMiddlewarePersistOptions) IsRateLimitEnabled() bool

IsRateLimitEnabled returns whether rate limit middleware is enabled

func (*ServiceMiddlewarePersistOptions) Persist

Persist saves the configuration to the storage.

func (*ServiceMiddlewarePersistOptions) Reload

Reload reloads the configuration from the storage.

func (*ServiceMiddlewarePersistOptions) SetAuditConfig

func (o *ServiceMiddlewarePersistOptions) SetAuditConfig(cfg *AuditConfig)

SetAuditConfig sets the PD service middleware configuration.

func (*ServiceMiddlewarePersistOptions) SetRateLimitConfig

func (o *ServiceMiddlewarePersistOptions) SetRateLimitConfig(cfg *RateLimitConfig)

SetRateLimitConfig sets the PD service middleware configuration.

type Source

type Source interface {
	GetConfig(statusAddress string) (*StoreConfig, error)
}

Source is used to get the store config.

type Storage

type Storage struct {
	Engine string `json:"engine"`
}

Storage is the config for the tikv storage.

type StoreConfig

type StoreConfig struct {
	Coprocessor `json:"coprocessor"`
	Storage     `json:"storage"`

	RegionMaxSizeMB    uint64 `json:"-"`
	RegionSplitSizeMB  uint64 `json:"-"`
	RegionBucketSizeMB uint64 `json:"-"`
}

StoreConfig is the config of store like TiKV. generated by https://mholt.github.io/json-to-go/.

func (*StoreConfig) CheckRegionKeys

func (c *StoreConfig) CheckRegionKeys(keys, mergeKeys uint64) error

CheckRegionKeys return error if the smallest region's keys is less than mergeKeys

func (*StoreConfig) CheckRegionSize

func (c *StoreConfig) CheckRegionSize(size, mergeSize uint64) error

CheckRegionSize return error if the smallest region's size is less than mergeSize

func (*StoreConfig) Clone

func (c *StoreConfig) Clone() *StoreConfig

Clone makes a deep copy of the config.

func (*StoreConfig) Equal

func (c *StoreConfig) Equal(other *StoreConfig) bool

Equal returns true if the two configs are equal.

func (*StoreConfig) GetRegionBucketSize

func (c *StoreConfig) GetRegionBucketSize() uint64

GetRegionBucketSize returns region bucket size if enable region buckets.

func (*StoreConfig) GetRegionMaxKeys

func (c *StoreConfig) GetRegionMaxKeys() uint64

GetRegionMaxKeys returns the region split keys

func (*StoreConfig) GetRegionMaxSize

func (c *StoreConfig) GetRegionMaxSize() uint64

GetRegionMaxSize returns the max region size in MB

func (*StoreConfig) GetRegionSplitKeys

func (c *StoreConfig) GetRegionSplitKeys() uint64

GetRegionSplitKeys returns the region split keys

func (*StoreConfig) GetRegionSplitSize

func (c *StoreConfig) GetRegionSplitSize() uint64

GetRegionSplitSize returns the region split size in MB

func (*StoreConfig) IsEnableRegionBucket

func (c *StoreConfig) IsEnableRegionBucket() bool

IsEnableRegionBucket return true if the region bucket is enabled.

func (*StoreConfig) IsRaftKV2

func (c *StoreConfig) IsRaftKV2() bool

IsRaftKV2 returns true if the raft kv is v2.

func (*StoreConfig) SetRegionBucketEnabled

func (c *StoreConfig) SetRegionBucketEnabled(enabled bool)

SetRegionBucketEnabled sets if the region bucket is enabled.

func (*StoreConfig) String

func (c *StoreConfig) String() string

String implements fmt.Stringer interface.

type StoreConfigManager

type StoreConfigManager struct {
	// contains filtered or unexported fields
}

StoreConfigManager is used to manage the store config.

func NewStoreConfigManager

func NewStoreConfigManager(client *http.Client) *StoreConfigManager

NewStoreConfigManager creates a new StoreConfigManager.

func NewTestStoreConfigManager

func NewTestStoreConfigManager(whiteList []string) *StoreConfigManager

NewTestStoreConfigManager creates a new StoreConfigManager for test.

func (*StoreConfigManager) GetStoreConfig

func (m *StoreConfigManager) GetStoreConfig() *StoreConfig

GetStoreConfig returns the current store configuration.

func (*StoreConfigManager) ObserveConfig

func (m *StoreConfigManager) ObserveConfig(address string) (switchRaftV2 bool, err error)

ObserveConfig is used to observe the config change. switchRaftV2 is true if the new config's raft engine is v2 and the old is v1.

func (*StoreConfigManager) SetStoreConfig

func (m *StoreConfigManager) SetStoreConfig(cfg *StoreConfig)

SetStoreConfig sets the store configuration.

type StoreLabel

type StoreLabel struct {
	Key   string `toml:"key" json:"key"`
	Value string `toml:"value" json:"value"`
}

StoreLabel is the config item of LabelPropertyConfig.

type StoreLimit

type StoreLimit struct {

	// AddPeer is the default rate of adding peers for store limit (per minute).
	AddPeer float64
	// RemovePeer is the default rate of removing peers for store limit (per minute).
	RemovePeer float64
	// contains filtered or unexported fields
}

StoreLimit is the default limit of adding peer and removing peer when putting stores.

func (*StoreLimit) GetDefaultStoreLimit

func (sl *StoreLimit) GetDefaultStoreLimit(typ storelimit.Type) float64

GetDefaultStoreLimit gets the default store limit for a given type.

func (*StoreLimit) SetDefaultStoreLimit

func (sl *StoreLimit) SetDefaultStoreLimit(typ storelimit.Type, ratePerMin float64)

SetDefaultStoreLimit sets the default store limit for a given type.

type StoreLimitConfig

type StoreLimitConfig struct {
	AddPeer    float64 `toml:"add-peer" json:"add-peer"`
	RemovePeer float64 `toml:"remove-peer" json:"remove-peer"`
}

StoreLimitConfig is a config about scheduling rate limit of different types for a store.

type TiKVConfigSource

type TiKVConfigSource struct {
	// contains filtered or unexported fields
}

TiKVConfigSource is used to get the store config from TiKV.

func (TiKVConfigSource) GetConfig

func (s TiKVConfigSource) GetConfig(statusAddress string) (*StoreConfig, error)

GetConfig returns the store config from TiKV.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL