execdetails

package
v0.0.0-...-503c688 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
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"
	// GetLatestTsTimeStr means the time of getting latest ts in async commit and 1pc.
	GetLatestTsTimeStr = "Get_latest_ts_time"
	// CommitBackoffTimeStr means the time of commit backoff.
	CommitBackoffTimeStr = "Commit_backoff_time"
	// BackoffTypesStr means the backoff type.
	BackoffTypesStr = "Backoff_types"
	// SlowestPrewriteRPCDetailStr means the details of the slowest RPC during the transaction 2pc prewrite process.
	SlowestPrewriteRPCDetailStr = "Slowest_prewrite_rpc_detail"
	// CommitPrimaryRPCDetailStr means the details of the slowest RPC during the transaction 2pc commit process.
	CommitPrimaryRPCDetailStr = "Commit_primary_rpc_detail"
	// 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"
	// GetSnapshotTimeStr means the time spent on getting an engine snapshot.
	GetSnapshotTimeStr = "Get_snapshot_time"
	// RocksdbDeleteSkippedCountStr means the count of rocksdb delete skipped count.
	RocksdbDeleteSkippedCountStr = "Rocksdb_delete_skipped_count"
	// RocksdbKeySkippedCountStr means the count of rocksdb key skipped count.
	RocksdbKeySkippedCountStr = "Rocksdb_key_skipped_count"
	// RocksdbBlockCacheHitCountStr means the count of rocksdb block cache hit.
	RocksdbBlockCacheHitCountStr = "Rocksdb_block_cache_hit_count"
	// RocksdbBlockReadCountStr means the count of rocksdb block read.
	RocksdbBlockReadCountStr = "Rocksdb_block_read_count"
	// RocksdbBlockReadByteStr means the bytes of rocksdb block read.
	RocksdbBlockReadByteStr = "Rocksdb_block_read_byte"
	// RocksdbBlockReadTimeStr means the time spent on rocksdb block read.
	RocksdbBlockReadTimeStr = "Rocksdb_block_read_time"
)
View Source
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
	// TpInsertRuntimeStat is the tp for InsertRuntimeStat
	TpInsertRuntimeStat
	// TpIndexLookUpRunTimeStats is the tp for IndexLookUpRunTimeStats
	TpIndexLookUpRunTimeStats
	// TpSlowQueryRuntimeStat is the tp for SlowQueryRuntimeStat
	TpSlowQueryRuntimeStat
	// TpHashAggRuntimeStat is the tp for HashAggRuntimeStat
	TpHashAggRuntimeStat
	// TpIndexMergeRunTimeStats is the tp for IndexMergeRunTimeStats
	TpIndexMergeRunTimeStats
	// TpBasicCopRunTimeStats is the tp for BasicCopRunTimeStats
	TpBasicCopRunTimeStats
	// TpUpdateRuntimeStats is the tp for UpdateRuntimeStats
	TpUpdateRuntimeStats
	// TpFKCheckRuntimeStats is the tp for FKCheckRuntimeStats
	TpFKCheckRuntimeStats
	// TpFKCascadeRuntimeStats is the tp for FKCascadeRuntimeStats
	TpFKCascadeRuntimeStats
	// TpRURuntimeStats is the tp for RURuntimeStats
	TpRURuntimeStats
)

Variables

View Source
var StmtExecDetailKey = stmtExecDetailKeyType{}

StmtExecDetailKey used to carry StmtExecDetail info in context.Context.

Functions

func FormatDuration

func FormatDuration(d time.Duration) string

FormatDuration uses to format duration, this function will prune precision before format duration. Pruning precision is for human readability. The prune rule is:

  1. if the duration was less than 1us, return the original string.
  2. readable value >=10, keep 1 decimal, otherwise, keep 2 decimal. such as: 9.412345ms -> 9.41ms 10.412345ms -> 10.4ms 5.999s -> 6s 100.45µs -> 100.5µs

Types

type BasicRuntimeStats

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

BasicRuntimeStats is the basic runtime stats.

func (*BasicRuntimeStats) Clone

func (e *BasicRuntimeStats) Clone() RuntimeStats

