Documentation ¶
Index ¶
- Constants
- func SelectSourceStores(stores []*core.StoreInfo, filters []Filter, opt opt.Options) []*core.StoreInfo
- func SelectTargetStores(stores []*core.StoreInfo, filters []Filter, opt opt.Options) []*core.StoreInfo
- func Source(opt opt.Options, store *core.StoreInfo, filters []Filter) bool
- func Target(opt opt.Options, store *core.StoreInfo, filters []Filter) bool
- type BlacklistStoreFilter
- func (f *BlacklistStoreFilter) Add(storeID uint64)
- func (f *BlacklistStoreFilter) Scope() string
- func (f *BlacklistStoreFilter) Source(opt opt.Options, store *core.StoreInfo) bool
- func (f *BlacklistStoreFilter) Target(opt opt.Options, store *core.StoreInfo) bool
- func (f *BlacklistStoreFilter) Type() string
- type BlacklistType
- type Filter
- func NewDistinctScoreFilter(scope string, labels []string, stores []*core.StoreInfo, ...) Filter
- func NewEngineFilter(scope string, allowEngines ...string) Filter
- func NewExcludedFilter(scope string, sources, targets map[uint64]struct{}) Filter
- func NewHealthFilter(scope string) Filter
- func NewLabelConstaintFilter(scope string, constraints []placement.LabelConstraint) Filter
- func NewPendingPeerCountFilter(scope string) Filter
- func NewPlacementLeaderSafeguard(scope string, cluster opt.Cluster, region *core.RegionInfo, ...) Filter
- func NewRuleFitFilter(scope string, fitter RegionFitter, region *core.RegionInfo, oldStoreID uint64) Filter
- func NewSnapshotCountFilter(scope string) Filter
- func NewSpecialUseFilter(scope string, allowUses ...string) Filter
- func NewStateFilter(scope string) Filter
- func NewStorageThresholdFilter(scope string) Filter
- func NewStoreLimitFilter(scope string) Filter
- type RegionFitter
- type StoreStateFilter
Constants ¶
const ( // SpecialUseKey is the label used to indicate special use storage. SpecialUseKey = "specialUse" // SpecialUseHotRegion is the hot region value of special use label SpecialUseHotRegion = "hotRegion" // SpecialUseReserved is the reserved value of special use label SpecialUseReserved = "reserved" // EngineKey is the label key used to indicate engine. EngineKey = "engine" // EngineTiFlash is the tiflash value of the engine label. EngineTiFlash = "tiflash" )
Variables ¶
This section is empty.
Functions ¶
func SelectSourceStores ¶
func SelectSourceStores(stores []*core.StoreInfo, filters []Filter, opt opt.Options) []*core.StoreInfo
SelectSourceStores selects stores that be selected as source store from the list.
func SelectTargetStores ¶
func SelectTargetStores(stores []*core.StoreInfo, filters []Filter, opt opt.Options) []*core.StoreInfo
SelectTargetStores selects stores that be selected as target store from the list.
Types ¶
type BlacklistStoreFilter ¶
type BlacklistStoreFilter struct {
// contains filtered or unexported fields
}
BlacklistStoreFilter filters the store according to the blacklist.
func NewBlacklistStoreFilter ¶
func NewBlacklistStoreFilter(scope string, typ BlacklistType) *BlacklistStoreFilter
NewBlacklistStoreFilter creates a blacklist filter.
func (*BlacklistStoreFilter) Add ¶
func (f *BlacklistStoreFilter) Add(storeID uint64)
Add adds the store to the blacklist.
func (*BlacklistStoreFilter) Scope ¶
func (f *BlacklistStoreFilter) Scope() string
Scope returns the scheduler or the checker which the filter acts on.
func (*BlacklistStoreFilter) Type ¶
func (f *BlacklistStoreFilter) Type() string
Type implements the Filter.
type BlacklistType ¶
type BlacklistType int
BlacklistType the type of BlackListStore Filter.
const ( // blacklist associated with the source. BlacklistSource BlacklistType = 1 << iota // blacklist associated with the target. BlacklistTarget )
some flags about blacklist type.
type Filter ¶
type Filter interface { // Scope is used to indicate where the filter will act on. Scope() string Type() string // Return true if the store can be used as a source store. Source(opt opt.Options, store *core.StoreInfo) bool // Return true if the store can be used as a target store. Target(opt opt.Options, store *core.StoreInfo) bool }
Filter is an interface to filter source and target store.
func NewDistinctScoreFilter ¶
func NewDistinctScoreFilter(scope string, labels []string, stores []*core.StoreInfo, source *core.StoreInfo) Filter
NewDistinctScoreFilter creates a filter that filters all stores that have lower distinct score than specified store.
func NewEngineFilter ¶
NewEngineFilter creates a filter that filters out default engine stores. By default, all stores that are not marked with a special engine will be filtered out. Specify the special engine label if you want to include the special stores.
func NewExcludedFilter ¶
NewExcludedFilter creates a Filter that filters all specified stores.
func NewHealthFilter ¶
NewHealthFilter creates a Filter that filters all stores that are Busy or Down.
func NewLabelConstaintFilter ¶
func NewLabelConstaintFilter(scope string, constraints []placement.LabelConstraint) Filter
NewLabelConstaintFilter creates a filter that selects stores satisfy the constraints.
func NewPendingPeerCountFilter ¶
NewPendingPeerCountFilter creates a Filter that filters all stores that are currently handling too many pending peers.
func NewPlacementLeaderSafeguard ¶ added in v4.0.3
func NewPlacementLeaderSafeguard(scope string, cluster opt.Cluster, region *core.RegionInfo, sourceStore *core.StoreInfo) Filter
NewPlacementLeaderSafeguard creates a filter that ensures after transfer a leader with existed peer, the placement restriction will not become worse. Note that it only worked when PlacementRules enabled otherwise it will always permit the sourceStore.
func NewRuleFitFilter ¶
func NewRuleFitFilter(scope string, fitter RegionFitter, region *core.RegionInfo, oldStoreID uint64) Filter
NewRuleFitFilter creates a filter that ensures after replace a peer with new one, the isolation level will not decrease. Its function is the same as distinctScoreFilter but used when placement rules is enabled.
func NewSnapshotCountFilter ¶
NewSnapshotCountFilter creates a Filter that filters all stores that are currently handling too many snapshots.
func NewSpecialUseFilter ¶
NewSpecialUseFilter creates a filter that filters out normal stores. By default, all stores that are not marked with a special use will be filtered out. Specify the special use label if you want to include the special stores.
func NewStateFilter ¶
NewStateFilter creates a Filter that filters all stores that are not UP.
func NewStorageThresholdFilter ¶
NewStorageThresholdFilter creates a Filter that filters all stores that are almost full.
func NewStoreLimitFilter ¶
NewStoreLimitFilter creates a Filter that filters all stores those exceed the limit of a store.
type RegionFitter ¶
type RegionFitter interface {
FitRegion(*core.RegionInfo) *placement.RegionFit
}
RegionFitter is the interface that can fit a region against placement rules.
type StoreStateFilter ¶
type StoreStateFilter struct { ActionScope string // Set true if the schedule involves any transfer leader operation. TransferLeader bool // Set true if the schedule involves any move region operation. MoveRegion bool }
StoreStateFilter is used to determine whether a store can be selected as the source or target of the schedule based on the store's state.
func (StoreStateFilter) Scope ¶
func (f StoreStateFilter) Scope() string
Scope returns the scheduler or the checker which the filter acts on.
func (StoreStateFilter) Source ¶
Source returns true when the store can be selected as the schedule source.
func (StoreStateFilter) Target ¶
Target returns true when the store can be selected as the schedule target.
func (StoreStateFilter) Type ¶
func (f StoreStateFilter) Type() string
Type returns the type of the Filter.