sidecardb

package
v0.16.6 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SidecarDBName              = "_vt"
	CreateSidecarDatabaseQuery = "create database if not exists _vt"
	UseSidecarDatabaseQuery    = "use _vt"
	ShowSidecarDatabasesQuery  = "SHOW DATABASES LIKE '\\_vt'"
	SelectCurrentDatabaseQuery = "select database()"
	ShowCreateTableQuery       = "show create table _vt.%s"

	CreateTableRegexp = "CREATE TABLE .* `\\_vt`\\..*"
	AlterTableRegexp  = "ALTER TABLE `\\_vt`\\..*"
)
View Source
const StatsKeyErrorCount = StatsKeyPrefix + "ErrorCount"
View Source
const StatsKeyErrors = StatsKeyPrefix + "Errors"
View Source
const StatsKeyPrefix = "SidecarDBDDL"
View Source
const StatsKeyQueryCount = StatsKeyPrefix + "QueryCount"

Variables

This section is empty.

Functions

func AddSchemaInitQueries

func AddSchemaInitQueries(db *fakesqldb.DB, populateTables bool)

AddSchemaInitQueries adds sidecar database schema related queries to a mock db.

func GetDDLCount

func GetDDLCount() int64

GetDDLCount returns the count of sidecardb DDLs that have been run as part of this vttablet's init process.

func GetDDLErrorCount

func GetDDLErrorCount() int64

GetDDLErrorCount returns the count of sidecardb DDLs that have been errored out as part of this vttablet's init process.

func GetDDLErrorHistory

func GetDDLErrorHistory() []*ddlError

GetDDLErrorHistory returns the errors encountered as part of this vttablet's init process..

func Init

func Init(ctx context.Context, exec Exec) error

Init creates or upgrades the sidecar database based on declarative schema for all tables in the schema.

func MatchesInitQuery

func MatchesInitQuery(query string) bool

MatchesInitQuery returns true if query has one of the test patterns as a substring, or it matches a provided regexp.

Types

type Exec

type Exec func(ctx context.Context, query string, maxRows int, useDB bool) (*sqltypes.Result, error)

Exec is a callback that has to be passed to Init() to execute the specified query in the database.

Jump to

Keyboard shortcuts

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