Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DeleteRangeTask ¶
type DeleteRangeTask struct {
// contains filtered or unexported fields
}
DeleteRangeTask is used to delete all keys in a range. After performing DeleteRange, it keeps how many ranges it affects and if the task was canceled or not.
func NewDeleteRangeTask ¶
func NewDeleteRangeTask(store storage, startKey []byte, endKey []byte, concurrency int) *DeleteRangeTask
NewDeleteRangeTask creates a DeleteRangeTask. Deleting will be performed when `Execute` method is invoked. Be careful while using this API. This API doesn't keep recent MVCC versions, but will delete all versions of all keys in the range immediately. Also notice that frequent invocation to this API may cause performance problems to TiKV.
func NewNotifyDeleteRangeTask ¶
func NewNotifyDeleteRangeTask(store storage, startKey []byte, endKey []byte, concurrency int) *DeleteRangeTask
NewNotifyDeleteRangeTask creates a task that sends delete range requests to all regions in the range, but with the flag `notifyOnly` set. TiKV will not actually delete the range after receiving request, but it will be replicated via raft. This is used to notify the involved regions before sending UnsafeDestroyRange requests.
func (*DeleteRangeTask) CompletedRegions ¶
func (t *DeleteRangeTask) CompletedRegions() int
CompletedRegions returns the number of regions that are affected by this delete range task
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner splits a range into many ranges to process concurrently, and convenient to send requests to all regions in the range. Because of merging and splitting, it's possible that multiple requests for disjoint ranges are sent to the same region.
func NewRangeTaskRunner ¶
func NewRangeTaskRunner( name string, store storage, concurrency int, handler TaskHandler, ) *Runner
NewRangeTaskRunner creates a RangeTaskRunner.
`requestCreator` is the function used to create RPC request according to the given range. `responseHandler` is the function to process responses of errors. If `responseHandler` returns error, the whole job will be canceled.
func (*Runner) CompletedRegions ¶
CompletedRegions returns how many regions has been sent requests.
func (*Runner) FailedRegions ¶
FailedRegions returns how many regions has failed to do the task.
func (*Runner) RunOnRange ¶
RunOnRange runs the task on the given range. Empty startKey or endKey means unbounded.
func (*Runner) SetRegionsPerTask ¶
SetRegionsPerTask sets how many regions is in a divided task. Since regions may split and merge, it's possible that a sub task contains not exactly specified number of regions.
type TaskHandler ¶
TaskHandler is the type of functions that processes a task of a key range. The function should calculate Regions that succeeded or failed to the task. Returning error from the handler means the error caused the whole task should be stopped.