Documentation
¶
Index ¶
- type Handler
- func (h *Handler) AccelerateRegionsScheduleInRange(rawStartKey, rawEndKey string, limit int) error
- func (h *Handler) AccelerateRegionsScheduleInRanges(startKeys [][]byte, endKeys [][]byte, limit int) error
- func (h *Handler) AddAddLearnerOperator(regionID uint64, toStoreID uint64) error
- func (h *Handler) AddAddPeerOperator(regionID uint64, toStoreID uint64) error
- func (h *Handler) AddMergeRegionOperator(regionID uint64, targetID uint64) error
- func (h *Handler) AddRemovePeerOperator(regionID uint64, fromStoreID uint64) error
- func (h *Handler) AddScatterRegionOperator(regionID uint64, group string) error
- func (h *Handler) AddScatterRegionsOperators(regionIDs []uint64, startRawKey, endRawKey, group string, retryLimit int) (int, error)
- func (h *Handler) AddSplitRegionOperator(regionID uint64, policyStr string, keys []string) error
- func (h *Handler) AddTransferLeaderOperator(regionID uint64, storeID uint64) error
- func (h *Handler) AddTransferPeerOperator(regionID uint64, fromStoreID, toStoreID uint64) error
- func (h *Handler) AddTransferRegionOperator(regionID uint64, storeIDs map[uint64]placement.PeerRoleType) error
- func (*Handler) AdjustLimit(limitStr string, defaultLimits ...int) (int, error)
- func (*Handler) BuildScatterRegionsResp(opsCount int, failures map[uint64]error) *ScatterRegionsResponse
- func (h *Handler) CheckRegionPlacementRule(region *core.RegionInfo) (*placement.RegionFit, error)
- func (h *Handler) CheckRegionsReplicated(rawStartKey, rawEndKey string) (string, error)
- func (h *Handler) GetAdminOperators() ([]*operator.Operator, error)
- func (h *Handler) GetCheckerStatus(name string) (map[string]bool, error)
- func (h *Handler) GetDiagnosticResult(name string) (*schedulers.DiagnosticResult, error)
- func (h *Handler) GetHistory(start time.Time) ([]operator.OpHistory, error)
- func (h *Handler) GetHotBuckets(regionIDs ...uint64) (HotBucketsResponse, error)
- func (h *Handler) GetHotRegions(typ utils.RWType, storeIDs ...uint64) (*statistics.StoreHotPeersInfos, error)
- func (h *Handler) GetHotStores() (*HotStoreStats, error)
- func (h *Handler) GetLeaderOperators() ([]*operator.Operator, error)
- func (h *Handler) GetOperator(regionID uint64) (*operator.Operator, error)
- func (h *Handler) GetOperatorController() (*operator.Controller, error)
- func (h *Handler) GetOperatorStatus(regionID uint64) (*operator.OpWithStatus, error)
- func (h *Handler) GetOperators() ([]*operator.Operator, error)
- func (h *Handler) GetOperatorsByKinds(kinds []string) ([]*operator.Operator, error)
- func (h *Handler) GetRecords(from time.Time) ([]*operator.OpRecord, error)
- func (h *Handler) GetRegion(id uint64) (*core.RegionInfo, error)
- func (h *Handler) GetRegionLabeler() (*labeler.RegionLabeler, error)
- func (h *Handler) GetRegionOperators() ([]*operator.Operator, error)
- func (h *Handler) GetRegionScatterer() (*scatter.RegionScatterer, error)
- func (h *Handler) GetRuleManager() (*placement.RuleManager, error)
- func (h *Handler) GetSchedulerByStatus(status string, needTS bool) (any, error)
- func (h *Handler) GetSchedulerNames() ([]string, error)
- func (h *Handler) GetSchedulersController() (*schedulers.Controller, error)
- func (h *Handler) GetStore(storeID uint64) (*core.StoreInfo, error)
- func (h *Handler) GetStores() ([]*core.StoreInfo, error)
- func (h *Handler) GetStoresLoads() (map[uint64][]float64, error)
- func (h *Handler) GetWaitingOperators() ([]*operator.Operator, error)
- func (h *Handler) HandleOperatorCreation(input map[string]any) (int, any, error)
- func (h *Handler) PauseOrResumeChecker(name string, t int64) (err error)
- func (h *Handler) PauseOrResumeScheduler(name string, t int64) (err error)
- func (h *Handler) PreCheckForRegion(regionStr string) (*core.RegionInfo, int, error)
- func (h *Handler) RemoveOperator(regionID uint64) error
- func (h *Handler) RemoveOperators() error
- func (h *Handler) ScatterRegionsByID(ids []uint64, group string, retryLimit int) (int, map[uint64]error, error)
- func (h *Handler) ScatterRegionsByRange(rawStartKey, rawEndKey string, group string, retryLimit int) (int, map[uint64]error, error)
- func (h *Handler) SplitRegions(ctx context.Context, rawSplitKeys []any, retryLimit int) (*SplitRegionsResponse, error)
- type HotBucketsItem
- type HotBucketsResponse
- type HotStoreStats
- type ScatterRegionsResponse
- type Server
- type SplitRegionsResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
Server
}
Handler is a handler to handle http request about schedule.
func (*Handler) AccelerateRegionsScheduleInRange ¶
AccelerateRegionsScheduleInRange accelerates regions scheduling in a given range.
func (*Handler) AccelerateRegionsScheduleInRanges ¶
func (h *Handler) AccelerateRegionsScheduleInRanges(startKeys [][]byte, endKeys [][]byte, limit int) error
AccelerateRegionsScheduleInRanges accelerates regions scheduling in given ranges.
func (*Handler) AddAddLearnerOperator ¶
AddAddLearnerOperator adds an operator to add learner.
func (*Handler) AddAddPeerOperator ¶
AddAddPeerOperator adds an operator to add peer.
func (*Handler) AddMergeRegionOperator ¶
AddMergeRegionOperator adds an operator to merge region.
func (*Handler) AddRemovePeerOperator ¶
AddRemovePeerOperator adds an operator to remove peer.
func (*Handler) AddScatterRegionOperator ¶
AddScatterRegionOperator adds an operator to scatter a region.
func (*Handler) AddScatterRegionsOperators ¶
func (h *Handler) AddScatterRegionsOperators(regionIDs []uint64, startRawKey, endRawKey, group string, retryLimit int) (int, error)
AddScatterRegionsOperators add operators to scatter regions and return the processed percentage and error
func (*Handler) AddSplitRegionOperator ¶
AddSplitRegionOperator adds an operator to split a region.
func (*Handler) AddTransferLeaderOperator ¶
AddTransferLeaderOperator adds an operator to transfer leader to the store.
func (*Handler) AddTransferPeerOperator ¶
AddTransferPeerOperator adds an operator to transfer peer.
func (*Handler) AddTransferRegionOperator ¶
func (h *Handler) AddTransferRegionOperator(regionID uint64, storeIDs map[uint64]placement.PeerRoleType) error
AddTransferRegionOperator adds an operator to transfer region to the stores.
func (*Handler) AdjustLimit ¶
AdjustLimit adjusts the limit of regions to schedule.
func (*Handler) BuildScatterRegionsResp ¶
func (*Handler) BuildScatterRegionsResp(opsCount int, failures map[uint64]error) *ScatterRegionsResponse
BuildScatterRegionsResp builds ScatterRegionsResponse.
func (*Handler) CheckRegionPlacementRule ¶
CheckRegionPlacementRule checks if the region matches the placement rules.
func (*Handler) CheckRegionsReplicated ¶
CheckRegionsReplicated checks if regions are replicated.
func (*Handler) GetAdminOperators ¶
GetAdminOperators returns the running admin operators.
func (*Handler) GetCheckerStatus ¶
GetCheckerStatus returns the status of the checker.
func (*Handler) GetDiagnosticResult ¶
func (h *Handler) GetDiagnosticResult(name string) (*schedulers.DiagnosticResult, error)
GetDiagnosticResult returns the diagnostic results of the specified scheduler.
func (*Handler) GetHistory ¶
GetHistory returns finished operators' history since start.
func (*Handler) GetHotBuckets ¶
func (h *Handler) GetHotBuckets(regionIDs ...uint64) (HotBucketsResponse, error)
GetHotBuckets returns all hot buckets stats.
func (*Handler) GetHotRegions ¶
func (h *Handler) GetHotRegions(typ utils.RWType, storeIDs ...uint64) (*statistics.StoreHotPeersInfos, error)
GetHotRegions gets hot regions' statistics by RWType and storeIDs. If storeIDs is empty, it returns all hot regions' statistics by RWType.
func (*Handler) GetHotStores ¶
func (h *Handler) GetHotStores() (*HotStoreStats, error)
GetHotStores gets all hot stores stats.
func (*Handler) GetLeaderOperators ¶
GetLeaderOperators returns the running leader operators.
func (*Handler) GetOperator ¶
GetOperator returns the region operator.
func (*Handler) GetOperatorController ¶
func (h *Handler) GetOperatorController() (*operator.Controller, error)
GetOperatorController returns OperatorController.
func (*Handler) GetOperatorStatus ¶
func (h *Handler) GetOperatorStatus(regionID uint64) (*operator.OpWithStatus, error)
GetOperatorStatus returns the status of the region operator.
func (*Handler) GetOperators ¶
GetOperators returns the running operators.
func (*Handler) GetOperatorsByKinds ¶
GetOperatorsByKinds returns the running operators by kinds.
func (*Handler) GetRecords ¶
GetRecords returns finished operators since start.
func (*Handler) GetRegion ¶
func (h *Handler) GetRegion(id uint64) (*core.RegionInfo, error)
GetRegion returns the region labeler.
func (*Handler) GetRegionLabeler ¶
func (h *Handler) GetRegionLabeler() (*labeler.RegionLabeler, error)
GetRegionLabeler returns the region labeler.
func (*Handler) GetRegionOperators ¶
GetRegionOperators returns the running region operators.
func (*Handler) GetRegionScatterer ¶
func (h *Handler) GetRegionScatterer() (*scatter.RegionScatterer, error)
GetRegionScatterer returns RegionScatterer.
func (*Handler) GetRuleManager ¶
func (h *Handler) GetRuleManager() (*placement.RuleManager, error)
GetRuleManager returns the rule manager.
func (*Handler) GetSchedulerByStatus ¶
GetSchedulerByStatus returns all names of schedulers by status.
func (*Handler) GetSchedulerNames ¶
GetSchedulerNames returns all names of schedulers.
func (*Handler) GetSchedulersController ¶
func (h *Handler) GetSchedulersController() (*schedulers.Controller, error)
GetSchedulersController returns controller of schedulers.
func (*Handler) GetStoresLoads ¶
GetStoresLoads gets all hot write stores stats.
func (*Handler) GetWaitingOperators ¶
GetWaitingOperators returns the waiting operators.
func (*Handler) HandleOperatorCreation ¶
HandleOperatorCreation processes the request and creates an operator based on the provided input. It supports various types of operators such as transfer-leader, transfer-region, add-peer, remove-peer, merge-region, split-region, scatter-region, and scatter-regions. The function validates the input, performs the corresponding operation, and returns the HTTP status code, response body, and any error encountered during the process.
func (*Handler) PauseOrResumeChecker ¶
PauseOrResumeChecker pauses checker for delay seconds or resume checker t == 0 : resume checker. t > 0 : checker delays t seconds.
func (*Handler) PauseOrResumeScheduler ¶
PauseOrResumeScheduler pauses a scheduler for delay seconds or resume a paused scheduler. t == 0 : resume scheduler. t > 0 : scheduler delays t seconds.
func (*Handler) PreCheckForRegion ¶
PreCheckForRegion checks if the region is valid.
func (*Handler) RemoveOperator ¶
RemoveOperator removes the region operator.
func (*Handler) RemoveOperators ¶
RemoveOperators removes the all operators.
func (*Handler) ScatterRegionsByID ¶
func (h *Handler) ScatterRegionsByID(ids []uint64, group string, retryLimit int) (int, map[uint64]error, error)
ScatterRegionsByID scatters regions by id.
func (*Handler) ScatterRegionsByRange ¶
func (h *Handler) ScatterRegionsByRange(rawStartKey, rawEndKey string, group string, retryLimit int) (int, map[uint64]error, error)
ScatterRegionsByRange scatters regions by range.
func (*Handler) SplitRegions ¶
func (h *Handler) SplitRegions(ctx context.Context, rawSplitKeys []any, retryLimit int) (*SplitRegionsResponse, error)
SplitRegions splits regions by split keys.
type HotBucketsItem ¶
type HotBucketsItem struct {
StartKey string `json:"start_key"`
EndKey string `json:"end_key"`
HotDegree int `json:"hot_degree"`
ReadBytes uint64 `json:"read_bytes"`
ReadKeys uint64 `json:"read_keys"`
WriteBytes uint64 `json:"write_bytes"`
WriteKeys uint64 `json:"write_keys"`
}
HotBucketsItem is the item of hot buckets.
type HotBucketsResponse ¶
type HotBucketsResponse map[uint64][]*HotBucketsItem
HotBucketsResponse is the response for hot buckets.
type HotStoreStats ¶
type HotStoreStats struct {
BytesWriteStats map[uint64]float64 `json:"bytes-write-rate,omitempty"`
BytesReadStats map[uint64]float64 `json:"bytes-read-rate,omitempty"`
KeysWriteStats map[uint64]float64 `json:"keys-write-rate,omitempty"`
KeysReadStats map[uint64]float64 `json:"keys-read-rate,omitempty"`
QueryWriteStats map[uint64]float64 `json:"query-write-rate,omitempty"`
QueryReadStats map[uint64]float64 `json:"query-read-rate,omitempty"`
}
HotStoreStats is used to record the status of hot stores.
type ScatterRegionsResponse ¶
type ScatterRegionsResponse struct {
ProcessedPercentage int `json:"processed-percentage"`
}
ScatterRegionsResponse is the response for scatter regions.
type Server ¶
type Server interface {
GetCoordinator() *schedule.Coordinator
GetCluster() sche.SchedulerCluster
}
Server is the interface for handler about schedule. TODO: remove it after GetCluster is unified between PD server and Scheduling server.
type SplitRegionsResponse ¶
type SplitRegionsResponse struct {
ProcessedPercentage int `json:"processed-percentage"`
NewRegionsID []uint64 `json:"regions-id"`
}
SplitRegionsResponse is the response for split regions.