Clone implements the RuntimeStats interface.

func (*BasicRuntimeStats) GetActRows

func (e *BasicRuntimeStats) GetActRows() int64

GetActRows return total rows of BasicRuntimeStats.

func (*BasicRuntimeStats) GetTime

func (e *BasicRuntimeStats) GetTime() int64

GetTime get the int64 total time

func (*BasicRuntimeStats) Merge

func (e *BasicRuntimeStats) Merge(rs RuntimeStats)

Merge implements the RuntimeStats interface.

func (*BasicRuntimeStats) Record

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

Record records executor's execution.

func (*BasicRuntimeStats) SetRowNum

func (e *BasicRuntimeStats) SetRowNum(rowNum int64)

SetRowNum sets the row num.

func (*BasicRuntimeStats) String

func (e *BasicRuntimeStats) String() string

String implements the RuntimeStats interface.

func (*BasicRuntimeStats) Tp

func (*BasicRuntimeStats) Tp() int

Tp implements the RuntimeStats interface.

type ConcurrencyInfo

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

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

func NewConcurrencyInfo

func NewConcurrencyInfo(name string, num int) *ConcurrencyInfo

NewConcurrencyInfo creates new executor's concurrencyInfo.

type CopRuntimeStats

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

CopRuntimeStats collects cop tasks' execution info.

func (*CopRuntimeStats) GetActRows

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

GetActRows return total rows of CopRuntimeStats.

func (*CopRuntimeStats) MergeBasicStats

func (crs *CopRuntimeStats) MergeBasicStats() (procTimes []time.Duration, totalTime time.Duration, totalTasks, totalLoops, totalThreads int32, totalTiFlashScanContext TiFlashScanContext)

MergeBasicStats traverses basicCopRuntimeStats in the CopRuntimeStats and collects some useful information.

func (*CopRuntimeStats) RecordOneCopTask

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

RecordOneCopTask records a specific cop tasks's execution detail.

func (*CopRuntimeStats) String

func (crs *CopRuntimeStats) String() string

type DetailsNeedP90

type DetailsNeedP90 struct {
	BackoffSleep  map[string]time.Duration
	BackoffTimes  map[string]int
	CalleeAddress string
	TimeDetail    util.TimeDetail
}

DetailsNeedP90 contains execution detail information which need calculate P90.

type ExecDetails

type ExecDetails struct {
	DetailsNeedP90
	CommitDetail     *util.CommitDetails
	LockKeysDetail   *util.LockKeysDetails
	ScanDetail       *util.ScanDetail
	CopTime          time.Duration
	BackoffTime      time.Duration
	LockKeysDuration time.Duration
	RequestCount     int
}

ExecDetails contains execution detail information.

func (ExecDetails) String

func (d ExecDetails) String() string

String implements the fmt.Stringer interface.

func (ExecDetails) ToZapFields

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

ToZapFields wraps the ExecDetails as zap.Fields.

type RootRuntimeStats

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

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

func NewRootRuntimeStats

func NewRootRuntimeStats() *RootRuntimeStats

NewRootRuntimeStats returns a new RootRuntimeStats

func (*RootRuntimeStats) GetActRows

func (e *RootRuntimeStats) GetActRows() int64

GetActRows return total rows of RootRuntimeStats.

func (*RootRuntimeStats) MergeStats

func (e *RootRuntimeStats) MergeStats() (basic *BasicRuntimeStats, groups []RuntimeStats)

MergeStats merges stats in the RootRuntimeStats and return the stats suitable for display directly.

func (*RootRuntimeStats) String

func (e *RootRuntimeStats) String() string

String implements the RuntimeStats interface.

type RuntimeStats

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

RuntimeStats is used to express the executor runtime information.

type RuntimeStatsColl

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

RuntimeStatsColl collects executors's execution info.

func NewRuntimeStatsColl

func NewRuntimeStatsColl(reuse *RuntimeStatsColl) *RuntimeStatsColl

NewRuntimeStatsColl creates new executor collector. Reuse the object to reduce allocation when *RuntimeStatsColl is not nil.

