tidb: github.com/pingcap/tidb/util/execdetails Index | Files

package execdetails

import "github.com/pingcap/tidb/util/execdetails"

Index

Package Files

execdetails.go pd_interceptor.go

Constants

const (
    // CopTimeStr represents the sum of cop-task time spend in TiDB distSQL.
    CopTimeStr = "Cop_time"
    // ProcessTimeStr represents the sum of process time of all the coprocessor tasks.
    ProcessTimeStr = "Process_time"
    // WaitTimeStr means the time of all coprocessor wait.
    WaitTimeStr = "Wait_time"
    // BackoffTimeStr means the time of all back-off.
    BackoffTimeStr = "Backoff_time"
    // LockKeysTimeStr means the time interval between pessimistic lock wait start and lock got obtain
    LockKeysTimeStr = "LockKeys_time"
    // RequestCountStr means the request count.
    RequestCountStr = "Request_count"
    // TotalKeysStr means the total scan keys.
    TotalKeysStr = "Total_keys"
    // ProcessKeysStr means the total processed keys.
    ProcessKeysStr = "Process_keys"
    // PreWriteTimeStr means the time of pre-write.
    PreWriteTimeStr = "Prewrite_time"
    // WaitPrewriteBinlogTimeStr means the time of waiting prewrite binlog finished when transaction committing.
    WaitPrewriteBinlogTimeStr = "Wait_prewrite_binlog_time"
    // CommitTimeStr means the time of commit.
    CommitTimeStr = "Commit_time"
    // GetCommitTSTimeStr means the time of getting commit ts.
    GetCommitTSTimeStr = "Get_commit_ts_time"
    // CommitBackoffTimeStr means the time of commit backoff.
    CommitBackoffTimeStr = "Commit_backoff_time"
    // BackoffTypesStr means the backoff type.
    BackoffTypesStr = "Backoff_types"
    // ResolveLockTimeStr means the time of resolving lock.
    ResolveLockTimeStr = "Resolve_lock_time"
    // LocalLatchWaitTimeStr means the time of waiting in local latch.
    LocalLatchWaitTimeStr = "Local_latch_wait_time"
    // WriteKeysStr means the count of keys in the transaction.
    WriteKeysStr = "Write_keys"
    // WriteSizeStr means the key/value size in the transaction.
    WriteSizeStr = "Write_size"
    // PrewriteRegionStr means the count of region when pre-write.
    PrewriteRegionStr = "Prewrite_region"
    // TxnRetryStr means the count of transaction retry.
    TxnRetryStr = "Txn_retry"
)
const (
    // TpBasicRuntimeStats is the tp for BasicRuntimeStats.
    TpBasicRuntimeStats int = iota
    // TpRuntimeStatsWithCommit is the tp for RuntimeStatsWithCommit.
    TpRuntimeStatsWithCommit
    // TpRuntimeStatsWithConcurrencyInfo is the tp for RuntimeStatsWithConcurrencyInfo.
    TpRuntimeStatsWithConcurrencyInfo
    // TpSnapshotRuntimeStats is the tp for SnapshotRuntimeStats.
    TpSnapshotRuntimeStats
    // TpHashJoinRuntimeStats is the tp for HashJoinRuntimeStats.
    TpHashJoinRuntimeStats
    // TpIndexLookUpJoinRuntimeStats is the tp for IndexLookUpJoinRuntimeStats.
    TpIndexLookUpJoinRuntimeStats
    // TpRuntimeStatsWithSnapshot is the tp for RuntimeStatsWithSnapshot.
    TpRuntimeStatsWithSnapshot
    // TpJoinRuntimeStats is the tp for JoinRuntimeStats.
    TpJoinRuntimeStats
    // TpSelectResultRuntimeStats is the tp for SelectResultRuntimeStats.
    TpSelectResultRuntimeStats
)

Variables

