Documentation ¶
Index ¶
- Constants
- Variables
- func BindDomain(ctx sessionctx.Context, domain *Domain)
- func CheckPlanReplayerTaskExists(ctx context.Context, sctx sessionctx.Context, sqlDigest, planDigest string) (bool, error)
- func DisableDumpHistoricalStats4Test()
- func DisablePlanReplayerBackgroundJob4Test()
- func DumpPlanReplayerInfo(ctx context.Context, sctx sessionctx.Context, task *PlanReplayerDumpTask) (err error)
- func GenerateExtractFile() (*os.File, string, error)
- func GetExtractTaskDirName() string
- func GetOptimizerTraceDirName() string
- type Domain
- func (do *Domain) BindHandle() *bindinfo.BindHandle
- func (do *Domain) Close()
- func (do *Domain) CreateStatsHandle(ctx, initStatsCtx sessionctx.Context) error
- func (do *Domain) DDL() ddl.DDL
- func (do *Domain) DumpFileGcCheckerLoop()
- func (do *Domain) EtcdClient() *clientv3.Client
- func (do *Domain) ExpensiveQueryHandle() *expensivequery.Handle
- func (do *Domain) ExpiredTimeStamp4PC() types.Time
- func (do *Domain) FetchAnalyzeExec(need int) []sessionctx.Context
- func (do *Domain) GetDumpFileGCChecker() *dumpFileGcChecker
- func (do *Domain) GetEtcdClient() *clientv3.Client
- func (do *Domain) GetExtractHandle() *ExtractHandle
- func (do *Domain) GetGlobalConfigSyncer() *globalconfigsync.GlobalConfigSyncer
- func (do *Domain) GetGlobalVar(name string) (string, error)
- func (do *Domain) GetHistoricalStatsWorker() *HistoricalStatsWorker
- func (do *Domain) GetPDClient() pd.Client
- func (do *Domain) GetPlanReplayerHandle() *planReplayerHandle
- func (do *Domain) GetScope(status string) variable.ScopeFlag
- func (do *Domain) GetSessionCache() (map[string]string, error)
- func (do *Domain) GetSnapshotInfoSchema(snapshotTS uint64) (infoschema.InfoSchema, error)
- func (do *Domain) GetSnapshotMeta(startTS uint64) (*meta.Meta, error)
- func (do *Domain) InfoCache() *infoschema.InfoCache
- func (do *Domain) InfoSchema() infoschema.InfoSchema
- func (do *Domain) InfoSyncer() *infosync.InfoSyncer
- func (do *Domain) Init(ddlLease time.Duration, ...) error
- func (do *Domain) InitDistTaskLoop(ctx context.Context) error
- func (do *Domain) IsLostConnectionToPD() bool
- func (do *Domain) LoadAndUpdateStatsLoop(ctxs []sessionctx.Context, initStatsCtx sessionctx.Context) error
- func (do *Domain) LoadBindInfoLoop(ctxForHandle sessionctx.Context, ctxForEvolve sessionctx.Context) error
- func (do *Domain) LoadPrivilegeLoop(sctx sessionctx.Context) error
- func (do *Domain) LoadSigningCertLoop(signingCert, signingKey string)
- func (do *Domain) LoadSysVarCacheLoop(ctx sessionctx.Context) error
- func (do *Domain) LogSlowQuery(query *SlowQueryInfo)
- func (do *Domain) MemoryUsageAlarmHandle() *memoryusagealarm.Handle
- func (do *Domain) MockInfoCacheAndLoadInfoSchema(is infoschema.InfoSchema)
- func (do *Domain) MustGetPartitionAt(t *testing.T, dbName, tableName string, idx int) int64
- func (do *Domain) MustGetTableID(t *testing.T, dbName, tableName string) int64
- func (do *Domain) MustGetTableInfo(t *testing.T, dbName, tableName string) *model.TableInfo
- func (do *Domain) NotifyGlobalConfigChange(name, value string)
- func (do *Domain) NotifyUpdatePrivilege() error
- func (do *Domain) NotifyUpdateSysVarCache(updateLocal bool)
- func (do *Domain) PrivilegeHandle() *privileges.Handle
- func (do *Domain) ReleaseAnalyzeExec(sctxs []sessionctx.Context)
- func (do *Domain) Reload() error
- func (do *Domain) ServerID() uint64
- func (do *Domain) ServerMemoryLimitHandle() *servermemorylimit.Handle
- func (do *Domain) SetDDL(d ddl.DDL)
- func (do *Domain) SetExpiredTimeStamp4PC(time types.Time)
- func (do *Domain) SetOnClose(onClose func())
- func (do *Domain) SetStatsUpdating(val bool)
- func (do *Domain) SetupAnalyzeExec(ctxs []sessionctx.Context)
- func (do *Domain) SetupDumpFileGCChecker(ctx sessionctx.Context)
- func (do *Domain) SetupExtractHandle(sctxs []sessionctx.Context)
- func (do *Domain) SetupHistoricalStatsWorker(ctx sessionctx.Context)
- func (do *Domain) SetupPlanReplayerHandle(collectorSctx sessionctx.Context, workersSctxs []sessionctx.Context)
- func (do *Domain) ShowSlowQuery(showSlow *ast.ShowSlow) []*SlowQueryInfo
- func (do *Domain) StartHistoricalStatsWorker()
- func (do *Domain) StartLoadStatsSubWorkers(ctxList []sessionctx.Context)
- func (do *Domain) StartPlanReplayerHandle()
- func (do *Domain) StartTTLJobManager()
- func (do *Domain) StatsHandle() *handle.Handle
- func (do *Domain) StatsUpdating() bool
- func (do *Domain) StopAutoAnalyze()
- func (do *Domain) Store() kv.Storage
- func (do *Domain) SysProcTracker() sessionctx.SysProcTracker
- func (do *Domain) SysSessionPool() *sessionPool
- func (do *Domain) TTLJobManager() *ttlworker.JobManager
- func (do *Domain) TelemetryReportLoop(ctx sessionctx.Context)
- func (do *Domain) TelemetryRotateSubWindowLoop(ctx sessionctx.Context)
- func (do *Domain) UpdateTableStatsLoop(ctx, initStatsCtx sessionctx.Context) error
- func (do *Domain) WatchTiFlashComputeNodeChange() error
- type ExtractHandle
- type ExtractTask
- type ExtractType
- type HistoricalStatsWorker
- type PlanReplayerDumpTask
- type PlanReplayerStatusRecord
- type SchemaChecker
- type SchemaValidator
- type SlowQueryInfo
- type SysProcesses
Constants ¶
const ( // ExtractTaskType indicates type of extract task ExtractTaskType = "taskType" // ExtractPlanTaskSkipStats indicates skip stats for extract plan task ExtractPlanTaskSkipStats = "SkipStats" )
const ( // PlanReplayerSQLMetaFile indicates sql meta path for plan replayer PlanReplayerSQLMetaFile = "sql_meta.toml" // PlanReplayerConfigFile indicates config file path for plan replayer PlanReplayerConfigFile = "config.toml" // PlanReplayerMetaFile meta file path for plan replayer PlanReplayerMetaFile = "meta.txt" // PlanReplayerVariablesFile indicates for session variables file path for plan replayer PlanReplayerVariablesFile = "variables.toml" // PlanReplayerTiFlashReplicasFile indicates for table tiflash replica file path for plan replayer PlanReplayerTiFlashReplicasFile = "table_tiflash_replica.txt" // PlanReplayerSessionBindingFile indicates session binding file path for plan replayer PlanReplayerSessionBindingFile = "session_bindings.sql" // PlanReplayerGlobalBindingFile indicates global binding file path for plan replayer PlanReplayerGlobalBindingFile = "global_bindings.sql" // PlanReplayerSchemaMetaFile indicates the schema meta PlanReplayerSchemaMetaFile = "schema_meta.txt" )
const ( // PlanReplayerSQLMetaStartTS indicates the startTS in plan replayer sql meta PlanReplayerSQLMetaStartTS = "startTS" // PlanReplayerTaskMetaIsCapture indicates whether this task is capture task PlanReplayerTaskMetaIsCapture = "isCapture" // PlanReplayerTaskMetaIsContinues indicates whether this task is continues task PlanReplayerTaskMetaIsContinues = "isContinues" // PlanReplayerTaskMetaSQLDigest indicates the sql digest of this task PlanReplayerTaskMetaSQLDigest = "sqlDigest" // PlanReplayerTaskMetaPlanDigest indicates the plan digest of this task PlanReplayerTaskMetaPlanDigest = "planDigest" // PlanReplayerTaskEnableHistoricalStats indicates whether the task is using historical stats PlanReplayerTaskEnableHistoricalStats = "enableHistoricalStats" )
const ( // ResultSucc means schemaValidator's check is passing. ResultSucc checkResult = iota // ResultFail means schemaValidator's check is fail. ResultFail // ResultUnknown means schemaValidator doesn't know the check would be success or fail. ResultUnknown )
const (
// ExtractMetaFile indicates meta file for extract
ExtractMetaFile = "extract_meta.txt"
)
Variables ¶
var ( // ErrInfoSchemaExpired returns the error that information schema is out of date. ErrInfoSchemaExpired = dbterror.ClassDomain.NewStd(errno.ErrInfoSchemaExpired) // ErrInfoSchemaChanged returns the error that information schema is changed. ErrInfoSchemaChanged = dbterror.ClassDomain.NewStdErr(errno.ErrInfoSchemaChanged, mysql.Message(errno.MySQLErrName[errno.ErrInfoSchemaChanged].Raw+". "+kv.TxnRetryableMark, nil)) )
var ( // SchemaOutOfDateRetryInterval is the backoff time before retrying. SchemaOutOfDateRetryInterval = atomicutil.NewDuration(500 * time.Millisecond) // SchemaOutOfDateRetryTimes is the max retry count when the schema is out of date. SchemaOutOfDateRetryTimes = atomicutil.NewInt32(10) )
var ( // LoadSchemaDiffVersionGapThreshold is the threshold for version gap to reload domain by loading schema diffs LoadSchemaDiffVersionGapThreshold int64 = 100 )
Functions ¶
func BindDomain ¶
func BindDomain(ctx sessionctx.Context, domain *Domain)
BindDomain binds domain to context.
func CheckPlanReplayerTaskExists ¶
func CheckPlanReplayerTaskExists(ctx context.Context, sctx sessionctx.Context, sqlDigest, planDigest string) (bool, error)
CheckPlanReplayerTaskExists checks whether plan replayer capture task exists already
func DisableDumpHistoricalStats4Test ¶
func DisableDumpHistoricalStats4Test()
DisableDumpHistoricalStats4Test disable historical dump worker for test
func DisablePlanReplayerBackgroundJob4Test ¶
func DisablePlanReplayerBackgroundJob4Test()
DisablePlanReplayerBackgroundJob4Test disable plan replayer handle for test
func DumpPlanReplayerInfo ¶
func DumpPlanReplayerInfo(ctx context.Context, sctx sessionctx.Context, task *PlanReplayerDumpTask) (err error)
DumpPlanReplayerInfo will dump the information about sqls. The files will be organized into the following format:
|-sql_meta.toml |-meta.txt |-schema | |-schema_meta.txt | |-db1.table1.schema.txt | |-db2.table2.schema.txt | |-.... |-view | |-db1.view1.view.txt | |-db2.view2.view.txt | |-.... |-stats | |-stats1.json | |-stats2.json | |-.... |-statsMem | |-stats1.txt | |-stats2.txt | |-.... |-config.toml |-table_tiflash_replica.txt |-variables.toml |-bindings.sql |-sql | |-sql1.sql | |-sql2.sql | |-.... |-explain.txt
func GenerateExtractFile ¶
GenerateExtractFile generates extract stmt file
func GetExtractTaskDirName ¶
func GetExtractTaskDirName() string
GetExtractTaskDirName get extract dir name
func GetOptimizerTraceDirName ¶
func GetOptimizerTraceDirName() string
GetOptimizerTraceDirName returns optimizer trace directory path. The path is related to the process id.
Types ¶
type Domain ¶
type Domain struct { SchemaValidator SchemaValidator // contains filtered or unexported fields }
Domain represents a storage space. Different domains can use the same database name. Multiple domains can be used in parallel without synchronization.
func NewDomain ¶
func NewDomain(store kv.Storage, ddlLease time.Duration, statsLease time.Duration, idxUsageSyncLease time.Duration, dumpFileGcLease time.Duration, factory pools.Factory) *Domain
NewDomain creates a new domain. Should not create multiple domains for the same store.
func (*Domain) BindHandle ¶
func (do *Domain) BindHandle() *bindinfo.BindHandle
BindHandle returns domain's bindHandle.
func (*Domain) CreateStatsHandle ¶
func (do *Domain) CreateStatsHandle(ctx, initStatsCtx sessionctx.Context) error
CreateStatsHandle is used only for test.
func (*Domain) DumpFileGcCheckerLoop ¶
func (do *Domain) DumpFileGcCheckerLoop()
DumpFileGcCheckerLoop creates a goroutine that handles `exit` and `gc`.
func (*Domain) EtcdClient ¶
EtcdClient export for test.
func (*Domain) ExpensiveQueryHandle ¶
func (do *Domain) ExpensiveQueryHandle() *expensivequery.Handle
ExpensiveQueryHandle returns the expensive query handle.
func (*Domain) ExpiredTimeStamp4PC ¶
ExpiredTimeStamp4PC gets expiredTimeStamp4PC from domain.
func (*Domain) FetchAnalyzeExec ¶
func (do *Domain) FetchAnalyzeExec(need int) []sessionctx.Context
FetchAnalyzeExec get needed exec for analyze
func (*Domain) GetDumpFileGCChecker ¶
func (do *Domain) GetDumpFileGCChecker() *dumpFileGcChecker
GetDumpFileGCChecker returns dump file GC checker for plan replayer and plan trace
func (*Domain) GetEtcdClient ¶
GetEtcdClient returns the etcd client.
func (*Domain) GetExtractHandle ¶
func (do *Domain) GetExtractHandle() *ExtractHandle
GetExtractHandle returns extract handle
func (*Domain) GetGlobalConfigSyncer ¶
func (do *Domain) GetGlobalConfigSyncer() *globalconfigsync.GlobalConfigSyncer
GetGlobalConfigSyncer exports for testing.
func (*Domain) GetGlobalVar ¶
GetGlobalVar gets an individual global var from the sysvar cache.
func (*Domain) GetHistoricalStatsWorker ¶
func (do *Domain) GetHistoricalStatsWorker() *HistoricalStatsWorker
GetHistoricalStatsWorker gets historical workers
func (*Domain) GetPDClient ¶
GetPDClient returns the PD client.
func (*Domain) GetPlanReplayerHandle ¶
func (do *Domain) GetPlanReplayerHandle() *planReplayerHandle
GetPlanReplayerHandle returns plan replayer handle
func (*Domain) GetSessionCache ¶
GetSessionCache gets a copy of the session sysvar cache. The intention is to copy it directly to the systems[] map on creating a new session.
func (*Domain) GetSnapshotInfoSchema ¶
func (do *Domain) GetSnapshotInfoSchema(snapshotTS uint64) (infoschema.InfoSchema, error)
GetSnapshotInfoSchema gets a snapshot information schema.
func (*Domain) GetSnapshotMeta ¶
GetSnapshotMeta gets a new snapshot meta at startTS.
func (*Domain) InfoCache ¶
func (do *Domain) InfoCache() *infoschema.InfoCache
InfoCache export for test.
func (*Domain) InfoSchema ¶
func (do *Domain) InfoSchema() infoschema.InfoSchema
InfoSchema gets the latest information schema from domain.
func (*Domain) InfoSyncer ¶
func (do *Domain) InfoSyncer() *infosync.InfoSyncer
InfoSyncer gets infoSyncer from domain.
func (*Domain) Init ¶
func (do *Domain) Init( ddlLease time.Duration, sysExecutorFactory func(*Domain) (pools.Resource, error), ddlInjector func(ddl.DDL) *schematracker.Checker, ) error
Init initializes a domain.
func (*Domain) InitDistTaskLoop ¶
InitDistTaskLoop initializes the distributed task framework.
func (*Domain) IsLostConnectionToPD ¶
IsLostConnectionToPD indicates lost connection to PD or not.
func (*Domain) LoadAndUpdateStatsLoop ¶
func (do *Domain) LoadAndUpdateStatsLoop(ctxs []sessionctx.Context, initStatsCtx sessionctx.Context) error
LoadAndUpdateStatsLoop loads and updates stats info.
func (*Domain) LoadBindInfoLoop ¶
func (do *Domain) LoadBindInfoLoop(ctxForHandle sessionctx.Context, ctxForEvolve sessionctx.Context) error
LoadBindInfoLoop create a goroutine loads BindInfo in a loop, it should be called only once in BootstrapSession.
func (*Domain) LoadPrivilegeLoop ¶
func (do *Domain) LoadPrivilegeLoop(sctx sessionctx.Context) error
LoadPrivilegeLoop create a goroutine loads privilege tables in a loop, it should be called only once in BootstrapSession.
func (*Domain) LoadSigningCertLoop ¶
LoadSigningCertLoop loads the signing cert periodically to make sure it's fresh new.
func (*Domain) LoadSysVarCacheLoop ¶
func (do *Domain) LoadSysVarCacheLoop(ctx sessionctx.Context) error
LoadSysVarCacheLoop create a goroutine loads sysvar cache in a loop, it should be called only once in BootstrapSession.
func (*Domain) LogSlowQuery ¶
func (do *Domain) LogSlowQuery(query *SlowQueryInfo)
LogSlowQuery keeps topN recent slow queries in domain.
func (*Domain) MemoryUsageAlarmHandle ¶
func (do *Domain) MemoryUsageAlarmHandle() *memoryusagealarm.Handle
MemoryUsageAlarmHandle returns the memory usage alarm handle.
func (*Domain) MockInfoCacheAndLoadInfoSchema ¶
func (do *Domain) MockInfoCacheAndLoadInfoSchema(is infoschema.InfoSchema)
MockInfoCacheAndLoadInfoSchema only used in unit tests.
func (*Domain) MustGetPartitionAt ¶
MustGetPartitionAt returns the partition ID. Only used in unit tests.
func (*Domain) MustGetTableID ¶
MustGetTableID returns the table ID. Only used in unit tests.
func (*Domain) MustGetTableInfo ¶
MustGetTableInfo returns the table info. Only used in unit tests.
func (*Domain) NotifyGlobalConfigChange ¶
NotifyGlobalConfigChange notify global config syncer to store the global config into PD.
func (*Domain) NotifyUpdatePrivilege ¶
NotifyUpdatePrivilege updates privilege key in etcd, TiDB client that watches the key will get notification.
func (*Domain) NotifyUpdateSysVarCache ¶
NotifyUpdateSysVarCache updates the sysvar cache key in etcd, which other TiDB clients are subscribed to for updates. For the caller, the cache is also built synchronously so that the effect is immediate.
func (*Domain) PrivilegeHandle ¶
func (do *Domain) PrivilegeHandle() *privileges.Handle
PrivilegeHandle returns the MySQLPrivilege.
func (*Domain) ReleaseAnalyzeExec ¶
func (do *Domain) ReleaseAnalyzeExec(sctxs []sessionctx.Context)
ReleaseAnalyzeExec returned extra exec for Analyze
func (*Domain) ServerMemoryLimitHandle ¶
func (do *Domain) ServerMemoryLimitHandle() *servermemorylimit.Handle
ServerMemoryLimitHandle returns the expensive query handle.
func (*Domain) SetExpiredTimeStamp4PC ¶
SetExpiredTimeStamp4PC sets the expiredTimeStamp4PC from domain.
func (*Domain) SetOnClose ¶
func (do *Domain) SetOnClose(onClose func())
SetOnClose used to set do.onClose func.
func (*Domain) SetStatsUpdating ¶
SetStatsUpdating sets the value of stats updating.
func (*Domain) SetupAnalyzeExec ¶
func (do *Domain) SetupAnalyzeExec(ctxs []sessionctx.Context)
SetupAnalyzeExec setups exec for Analyze Executor
func (*Domain) SetupDumpFileGCChecker ¶
func (do *Domain) SetupDumpFileGCChecker(ctx sessionctx.Context)
SetupDumpFileGCChecker setup sctx
func (*Domain) SetupExtractHandle ¶
func (do *Domain) SetupExtractHandle(sctxs []sessionctx.Context)
SetupExtractHandle setups extract handler
func (*Domain) SetupHistoricalStatsWorker ¶
func (do *Domain) SetupHistoricalStatsWorker(ctx sessionctx.Context)
SetupHistoricalStatsWorker setups worker
func (*Domain) SetupPlanReplayerHandle ¶
func (do *Domain) SetupPlanReplayerHandle(collectorSctx sessionctx.Context, workersSctxs []sessionctx.Context)
SetupPlanReplayerHandle setup plan replayer handle
func (*Domain) ShowSlowQuery ¶
func (do *Domain) ShowSlowQuery(showSlow *ast.ShowSlow) []*SlowQueryInfo
ShowSlowQuery returns the slow queries.
func (*Domain) StartHistoricalStatsWorker ¶
func (do *Domain) StartHistoricalStatsWorker()
StartHistoricalStatsWorker start historical workers running
func (*Domain) StartLoadStatsSubWorkers ¶
func (do *Domain) StartLoadStatsSubWorkers(ctxList []sessionctx.Context)
StartLoadStatsSubWorkers starts sub workers with new sessions to load stats concurrently.
func (*Domain) StartPlanReplayerHandle ¶
func (do *Domain) StartPlanReplayerHandle()
StartPlanReplayerHandle start plan replayer handle job
func (*Domain) StartTTLJobManager ¶
func (do *Domain) StartTTLJobManager()
StartTTLJobManager creates and starts the ttl job manager
func (*Domain) StatsHandle ¶
StatsHandle returns the statistic handle.
func (*Domain) StatsUpdating ¶
StatsUpdating checks if the stats worker is updating.
func (*Domain) StopAutoAnalyze ¶
func (do *Domain) StopAutoAnalyze()
StopAutoAnalyze stops (*Domain).autoAnalyzeWorker to launch new auto analyze jobs.
func (*Domain) SysProcTracker ¶
func (do *Domain) SysProcTracker() sessionctx.SysProcTracker
SysProcTracker returns the system processes tracker.
func (*Domain) SysSessionPool ¶
func (do *Domain) SysSessionPool() *sessionPool
SysSessionPool returns the system session pool.
func (*Domain) TTLJobManager ¶
func (do *Domain) TTLJobManager() *ttlworker.JobManager
TTLJobManager returns the ttl job manager on this domain
func (*Domain) TelemetryReportLoop ¶
func (do *Domain) TelemetryReportLoop(ctx sessionctx.Context)
TelemetryReportLoop create a goroutine that reports usage data in a loop, it should be called only once in BootstrapSession.
func (*Domain) TelemetryRotateSubWindowLoop ¶
func (do *Domain) TelemetryRotateSubWindowLoop(ctx sessionctx.Context)
TelemetryRotateSubWindowLoop create a goroutine that rotates the telemetry window regularly.
func (*Domain) UpdateTableStatsLoop ¶
func (do *Domain) UpdateTableStatsLoop(ctx, initStatsCtx sessionctx.Context) error
UpdateTableStatsLoop creates a goroutine loads stats info and updates stats info in a loop. It will also start a goroutine to analyze tables automatically. It should be called only once in BootstrapSession.
func (*Domain) WatchTiFlashComputeNodeChange ¶
WatchTiFlashComputeNodeChange create a routine to watch if the topology of tiflash_compute node is changed. TODO: tiflashComputeNodeKey is not put to etcd yet(finish this when AutoScaler is done)
store cache will only be invalidated every n seconds.
type ExtractHandle ¶
type ExtractHandle struct {
// contains filtered or unexported fields
}
ExtractHandle handles the extractWorker to run extract the information task like Plan or any others. extractHandle will provide 2 mode for extractWorker: 1. submit a background extract task, the response will be returned after the task is started to be solved 2. submit a task and wait until the task is solved, the result will be returned to the response.
func NewExtractHandler ¶
func NewExtractHandler(sctxs []sessionctx.Context) *ExtractHandle
NewExtractHandler new extract handler
func (*ExtractHandle) ExtractTask ¶
func (h *ExtractHandle) ExtractTask(ctx context.Context, task *ExtractTask) (string, error)
ExtractTask extract tasks
type ExtractTask ¶
type ExtractTask struct { ExtractType ExtractType IsBackgroundJob bool // Param for Extract Plan SkipStats bool UseHistoryView bool // variables for plan task type Begin time.Time End time.Time }
ExtractTask indicates task
func NewExtractPlanTask ¶
func NewExtractPlanTask(begin, end time.Time) *ExtractTask
NewExtractPlanTask returns extract plan task
type ExtractType ¶
type ExtractType uint8
ExtractType indicates type
const ( // ExtractPlanType indicates extract plan task ExtractPlanType ExtractType = iota )
type HistoricalStatsWorker ¶
type HistoricalStatsWorker struct {
// contains filtered or unexported fields
}
HistoricalStatsWorker indicates for dump historical stats
func (*HistoricalStatsWorker) DumpHistoricalStats ¶
func (w *HistoricalStatsWorker) DumpHistoricalStats(tableID int64, statsHandle *handle.Handle) error
DumpHistoricalStats dump stats by given tableID
func (*HistoricalStatsWorker) GetOneHistoricalStatsTable ¶
func (w *HistoricalStatsWorker) GetOneHistoricalStatsTable() int64
GetOneHistoricalStatsTable gets one tableID from channel, only used for test
func (*HistoricalStatsWorker) SendTblToDumpHistoricalStats ¶
func (w *HistoricalStatsWorker) SendTblToDumpHistoricalStats(tableID int64)
SendTblToDumpHistoricalStats send tableID to worker to dump historical stats
type PlanReplayerDumpTask ¶
type PlanReplayerDumpTask struct { replayer.PlanReplayerTaskKey // tmp variables stored during the query TblStats map[int64]interface{} // variables used to dump the plan StartTS uint64 SessionBindings []*bindinfo.BindRecord EncodedPlan string SessionVars *variable.SessionVars ExecStmts []ast.StmtNode Analyze bool DebugTrace interface{} FileName string Zf *os.File // IsCapture indicates whether the task is from capture IsCapture bool // IsContinuesCapture indicates whether the task is from continues capture IsContinuesCapture bool }
PlanReplayerDumpTask wrap the params for plan replayer dump
type PlanReplayerStatusRecord ¶
type PlanReplayerStatusRecord struct { SQLDigest string PlanDigest string OriginSQL string Token string FailedReason string }
PlanReplayerStatusRecord indicates record in mysql.plan_replayer_status
type SchemaChecker ¶
type SchemaChecker struct { SchemaValidator // contains filtered or unexported fields }
SchemaChecker is used for checking schema-validity.
func NewSchemaChecker ¶
func NewSchemaChecker(do *Domain, schemaVer int64, relatedTableIDs []int64, needCheckSchema bool) *SchemaChecker
NewSchemaChecker creates a new schema checker.
func (*SchemaChecker) Check ¶
func (s *SchemaChecker) Check(txnTS uint64) (*transaction.RelatedSchemaChange, error)
Check checks the validity of the schema version.
func (*SchemaChecker) CheckBySchemaVer ¶
func (s *SchemaChecker) CheckBySchemaVer(txnTS uint64, startSchemaVer tikv.SchemaVer) (*transaction.RelatedSchemaChange, error)
CheckBySchemaVer checks if the schema version valid or not at txnTS.
type SchemaValidator ¶
type SchemaValidator interface { // Update the schema validator, add a new item, delete the expired deltaSchemaInfos. // The latest schemaVer is valid within leaseGrantTime plus lease duration. // Add the changed table IDs to the new schema information, // which is produced when the oldSchemaVer is updated to the newSchemaVer. Update(leaseGrantTime uint64, oldSchemaVer, newSchemaVer int64, change *transaction.RelatedSchemaChange) // Check is it valid for a transaction to use schemaVer and related tables, at timestamp txnTS. Check(txnTS uint64, schemaVer int64, relatedPhysicalTableIDs []int64, needCheckSchema bool) (*transaction.RelatedSchemaChange, checkResult) // Stop stops checking the valid of transaction. Stop() // Restart restarts the schema validator after it is stopped. Restart() // Reset resets SchemaValidator to initial state. Reset() // IsStarted indicates whether SchemaValidator is started. IsStarted() bool }
SchemaValidator is the interface for checking the validity of schema version.
func NewSchemaValidator ¶
func NewSchemaValidator(lease time.Duration, do *Domain) SchemaValidator
NewSchemaValidator returns a SchemaValidator structure.
type SlowQueryInfo ¶
type SlowQueryInfo struct { SQL string Start time.Time Duration time.Duration Detail execdetails.ExecDetails ConnID uint64 TxnTS uint64 User string DB string TableIDs string IndexNames string Digest string Internal bool Succ bool }
SlowQueryInfo is a struct to record slow query info.
type SysProcesses ¶
type SysProcesses struct {
// contains filtered or unexported fields
}
SysProcesses holds the sys processes infos
func (*SysProcesses) GetSysProcessList ¶
func (s *SysProcesses) GetSysProcessList() map[uint64]*util.ProcessInfo
GetSysProcessList gets list of system ProcessInfo
func (*SysProcesses) KillSysProcess ¶
func (s *SysProcesses) KillSysProcess(id uint64)
KillSysProcess kills sys process with specified ID
func (*SysProcesses) Track ¶
func (s *SysProcesses) Track(id uint64, proc sessionctx.Context) error
Track tracks the sys process into procMap
func (*SysProcesses) UnTrack ¶
func (s *SysProcesses) UnTrack(id uint64)
UnTrack removes the sys process from procMap