Documentation ¶
Index ¶
- Constants
- func BuildKeyRanges(keys ...string) []kv.KeyRange
- type Backoffer
- type CopClient
- type CopRuntimeStats
- type KeyRanges
- func (r *KeyRanges) At(i int) kv.KeyRange
- func (r *KeyRanges) Do(f func(ran *kv.KeyRange))
- func (r *KeyRanges) Len() int
- func (r *KeyRanges) RefAt(i int) *kv.KeyRange
- func (r *KeyRanges) Slice(from, to int) *KeyRanges
- func (r *KeyRanges) Split(key []byte) (*KeyRanges, *KeyRanges)
- func (r *KeyRanges) String() string
- func (r *KeyRanges) ToPBRanges() []*coprocessor.KeyRange
- type LocationKeyRanges
- type MPPClient
- type MPPFailedStoreProber
- func (t *MPPFailedStoreProber) Add(ctx context.Context, address string, tikvClient tikv.Client)
- func (t *MPPFailedStoreProber) Delete(address string)
- func (t *MPPFailedStoreProber) IsRecovery(ctx context.Context, address string, recoveryTTL time.Duration) bool
- func (t *MPPFailedStoreProber) Run()
- func (t *MPPFailedStoreProber) Stop()
- type MPPStoreState
- type RegionBatchRequestSender
- type RegionCache
- func (c *RegionCache) BuildBatchTask(bo *Backoffer, task *copTask, replicaRead kv.ReplicaReadType) (*batchedCopTask, error)
- func (c *RegionCache) OnSendFailForBatchRegions(bo *Backoffer, store *tikv.Store, regionInfos []RegionInfo, ...)
- func (c *RegionCache) SplitKeyRangesByBuckets(bo *Backoffer, ranges *KeyRanges) ([]*LocationKeyRanges, error)
- func (c *RegionCache) SplitKeyRangesByLocations(bo *Backoffer, ranges *KeyRanges, limit int) ([]*LocationKeyRanges, error)
- func (c *RegionCache) SplitRegionRanges(bo *Backoffer, keyRanges []kv.KeyRange, limit int) ([]kv.KeyRange, error)
- type RegionInfo
- type Store
Constants ¶
const ( // DetectPeriod detect period DetectPeriod = 3 * time.Second // DetectTimeoutLimit detect timeout DetectTimeoutLimit = 2 * time.Second // MaxRecoveryTimeLimit wait TiFlash recovery,more than MPPStoreFailTTL MaxRecoveryTimeLimit = 15 * time.Minute // MaxObsoletTimeLimit no request for a long time,that might be obsoleted MaxObsoletTimeLimit = time.Hour )
const (
CopSmallTaskRow = 32 // 32 is the initial batch size of TiKV
)
Maximum total sleep time(in ms) for kv/cop commands.
const MockResponseSizeForTest = 100 * 1024 * 1024
MockResponseSizeForTest mock the response size
const UnspecifiedLimit = -1
UnspecifiedLimit means no limit.
Variables ¶
This section is empty.
Functions ¶
func BuildKeyRanges ¶
BuildKeyRanges is used for test, quickly build key ranges from paired keys.
Types ¶
type Backoffer ¶
Backoffer wraps tikv.Backoffer and converts the error which returns by the functions of tikv.Backoffer to tidb error.
type CopClient ¶
type CopClient struct { kv.RequestTypeSupportedChecker // contains filtered or unexported fields }
CopClient is coprocessor client.
type CopRuntimeStats ¶
type CopRuntimeStats struct { execdetails.ExecDetails tikv.RegionRequestRuntimeStats CoprCacheHit bool }
CopRuntimeStats contains execution detail information.
type KeyRanges ¶
type KeyRanges struct {
// contains filtered or unexported fields
}
KeyRanges is like []kv.KeyRange, but may has extra elements at head/tail. It's for avoiding alloc big slice during build copTask.
func NewKeyRanges ¶
NewKeyRanges constructs a KeyRanges instance.
func (*KeyRanges) ToPBRanges ¶
func (r *KeyRanges) ToPBRanges() []*coprocessor.KeyRange
ToPBRanges converts ranges to wire type.
type LocationKeyRanges ¶
type LocationKeyRanges struct { // Location is the real location in PD. Location *tikv.KeyLocation // Ranges is the logic ranges the current Location contains. Ranges *KeyRanges }
LocationKeyRanges wrapps a real Location in PD and its logical ranges info.
type MPPClient ¶
type MPPClient struct {
// contains filtered or unexported fields
}
MPPClient servers MPP requests.
func (*MPPClient) ConstructMPPTasks ¶
func (c *MPPClient) ConstructMPPTasks(ctx context.Context, req *kv.MPPBuildTasksRequest, ttl time.Duration) ([]kv.MPPTaskMeta, error)
ConstructMPPTasks receives ScheduleRequest, which are actually collects of kv ranges. We allocates MPPTaskMeta for them and returns.
func (*MPPClient) DispatchMPPTasks ¶
func (c *MPPClient) DispatchMPPTasks(ctx context.Context, variables interface{}, dispatchReqs []*kv.MPPDispatchRequest, needTriggerFallback bool, startTs uint64, mppQueryID kv.MPPQueryID) kv.Response
DispatchMPPTasks dispatches all the mpp task and waits for the responses.
type MPPFailedStoreProber ¶
type MPPFailedStoreProber struct {
// contains filtered or unexported fields
}
MPPFailedStoreProber use for detecting of failed TiFlash instance
var GlobalMPPFailedStoreProber *MPPFailedStoreProber
GlobalMPPFailedStoreProber mpp failed store probe
func (*MPPFailedStoreProber) Delete ¶
func (t *MPPFailedStoreProber) Delete(address string)
Delete clean store from failed map
func (*MPPFailedStoreProber) IsRecovery ¶
func (t *MPPFailedStoreProber) IsRecovery(ctx context.Context, address string, recoveryTTL time.Duration) bool
IsRecovery check whether the store is recovery
func (*MPPFailedStoreProber) Run ¶
func (t *MPPFailedStoreProber) Run()
Run a loop of scan there can be only one background task
func (*MPPFailedStoreProber) Stop ¶
func (t *MPPFailedStoreProber) Stop()
Stop stop background goroutine
type MPPStoreState ¶
type MPPStoreState struct {
// contains filtered or unexported fields
}
MPPStoreState the state for MPPStore.
type RegionBatchRequestSender ¶
type RegionBatchRequestSender struct { *tikv.RegionRequestSender // contains filtered or unexported fields }
RegionBatchRequestSender sends BatchCop requests to TiFlash server by stream way.
func NewRegionBatchRequestSender ¶
func NewRegionBatchRequestSender(cache *RegionCache, client tikv.Client, enableCollectExecutionInfo bool) *RegionBatchRequestSender
NewRegionBatchRequestSender creates a RegionBatchRequestSender object.
func (*RegionBatchRequestSender) SendReqToAddr ¶
func (ss *RegionBatchRequestSender) SendReqToAddr(bo *Backoffer, rpcCtx *tikv.RPCContext, regionInfos []RegionInfo, req *tikvrpc.Request, timout time.Duration) (resp *tikvrpc.Response, retry bool, cancel func(), err error)
SendReqToAddr send batch cop request
type RegionCache ¶
type RegionCache struct {
*tikv.RegionCache
}
RegionCache wraps tikv.RegionCache.
func NewRegionCache ¶
func NewRegionCache(rc *tikv.RegionCache) *RegionCache
NewRegionCache returns a new RegionCache.
func (*RegionCache) BuildBatchTask ¶
func (c *RegionCache) BuildBatchTask(bo *Backoffer, task *copTask, replicaRead kv.ReplicaReadType) (*batchedCopTask, error)
BuildBatchTask fetches store and peer info for cop task, wrap it as `batchedCopTask`.
func (*RegionCache) OnSendFailForBatchRegions ¶
func (c *RegionCache) OnSendFailForBatchRegions(bo *Backoffer, store *tikv.Store, regionInfos []RegionInfo, scheduleReload bool, err error)
OnSendFailForBatchRegions handles send request fail logic.
func (*RegionCache) SplitKeyRangesByBuckets ¶
func (c *RegionCache) SplitKeyRangesByBuckets(bo *Backoffer, ranges *KeyRanges) ([]*LocationKeyRanges, error)
SplitKeyRangesByBuckets splits the KeyRanges by buckets information in the cache. If regions don't have buckets, it's equal to SplitKeyRangesByLocations.
TODO(youjiali1995): Try to do it in one round and reduce allocations if bucket is not enabled.
func (*RegionCache) SplitKeyRangesByLocations ¶
func (c *RegionCache) SplitKeyRangesByLocations(bo *Backoffer, ranges *KeyRanges, limit int) ([]*LocationKeyRanges, error)
SplitKeyRangesByLocations splits the KeyRanges by logical info in the cache.
func (*RegionCache) SplitRegionRanges ¶
func (c *RegionCache) SplitRegionRanges(bo *Backoffer, keyRanges []kv.KeyRange, limit int) ([]kv.KeyRange, error)
SplitRegionRanges gets the split ranges from pd region.
type RegionInfo ¶
type RegionInfo struct { Region tikv.RegionVerID Meta *metapb.Region Ranges *KeyRanges AllStores []uint64 PartitionIndex int64 // used by PartitionTableScan, indicates the n-th partition of the partition table }
RegionInfo contains region related information for batchCopTask
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store wraps tikv.KVStore and provides coprocessor utilities.
func (Store) CheckVisibility ¶
CheckVisibility checks if it is safe to read using given ts.
func (*Store) GetMPPClient ¶
GetMPPClient gets a mpp client instance.
func (Store) GetRegionCache ¶
func (s Store) GetRegionCache() *RegionCache
GetRegionCache returns the region cache instance.
func (Store) GetTiKVClient ¶
GetTiKVClient gets the client instance.