check

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package check provides various configuration and health checks that can be run against a sql.DB connection.

Index

Constants

View Source
const (

	// Formats for table names
	NameFormatCheckpoint   = "_%s_chkpnt"
	NameFormatNew          = "_%s_new"
	NameFormatOld          = "_%s_old"
	NameFormatOldTimeStamp = "_%s_old_%s"
	NameFormatTimestamp    = "20060102_150405"
)

Variables

View Source
var (
	// The number of extra characters needed for table names with all possible
	// formats. These vars are calculated in the `init` function below.
	NameFormatNormalExtraChars    = 0
	NameFormatTimestampExtraChars = 0
)
View Source
var ErrVisibilityMixedWithOtherChanges = errors.New("the ALTER operation contains a change to index visibility mixed with table-rebuilding operations. This creates semantic issues for experiments. Please split the ALTER statement into separate statements for changing the invisible index and other operations")

ErrVisibilityMixedWithOtherChanges is returned when index visibility changes are mixed with table-rebuilding operations

Functions

func AlterContainsIndexVisibility

func AlterContainsIndexVisibility(stmt *statement.AbstractStatement) error

AlterContainsIndexVisibility checks to see if there are any clauses of an ALTER to change index visibility. Allows index visibility changes when mixed with other metadata-only operations, but blocks them when mixed with table-rebuilding operations to avoid semantic issues.

func RunChecks

func RunChecks(ctx context.Context, r Resources, logger loggers.Advanced, scope ScopeFlag) error

RunChecks runs all checks that are registered for the given scope

Types

type Resources

type Resources struct {
	DB                   *sql.DB
	Replica              *sql.DB
	Table                *table.TableInfo
	Statement            *statement.AbstractStatement
	TargetChunkTime      time.Duration
	Threads              int
	ReplicaMaxLag        time.Duration
	SkipDropAfterCutover bool
	ForceKill            bool
	// The following resources are only used by the
	// pre-run checks
	Host                     string
	Username                 string
	Password                 string
	TLSMode                  string
	TLSCertificatePath       string
	ExperimentalBufferedCopy bool
}

type ScopeFlag

type ScopeFlag uint8

ScopeFlag scopes a check

const (
	ScopeNone        ScopeFlag = 0
	ScopePreRun      ScopeFlag = 1 << 0
	ScopePreflight   ScopeFlag = 1 << 1
	ScopePostSetup   ScopeFlag = 1 << 2
	ScopeCutover     ScopeFlag = 1 << 3
	ScopePostCutover ScopeFlag = 1 << 4
	ScopeTesting     ScopeFlag = 1 << 5
)

Jump to

Keyboard shortcuts

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