admin

package
v0.0.0-...-37ba7e9 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TblCntGreater means that the number of table rows is more than the number of index rows.
	TblCntGreater byte = 1
	// IdxCntGreater means that the number of index rows is more than the number of table rows.
	IdxCntGreater byte = 2
)

Count greater Types

View Source
const DefNumHistoryJobs = 10

DefNumHistoryJobs is default value of the default number of history job

View Source
const MaxHistoryJobs = 10

MaxHistoryJobs is exported for testing.

Variables

View Source
var (
	// ErrDataInConsistent indicate that meets inconsistent data.
	ErrDataInConsistent = dbterror.ClassAdmin.NewStd(errno.ErrDataInConsistent)
	// ErrDDLJobNotFound indicates the job id was not found.
	ErrDDLJobNotFound = dbterror.ClassAdmin.NewStd(errno.ErrDDLJobNotFound)
	// ErrCancelFinishedDDLJob returns when cancel a finished ddl job.
	ErrCancelFinishedDDLJob = dbterror.ClassAdmin.NewStd(errno.ErrCancelFinishedDDLJob)
	// ErrCannotCancelDDLJob returns when cancel a almost finished ddl job, because cancel in now may cause data inconsistency.
	ErrCannotCancelDDLJob = dbterror.ClassAdmin.NewStd(errno.ErrCannotCancelDDLJob)
	// ErrAdminCheckTable returns when the table records is inconsistent with the index values.
	ErrAdminCheckTable = dbterror.ClassAdmin.NewStd(errno.ErrAdminCheckTable)
)

Functions

func CancelJobs

func CancelJobs(txn kv.Transaction, ids []int64) ([]error, error)

CancelJobs cancels the DDL jobs.

func CheckIndicesCount

func CheckIndicesCount(ctx sessionctx.Context, dbName, tableName string, indices []string) (byte, int, error)

CheckIndicesCount compares indices count with table count. It returns the count greater type, the index offset and an error. It returns nil if the count from the index is equal to the count from the table columns, otherwise it returns an error and the corresponding index's offset.

func CheckRecordAndIndex

func CheckRecordAndIndex(sessCtx sessionctx.Context, txn kv.Transaction, t table.Table, idx table.Index) error

CheckRecordAndIndex is exported for testing.

func GetDDLJobs

func GetDDLJobs(txn kv.Transaction) ([]*model.Job, error)

GetDDLJobs get all DDL jobs and sorts jobs by job.ID.

func GetHistoryDDLJobs

func GetHistoryDDLJobs(txn kv.Transaction, maxNumJobs int) ([]*model.Job, error)

GetHistoryDDLJobs returns the DDL history jobs and an error. The maximum count of history jobs is num.

func IsJobRollbackable

func IsJobRollbackable(job *model.Job) bool

IsJobRollbackable checks whether the job can be rollback.

func IterAllDDLJobs

func IterAllDDLJobs(txn kv.Transaction, finishFn func([]*model.Job) (bool, error)) error

IterAllDDLJobs will iterates running DDL jobs first, return directly if `finishFn` return true or error, then iterates history DDL jobs until the `finishFn` return true or error.

func IterHistoryDDLJobs

func IterHistoryDDLJobs(txn kv.Transaction, finishFn func([]*model.Job) (bool, error)) error

IterHistoryDDLJobs iterates history DDL jobs until the `finishFn` return true or error.

func MayNeedBackfill

func MayNeedBackfill(tp model.ActionType) bool

MayNeedBackfill returns whether the action type may need to backfill the data.

Types

type DDLInfo

type DDLInfo struct {
	SchemaVer   int64
	ReorgHandle kv.Key       // It's only used for DDL information.
	Jobs        []*model.Job // It's the currently running jobs.
}

DDLInfo is for DDL information.

func GetDDLInfo

func GetDDLInfo(txn kv.Transaction) (*DDLInfo, error)

GetDDLInfo returns DDL information.

type RecordData

type RecordData struct {
	Handle kv.Handle
	Values []types.Datum
}

RecordData is the record data composed of a handle and values.

Jump to

Keyboard shortcuts

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