var (
    // CommitDetailCtxKey presents CommitDetail info key in context.
    CommitDetailCtxKey = commitDetailCtxKeyType{}

    // LockKeysDetailCtxKey presents LockKeysDetail info key in context.
    LockKeysDetailCtxKey = lockKeysDetailCtxKeyType{}
)
var StmtExecDetailKey = stmtExecDetailKeyType{}

StmtExecDetailKey used to carry StmtExecDetail info in context.Context.

type BasicRuntimeStats Uses

type BasicRuntimeStats struct {
    // contains filtered or unexported fields
}

BasicRuntimeStats is the basic runtime stats.

func (*BasicRuntimeStats) Clone Uses

func (e *BasicRuntimeStats) Clone() RuntimeStats

Clone implements the RuntimeStats interface.

func (*BasicRuntimeStats) GetActRows Uses

func (e *BasicRuntimeStats) GetActRows() int64

GetActRows return total rows of BasicRuntimeStats.

func (*BasicRuntimeStats) Merge Uses

func (e *BasicRuntimeStats) Merge(rs RuntimeStats)

Merge implements the RuntimeStats interface.

func (*BasicRuntimeStats) Record Uses

func (e *BasicRuntimeStats) Record(d time.Duration, rowNum int)

Record records executor's execution.

func (*BasicRuntimeStats) SetRowNum Uses

func (e *BasicRuntimeStats) SetRowNum(rowNum int64)

SetRowNum sets the row num.

func (*BasicRuntimeStats) String Uses

func (e *BasicRuntimeStats) String() string

String implements the RuntimeStats interface.

func (*BasicRuntimeStats) Tp Uses

func (e *BasicRuntimeStats) Tp() int

Tp implements the RuntimeStats interface.

type CommitDetails Uses

type CommitDetails struct {
    GetCommitTsTime        time.Duration
    PrewriteTime           time.Duration
    WaitPrewriteBinlogTime time.Duration
    CommitTime             time.Duration
    LocalLatchTime         time.Duration
    CommitBackoffTime      int64
    Mu                     struct {
        sync.Mutex
        BackoffTypes []fmt.Stringer
    }
    ResolveLockTime   int64
    WriteKeys         int
    WriteSize         int
    PrewriteRegionNum int32
    TxnRetry          int
}

CommitDetails contains commit detail information.

func (*CommitDetails) Clone Uses

func (cd *CommitDetails) Clone() *CommitDetails

Clone returns a deep copy of itself.

func (*CommitDetails) Merge Uses

func (cd *CommitDetails) Merge(other *CommitDetails)

Merge merges commit details into itself.

type ConcurrencyInfo Uses

type ConcurrencyInfo struct {
    // contains filtered or unexported fields
}

ConcurrencyInfo is used to save the concurrency information of the executor operator

func NewConcurrencyInfo Uses

func NewConcurrencyInfo(name string, num int) *ConcurrencyInfo

NewConcurrencyInfo creates new executor's concurrencyInfo.

type CopRuntimeStats Uses

type CopRuntimeStats struct {
    sync.Mutex
    // contains filtered or unexported fields
}

CopRuntimeStats collects cop tasks' execution info.

func (*CopRuntimeStats) GetActRows Uses

func (crs *CopRuntimeStats) GetActRows() (totalRows int64)

GetActRows return total rows of CopRuntimeStats.

func (*CopRuntimeStats) RecordOneCopTask Uses

func (crs *CopRuntimeStats) RecordOneCopTask(address string, summary *tipb.ExecutorExecutionSummary)

RecordOneCopTask records a specific cop tasks's execution detail.

func (*CopRuntimeStats) String Uses

func (crs *CopRuntimeStats) String() string

type ExecDetails Uses

type ExecDetails struct {
    CalleeAddress    string
    CopTime          time.Duration
    ProcessTime      time.Duration
    WaitTime         time.Duration
    BackoffTime      time.Duration
    LockKeysDuration time.Duration
    BackoffSleep     map[string]time.Duration
    BackoffTimes     map[string]int
    RequestCount     int
    TotalKeys        int64
    ProcessedKeys    int64
    CommitDetail     *CommitDetails
    LockKeysDetail   *LockKeysDetails
}

