Documentation ¶
Index ¶
- Variables
- func FetchPDVersion(ctx context.Context, tls *common.TLS, pdAddr string) (*semver.Version, error)
- func GetPlacementRules(ctx context.Context, pdAddr string, tlsConf *tls.Config) ([]placement.Rule, error)
- func ResetTS(ctx context.Context, pdAddr string, ts uint64, tlsConf *tls.Config) error
- func SearchPlacementRule(tableID int64, placementRules []placement.Rule, role placement.PeerRoleType) *placement.Rule
- type ClusterConfig
- type PdController
- func (p *PdController) Close()
- func (p *PdController) GetClusterVersion(ctx context.Context) (string, error)
- func (p *PdController) GetPDClient() pd.Client
- func (p *PdController) GetPDScheduleConfig(ctx context.Context) (map[string]interface{}, error)
- func (p *PdController) GetRegionCount(ctx context.Context, startKey, endKey []byte) (int, error)
- func (p *PdController) GetStoreInfo(ctx context.Context, storeID uint64) (*pdapi.StoreInfo, error)
- func (p *PdController) ListSchedulers(ctx context.Context) ([]string, error)
- func (p *PdController) MakeUndoFunctionByConfig(config ClusterConfig) UndoFunc
- func (p *PdController) RemoveSchedulers(ctx context.Context) (undo UndoFunc, err error)
- func (p *PdController) RemoveSchedulersWithCfg(ctx context.Context, removeCfg ClusterConfig) error
- func (p *PdController) RemoveSchedulersWithOrigin(ctx context.Context) (ClusterConfig, ClusterConfig, error)
- func (p *PdController) ResumeSchedulers(ctx context.Context, schedulers []string) error
- func (p *PdController) SetHTTP(addrs []string, cli *http.Client)
- func (p *PdController) SetPDClient(pdClient pd.Client)
- func (p *PdController) UpdatePDScheduleConfig(ctx context.Context) error
- type UndoFunc
Constants ¶
This section is empty.
Variables ¶
var ( // Schedulers represent region/leader schedulers which can impact on performance. Schedulers = map[string]struct{}{ "balance-leader-scheduler": {}, "balance-hot-region-scheduler": {}, "balance-region-scheduler": {}, "shuffle-leader-scheduler": {}, "shuffle-region-scheduler": {}, "shuffle-hot-region-scheduler": {}, } )
Functions ¶
func FetchPDVersion ¶
FetchPDVersion get pd version
func GetPlacementRules ¶
func GetPlacementRules(ctx context.Context, pdAddr string, tlsConf *tls.Config) ([]placement.Rule, error)
GetPlacementRules return the current placement rules.
func SearchPlacementRule ¶
func SearchPlacementRule(tableID int64, placementRules []placement.Rule, role placement.PeerRoleType) *placement.Rule
SearchPlacementRule returns the placement rule matched to the table or nil.
Types ¶
type ClusterConfig ¶
type ClusterConfig struct { // Enable PD schedulers before restore Schedulers []string `json:"schedulers"` // Original scheudle configuration ScheduleCfg map[string]interface{} `json:"schedule_cfg"` }
ClusterConfig represents a set of scheduler whose config have been modified along with their original config.
type PdController ¶
type PdController struct {
// contains filtered or unexported fields
}
PdController manage get/update config from pd.
func NewPdController ¶
func NewPdController( ctx context.Context, pdAddrs string, tlsConf *tls.Config, securityOption pd.SecurityOption, ) (*PdController, error)
NewPdController creates a new PdController.
func (*PdController) GetClusterVersion ¶
func (p *PdController) GetClusterVersion(ctx context.Context) (string, error)
GetClusterVersion returns the current cluster version.
func (*PdController) GetPDClient ¶
func (p *PdController) GetPDClient() pd.Client
GetPDClient set pd addrs and cli for test.
func (*PdController) GetPDScheduleConfig ¶
func (p *PdController) GetPDScheduleConfig( ctx context.Context, ) (map[string]interface{}, error)
GetPDScheduleConfig returns PD schedule config value associated with the key. It returns nil if there is no such config item.
func (*PdController) GetRegionCount ¶
GetRegionCount returns the region count in the specified range.
func (*PdController) GetStoreInfo ¶
GetStoreInfo returns the info of store with the specified id.
func (*PdController) ListSchedulers ¶
func (p *PdController) ListSchedulers(ctx context.Context) ([]string, error)
ListSchedulers list all pd scheduler.
func (*PdController) MakeUndoFunctionByConfig ¶
func (p *PdController) MakeUndoFunctionByConfig(config ClusterConfig) UndoFunc
MakeUndoFunctionByConfig return an UndoFunc based on specified ClusterConfig
func (*PdController) RemoveSchedulers ¶
func (p *PdController) RemoveSchedulers(ctx context.Context) (undo UndoFunc, err error)
RemoveSchedulers removes the schedulers that may slow down BR speed.
func (*PdController) RemoveSchedulersWithCfg ¶
func (p *PdController) RemoveSchedulersWithCfg(ctx context.Context, removeCfg ClusterConfig) error
RemoveSchedulersWithCfg removes pd schedulers and configs with specified ClusterConfig
func (*PdController) RemoveSchedulersWithOrigin ¶
func (p *PdController) RemoveSchedulersWithOrigin(ctx context.Context) (ClusterConfig, ClusterConfig, error)
RemoveSchedulersWithOrigin pause and remove br related schedule configs and return the origin and modified configs
func (*PdController) ResumeSchedulers ¶
func (p *PdController) ResumeSchedulers(ctx context.Context, schedulers []string) error
ResumeSchedulers resume pd scheduler.
func (*PdController) SetHTTP ¶
func (p *PdController) SetHTTP(addrs []string, cli *http.Client)
SetHTTP set pd addrs and cli for test.
func (*PdController) SetPDClient ¶
func (p *PdController) SetPDClient(pdClient pd.Client)
SetPDClient set pd addrs and cli for test.
func (*PdController) UpdatePDScheduleConfig ¶
func (p *PdController) UpdatePDScheduleConfig(ctx context.Context) error
UpdatePDScheduleConfig updates PD schedule config value associated with the key.