Documentation ¶
Index ¶
- Constants
- Variables
- func CheckSrvKeyspace(t *testing.T, cell string, ksname string, ...)
- func DialVTGate(ctx context.Context, name, addr, username, password string) (*vtgateconn.VTGateConn, error)
- func ExecuteOnTablet(t *testing.T, query string, vttablet Vttablet, ks string, expectFail bool)
- func ExecuteQueriesUsingVtgate(t *testing.T, session *vtgateconn.VTGateSession, query string)
- func GetMajorVersion(binaryName string) (int, error)
- func GetPasswordUpdateSQL(localCluster *LocalProcessCluster) string
- func GetPrimaryPosition(t *testing.T, vttablet Vttablet, hostname string) (string, string)
- func NewConnParams(port int, password, socketPath, keyspace string) mysql.ConnParams
- func PanicHandler(t testing.TB)
- func PrintFiles(t *testing.T, dir string, files ...string)
- func ResetTabletDirectory(tablet Vttablet) error
- func StartMySQL(ctx context.Context, tablet *Vttablet, username string, tmpDirectory string) error
- func StartMySQLAndGetConnection(ctx context.Context, tablet *Vttablet, username string, tmpDirectory string) (*mysql.Conn, error)
- func TopoGlobalRoot(flavor string) string
- func ValidateReplicationIsHealthy(t *testing.T, tablet *Vttablet) bool
- func VerifyRowsInTablet(t *testing.T, vttablet *Vttablet, ksName string, expectedRows int)
- func VerifyRowsInTabletForTable(t *testing.T, vttablet *Vttablet, ksName string, expectedRows int, ...)
- func WaitForHealthyShard(vtctldclient *VtctldClientProcess, keyspace, shard string) error
- func WaitForReplicationPos(t *testing.T, tabletA *Vttablet, tabletB *Vttablet, validateReplication bool, ...)
- func WaitForTabletSetup(vtctlClientProcess *VtctlClientProcess, expectedTablets int, ...) error
- func WriteDbCredentialToTmp(tmpDir string) string
- type ApplySchemaParams
- type ConsulConfigs
- type Keyspace
- type LocalProcessCluster
- func (cluster *LocalProcessCluster) AddShard(keyspaceName string, shardName string, totalTabletsRequired int, rdonly bool, ...) (*Shard, error)
- func (cluster *LocalProcessCluster) DisableVTOrcRecoveries(t *testing.T)
- func (cluster *LocalProcessCluster) EnableGeneralLog() error
- func (cluster *LocalProcessCluster) EnableVTOrcRecoveries(t *testing.T)
- func (cluster *LocalProcessCluster) ExecOnTablet(ctx context.Context, vttablet *Vttablet, sql string, binds map[string]any, ...) (*sqltypes.Result, error)
- func (cluster *LocalProcessCluster) ExecOnVTGate(ctx context.Context, addr string, target string, sql string, ...) (*sqltypes.Result, error)
- func (cluster *LocalProcessCluster) GetAndReservePort() int
- func (cluster *LocalProcessCluster) GetAndReserveTabletUID() int
- func (cluster LocalProcessCluster) GetSidecarDBName(keyspace string) (string, error)
- func (cluster *LocalProcessCluster) GetVTParams(dbname string) mysql.ConnParams
- func (cluster *LocalProcessCluster) InitTablet(tablet *Vttablet, keyspace string, shard string) error
- func (cluster LocalProcessCluster) ListBackups(shardKsName string) ([]string, error)
- func (cluster *LocalProcessCluster) NewVTOrcProcess(config VTOrcConfiguration) *VTOrcProcess
- func (cluster *LocalProcessCluster) NewVtgateInstance() *VtgateProcess
- func (cluster *LocalProcessCluster) NewVttabletInstance(tabletType string, UID int, cell string) *Vttablet
- func (cluster *LocalProcessCluster) PrintMysqlctlLogFiles()
- func (cluster LocalProcessCluster) RemoveAllBackups(t *testing.T, shardKsName string)
- func (cluster *LocalProcessCluster) RestartVtgate() (err error)
- func (cluster *LocalProcessCluster) SetupCluster(keyspace *Keyspace, shards []Shard) (err error)
- func (cluster *LocalProcessCluster) SetupCtrlCHandler()
- func (cluster *LocalProcessCluster) StartKeyspace(keyspace Keyspace, shardNames []string, replicaCount int, rdonly bool, ...) (err error)
- func (cluster *LocalProcessCluster) StartKeyspaceLegacy(keyspace Keyspace, shardNames []string, replicaCount int, rdonly bool, ...) (err error)
- func (cluster *LocalProcessCluster) StartTopo() (err error)
- func (cluster *LocalProcessCluster) StartUnshardedKeyspace(keyspace Keyspace, replicaCount int, rdonly bool) error
- func (cluster *LocalProcessCluster) StartUnshardedKeyspaceLegacy(keyspace Keyspace, replicaCount int, rdonly bool) error
- func (cluster *LocalProcessCluster) StartVTOrc(keyspace string) error
- func (cluster *LocalProcessCluster) StartVtbackup(newInitDBFile string, initialBackup bool, keyspace string, shard string, ...) error
- func (cluster *LocalProcessCluster) StartVtgate() (err error)
- func (cluster *LocalProcessCluster) StartVttablet(tablet *Vttablet, explicitServingStatus bool, servingStatus string, ...) error
- func (cluster *LocalProcessCluster) StreamTabletHealth(ctx context.Context, vttablet *Vttablet, count int) (responses []*querypb.StreamHealthResponse, err error)
- func (cluster *LocalProcessCluster) StreamTabletHealthUntil(ctx context.Context, vttablet *Vttablet, timeout time.Duration, ...) error
- func (cluster *LocalProcessCluster) Teardown()
- func (cluster *LocalProcessCluster) TopoFlavorString() *string
- func (cluster LocalProcessCluster) VerifyBackupCount(t *testing.T, shardKsName string, expected int) []string
- func (cluster *LocalProcessCluster) VtprocessInstanceFromVttablet(tablet *Vttablet, shardName string, ksName string) *VttabletProcess
- func (cluster *LocalProcessCluster) WaitForTabletsToHealthyInVtgate() (err error)
- func (cluster *LocalProcessCluster) WaitForVTGateAndVTTablets(howlong time.Duration) error
- type MoveTablesWorkflow
- func (mtw *MoveTablesWorkflow) Cancel() (string, error)
- func (mtw *MoveTablesWorkflow) Complete() (string, error)
- func (mtw *MoveTablesWorkflow) Create() (string, error)
- func (mtw *MoveTablesWorkflow) ReverseReadsAndWrites() (string, error)
- func (mtw *MoveTablesWorkflow) Show() (string, error)
- func (mtw *MoveTablesWorkflow) SwitchReadsAndWrites() (string, error)
- func (mtw *MoveTablesWorkflow) WaitForVreplCatchup(timeToWait time.Duration)
- type MysqlctlProcess
- func (mysqlctl *MysqlctlProcess) BasePath() string
- func (mysqlctl *MysqlctlProcess) BinaryLogsPath() string
- func (mysqlctl *MysqlctlProcess) CleanupFiles(tabletUID int)
- func (mysqlctl *MysqlctlProcess) ExecuteCommandWithOutput(args ...string) (result string, err error)
- func (mysqlctl *MysqlctlProcess) InitDb() (err error)
- func (mysqlctl *MysqlctlProcess) Start() (err error)
- func (mysqlctl *MysqlctlProcess) StartProcess() (*exec.Cmd, error)
- func (mysqlctl *MysqlctlProcess) StartProvideInit(init bool) (err error)
- func (mysqlctl *MysqlctlProcess) Stop() (err error)
- func (mysqlctl *MysqlctlProcess) StopProcess() (*exec.Cmd, error)
- type MysqlctldProcess
- func (mysqlctld *MysqlctldProcess) CleanupFiles(tabletUID int)
- func (mysqlctld *MysqlctldProcess) InitDb() (err error)
- func (mysqlctld *MysqlctldProcess) IsHealthy() bool
- func (mysqlctld *MysqlctldProcess) Start() error
- func (mysqlctld *MysqlctldProcess) Stop() error
- func (mysqlctld *MysqlctldProcess) WaitForMysqlCtldShutdown() bool
- type PortsInfo
- type ReshardWorkflow
- func (rw *ReshardWorkflow) Cancel() (string, error)
- func (rw *ReshardWorkflow) Complete() (string, error)
- func (rw *ReshardWorkflow) Create() (string, error)
- func (rw *ReshardWorkflow) ReverseReadsAndWrites() (string, error)
- func (rw *ReshardWorkflow) Show() (string, error)
- func (rw *ReshardWorkflow) SwitchReadsAndWrites() (string, error)
- func (rw *ReshardWorkflow) WaitForVreplCatchup(timeToWait time.Duration)
- type Shard
- type TopoProcess
- func (topo *TopoProcess) IsHealthy() bool
- func (topo *TopoProcess) ManageTopoDir(command string, directory string) (err error)
- func (topo *TopoProcess) Setup(topoFlavor string, cluster *LocalProcessCluster) (err error)
- func (topo *TopoProcess) SetupConsul(cluster *LocalProcessCluster) (err error)
- func (topo *TopoProcess) SetupEtcd() (err error)
- func (topo *TopoProcess) SetupZookeeper(cluster *LocalProcessCluster) error
- func (topo *TopoProcess) TearDown(Cell string, originalVtRoot string, currentRoot string, keepdata bool, ...) error
- type VTOrcConfiguration
- type VTOrcProcess
- func (orc *VTOrcProcess) DisableGlobalRecoveries(t *testing.T)
- func (orc *VTOrcProcess) EnableGlobalRecoveries(t *testing.T)
- func (orc *VTOrcProcess) GetMetrics() string
- func (orc *VTOrcProcess) GetVars() map[string]any
- func (orc *VTOrcProcess) MakeAPICall(endpoint string) (status int, response string, err error)
- func (orc *VTOrcProcess) MakeAPICallRetry(t *testing.T, url string)
- func (orc *VTOrcProcess) Setup() (err error)
- func (orc *VTOrcProcess) TearDown() error
- type VtbackupProcess
- type VtctlClientParams
- type VtctlClientProcess
- func (vtctlclient *VtctlClientProcess) ApplyRoutingRules(JSON string) (err error)
- func (vtctlclient *VtctlClientProcess) ApplySchema(Keyspace string, SQL string) error
- func (vtctlclient *VtctlClientProcess) ApplySchemaWithOutput(Keyspace string, SQL string, params VtctlClientParams) (result string, err error)
- func (vtctlclient *VtctlClientProcess) ApplyShardRoutingRules(JSON string) (err error)
- func (vtctlclient *VtctlClientProcess) ApplyVSchema(Keyspace string, JSON string) (err error)
- func (vtctlclient *VtctlClientProcess) ExecuteCommand(args ...string) (err error)
- func (vtctlclient *VtctlClientProcess) ExecuteCommandWithOutput(args ...string) (string, error)
- func (vtctlclient *VtctlClientProcess) InitShardPrimary(Keyspace string, Shard string, Cell string, TabletUID int) (err error)
- func (vtctlclient *VtctlClientProcess) InitTablet(tablet *Vttablet, cell string, keyspaceName string, hostname string, ...) error
- func (vtctlclient *VtctlClientProcess) InitializeShard(Keyspace string, Shard string, Cell string, TabletUID int) (err error)
- func (vtctlclient *VtctlClientProcess) OnlineDDLCancelAllMigrations(Keyspace string) (result string, err error)
- func (vtctlclient *VtctlClientProcess) OnlineDDLCancelMigration(Keyspace, uuid string) (result string, err error)
- func (vtctlclient *VtctlClientProcess) OnlineDDLRetryMigration(Keyspace, uuid string) (result string, err error)
- func (vtctlclient *VtctlClientProcess) OnlineDDLRevertMigration(Keyspace, uuid string) (result string, err error)
- func (vtctlclient *VtctlClientProcess) OnlineDDLShowRecent(Keyspace string) (result string, err error)
- func (vtctlclient *VtctlClientProcess) VExec(Keyspace, workflow, query string) (result string, err error)
- type VtctlProcess
- func (vtctl *VtctlProcess) AddCellInfo(Cell string) (err error)
- func (vtctl *VtctlProcess) CreateKeyspace(keyspace, sidecarDBName, durabilityPolicy string) error
- func (vtctl *VtctlProcess) ExecuteCommand(args ...string) (err error)
- func (vtctl *VtctlProcess) ExecuteCommandWithOutput(args ...string) (result string, err error)
- type VtctldClientProcess
- func (vtctldclient *VtctldClientProcess) ApplyRoutingRules(json string) error
- func (vtctldclient *VtctldClientProcess) ApplySchema(keyspace string, sql string) error
- func (vtctldclient *VtctldClientProcess) ApplySchemaWithOutput(keyspace string, sql string, params ApplySchemaParams) (result string, err error)
- func (vtctldclient *VtctldClientProcess) ApplyVSchema(keyspace string, json string) (err error)
- func (vtctldclient *VtctldClientProcess) ChangeTabletType(tablet *Vttablet, tabletType topodatapb.TabletType) error
- func (vtctldclient *VtctldClientProcess) CreateKeyspace(keyspaceName string, sidecarDBName string) (err error)
- func (vtctldclient *VtctldClientProcess) ExecuteCommand(args ...string) (err error)
- func (vtctldclient *VtctldClientProcess) ExecuteCommandWithOutput(args ...string) (string, error)
- func (vtctldclient *VtctldClientProcess) GetKeyspace(keyspace string) (*vtctldatapb.Keyspace, error)
- func (vtctldclient *VtctldClientProcess) GetShard(keyspace string, shard string) (*vtctldatapb.Shard, error)
- func (vtctldclient *VtctldClientProcess) GetShardReplication(keyspace string, shard string, cells ...string) (map[string]*topodatapb.ShardReplication, error)
- func (vtctldclient *VtctldClientProcess) GetSrvKeyspaces(keyspace string, cells ...string) (ksMap map[string]*topodatapb.SrvKeyspace, err error)
- func (vtctldclient *VtctldClientProcess) GetTablet(alias string) (*topodatapb.Tablet, error)
- func (vtctldclient *VtctldClientProcess) InitShardPrimary(keyspace string, shard string, cell string, uid int) error
- func (vtctldclient *VtctldClientProcess) InitializeShard(keyspace string, shard string, cell string, uid int) error
- func (vtctldclient *VtctldClientProcess) OnlineDDLShow(keyspace, workflow string) (result string, err error)
- func (vtctldclient *VtctldClientProcess) OnlineDDLShowRecent(Keyspace string) (result string, err error)
- func (vtctldclient *VtctldClientProcess) PlannedReparentShard(Keyspace string, Shard string, alias string) (err error)
- type VtctldProcess
- type VtgateProcess
- func (vtgate *VtgateProcess) GetStatusForTabletOfShard(name string, endPointsCount int) bool
- func (vtgate *VtgateProcess) GetVars() (map[string]any, error)
- func (vtgate *VtgateProcess) IsShutdown() bool
- func (vtgate *VtgateProcess) ReadVSchema() (*interface{}, error)
- func (vtgate *VtgateProcess) Setup() (err error)
- func (vtgate *VtgateProcess) TearDown() error
- func (vtgate *VtgateProcess) Terminate() error
- func (vtgate *VtgateProcess) WaitForStatus() bool
- func (vtgate *VtgateProcess) WaitForStatusOfTabletInShard(name string, endPointsCount int, timeout time.Duration) error
- type Vttablet
- type VttabletProcess
- func (vttablet *VttabletProcess) BulkLoad(t testing.TB, db, table string, bulkInsert func(io.Writer))
- func (vttablet *VttabletProcess) CreateDB(keyspace string) error
- func (vttablet *VttabletProcess) GetConsolidations() (map[string]int, error)
- func (vttablet *VttabletProcess) GetDBStatus(status string, ksName string) (string, error)
- func (vttablet *VttabletProcess) GetDBVar(varName string, ksName string) (string, error)
- func (vttablet *VttabletProcess) GetStatus() string
- func (vttablet *VttabletProcess) GetStatusDetails() string
- func (vttablet *VttabletProcess) GetTabletStatus() string
- func (vttablet *VttabletProcess) GetTabletType() string
- func (vttablet *VttabletProcess) GetVars() map[string]any
- func (vttablet *VttabletProcess) IsShutdown() bool
- func (vttablet *VttabletProcess) Kill() error
- func (vttablet *VttabletProcess) MultiQueryTabletWithDB(query string, dbname string) error
- func (vttablet *VttabletProcess) QueryTablet(query string, keyspace string, useDb bool) (*sqltypes.Result, error)
- func (vttablet *VttabletProcess) QueryTabletMultiple(queries []string, keyspace string, useDb bool) error
- func (vttablet *VttabletProcess) QueryTabletWithDB(query string, dbname string) (*sqltypes.Result, error)
- func (vttablet *VttabletProcess) ResetBinaryLogsCommand() (string, error)
- func (vttablet *VttabletProcess) SemiSyncExtensionLoaded() (mysql.SemiSyncType, error)
- func (vttablet *VttabletProcess) Setup() (err error)
- func (vttablet *VttabletProcess) TabletConn(keyspace string, useDb bool) (*mysql.Conn, error)
- func (vttablet *VttabletProcess) TearDown() error
- func (vttablet *VttabletProcess) TearDownWithTimeout(timeout time.Duration) error
- func (vttablet *VttabletProcess) ToggleProfiling() error
- func (vttablet *VttabletProcess) WaitForBinLogPlayerCount(expectedCount int) error
- func (vttablet *VttabletProcess) WaitForBinlogServerState(expectedStatus string) error
- func (vttablet *VttabletProcess) WaitForStatus(status string, howLong time.Duration) bool
- func (vttablet *VttabletProcess) WaitForTabletStatus(expectedStatus string) error
- func (vttablet *VttabletProcess) WaitForTabletStatuses(expectedStatuses []string) error
- func (vttablet *VttabletProcess) WaitForTabletStatusesForTimeout(expectedStatuses []string, timeout time.Duration) error
- func (vttablet *VttabletProcess) WaitForTabletTypes(expectedTypes []string) error
- func (vttablet *VttabletProcess) WaitForTabletTypesForTimeout(expectedTypes []string, timeout time.Duration) error
- func (vttablet *VttabletProcess) WaitForVReplicationToCatchup(t testing.TB, workflow, database string, sidecarDBName string, ...)
Constants ¶
const ( DefaultCell = "zone1" DefaultStartPort = 6700 DefaultVttestEnv = "VTTEST=endtoend" )
DefaultCell : If no cell name is passed, then use following
Variables ¶
var (
InsertTabletTemplateKsID = `insert into %s (id, msg) values (%d, '%s') /* id:%d */`
)
var ( // PerfTest controls whether to run the slower end-to-end tests that check the system's performance PerfTest = flag.Bool("perf-test", false, "include end-to-end performance tests") )
Functions ¶
func CheckSrvKeyspace ¶ added in v0.15.0
func CheckSrvKeyspace(t *testing.T, cell string, ksname string, expectedPartition map[topodatapb.TabletType][]string, ci LocalProcessCluster)
CheckSrvKeyspace confirms that the cell and keyspace contain the expected shard mappings.
func DialVTGate ¶ added in v0.17.0
func DialVTGate(ctx context.Context, name, addr, username, password string) (*vtgateconn.VTGateConn, error)
DialVTGate returns a VTGate grpc connection.
func ExecuteOnTablet ¶ added in v0.15.0
ExecuteOnTablet executes a query on the specified vttablet. It should always be called with a primary tablet for a keyspace/shard.
func ExecuteQueriesUsingVtgate ¶
func ExecuteQueriesUsingVtgate(t *testing.T, session *vtgateconn.VTGateSession, query string)
ExecuteQueriesUsingVtgate sends query to vtgate using vtgate session.
func GetMajorVersion ¶ added in v0.12.5
func GetPasswordUpdateSQL ¶ added in v0.15.0
func GetPasswordUpdateSQL(localCluster *LocalProcessCluster) string
GetPasswordUpdateSQL returns the SQL for updating the users' passwords to the static creds used throughout tests.
func GetPrimaryPosition ¶ added in v0.12.0
GetPrimaryPosition gets the executed replication position of given vttablet
func NewConnParams ¶
func NewConnParams(port int, password, socketPath, keyspace string) mysql.ConnParams
NewConnParams creates ConnParams corresponds to given arguments.
func PrintFiles ¶ added in v0.19.0
PrintFiles prints the files that are asked for. If no file is specified, all the files are printed.
func ResetTabletDirectory ¶
ResetTabletDirectory transitions back to tablet state (i.e. mysql process restarts with cleaned directory and tablet is off)
func StartMySQL ¶
StartMySQL starts mysqlctl process
func StartMySQLAndGetConnection ¶
func StartMySQLAndGetConnection(ctx context.Context, tablet *Vttablet, username string, tmpDirectory string) (*mysql.Conn, error)
StartMySQLAndGetConnection create a connection to tablet mysql
func TopoGlobalRoot ¶ added in v0.20.0
TopoGlobalRoot returns the global root for the given topo flavor.
func ValidateReplicationIsHealthy ¶ added in v0.18.0
func VerifyRowsInTablet ¶
VerifyRowsInTablet Verify total number of rows in a tablet
func VerifyRowsInTabletForTable ¶
func VerifyRowsInTabletForTable(t *testing.T, vttablet *Vttablet, ksName string, expectedRows int, tableName string)
VerifyRowsInTabletForTable verifies the total number of rows in a table. This is used to check that replication has caught up with the changes on primary.
func WaitForHealthyShard ¶ added in v0.16.1
func WaitForHealthyShard(vtctldclient *VtctldClientProcess, keyspace, shard string) error
WaitForHealthyShard waits for the given shard info record in the topo server to list a tablet (alias and uid) as the primary serving tablet for the shard. This is done using "vtctldclient GetShard" and parsing its JSON output. All other watchers should then also see this shard info status as well.
func WaitForReplicationPos ¶
func WaitForReplicationPos(t *testing.T, tabletA *Vttablet, tabletB *Vttablet, validateReplication bool, timeout time.Duration)
WaitForReplicationPos will wait for replication position to catch-up
func WaitForTabletSetup ¶ added in v0.15.0
func WaitForTabletSetup(vtctlClientProcess *VtctlClientProcess, expectedTablets int, expectedStatus []string) error
func WriteDbCredentialToTmp ¶ added in v0.15.0
WriteDbCredentialToTmp writes JSON formatted db credentials to the specified tmp directory.
Types ¶
type ApplySchemaParams ¶ added in v0.20.0
type ConsulConfigs ¶ added in v0.10.3
type ConsulConfigs struct { Ports PortsInfo `json:"ports"` DataDir string `json:"data_dir"` LogFile string `json:"log_file"` }
ConsulConfigs are the configurations that are added the config files which are used by consul
type Keyspace ¶
type Keyspace struct { Name string SchemaSQL string VSchema string SidecarDBName string DurabilityPolicy string Shards []Shard }
Keyspace : Cluster accepts keyspace to launch it
type LocalProcessCluster ¶
type LocalProcessCluster struct { Keyspaces []Keyspace Cell string DefaultCharset string BaseTabletUID int Hostname string TopoFlavor string TopoPort int TmpDirectory string OriginalVTDATAROOT string CurrentVTDATAROOT string ReusingVTDATAROOT bool VtgateMySQLPort int VtgateGrpcPort int VtctldHTTPPort int // major version numbers VtTabletMajorVersion int VtctlMajorVersion int // standalone executable VtctlclientProcess VtctlClientProcess VtctldClientProcess VtctldClientProcess VtctlProcess VtctlProcess // background executable processes TopoProcess TopoProcess VtctldProcess VtctldProcess VtgateProcess VtgateProcess VtbackupProcess VtbackupProcess VTOrcProcesses []*VTOrcProcess // Extra arguments for vtTablet VtTabletExtraArgs []string // Extra arguments for vtGate VtGateExtraArgs []string VtGatePlannerVersion plancontext.PlannerVersion VtctldExtraArgs []string context.Context context.CancelFunc HasPartialKeyspaces bool // contains filtered or unexported fields }
LocalProcessCluster Testcases need to use this to iniate a cluster
func NewBareCluster ¶ added in v0.16.0
func NewBareCluster(cell string, hostname string) *LocalProcessCluster
NewBareCluster instantiates a new cluster and does not assume existence of any of the vitess processes
func NewCluster ¶
func NewCluster(cell string, hostname string) *LocalProcessCluster
NewCluster instantiates a new cluster
func (*LocalProcessCluster) DisableVTOrcRecoveries ¶ added in v0.16.0
func (cluster *LocalProcessCluster) DisableVTOrcRecoveries(t *testing.T)
DisableVTOrcRecoveries stops all VTOrcs from running any recoveries
func (*LocalProcessCluster) EnableGeneralLog ¶ added in v0.17.0
func (cluster *LocalProcessCluster) EnableGeneralLog() error
EnableGeneralLog enables generals logs on all the mysql server started by this cluster. This method should be used only for local debugging purpose.
func (*LocalProcessCluster) EnableVTOrcRecoveries ¶ added in v0.16.0
func (cluster *LocalProcessCluster) EnableVTOrcRecoveries(t *testing.T)
EnableVTOrcRecoveries allows all VTOrcs to run any recoveries
func (*LocalProcessCluster) ExecOnTablet ¶ added in v0.14.2
func (cluster *LocalProcessCluster) ExecOnTablet(ctx context.Context, vttablet *Vttablet, sql string, binds map[string]any, opts *querypb.ExecuteOptions) (*sqltypes.Result, error)
ExecOnTablet executes a query on the local cluster Vttablet and returns the result.
func (*LocalProcessCluster) ExecOnVTGate ¶ added in v0.14.2
func (cluster *LocalProcessCluster) ExecOnVTGate(ctx context.Context, addr string, target string, sql string, binds map[string]any, opts *querypb.ExecuteOptions) (*sqltypes.Result, error)
ExecOnVTGate executes a query on a local cluster VTGate with the provided target, bindvars, and execute options.
func (*LocalProcessCluster) GetAndReservePort ¶
func (cluster *LocalProcessCluster) GetAndReservePort() int
GetAndReservePort gives port for required process
func (*LocalProcessCluster) GetAndReserveTabletUID ¶
func (cluster *LocalProcessCluster) GetAndReserveTabletUID() int
GetAndReserveTabletUID gives tablet uid
func (LocalProcessCluster) GetSidecarDBName ¶ added in v0.17.0
func (cluster LocalProcessCluster) GetSidecarDBName(keyspace string) (string, error)
GetSidecarDBName returns the sidecar database name configured for the keyspace in the topo server.
func (*LocalProcessCluster) GetVTParams ¶ added in v0.15.0
func (cluster *LocalProcessCluster) GetVTParams(dbname string) mysql.ConnParams
GetVTParams returns mysql.ConnParams with host and port only for regular tests enabling global routing, and also dbname if we are testing for a cluster with a partially moved keyspace
func (*LocalProcessCluster) InitTablet ¶ added in v0.20.0
func (cluster *LocalProcessCluster) InitTablet(tablet *Vttablet, keyspace string, shard string) error
InitTablet initializes a tablet record in the topo server. It does not start the tablet process.
func (LocalProcessCluster) ListBackups ¶
func (cluster LocalProcessCluster) ListBackups(shardKsName string) ([]string, error)
ListBackups Lists back preset in shard
func (*LocalProcessCluster) NewVTOrcProcess ¶ added in v0.15.0
func (cluster *LocalProcessCluster) NewVTOrcProcess(config VTOrcConfiguration) *VTOrcProcess
NewVTOrcProcess creates a new VTOrcProcess object
func (*LocalProcessCluster) NewVtgateInstance ¶
func (cluster *LocalProcessCluster) NewVtgateInstance() *VtgateProcess
NewVtgateInstance returns an instance of vtgateprocess
func (*LocalProcessCluster) NewVttabletInstance ¶
func (cluster *LocalProcessCluster) NewVttabletInstance(tabletType string, UID int, cell string) *Vttablet
NewVttabletInstance creates a new vttablet object
func (*LocalProcessCluster) PrintMysqlctlLogFiles ¶ added in v0.14.0
func (cluster *LocalProcessCluster) PrintMysqlctlLogFiles()
PrintMysqlctlLogFiles prints all the log files associated with the mysqlctl binary
func (LocalProcessCluster) RemoveAllBackups ¶
func (cluster LocalProcessCluster) RemoveAllBackups(t *testing.T, shardKsName string)
RemoveAllBackups removes all the backup corresponds to list backup.
func (*LocalProcessCluster) RestartVtgate ¶
func (cluster *LocalProcessCluster) RestartVtgate() (err error)
RestartVtgate starts vtgate with updated configs
func (*LocalProcessCluster) SetupCluster ¶ added in v0.8.0
func (cluster *LocalProcessCluster) SetupCluster(keyspace *Keyspace, shards []Shard) (err error)
SetupCluster creates the skeleton for a cluster by creating keyspace shards and initializing tablets and mysqlctl processes. This does not start any process and user have to explicitly start all the required services (ex topo, vtgate, mysql and vttablet)
func (*LocalProcessCluster) SetupCtrlCHandler ¶ added in v0.18.0
func (cluster *LocalProcessCluster) SetupCtrlCHandler()
SetupCtrlCHandler handles the teardown for the ctrl-c.
func (*LocalProcessCluster) StartKeyspace ¶
func (*LocalProcessCluster) StartKeyspaceLegacy ¶ added in v0.13.0
func (cluster *LocalProcessCluster) StartKeyspaceLegacy(keyspace Keyspace, shardNames []string, replicaCount int, rdonly bool, customizers ...any) (err error)
StartKeyspaceLegacy starts required number of shard and the corresponding tablets keyspace : struct containing keyspace name, Sqlschema to apply, VSchema to apply shardName : list of shard names replicaCount: total number of replicas excluding shard primary and rdonly rdonly: whether readonly tablets needed customizers: functions like "func(*VttabletProcess)" that can modify settings of various objects after they're created.
func (*LocalProcessCluster) StartTopo ¶
func (cluster *LocalProcessCluster) StartTopo() (err error)
StartTopo starts topology server
func (*LocalProcessCluster) StartUnshardedKeyspace ¶
func (cluster *LocalProcessCluster) StartUnshardedKeyspace(keyspace Keyspace, replicaCount int, rdonly bool) error
StartUnshardedKeyspace starts unshared keyspace with shard name as "0"
func (*LocalProcessCluster) StartUnshardedKeyspaceLegacy ¶ added in v0.13.0
func (cluster *LocalProcessCluster) StartUnshardedKeyspaceLegacy(keyspace Keyspace, replicaCount int, rdonly bool) error
StartUnshardedKeyspaceLegacy starts unshared keyspace with shard name as "0"
func (*LocalProcessCluster) StartVTOrc ¶ added in v0.15.3
func (cluster *LocalProcessCluster) StartVTOrc(keyspace string) error
StartVTOrc starts a VTOrc instance
func (*LocalProcessCluster) StartVtbackup ¶
func (cluster *LocalProcessCluster) StartVtbackup(newInitDBFile string, initialBackup bool, keyspace string, shard string, cell string, extraArgs ...string) error
StartVtbackup starts a vtbackup
func (*LocalProcessCluster) StartVtgate ¶
func (cluster *LocalProcessCluster) StartVtgate() (err error)
StartVtgate starts vtgate
func (*LocalProcessCluster) StartVttablet ¶
func (cluster *LocalProcessCluster) StartVttablet( tablet *Vttablet, explicitServingStatus bool, servingStatus string, supportBackup bool, cell string, keyspaceName string, hostname string, shardName string, ) error
StartVttablet starts a new tablet
func (*LocalProcessCluster) StreamTabletHealth ¶ added in v0.14.2
func (cluster *LocalProcessCluster) StreamTabletHealth(ctx context.Context, vttablet *Vttablet, count int) (responses []*querypb.StreamHealthResponse, err error)
StreamTabletHealth invokes a HealthStream on a local cluster Vttablet and returns the responses. It returns an error if the stream ends with fewer than `count` responses.
func (*LocalProcessCluster) StreamTabletHealthUntil ¶ added in v0.17.0
func (cluster *LocalProcessCluster) StreamTabletHealthUntil(ctx context.Context, vttablet *Vttablet, timeout time.Duration, condition func(shr *querypb.StreamHealthResponse) bool) error
StreamTabletHealthUntil invokes a HealthStream on a local cluster Vttablet and returns the responses. It waits until a certain condition is met. The amount of time to wait is an input that it takes.
func (*LocalProcessCluster) Teardown ¶
func (cluster *LocalProcessCluster) Teardown()
Teardown brings down the cluster by invoking teardown for individual processes
func (*LocalProcessCluster) TopoFlavorString ¶ added in v0.9.1
func (cluster *LocalProcessCluster) TopoFlavorString() *string
TopoFlavorString returns the topo flavor
func (LocalProcessCluster) VerifyBackupCount ¶
func (cluster LocalProcessCluster) VerifyBackupCount(t *testing.T, shardKsName string, expected int) []string
VerifyBackupCount compares the backup count with expected count.
func (*LocalProcessCluster) VtprocessInstanceFromVttablet ¶
func (cluster *LocalProcessCluster) VtprocessInstanceFromVttablet(tablet *Vttablet, shardName string, ksName string) *VttabletProcess
VtprocessInstanceFromVttablet creates a new vttablet object
func (*LocalProcessCluster) WaitForTabletsToHealthyInVtgate ¶
func (cluster *LocalProcessCluster) WaitForTabletsToHealthyInVtgate() (err error)
WaitForTabletsToHealthyInVtgate waits for all tablets in all shards to be seen as healthy and serving in vtgate. For each shard:
- It must have 1 (and only 1) healthy primary tablet so we always wait for that
- For replica and rdonly tablets, which are optional, we wait for as many as we should have based on how the cluster was defined.
func (*LocalProcessCluster) WaitForVTGateAndVTTablets ¶ added in v0.17.0
func (cluster *LocalProcessCluster) WaitForVTGateAndVTTablets(howlong time.Duration) error
WaitForVTGateAndVTTablets waits for as long as you like for the vtgate and any vttablets to be healthy.
type MoveTablesWorkflow ¶ added in v0.21.0
type MoveTablesWorkflow struct {
// contains filtered or unexported fields
}
MoveTablesWorkflow is used to store the information needed to run MoveTables commands.
func NewMoveTables ¶ added in v0.21.0
func NewMoveTables(t *testing.T, clusterInstance *LocalProcessCluster, workflowName, targetKs, srcKs, tables string, tabletTypes []string) *MoveTablesWorkflow
NewMoveTables creates a new MoveTablesWorkflow.
func (*MoveTablesWorkflow) Cancel ¶ added in v0.21.0
func (mtw *MoveTablesWorkflow) Cancel() (string, error)
func (*MoveTablesWorkflow) Complete ¶ added in v0.21.0
func (mtw *MoveTablesWorkflow) Complete() (string, error)
func (*MoveTablesWorkflow) Create ¶ added in v0.21.0
func (mtw *MoveTablesWorkflow) Create() (string, error)
func (*MoveTablesWorkflow) ReverseReadsAndWrites ¶ added in v0.21.0
func (mtw *MoveTablesWorkflow) ReverseReadsAndWrites() (string, error)
func (*MoveTablesWorkflow) Show ¶ added in v0.21.0
func (mtw *MoveTablesWorkflow) Show() (string, error)
func (*MoveTablesWorkflow) SwitchReadsAndWrites ¶ added in v0.21.0
func (mtw *MoveTablesWorkflow) SwitchReadsAndWrites() (string, error)
func (*MoveTablesWorkflow) WaitForVreplCatchup ¶ added in v0.21.0
func (mtw *MoveTablesWorkflow) WaitForVreplCatchup(timeToWait time.Duration)
type MysqlctlProcess ¶
type MysqlctlProcess struct { Name string Binary string LogDirectory string TabletUID int MySQLPort int InitDBFile string ExtraArgs []string InitMysql bool SecureTransport bool MajorVersion int }
MysqlctlProcess is a generic handle for a running mysqlctl command . It can be spawned manually
func MysqlCtlProcessInstance ¶
func MysqlCtlProcessInstance(tabletUID int, mySQLPort int, tmpDirectory string) (*MysqlctlProcess, error)
MysqlCtlProcessInstance returns a Mysqlctl handle for mysqlctl process configured with the given Config.
func MysqlCtlProcessInstanceOptionalInit ¶ added in v0.9.0
func MysqlCtlProcessInstanceOptionalInit(tabletUID int, mySQLPort int, tmpDirectory string, initMySQL bool) (*MysqlctlProcess, error)
MysqlCtlProcessInstanceOptionalInit returns a Mysqlctl handle for mysqlctl process configured with the given Config.
func (*MysqlctlProcess) BasePath ¶ added in v0.16.0
func (mysqlctl *MysqlctlProcess) BasePath() string
func (*MysqlctlProcess) BinaryLogsPath ¶ added in v0.16.0
func (mysqlctl *MysqlctlProcess) BinaryLogsPath() string
func (*MysqlctlProcess) CleanupFiles ¶
func (mysqlctl *MysqlctlProcess) CleanupFiles(tabletUID int)
CleanupFiles clean the mysql files to make sure we can start the same process again
func (*MysqlctlProcess) ExecuteCommandWithOutput ¶
func (mysqlctl *MysqlctlProcess) ExecuteCommandWithOutput(args ...string) (result string, err error)
ExecuteCommandWithOutput executes any mysqlctl command and returns output
func (*MysqlctlProcess) InitDb ¶
func (mysqlctl *MysqlctlProcess) InitDb() (err error)
InitDb executes mysqlctl command to add cell info
func (*MysqlctlProcess) Start ¶
func (mysqlctl *MysqlctlProcess) Start() (err error)
Start executes mysqlctl command to start mysql instance
func (*MysqlctlProcess) StartProcess ¶
func (mysqlctl *MysqlctlProcess) StartProcess() (*exec.Cmd, error)
StartProcess starts the mysqlctl and returns the process reference
func (*MysqlctlProcess) StartProvideInit ¶ added in v0.15.0
func (mysqlctl *MysqlctlProcess) StartProvideInit(init bool) (err error)
StartProvideInit executes mysqlctl command to start mysql instance
func (*MysqlctlProcess) Stop ¶
func (mysqlctl *MysqlctlProcess) Stop() (err error)
Stop executes mysqlctl command to stop mysql instance and kills the mysql instance if it doesn't shutdown in 30 seconds.
func (*MysqlctlProcess) StopProcess ¶
func (mysqlctl *MysqlctlProcess) StopProcess() (*exec.Cmd, error)
StopProcess executes mysqlctl command to stop mysql instance and returns process reference
type MysqlctldProcess ¶
type MysqlctldProcess struct { Name string Binary string LogDirectory string ErrorLog string Password string TabletUID int MySQLPort int InitDBFile string ExtraArgs []string InitMysql bool SocketFile string // contains filtered or unexported fields }
MysqlctldProcess is a generic handle for a running mysqlctld command . It can be spawned manually
func MysqlCtldProcessInstance ¶
func MysqlCtldProcessInstance(tabletUID int, mySQLPort int, tmpDirectory string) (*MysqlctldProcess, error)
MysqlCtldProcessInstance returns a Mysqlctld handle for mysqlctld process configured with the given Config.
func (*MysqlctldProcess) CleanupFiles ¶
func (mysqlctld *MysqlctldProcess) CleanupFiles(tabletUID int)
CleanupFiles clean the mysql files to make sure we can start the same process again
func (*MysqlctldProcess) InitDb ¶
func (mysqlctld *MysqlctldProcess) InitDb() (err error)
InitDb executes mysqlctld command to add cell info
func (*MysqlctldProcess) IsHealthy ¶
func (mysqlctld *MysqlctldProcess) IsHealthy() bool
IsHealthy gives the health status of mysql.
func (*MysqlctldProcess) Start ¶
func (mysqlctld *MysqlctldProcess) Start() error
Start starts the mysqlctld and returns the error.
func (*MysqlctldProcess) Stop ¶
func (mysqlctld *MysqlctldProcess) Stop() error
Stop executes mysqlctld command to stop mysql instance
func (*MysqlctldProcess) WaitForMysqlCtldShutdown ¶ added in v0.16.7
func (mysqlctld *MysqlctldProcess) WaitForMysqlCtldShutdown() bool
type PortsInfo ¶ added in v0.10.3
type PortsInfo struct { DNS int `json:"dns"` HTTP int `json:"http"` SerfLan int `json:"serf_lan"` SerfWan int `json:"serf_wan"` Server int `json:"server"` }
PortsInfo is the different ports used by consul
type ReshardWorkflow ¶ added in v0.21.0
type ReshardWorkflow struct {
// contains filtered or unexported fields
}
ReshardWorkflow is used to store the information needed to run Reshard commands.
func NewReshard ¶ added in v0.21.0
func NewReshard(t *testing.T, clusterInstance *LocalProcessCluster, workflowName, targetKs, targetShards, srcShards string) *ReshardWorkflow
NewReshard creates a new ReshardWorkflow.
func (*ReshardWorkflow) Cancel ¶ added in v0.21.0
func (rw *ReshardWorkflow) Cancel() (string, error)
func (*ReshardWorkflow) Complete ¶ added in v0.21.0
func (rw *ReshardWorkflow) Complete() (string, error)
func (*ReshardWorkflow) Create ¶ added in v0.21.0
func (rw *ReshardWorkflow) Create() (string, error)
func (*ReshardWorkflow) ReverseReadsAndWrites ¶ added in v0.21.0
func (rw *ReshardWorkflow) ReverseReadsAndWrites() (string, error)
func (*ReshardWorkflow) Show ¶ added in v0.21.0
func (rw *ReshardWorkflow) Show() (string, error)
func (*ReshardWorkflow) SwitchReadsAndWrites ¶ added in v0.21.0
func (rw *ReshardWorkflow) SwitchReadsAndWrites() (string, error)
func (*ReshardWorkflow) WaitForVreplCatchup ¶ added in v0.21.0
func (rw *ReshardWorkflow) WaitForVreplCatchup(timeToWait time.Duration)
type Shard ¶
Shard with associated vttablets
func (*Shard) PrimaryTablet ¶ added in v0.12.0
PrimaryTablet get the 1st tablet which is always elected as primary
type TopoProcess ¶
type TopoProcess struct { Name string Binary string DataDirectory string LogDirectory string ErrorLog string ListenClientURL string AdvertiseClientURL string Port int Host string VerifyURL string PeerURL string ZKPorts string Client interface{} Server *vtopo.Server // contains filtered or unexported fields }
TopoProcess is a generic handle for a running Topo service . It can be spawned manually
func TopoProcessInstance ¶
func TopoProcessInstance(port int, peerPort int, hostname string, flavor string, name string) *TopoProcess
TopoProcessInstance returns a TopoProcess handle for a etcd sevice, configured with the given Config. The process must be manually started by calling setup()
func (*TopoProcess) IsHealthy ¶
func (topo *TopoProcess) IsHealthy() bool
IsHealthy function checks if topo server is up and running
func (*TopoProcess) ManageTopoDir ¶
func (topo *TopoProcess) ManageTopoDir(command string, directory string) (err error)
ManageTopoDir creates global and zone in etcd2
func (*TopoProcess) Setup ¶
func (topo *TopoProcess) Setup(topoFlavor string, cluster *LocalProcessCluster) (err error)
Setup starts a new topo service
func (*TopoProcess) SetupConsul ¶
func (topo *TopoProcess) SetupConsul(cluster *LocalProcessCluster) (err error)
SetupConsul spawns a new consul service and initializes it with the defaults. The service is kept running in the background until TearDown() is called.
func (*TopoProcess) SetupEtcd ¶
func (topo *TopoProcess) SetupEtcd() (err error)
SetupEtcd spawns a new etcd service and initializes it with the defaults. The service is kept running in the background until TearDown() is called.
func (*TopoProcess) SetupZookeeper ¶
func (topo *TopoProcess) SetupZookeeper(cluster *LocalProcessCluster) error
SetupZookeeper spawns a new zookeeper topo service and initializes it with the defaults. The service is kept running in the background until TearDown() is called.
type VTOrcConfiguration ¶ added in v0.15.0
type VTOrcConfiguration struct { Debug bool ListenAddress string MySQLTopologyUser string MySQLTopologyPassword string MySQLReplicaUser string MySQLReplicaPassword string RecoveryPeriodBlockSeconds int TopologyRefreshSeconds int `json:",omitempty"` PreventCrossDataCenterPrimaryFailover bool `json:",omitempty"` LockShardTimeoutSeconds int `json:",omitempty"` ReplicationLagQuery string `json:",omitempty"` FailPrimaryPromotionOnLagMinutes int `json:",omitempty"` }
func (*VTOrcConfiguration) AddDefaults ¶ added in v0.15.0
func (config *VTOrcConfiguration) AddDefaults(webPort int)
func (*VTOrcConfiguration) ToJSONString ¶ added in v0.15.0
func (config *VTOrcConfiguration) ToJSONString() string
ToJSONString will marshal this configuration as JSON
type VTOrcProcess ¶ added in v0.15.0
type VTOrcProcess struct { VtctlProcess Port int LogDir string LogFileName string ExtraArgs []string ConfigPath string Config VTOrcConfiguration WebPort int // contains filtered or unexported fields }
VTOrcProcess is a test struct for running vtorc as a separate process for testing
func (*VTOrcProcess) DisableGlobalRecoveries ¶ added in v0.16.0
func (orc *VTOrcProcess) DisableGlobalRecoveries(t *testing.T)
DisableGlobalRecoveries stops VTOrc from running any recoveries
func (*VTOrcProcess) EnableGlobalRecoveries ¶ added in v0.16.0
func (orc *VTOrcProcess) EnableGlobalRecoveries(t *testing.T)
EnableGlobalRecoveries allows VTOrc to run any recoveries
func (*VTOrcProcess) GetMetrics ¶ added in v0.20.0
func (orc *VTOrcProcess) GetMetrics() string
GetMetrics gets the metrics exported on the /metrics page of VTOrc
func (*VTOrcProcess) GetVars ¶ added in v0.15.0
func (orc *VTOrcProcess) GetVars() map[string]any
GetVars gets the variables exported on the /debug/vars page of VTOrc
func (*VTOrcProcess) MakeAPICall ¶ added in v0.15.0
func (orc *VTOrcProcess) MakeAPICall(endpoint string) (status int, response string, err error)
MakeAPICall makes an API call on the given endpoint of VTOrc
func (*VTOrcProcess) MakeAPICallRetry ¶ added in v0.16.0
func (orc *VTOrcProcess) MakeAPICallRetry(t *testing.T, url string)
MakeAPICallRetry is used to make an API call and retries until success
func (*VTOrcProcess) Setup ¶ added in v0.15.0
func (orc *VTOrcProcess) Setup() (err error)
Setup starts orc process with required arguements
func (*VTOrcProcess) TearDown ¶ added in v0.15.0
func (orc *VTOrcProcess) TearDown() error
TearDown shuts down the running vtorc service
type VtbackupProcess ¶
type VtbackupProcess struct { Name string Binary string CommonArg VtctlProcess LogDir string MysqlPort int Directory string Cell string Keyspace string Shard string TabletAlias string Server string ExtraArgs []string // contains filtered or unexported fields }
VtbackupProcess is a generic handle for a running Vtbackup. It can be spawned manually
func VtbackupProcessInstance ¶
func VtbackupProcessInstance(tabletUID int, mysqlPort int, newInitDBFile string, keyspace string, shard string, cell string, hostname string, tmpDirectory string, topoPort int, initialBackup bool) *VtbackupProcess
VtbackupProcessInstance returns a vtbackup handle configured with the given Config. The process must be manually started by calling Setup()
func (*VtbackupProcess) Setup ¶
func (vtbackup *VtbackupProcess) Setup() (err error)
Setup starts vtbackup process with required arguements
func (*VtbackupProcess) TearDown ¶
func (vtbackup *VtbackupProcess) TearDown() error
TearDown shutdowns the running vtbackup process
type VtctlClientParams ¶ added in v0.11.0
type VtctlClientParams struct { DDLStrategy string MigrationContext string UUIDList string CallerID string BatchSize int }
VtctlClientParams encapsulated params to provide if non-default
type VtctlClientProcess ¶
type VtctlClientProcess struct { Name string Binary string Server string TempDirectory string ZoneName string VtctlClientMajorVersion int }
VtctlClientProcess is a generic handle for a running vtctlclient command . It can be spawned manually
func VtctlClientProcessInstance ¶
func VtctlClientProcessInstance(hostname string, grpcPort int, tmpDirectory string) *VtctlClientProcess
VtctlClientProcessInstance returns a VtctlProcess handle for vtctlclient process configured with the given Config.
func (*VtctlClientProcess) ApplyRoutingRules ¶ added in v0.9.0
func (vtctlclient *VtctlClientProcess) ApplyRoutingRules(JSON string) (err error)
ApplyRoutingRules does it
func (*VtctlClientProcess) ApplySchema ¶
func (vtctlclient *VtctlClientProcess) ApplySchema(Keyspace string, SQL string) error
ApplySchema applies SQL schema to the keyspace
func (*VtctlClientProcess) ApplySchemaWithOutput ¶ added in v0.8.0
func (vtctlclient *VtctlClientProcess) ApplySchemaWithOutput(Keyspace string, SQL string, params VtctlClientParams) (result string, err error)
ApplySchemaWithOutput applies SQL schema to the keyspace
func (*VtctlClientProcess) ApplyShardRoutingRules ¶ added in v0.15.0
func (vtctlclient *VtctlClientProcess) ApplyShardRoutingRules(JSON string) (err error)
ApplyRoutingRules does it
func (*VtctlClientProcess) ApplyVSchema ¶
func (vtctlclient *VtctlClientProcess) ApplyVSchema(Keyspace string, JSON string) (err error)
ApplyVSchema applies vitess schema (JSON format) to the keyspace
func (*VtctlClientProcess) ExecuteCommand ¶
func (vtctlclient *VtctlClientProcess) ExecuteCommand(args ...string) (err error)
ExecuteCommand executes any vtctlclient command
func (*VtctlClientProcess) ExecuteCommandWithOutput ¶
func (vtctlclient *VtctlClientProcess) ExecuteCommandWithOutput(args ...string) (string, error)
ExecuteCommandWithOutput executes any vtctlclient command and returns output
func (*VtctlClientProcess) InitShardPrimary ¶ added in v0.12.0
func (vtctlclient *VtctlClientProcess) InitShardPrimary(Keyspace string, Shard string, Cell string, TabletUID int) (err error)
InitShardPrimary executes vtctlclient command to make specified tablet the primary for the shard.
func (*VtctlClientProcess) InitTablet ¶
func (vtctlclient *VtctlClientProcess) InitTablet(tablet *Vttablet, cell string, keyspaceName string, hostname string, shardName string) error
InitTablet initializes a tablet
func (*VtctlClientProcess) InitializeShard ¶ added in v0.13.0
func (vtctlclient *VtctlClientProcess) InitializeShard(Keyspace string, Shard string, Cell string, TabletUID int) (err error)
InitializeShard executes vtctlclient command to make specified tablet the primary for the shard.
func (*VtctlClientProcess) OnlineDDLCancelAllMigrations ¶ added in v0.9.0
func (vtctlclient *VtctlClientProcess) OnlineDDLCancelAllMigrations(Keyspace string) (result string, err error)
OnlineDDLCancelAllMigrations cancels all migrations for a keyspace
func (*VtctlClientProcess) OnlineDDLCancelMigration ¶ added in v0.8.0
func (vtctlclient *VtctlClientProcess) OnlineDDLCancelMigration(Keyspace, uuid string) (result string, err error)
OnlineDDLCancelMigration cancels a given migration uuid
func (*VtctlClientProcess) OnlineDDLRetryMigration ¶ added in v0.8.0
func (vtctlclient *VtctlClientProcess) OnlineDDLRetryMigration(Keyspace, uuid string) (result string, err error)
OnlineDDLRetryMigration retries a given migration uuid
func (*VtctlClientProcess) OnlineDDLRevertMigration ¶ added in v0.10.0
func (vtctlclient *VtctlClientProcess) OnlineDDLRevertMigration(Keyspace, uuid string) (result string, err error)
OnlineDDLRevertMigration reverts a given migration uuid
func (*VtctlClientProcess) OnlineDDLShowRecent ¶ added in v0.8.0
func (vtctlclient *VtctlClientProcess) OnlineDDLShowRecent(Keyspace string) (result string, err error)
OnlineDDLShowRecent responds with recent schema migration list
type VtctlProcess ¶
type VtctlProcess struct { Name string Binary string LogDir string TopoImplementation string TopoGlobalAddress string TopoGlobalRoot string TopoServerAddress string TopoRootPath string VtctlMajorVersion int }
VtctlProcess is a generic handle for a running vtctl command . It can be spawned manually
func VtctlProcessInstance ¶
func VtctlProcessInstance(topoPort int, hostname string) *VtctlProcess
VtctlProcessInstance returns a VtctlProcess handle for vtctl process configured with the given Config. The process must be manually started by calling setup()
func (*VtctlProcess) AddCellInfo ¶
func (vtctl *VtctlProcess) AddCellInfo(Cell string) (err error)
AddCellInfo executes vtctl command to add cell info
func (*VtctlProcess) CreateKeyspace ¶
func (vtctl *VtctlProcess) CreateKeyspace(keyspace, sidecarDBName, durabilityPolicy string) error
CreateKeyspace executes vtctl command to create keyspace
func (*VtctlProcess) ExecuteCommand ¶
func (vtctl *VtctlProcess) ExecuteCommand(args ...string) (err error)
ExecuteCommand executes any vtctlclient command
func (*VtctlProcess) ExecuteCommandWithOutput ¶
func (vtctl *VtctlProcess) ExecuteCommandWithOutput(args ...string) (result string, err error)
ExecuteCommandWithOutput executes any vtctlclient command and returns output
type VtctldClientProcess ¶ added in v0.14.0
type VtctldClientProcess struct { Name string Binary string Server string TempDirectory string ZoneName string VtctldClientMajorVersion int }
VtctldClientProcess is a generic handle for a running vtctldclient command . It can be spawned manually
func VtctldClientProcessInstance ¶ added in v0.14.0
func VtctldClientProcessInstance(hostname string, grpcPort int, tmpDirectory string) *VtctldClientProcess
VtctldClientProcessInstance returns a VtctldProcess handle for vtctldclient process configured with the given Config.
func (*VtctldClientProcess) ApplyRoutingRules ¶ added in v0.20.0
func (vtctldclient *VtctldClientProcess) ApplyRoutingRules(json string) error
ApplyRoutingRules applies the given routing rules.
func (*VtctldClientProcess) ApplySchema ¶ added in v0.20.0
func (vtctldclient *VtctldClientProcess) ApplySchema(keyspace string, sql string) error
ApplySchema applies SQL schema to the keyspace
func (*VtctldClientProcess) ApplySchemaWithOutput ¶ added in v0.20.0
func (vtctldclient *VtctldClientProcess) ApplySchemaWithOutput(keyspace string, sql string, params ApplySchemaParams) (result string, err error)
ApplySchemaWithOutput applies SQL schema to the keyspace
func (*VtctldClientProcess) ApplyVSchema ¶ added in v0.20.0
func (vtctldclient *VtctldClientProcess) ApplyVSchema(keyspace string, json string) (err error)
ApplyVSchema applies vitess schema (JSON format) to the keyspace
func (*VtctldClientProcess) ChangeTabletType ¶ added in v0.20.0
func (vtctldclient *VtctldClientProcess) ChangeTabletType(tablet *Vttablet, tabletType topodatapb.TabletType) error
ChangeTabletType changes the type of the given tablet.
func (*VtctldClientProcess) CreateKeyspace ¶ added in v0.17.0
func (vtctldclient *VtctldClientProcess) CreateKeyspace(keyspaceName string, sidecarDBName string) (err error)
CreateKeyspace executes the vtctl command to create a keyspace
func (*VtctldClientProcess) ExecuteCommand ¶ added in v0.14.0
func (vtctldclient *VtctldClientProcess) ExecuteCommand(args ...string) (err error)
ExecuteCommand executes any vtctldclient command
func (*VtctldClientProcess) ExecuteCommandWithOutput ¶ added in v0.14.0
func (vtctldclient *VtctldClientProcess) ExecuteCommandWithOutput(args ...string) (string, error)
ExecuteCommandWithOutput executes any vtctldclient command and returns output
func (*VtctldClientProcess) GetKeyspace ¶ added in v0.20.0
func (vtctldclient *VtctldClientProcess) GetKeyspace(keyspace string) (*vtctldatapb.Keyspace, error)
GetKeyspace executes the vtctldclient command to get a shard, and parses the response.
func (*VtctldClientProcess) GetShard ¶ added in v0.20.0
func (vtctldclient *VtctldClientProcess) GetShard(keyspace string, shard string) (*vtctldatapb.Shard, error)
GetShard executes the vtctldclient command to get a shard, and parses the response.
func (*VtctldClientProcess) GetShardReplication ¶ added in v0.20.0
func (vtctldclient *VtctldClientProcess) GetShardReplication(keyspace string, shard string, cells ...string) (map[string]*topodatapb.ShardReplication, error)
GetShardReplication returns a mapping of cell to shard replication for the given keyspace and shard.
func (*VtctldClientProcess) GetSrvKeyspaces ¶ added in v0.20.0
func (vtctldclient *VtctldClientProcess) GetSrvKeyspaces(keyspace string, cells ...string) (ksMap map[string]*topodatapb.SrvKeyspace, err error)
GetSrvKeyspaces returns a mapping of cell to srv keyspace for the given keyspace.
func (*VtctldClientProcess) GetTablet ¶ added in v0.20.0
func (vtctldclient *VtctldClientProcess) GetTablet(alias string) (*topodatapb.Tablet, error)
GetTablet executes vtctldclient command to get a tablet, and parses the response.
func (*VtctldClientProcess) InitShardPrimary ¶ added in v0.20.0
func (vtctldclient *VtctldClientProcess) InitShardPrimary(keyspace string, shard string, cell string, uid int) error
InitShardPrimary executes vtctldclient command to make specified tablet the primary for the shard.
func (*VtctldClientProcess) InitializeShard ¶ added in v0.20.0
func (vtctldclient *VtctldClientProcess) InitializeShard(keyspace string, shard string, cell string, uid int) error
InitializeShard executes vtctldclient command to make specified tablet the primary for the shard.
func (*VtctldClientProcess) OnlineDDLShow ¶ added in v0.20.0
func (vtctldclient *VtctldClientProcess) OnlineDDLShow(keyspace, workflow string) (result string, err error)
OnlineDDLShow responds with recent schema migration list
func (*VtctldClientProcess) OnlineDDLShowRecent ¶ added in v0.18.0
func (vtctldclient *VtctldClientProcess) OnlineDDLShowRecent(Keyspace string) (result string, err error)
OnlineDDLShowRecent responds with recent schema migration list
func (*VtctldClientProcess) PlannedReparentShard ¶ added in v0.17.0
func (vtctldclient *VtctldClientProcess) PlannedReparentShard(Keyspace string, Shard string, alias string) (err error)
PlannedReparentShard executes vtctlclient command to make specified tablet the primary for the shard.
type VtctldProcess ¶
type VtctldProcess struct { Name string Binary string CommonArg VtctlProcess ServiceMap string BackupStorageImplementation string FileBackupStorageRoot string LogDir string ErrorLog string Port int GrpcPort int VerifyURL string Directory string // contains filtered or unexported fields }
VtctldProcess is a generic handle for a running vtctld . It can be spawned manually
func VtctldProcessInstance ¶
func VtctldProcessInstance(httpPort int, grpcPort int, topoPort int, hostname string, tmpDirectory string) *VtctldProcess
VtctldProcessInstance returns a VtctlProcess handle for vtctl process configured with the given Config. The process must be manually started by calling setup()
func (*VtctldProcess) IsHealthy ¶
func (vtctld *VtctldProcess) IsHealthy() bool
IsHealthy function checks if vtctld process is up and running
func (*VtctldProcess) Setup ¶
func (vtctld *VtctldProcess) Setup(cell string, extraArgs ...string) (err error)
Setup starts vtctld process with required arguements
func (*VtctldProcess) TearDown ¶
func (vtctld *VtctldProcess) TearDown() error
TearDown shutdowns the running vtctld service
type VtgateProcess ¶
type VtgateProcess struct { Name string Binary string CommonArg VtctlProcess LogDir string ErrorLog string FileToLogQueries string Port int GrpcPort int MySQLServerPort int MySQLServerSocketPath string Cell string CellsToWatch string TabletTypesToWait string ServiceMap string MySQLAuthServerImpl string Directory string VerifyURL string VSchemaURL string SysVarSetEnabled bool PlannerVersion plancontext.PlannerVersion // Extra Args to be set before starting the vtgate process ExtraArgs []string // contains filtered or unexported fields }
VtgateProcess is a generic handle for a running vtgate . It can be spawned manually
func VtgateProcessInstance ¶
func VtgateProcessInstance( port, grpcPort, mySQLServerPort int, cell, cellsToWatch, hostname, tabletTypesToWait string, topoPort int, tmpDirectory string, extraArgs []string, plannerVersion plancontext.PlannerVersion, ) *VtgateProcess
VtgateProcessInstance returns a Vtgate handle for vtgate process configured with the given Config. The process must be manually started by calling setup()
func (*VtgateProcess) GetStatusForTabletOfShard ¶
func (vtgate *VtgateProcess) GetStatusForTabletOfShard(name string, endPointsCount int) bool
GetStatusForTabletOfShard function gets status for a specific tablet of a shard in keyspace endPointsCount : number of endpoints
func (*VtgateProcess) GetVars ¶
func (vtgate *VtgateProcess) GetVars() (map[string]any, error)
GetVars returns map of vars
func (*VtgateProcess) IsShutdown ¶ added in v0.21.0
func (vtgate *VtgateProcess) IsShutdown() bool
IsShutdown checks if the vtgate process is shutdown
func (*VtgateProcess) ReadVSchema ¶ added in v0.13.2
func (vtgate *VtgateProcess) ReadVSchema() (*interface{}, error)
ReadVSchema reads the vschema from the vtgate endpoint for it and returns a pointer to the interface. To read this vschema, the caller must convert it to a map
func (*VtgateProcess) Setup ¶
func (vtgate *VtgateProcess) Setup() (err error)
Setup starts Vtgate process with required arguements
func (*VtgateProcess) TearDown ¶
func (vtgate *VtgateProcess) TearDown() error
TearDown shuts down the running vtgate service
func (*VtgateProcess) Terminate ¶ added in v0.21.0
func (vtgate *VtgateProcess) Terminate() error
Terminate sends a SIGTERM to vtgate
func (*VtgateProcess) WaitForStatus ¶
func (vtgate *VtgateProcess) WaitForStatus() bool
WaitForStatus function checks if vtgate process is up and running
func (*VtgateProcess) WaitForStatusOfTabletInShard ¶
func (vtgate *VtgateProcess) WaitForStatusOfTabletInShard(name string, endPointsCount int, timeout time.Duration) error
WaitForStatusOfTabletInShard function waits till status of a tablet in shard is 1 endPointsCount: how many endpoints to wait for
type Vttablet ¶
type Vttablet struct { Type string TabletUID int HTTPPort int GrpcPort int MySQLPort int Alias string Cell string // background executable processes MysqlctlProcess MysqlctlProcess MysqlctldProcess MysqlctldProcess VttabletProcess *VttabletProcess }
Vttablet stores the properties needed to start a vttablet process
func (*Vttablet) RestartOnlyTablet ¶ added in v0.11.0
RestartOnlyTablet restarts vttablet, but not the underlying mysql instance
func (*Vttablet) ValidateTabletRestart ¶
ValidateTabletRestart restarts the tablet and validate error if there is any.
type VttabletProcess ¶
type VttabletProcess struct { Name string Binary string FileToLogQueries string TabletUID int TabletPath string Cell string Port int GrpcPort int Shard string CommonArg VtctlProcess LogDir string ErrorLog string TabletHostname string Keyspace string TabletType string HealthCheckInterval int BackupStorageImplementation string FileBackupStorageRoot string ServiceMap string VtctldAddress string Directory string VerifyURL string QueryzURL string StatusDetailsURL string SupportsBackup bool ExplicitServingStatus bool ServingStatus string DbName string DbPassword string DbPort int DbFlavor string Charset string ConsolidationsURL string IsPrimary bool // Extra Args to be set before starting the vttablet process ExtraArgs []string // contains filtered or unexported fields }
VttabletProcess is a generic handle for a running vttablet . It can be spawned manually
func VttabletProcessInstance ¶
func VttabletProcessInstance(port, grpcPort, tabletUID int, cell, shard, keyspace string, vtctldPort int, tabletType string, topoPort int, hostname, tmpDirectory string, extraArgs []string, charset string) *VttabletProcess
VttabletProcessInstance returns a VttabletProcess handle for vttablet process configured with the given Config. The process must be manually started by calling setup()
func (*VttabletProcess) BulkLoad ¶ added in v0.11.0
func (vttablet *VttabletProcess) BulkLoad(t testing.TB, db, table string, bulkInsert func(io.Writer))
BulkLoad performs a bulk load of rows into a given vttablet.
func (*VttabletProcess) CreateDB ¶
func (vttablet *VttabletProcess) CreateDB(keyspace string) error
CreateDB creates the database for keyspace
func (*VttabletProcess) GetConsolidations ¶ added in v0.16.0
func (vttablet *VttabletProcess) GetConsolidations() (map[string]int, error)
GetConsolidations gets consolidations
func (*VttabletProcess) GetDBStatus ¶
func (vttablet *VttabletProcess) GetDBStatus(status string, ksName string) (string, error)
GetDBStatus returns first matching database variable's value
func (*VttabletProcess) GetDBVar ¶
func (vttablet *VttabletProcess) GetDBVar(varName string, ksName string) (string, error)
GetDBVar returns first matching database variable's value
func (*VttabletProcess) GetStatus ¶
func (vttablet *VttabletProcess) GetStatus() string
GetStatus returns /debug/status endpoint result
func (*VttabletProcess) GetStatusDetails ¶
func (vttablet *VttabletProcess) GetStatusDetails() string
GetStatusDetails gets the status details
func (*VttabletProcess) GetTabletStatus ¶
func (vttablet *VttabletProcess) GetTabletStatus() string
GetTabletStatus returns the tablet state as seen in /debug/vars TabletStateName
func (*VttabletProcess) GetTabletType ¶ added in v0.12.0
func (vttablet *VttabletProcess) GetTabletType() string
GetTabletType returns the tablet type as seen in /debug/vars TabletType
func (*VttabletProcess) GetVars ¶
func (vttablet *VttabletProcess) GetVars() map[string]any
GetVars gets the debug vars as map
func (*VttabletProcess) IsShutdown ¶ added in v0.12.0
func (vttablet *VttabletProcess) IsShutdown() bool
IsShutdown returns whether a vttablet is shutdown or not
func (*VttabletProcess) Kill ¶ added in v0.17.0
func (vttablet *VttabletProcess) Kill() error
Kill shuts down the running vttablet service immediately.
func (*VttabletProcess) MultiQueryTabletWithDB ¶ added in v0.20.0
func (vttablet *VttabletProcess) MultiQueryTabletWithDB(query string, dbname string) error
MultiQueryTabletWithDB lets you execute multiple queries on a specific DB in this tablet.
func (*VttabletProcess) QueryTablet ¶
func (vttablet *VttabletProcess) QueryTablet(query string, keyspace string, useDb bool) (*sqltypes.Result, error)
QueryTablet lets you execute a query in this tablet and get the result
func (*VttabletProcess) QueryTabletMultiple ¶ added in v0.17.6
func (vttablet *VttabletProcess) QueryTabletMultiple(queries []string, keyspace string, useDb bool) error
QueryTabletMultiple lets you execute multiple queries -- without any results -- against the tablet.
func (*VttabletProcess) QueryTabletWithDB ¶
func (vttablet *VttabletProcess) QueryTabletWithDB(query string, dbname string) (*sqltypes.Result, error)
QueryTabletWithDB lets you execute query on a specific DB in this tablet and get the result
func (*VttabletProcess) ResetBinaryLogsCommand ¶ added in v0.20.0
func (vttablet *VttabletProcess) ResetBinaryLogsCommand() (string, error)
ResetBinaryLogsCommand returns the commands to reset binary logs
func (*VttabletProcess) SemiSyncExtensionLoaded ¶ added in v0.19.4
func (vttablet *VttabletProcess) SemiSyncExtensionLoaded() (mysql.SemiSyncType, error)
SemiSyncExtensionLoaded returns what type of semi-sync extension is loaded
func (*VttabletProcess) Setup ¶
func (vttablet *VttabletProcess) Setup() (err error)
Setup starts vttablet process with required arguements
func (*VttabletProcess) TabletConn ¶ added in v0.17.6
TabletConn opens a MySQL connection on this tablet
func (*VttabletProcess) TearDown ¶
func (vttablet *VttabletProcess) TearDown() error
TearDown shuts down the running vttablet service and fails after a timeout
func (*VttabletProcess) TearDownWithTimeout ¶ added in v0.12.0
func (vttablet *VttabletProcess) TearDownWithTimeout(timeout time.Duration) error
TearDownWithTimeout shuts down the running vttablet service and fails once the given duration has elapsed.
func (*VttabletProcess) ToggleProfiling ¶ added in v0.11.0
func (vttablet *VttabletProcess) ToggleProfiling() error
ToggleProfiling enables or disables the configured CPU profiler on this vttablet
func (*VttabletProcess) WaitForBinLogPlayerCount ¶
func (vttablet *VttabletProcess) WaitForBinLogPlayerCount(expectedCount int) error
WaitForBinLogPlayerCount waits till binlog player count var matches
func (*VttabletProcess) WaitForBinlogServerState ¶
func (vttablet *VttabletProcess) WaitForBinlogServerState(expectedStatus string) error
WaitForBinlogServerState wait for the tablet's binlog server to be in the provided state.
func (*VttabletProcess) WaitForStatus ¶
func (vttablet *VttabletProcess) WaitForStatus(status string, howLong time.Duration) bool
WaitForStatus waits till desired status of tablet is reached
func (*VttabletProcess) WaitForTabletStatus ¶ added in v0.12.0
func (vttablet *VttabletProcess) WaitForTabletStatus(expectedStatus string) error
WaitForTabletStatus waits for one of the expected statuses to be reached
func (*VttabletProcess) WaitForTabletStatuses ¶ added in v0.12.0
func (vttablet *VttabletProcess) WaitForTabletStatuses(expectedStatuses []string) error
WaitForTabletStatuses waits for one of expected statuses is reached
func (*VttabletProcess) WaitForTabletStatusesForTimeout ¶ added in v0.12.0
func (vttablet *VttabletProcess) WaitForTabletStatusesForTimeout(expectedStatuses []string, timeout time.Duration) error
WaitForTabletStatusesForTimeout waits till the tablet reaches to any of the provided statuses
func (*VttabletProcess) WaitForTabletTypes ¶
func (vttablet *VttabletProcess) WaitForTabletTypes(expectedTypes []string) error
WaitForTabletTypes waits for one of expected statuses is reached
func (*VttabletProcess) WaitForTabletTypesForTimeout ¶
func (vttablet *VttabletProcess) WaitForTabletTypesForTimeout(expectedTypes []string, timeout time.Duration) error
WaitForTabletTypesForTimeout waits till the tablet reaches to any of the provided types
func (*VttabletProcess) WaitForVReplicationToCatchup ¶ added in v0.11.0
func (vttablet *VttabletProcess) WaitForVReplicationToCatchup(t testing.TB, workflow, database string, sidecarDBName string, duration time.Duration)
WaitForVReplicationToCatchup waits for "workflow" to finish copying