systable

package
v1.1.0-beta.0...-384f858 Latest Latest
Warning

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

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

Documentation

Overview

Package systable contains all constants/methods related accessing system tables related to DDL job execution

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is the error when we can't found the info we are querying related
	// to some jobID. might happen when there are multiple owners and 1 of them run and delete it.
	ErrNotFound = errors.New("not found")
)

Functions

This section is empty.

Types

type Manager

type Manager interface {
	// GetJobByID gets the job by ID, returns ErrNotFound if the job does not exist.
	GetJobByID(ctx context.Context, jobID int64) (*model.Job, error)
	// GetMDLVer gets the MDL version by job ID, returns ErrNotFound if the MDL info does not exist.
	GetMDLVer(ctx context.Context, jobID int64) (int64, error)
	// GetMinJobID gets current minimum job ID in the job table for job_id >= prevMinJobID,
	// if no jobs, returns 0. prevMinJobID is used to avoid full table scan, see
	// https://github.com/pingcap/tidb/issues/52905
	GetMinJobID(ctx context.Context, prevMinJobID int64) (int64, error)
	// HasFlashbackClusterJob checks if there is any flashback cluster job.
	// minJobID has the same meaning as in GetMinJobID.
	HasFlashbackClusterJob(ctx context.Context, minJobID int64) (bool, error)
}

Manager is the interface for DDL job/MDL storage layer, it provides the methods to access the job/MDL related tables.

func NewManager

func NewManager(pool *session.Pool) Manager

NewManager creates a new Manager.

type MinJobIDRefresher

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

MinJobIDRefresher is used to maintain the minimal job ID in tidb_ddl_job table. we use it to mitigate this issue https://github.com/pingcap/tidb/issues/52905 by querying since min job ID, TiKV can seek to the position where rows exists to avoid scanning and skipping all the deleted rows.

func NewMinJobIDRefresher

func NewMinJobIDRefresher(sysTblMgr Manager) *MinJobIDRefresher

NewMinJobIDRefresher creates a new MinJobIDRefresher.

func (*MinJobIDRefresher) GetCurrMinJobID

func (r *MinJobIDRefresher) GetCurrMinJobID() int64

GetCurrMinJobID gets the minimal job ID in tidb_ddl_job table.

func (*MinJobIDRefresher) Start

func (r *MinJobIDRefresher) Start(ctx context.Context)

Start refreshes the minimal job ID in tidb_ddl_job table.

Jump to

Keyboard shortcuts

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