lockstats

package
v1.1.0-beta.0...-2a72e7f Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// DeleteLockSQL is used to delete the locked table record.
	DeleteLockSQL = "DELETE FROM mysql.stats_table_locked WHERE table_id = %?"
)

Variables

This section is empty.

Functions

func AddLockedPartitions

func AddLockedPartitions(
	sctx sessionctx.Context,
	tid int64,
	tableName string,
	pidNames map[int64]string,
) (string, error)

AddLockedPartitions add locked partitions id to store. If the whole table is locked, then skip all partitions of the table. - exec: sql executor. - tid: table id of which will be locked. - tableName: table name of which will be locked. - pidNames: partition ids of which will be locked. Return the message of skipped tables and error.

func AddLockedTables

func AddLockedTables(
	sctx sessionctx.Context,
	tables map[int64]*types.StatsLockTable,
) (string, error)

AddLockedTables add locked tables id to store. - exec: sql executor. - tables: tables that will be locked. Return the message of skipped tables and error.

func GetLockedTables

func GetLockedTables(tableLocked map[int64]struct{}, tableIDs ...int64) map[int64]struct{}

GetLockedTables returns the locked status of the given tables.

func NewStatsLock

func NewStatsLock(pool pkgutil.SessionPool) types.StatsLock

NewStatsLock creates a new StatsLock.

func QueryLockedTables

func QueryLockedTables(ctx context.Context, sctx sessionctx.Context) (map[int64]struct{}, error)

QueryLockedTables loads locked tables from mysql.stats_table_locked. Return it as a map for fast query.

func RemoveLockedPartitions

func RemoveLockedPartitions(
	sctx sessionctx.Context,
	tid int64,
	tableName string,
	pidNames map[int64]string,
) (string, error)

RemoveLockedPartitions remove partitions from table locked records. - exec: sql executor. - tid: table id of which will be unlocked. - tableName: table name of which will be unlocked. - pidNames: partition ids of which will be unlocked. Return the message of skipped tables and error.

func RemoveLockedTables

func RemoveLockedTables(
	sctx sessionctx.Context,
	tables map[int64]*types.StatsLockTable,
) (string, error)

RemoveLockedTables remove tables from table locked records. - exec: sql executor. - tables: tables of which will be unlocked. Return the message of skipped tables and error.

Types

This section is empty.

Jump to

Keyboard shortcuts

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