Documentation
¶
Index ¶
- Constants
- Variables
- func CalculateRequiredNodes(tasks []*proto.TaskBase, cpuCount int) int
- func CancelTask(ctx context.Context, taskKey string) error
- func GetBusyNodes(ctx context.Context, manager *storage.TaskManager) ([]schstatus.Node, error)
- func GetCPUCountOfNode(ctx context.Context) (int, error)
- func GetCloudStorageURI(ctx context.Context, store kv.Storage) string
- func GetDefaultRegionSplitConfig() (splitSize, splitKeys int64)
- func GetNodeResource() *proto.NodeResource
- func GetNodesInfo(ctx context.Context, manager *storage.TaskManager) (nodeCount int, cpuCount int, err error)
- func GetScheduleFlags(ctx context.Context, manager *storage.TaskManager) (map[schstatus.Flag]schstatus.TTLFlag, error)
- func GetScheduleStatus(ctx context.Context) (*schstatus.Status, error)
- func GetScheduleTuneFactors(ctx context.Context, keyspace string) (*schstatus.TuneFactors, error)
- func GetTargetScope() string
- func NewObjStore(ctx context.Context, uri string) (extstorage.ExternalStorage, error)
- func NewObjStoreWithRecording(ctx context.Context, uri string) (*recording.AccessStats, extstorage.ExternalStorage, error)
- func NotifyTaskChange()
- func PauseTask(ctx context.Context, taskKey string) error
- func ResumeTask(ctx context.Context, taskKey string) error
- func RunWithRetry(ctx context.Context, maxRetry int, backoffer backoff.Backoffer, ...) error
- func SendRowAndSizeMeterData(ctx context.Context, task *proto.Task, rows int64, ...) (err error)
- func SetNodeResource(rc *proto.NodeResource)
- func SubmitTask(ctx context.Context, taskKey string, taskType proto.TaskType, keyspace string, ...) (*proto.Task, error)
- func UpdatePauseScaleInFlag(ctx context.Context, flag *schstatus.TTLFlag) error
- func WaitTask(ctx context.Context, id int64, matchFn func(base *proto.TaskBase) bool) (*proto.TaskBase, error)
- func WaitTaskDoneByKey(ctx context.Context, taskKey string) error
- func WaitTaskDoneOrPaused(ctx context.Context, id int64) error
Constants ¶
const ( // NextGenTargetScope is the target scope for new tasks in nextgen kernel. // on nextgen, DXF works as a service and runs only on node with scope 'dxf_service', // so all tasks must be submitted to that scope. NextGenTargetScope = "dxf_service" )
Variables ¶
var ( // TaskChangedCh used to speed up task schedule, such as when task is submitted // in the same node as the scheduler manager. // put it here to avoid cyclic import. TaskChangedCh = make(chan struct{}, 1) )
Functions ¶
func CalculateRequiredNodes ¶
CalculateRequiredNodes simulates how scheduler and balancer schedules tasks, and calculates the required node count to run the tasks. 'tasks' must be ordered by its rank, see TaskBase for more info about task rank.
func CancelTask ¶
CancelTask cancels a task.
func GetBusyNodes ¶
GetBusyNodes get nodes that are currently running subtasks, or is the DXF owner as we don't want owner node floating around. exported for test.
func GetCPUCountOfNode ¶
GetCPUCountOfNode gets the CPU count of the managed node.
func GetCloudStorageURI ¶
GetCloudStorageURI returns the cloud storage URI with cluster ID appended to the path.
func GetDefaultRegionSplitConfig ¶
func GetDefaultRegionSplitConfig() (splitSize, splitKeys int64)
GetDefaultRegionSplitConfig gets the default region split size and keys.
func GetNodeResource ¶
func GetNodeResource() *proto.NodeResource
GetNodeResource gets the node resource.
func GetNodesInfo ¶
func GetNodesInfo(ctx context.Context, manager *storage.TaskManager) (nodeCount int, cpuCount int, err error)
GetNodesInfo retrieves the number of managed nodes and their CPU count. exported for test.
func GetScheduleFlags ¶
func GetScheduleFlags(ctx context.Context, manager *storage.TaskManager) (map[schstatus.Flag]schstatus.TTLFlag, error)
GetScheduleFlags returns the schedule flags, such as pause-scale-in flag. exported for test.
func GetScheduleStatus ¶
GetScheduleStatus returns the schedule status.
func GetScheduleTuneFactors ¶
GetScheduleTuneFactors gets the schedule tune factors for a keyspace. if not set or expired, it returns the default tune factors.
func GetTargetScope ¶
func GetTargetScope() string
GetTargetScope get target scope for new tasks. in classical kernel, the target scope the new task is the service scope of the TiDB instance that user is currently connecting to. in nextgen kernel, it's always NextGenTargetScope.
func NewObjStore ¶
func NewObjStore(ctx context.Context, uri string) (extstorage.ExternalStorage, error)
NewObjStore creates an object storage for global sort.
func NewObjStoreWithRecording ¶
func NewObjStoreWithRecording(ctx context.Context, uri string) (*recording.AccessStats, extstorage.ExternalStorage, error)
NewObjStoreWithRecording creates an object storage for global sort with request recording.
func NotifyTaskChange ¶
func NotifyTaskChange()
NotifyTaskChange is used to notify the scheduler manager that the task is changed, either a new task is submitted or a task is finished.
func ResumeTask ¶
ResumeTask resumes a task.
func RunWithRetry ¶
func RunWithRetry( ctx context.Context, maxRetry int, backoffer backoff.Backoffer, logger *zap.Logger, f func(context.Context) (bool, error), ) error
RunWithRetry runs a function with retry, when retry exceed max retry time, it returns the last error met. if the function fails with err, it should return a bool to indicate whether the error is retryable. if context done, it will stop early and return ctx.Err().
func SendRowAndSizeMeterData ¶
func SendRowAndSizeMeterData(ctx context.Context, task *proto.Task, rows int64, dataKVSize, indexKVSize int64, logger *zap.Logger) (err error)
SendRowAndSizeMeterData sends the row count and size metering data.
func SetNodeResource ¶
func SetNodeResource(rc *proto.NodeResource)
SetNodeResource gets the node resource.
func SubmitTask ¶
func SubmitTask(ctx context.Context, taskKey string, taskType proto.TaskType, keyspace string, requiredSlots int, targetScope string, maxNodeCnt int, taskMeta []byte) (*proto.Task, error)
SubmitTask submits a task.
func UpdatePauseScaleInFlag ¶
UpdatePauseScaleInFlag updates the pause scale-in flag.
func WaitTask ¶
func WaitTask(ctx context.Context, id int64, matchFn func(base *proto.TaskBase) bool) (*proto.TaskBase, error)
WaitTask waits for a task until it meets the matchFn.
func WaitTaskDoneByKey ¶
WaitTaskDoneByKey waits for a task done by task key.
Types ¶
This section is empty.