func (*RuntimeStatsColl) ExistsCopStats

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

ExistsCopStats checks if the planID exists in the copStats collection.

func (*RuntimeStatsColl) ExistsRootStats

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

ExistsRootStats checks if the planID exists in the rootStats collection.

func (*RuntimeStatsColl) GetBasicRuntimeStats

func (e *RuntimeStatsColl) GetBasicRuntimeStats(planID int) *BasicRuntimeStats

GetBasicRuntimeStats gets basicRuntimeStats for a executor.

func (*RuntimeStatsColl) GetCopStats

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

GetCopStats gets the CopRuntimeStats specified by planID.

func (*RuntimeStatsColl) GetOrCreateCopStats

func (e *RuntimeStatsColl) GetOrCreateCopStats(planID int, storeType string) *CopRuntimeStats

GetOrCreateCopStats gets the CopRuntimeStats specified by planID, if not exists a new one will be created.

func (*RuntimeStatsColl) GetRootStats

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

GetRootStats gets execStat for a executor.

func (*RuntimeStatsColl) RecordOneCopTask

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

RecordOneCopTask records a specific cop tasks's execution detail.

func (*RuntimeStatsColl) RecordScanDetail

func (e *RuntimeStatsColl) RecordScanDetail(planID int, storeType string, detail *util.ScanDetail)

RecordScanDetail records a specific cop tasks's cop detail.

func (*RuntimeStatsColl) RegisterStats

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

RegisterStats register execStat for a executor.

type RuntimeStatsWithCommit

type RuntimeStatsWithCommit struct {
	Commit   *util.CommitDetails
	LockKeys *util.LockKeysDetails
	TxnCnt   int
}

RuntimeStatsWithCommit is the RuntimeStats with commit detail.

func (*RuntimeStatsWithCommit) Clone

Clone implements the RuntimeStats interface.

func (*RuntimeStatsWithCommit) Merge

func (e *RuntimeStatsWithCommit) Merge(rs RuntimeStats)

Merge implements the RuntimeStats interface.

func (*RuntimeStatsWithCommit) MergeCommitDetails

func (e *RuntimeStatsWithCommit) MergeCommitDetails(detail *util.CommitDetails)

MergeCommitDetails merges the commit details.

func (*RuntimeStatsWithCommit) String

func (e *RuntimeStatsWithCommit) String() string

String implements the RuntimeStats interface.

func (*RuntimeStatsWithCommit) Tp

Tp implements the RuntimeStats interface.

type RuntimeStatsWithConcurrencyInfo

type RuntimeStatsWithConcurrencyInfo struct {

	// protect concurrency
	sync.Mutex
	// contains filtered or unexported fields
}

RuntimeStatsWithConcurrencyInfo is the BasicRuntimeStats with ConcurrencyInfo.

func (*RuntimeStatsWithConcurrencyInfo) Clone

Clone implements the RuntimeStats interface.

func (*RuntimeStatsWithConcurrencyInfo) Merge

Merge implements the RuntimeStats interface.

func (*RuntimeStatsWithConcurrencyInfo) SetConcurrencyInfo

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

String implements the RuntimeStats interface.

func (*RuntimeStatsWithConcurrencyInfo) Tp

Tp implements the RuntimeStats interface.

type StmtExecDetails

type StmtExecDetails struct {
	WriteSQLRespDuration time.Duration
}

StmtExecDetails contains stmt level execution detail info.

type TiFlashScanContext

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

TiFlashScanContext is used to express the table scan information in tiflash

func (*TiFlashScanContext) Clone

func (context *TiFlashScanContext) Clone() TiFlashScanContext

Clone implements the deep copy of * TiFlashshScanContext

func (*TiFlashScanContext) Empty

func (context *TiFlashScanContext) Empty() bool

Empty check whether TiFlashScanContext is Empty, if scan no pack and skip no pack, we regard it as empty

func (*TiFlashScanContext) Merge

func (context *TiFlashScanContext) Merge(other TiFlashScanContext)

Merge make sum to merge the information in TiFlashScanContext

func (*TiFlashScanContext) String

func (context *TiFlashScanContext) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL