handle

package
v1.1.0-beta.0...-5129bb3 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StatsOwnerKey is the stats owner path that is saved to etcd.
	StatsOwnerKey = "/tidb/stats/owner"
	// StatsPrompt is the prompt for stats owner manager.
	StatsPrompt = "stats"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Handle

type Handle struct {
	// Pool is used to get a session or a goroutine to execute stats updating.
	util.Pool

	// AutoAnalyzeProcIDGenerator is used to generate auto analyze proc ID.
	util.AutoAnalyzeProcIDGenerator

	// LeaseGetter is used to get stats lease.
	util.LeaseGetter

	// TableInfoGetter is used to fetch table meta info.
	util.TableInfoGetter

	// StatsGC is used to GC stats.
	types.StatsGC

	// StatsUsage is used to track the usage of column / index statistics.
	types.StatsUsage

	// StatsHistory is used to manage historical stats.
	types.StatsHistory

	// StatsAnalyze is used to handle auto-analyze and manage analyze jobs.
	types.StatsAnalyze

	// StatsSyncLoad is used to load stats syncly.
	types.StatsSyncLoad

	// StatsReadWriter is used to read/write stats from/to storage.
	types.StatsReadWriter

	// StatsLock is used to manage locked stats.
	types.StatsLock

	// StatsGlobal is used to manage global stats.
	types.StatsGlobal

	// DDL is used to handle ddl events.
	types.DDL

	InitStatsDone chan struct{}

	// StatsCache ...
	types.StatsCache
	// contains filtered or unexported fields
}

Handle can update stats info periodically.

func NewHandle

func NewHandle(
	_,
	initStatsCtx sessionctx.Context,
	lease time.Duration,
	is infoschema.InfoSchema,
	pool pkgutil.SessionPool,
	tracker sysproctrack.Tracker,
	ddlNotifier *notifier.DDLNotifier,
	autoAnalyzeProcIDGetter func() uint64,
	releaseAutoAnalyzeProcID func(uint64),
) (*Handle, error)

NewHandle creates a Handle for update stats.

func (*Handle) Clear

func (h *Handle) Clear()

Clear the statsCache, only for test.

func (*Handle) Close

func (h *Handle) Close()

Close stops the background

func (*Handle) FlushStats

func (h *Handle) FlushStats()

FlushStats flushes the cached stats update into store.

func (*Handle) GetPartitionStats

func (h *Handle) GetPartitionStats(tblInfo *model.TableInfo, pid int64) *statistics.Table

GetPartitionStats retrieves the partition stats from cache. TODO: remove GetTableStats later on.

func (*Handle) GetPartitionStatsForAutoAnalyze

func (h *Handle) GetPartitionStatsForAutoAnalyze(tblInfo *model.TableInfo, pid int64) *statistics.Table

GetPartitionStatsForAutoAnalyze is to get partition stats but it will not return pseudo stats.

func (*Handle) GetTableStats

func (h *Handle) GetTableStats(tblInfo *model.TableInfo) *statistics.Table

GetTableStats retrieves the statistics table from cache, and the cache will be updated by a goroutine. TODO: remove GetTableStats later on.

func (*Handle) GetTableStatsForAutoAnalyze

func (h *Handle) GetTableStatsForAutoAnalyze(tblInfo *model.TableInfo) *statistics.Table

GetTableStatsForAutoAnalyze is to get table stats but it will not return pseudo stats.

func (*Handle) InitStats

func (h *Handle) InitStats(ctx context.Context, is infoschema.InfoSchema) (err error)

InitStats initiates the stats cache. 1. Basic stats meta data is loaded.(count, modify count, etc.) 2. Column/index stats are loaded. (histogram, topn, buckets, FMSketch)

func (*Handle) InitStatsLite

func (h *Handle) InitStatsLite(ctx context.Context) (err error)

InitStatsLite initiates the stats cache. The function is liter and faster than InitStats. 1. Basic stats meta data is loaded.(count, modify count, etc.) 2. Column/index stats are loaded. (only histogram) 3. TopN, Bucket, FMSketch are not loaded.

func (*Handle) StartWorker

func (h *Handle) StartWorker()

StartWorker starts the background collector worker inside

type MaxTidRecord

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

MaxTidRecord is to record the max tid.

Jump to

Keyboard shortcuts

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