ExecDetails contains execution detail information.

func (ExecDetails) String Uses

func (d ExecDetails) String() string

String implements the fmt.Stringer interface.

func (ExecDetails) ToZapFields Uses

func (d ExecDetails) ToZapFields() (fields []zap.Field)

ToZapFields wraps the ExecDetails as zap.Fields.

type InterceptedPDClient Uses

type InterceptedPDClient struct {
    pd.Client
}

InterceptedPDClient is a PD's wrapper client to record stmt detail.

func (InterceptedPDClient) GetPrevRegion Uses

func (m InterceptedPDClient) GetPrevRegion(ctx context.Context, key []byte) (*pd.Region, error)

GetPrevRegion implements pd.Client#GetPrevRegion.

func (InterceptedPDClient) GetRegion Uses

func (m InterceptedPDClient) GetRegion(ctx context.Context, key []byte) (*pd.Region, error)

GetRegion implements pd.Client#GetRegion.

func (InterceptedPDClient) GetRegionByID Uses

func (m InterceptedPDClient) GetRegionByID(ctx context.Context, regionID uint64) (*pd.Region, error)

GetRegionByID implements pd.Client#GetRegionByID.

func (InterceptedPDClient) GetStore Uses

func (m InterceptedPDClient) GetStore(ctx context.Context, storeID uint64) (*metapb.Store, error)

GetStore implements pd.Client#GetStore.

func (InterceptedPDClient) GetTS Uses

func (m InterceptedPDClient) GetTS(ctx context.Context) (int64, int64, error)

GetTS implements pd.Client#GetTS.

func (InterceptedPDClient) GetTSAsync Uses

func (m InterceptedPDClient) GetTSAsync(ctx context.Context) pd.TSFuture

GetTSAsync implements pd.Client#GetTSAsync.

func (InterceptedPDClient) ScanRegions Uses

func (m InterceptedPDClient) ScanRegions(ctx context.Context, key, endKey []byte, limit int) ([]*pd.Region, error)

ScanRegions implements pd.Client#ScanRegions.

type LockKeysDetails Uses

type LockKeysDetails struct {
    TotalTime       time.Duration
    RegionNum       int32
    LockKeys        int32
    ResolveLockTime int64
    BackoffTime     int64
    Mu              struct {
        sync.Mutex
        BackoffTypes []fmt.Stringer
    }
    LockRPCTime  int64
    LockRPCCount int64
    RetryCount   int
}

LockKeysDetails contains pessimistic lock keys detail information.

func (*LockKeysDetails) Clone Uses

func (ld *LockKeysDetails) Clone() *LockKeysDetails

Clone returns a deep copy of itself.

func (*LockKeysDetails) Merge Uses

func (ld *LockKeysDetails) Merge(lockKey *LockKeysDetails)

Merge merges lock keys execution details into self.

type RootRuntimeStats Uses

type RootRuntimeStats struct {
    // contains filtered or unexported fields
}

RootRuntimeStats is the executor runtime stats that combine with multiple runtime stats.

func (*RootRuntimeStats) GetActRows Uses

func (e *RootRuntimeStats) GetActRows() int64

GetActRows return total rows of RootRuntimeStats.

func (*RootRuntimeStats) String Uses

func (e *RootRuntimeStats) String() string

String implements the RuntimeStats interface.

type RuntimeStats Uses

type RuntimeStats interface {
    String() string
    Merge(RuntimeStats)
    Clone() RuntimeStats
    Tp() int
}

RuntimeStats is used to express the executor runtime information.

type RuntimeStatsColl Uses

type RuntimeStatsColl struct {
    // contains filtered or unexported fields
}

RuntimeStatsColl collects executors's execution info.

func NewRuntimeStatsColl Uses

func NewRuntimeStatsColl() *RuntimeStatsColl

NewRuntimeStatsColl creates new executor collector.

func (*RuntimeStatsColl) ExistsCopStats Uses

func (e *RuntimeStatsColl) ExistsCopStats(planID int) bool

