check

package
v0.5.0-prerelease Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: Apache-2.0 Imports: 15 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
	NameFormatSentinel     = "_%s_sentinel"
	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
)

Functions

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
	Alter                string
	TargetChunkTime      time.Duration
	Threads              int
	ReplicaMaxLag        time.Duration
	SkipDropAfterCutover bool
	// The following resources are only used by the
	// pre-run checks
	Host     string
	Username string
	Password string
}

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