ExistsCopStats checks if the planID exists in the copStats collection.

func (*RuntimeStatsColl) ExistsRootStats Uses

func (e *RuntimeStatsColl) ExistsRootStats(planID int) bool

ExistsRootStats checks if the planID exists in the rootStats collection.

func (*RuntimeStatsColl) GetCopStats Uses

func (e *RuntimeStatsColl) GetCopStats(planID int) *CopRuntimeStats

GetCopStats gets the CopRuntimeStats specified by planID.

func (*RuntimeStatsColl) GetRootStats Uses

func (e *RuntimeStatsColl) GetRootStats(planID int) *RootRuntimeStats

GetRootStats gets execStat for a executor.

func (*RuntimeStatsColl) RecordOneCopTask Uses

func (e *RuntimeStatsColl) RecordOneCopTask(planID int, address string, summary *tipb.ExecutorExecutionSummary)

RecordOneCopTask records a specific cop tasks's execution detail.

func (*RuntimeStatsColl) RegisterStats Uses

func (e *RuntimeStatsColl) RegisterStats(planID int, info RuntimeStats)

RegisterStats register execStat for a executor.

type RuntimeStatsWithCommit Uses

type RuntimeStatsWithCommit struct {
    Commit   *CommitDetails
    LockKeys *LockKeysDetails
}

RuntimeStatsWithCommit is the RuntimeStats with commit detail.

func (*RuntimeStatsWithCommit) Clone Uses

func (e *RuntimeStatsWithCommit) Clone() RuntimeStats

Clone implements the RuntimeStats interface.

func (*RuntimeStatsWithCommit) Merge Uses

func (e *RuntimeStatsWithCommit) Merge(rs RuntimeStats)

Merge implements the RuntimeStats interface.

func (*RuntimeStatsWithCommit) String Uses

func (e *RuntimeStatsWithCommit) String() string

String implements the RuntimeStats interface.

func (*RuntimeStatsWithCommit) Tp Uses

func (e *RuntimeStatsWithCommit) Tp() int

Tp implements the RuntimeStats interface.

type RuntimeStatsWithConcurrencyInfo Uses

type RuntimeStatsWithConcurrencyInfo struct {
    // protect concurrency
    sync.Mutex
    // contains filtered or unexported fields
}

RuntimeStatsWithConcurrencyInfo is the BasicRuntimeStats with ConcurrencyInfo.

func (*RuntimeStatsWithConcurrencyInfo) Clone Uses

func (e *RuntimeStatsWithConcurrencyInfo) Clone() RuntimeStats

Clone implements the RuntimeStats interface.

func (*RuntimeStatsWithConcurrencyInfo) Merge Uses

func (e *RuntimeStatsWithConcurrencyInfo) Merge(rs RuntimeStats)

Merge implements the RuntimeStats interface.

func (*RuntimeStatsWithConcurrencyInfo) SetConcurrencyInfo Uses

func (e *RuntimeStatsWithConcurrencyInfo) SetConcurrencyInfo(infos ...*ConcurrencyInfo)

SetConcurrencyInfo sets the concurrency informations. We must clear the concurrencyInfo first when we call the SetConcurrencyInfo. When the num <= 0, it means the exector operator is not executed parallel.

func (*RuntimeStatsWithConcurrencyInfo) String Uses

func (e *RuntimeStatsWithConcurrencyInfo) String() string

String implements the RuntimeStats interface.

func (*RuntimeStatsWithConcurrencyInfo) Tp Uses

func (e *RuntimeStatsWithConcurrencyInfo) Tp() int

Tp implements the RuntimeStats interface.

type StmtExecDetails Uses

type StmtExecDetails struct {
    BackoffCount         int64
    BackoffDuration      int64
    WaitKVRespDuration   int64
    WaitPDRespDuration   int64
    WriteSQLRespDuration time.Duration
}

StmtExecDetails contains stmt level execution detail info.

Package execdetails imports 13 packages (graph) and is imported by 89 packages. Updated 2020-09-11. Refresh now. Tools for package owners.