Documentation ¶
Index ¶
- type FakeMysqlDaemon
- func (fmd *FakeMysqlDaemon) ApplySchemaChange(ctx context.Context, dbName string, change *tmutils.SchemaChange) (*tabletmanagerdatapb.SchemaChangeResult, error)
- func (fmd *FakeMysqlDaemon) CheckSuperQueryList() error
- func (fmd *FakeMysqlDaemon) Close()
- func (fmd *FakeMysqlDaemon) CurrentPrimaryPositionLocked(pos mysql.Position)
- func (fmd *FakeMysqlDaemon) DisableBinlogPlayback() error
- func (fmd *FakeMysqlDaemon) EnableBinlogPlayback() error
- func (fmd *FakeMysqlDaemon) ExecuteSuperQueryList(ctx context.Context, queryList []string) error
- func (fmd *FakeMysqlDaemon) FetchSuperQuery(ctx context.Context, query string) (*sqltypes.Result, error)
- func (fmd *FakeMysqlDaemon) GetAllPrivsConnection(ctx context.Context) (*dbconnpool.DBConnection, error)
- func (fmd *FakeMysqlDaemon) GetAppConnection(ctx context.Context) (*dbconnpool.PooledDBConnection, error)
- func (fmd *FakeMysqlDaemon) GetBinlogInformation(ctx context.Context) (binlogFormat string, logEnabled bool, logReplicaUpdate bool, ...)
- func (fmd *FakeMysqlDaemon) GetColumns(ctx context.Context, dbName, table string) ([]*querypb.Field, []string, error)
- func (fmd *FakeMysqlDaemon) GetDbaConnection(ctx context.Context) (*dbconnpool.DBConnection, error)
- func (fmd *FakeMysqlDaemon) GetGTIDMode(ctx context.Context) (gtidMode string, err error)
- func (fmd *FakeMysqlDaemon) GetGTIDPurged(ctx context.Context) (mysql.Position, error)
- func (fmd *FakeMysqlDaemon) GetMysqlPort() (int32, error)
- func (fmd *FakeMysqlDaemon) GetPrimaryKeyColumns(ctx context.Context, dbName, table string) ([]string, error)
- func (fmd *FakeMysqlDaemon) GetPrimaryKeyEquivalentColumns(ctx context.Context, dbName, table string) ([]string, error)
- func (fmd *FakeMysqlDaemon) GetSchema(ctx context.Context, dbName string, tables, excludeTables []string, ...) (*tabletmanagerdatapb.SchemaDefinition, error)
- func (fmd *FakeMysqlDaemon) GetServerID(ctx context.Context) (uint32, error)
- func (fmd *FakeMysqlDaemon) GetServerUUID(ctx context.Context) (string, error)
- func (fmd *FakeMysqlDaemon) GetVersionComment(ctx context.Context) string
- func (fmd *FakeMysqlDaemon) GetVersionString() string
- func (fmd *FakeMysqlDaemon) IsReadOnly() (bool, error)
- func (fmd *FakeMysqlDaemon) PreflightSchemaChange(ctx context.Context, dbName string, changes []string) ([]*tabletmanagerdatapb.SchemaChangeResult, error)
- func (fmd *FakeMysqlDaemon) PrimaryPosition() (mysql.Position, error)
- func (fmd *FakeMysqlDaemon) PrimaryStatus(ctx context.Context) (mysql.PrimaryStatus, error)
- func (fmd *FakeMysqlDaemon) Promote(hookExtraEnv map[string]string) (mysql.Position, error)
- func (fmd *FakeMysqlDaemon) RefreshConfig(ctx context.Context, cnf *mysqlctl.Mycnf) error
- func (fmd *FakeMysqlDaemon) ReinitConfig(ctx context.Context, cnf *mysqlctl.Mycnf) error
- func (fmd *FakeMysqlDaemon) ReplicationStatus() (mysql.ReplicationStatus, error)
- func (fmd *FakeMysqlDaemon) ResetReplication(ctx context.Context) error
- func (fmd *FakeMysqlDaemon) ResetReplicationParameters(ctx context.Context) error
- func (fmd *FakeMysqlDaemon) RestartReplication(hookExtraEnv map[string]string) error
- func (fmd *FakeMysqlDaemon) RunMysqlUpgrade() error
- func (fmd *FakeMysqlDaemon) SemiSyncClients() uint32
- func (fmd *FakeMysqlDaemon) SemiSyncEnabled() (primary, replica bool)
- func (fmd *FakeMysqlDaemon) SemiSyncReplicationStatus() (bool, error)
- func (fmd *FakeMysqlDaemon) SemiSyncSettings() (timeout uint64, numReplicas uint32)
- func (fmd *FakeMysqlDaemon) SemiSyncStatus() (bool, bool)
- func (fmd *FakeMysqlDaemon) SetReadOnly(on bool) error
- func (fmd *FakeMysqlDaemon) SetReplicationPosition(ctx context.Context, pos mysql.Position) error
- func (fmd *FakeMysqlDaemon) SetReplicationSource(ctx context.Context, host string, port int, stopReplicationBefore bool, ...) error
- func (fmd *FakeMysqlDaemon) SetSemiSyncEnabled(primary, replica bool) error
- func (fmd *FakeMysqlDaemon) SetSuperReadOnly(on bool) error
- func (fmd *FakeMysqlDaemon) Shutdown(ctx context.Context, cnf *mysqlctl.Mycnf, waitForMysqld bool) error
- func (fmd *FakeMysqlDaemon) Start(ctx context.Context, cnf *mysqlctl.Mycnf, mysqldArgs ...string) error
- func (fmd *FakeMysqlDaemon) StartReplication(hookExtraEnv map[string]string) error
- func (fmd *FakeMysqlDaemon) StartReplicationUntilAfter(ctx context.Context, pos mysql.Position) error
- func (fmd *FakeMysqlDaemon) StopIOThread(ctx context.Context) error
- func (fmd *FakeMysqlDaemon) StopReplication(hookExtraEnv map[string]string) error
- func (fmd *FakeMysqlDaemon) Wait(ctx context.Context, cnf *mysqlctl.Mycnf) error
- func (fmd *FakeMysqlDaemon) WaitForReparentJournal(ctx context.Context, timeCreatedNS int64) error
- func (fmd *FakeMysqlDaemon) WaitSourcePos(_ context.Context, pos mysql.Position) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FakeMysqlDaemon ¶
type FakeMysqlDaemon struct { // Running is used by Start / Shutdown Running bool // StartupTime is used to simulate mysqlds that take some time to respond // to a "start" command. It is used by Start. StartupTime time.Duration // ShutdownTime is used to simulate mysqlds that take some time to respond // to a "stop" request (i.e. a wedged systemd unit). It is used by Shutdown. ShutdownTime time.Duration // MysqlPort will be returned by GetMysqlPort(). Set to -1 to // return an error. MysqlPort sync2.AtomicInt32 // Replicating is updated when calling StartReplication / StopReplication // (it is not used at all when calling ReplicationStatus, it is the // test owner responsibility to have these two match) Replicating bool // IOThreadRunning is always true except in one testcase // where we want to test error handling during SetReplicationSource IOThreadRunning bool // CurrentPrimaryPosition is returned by PrimaryPosition // and ReplicationStatus CurrentPrimaryPosition mysql.Position // CurrentSourceFilePosition is used to determine the executed file based positioning of the replication source. CurrentSourceFilePosition mysql.Position // ReplicationStatusError is used by ReplicationStatus ReplicationStatusError error // StartReplicationError is used by StartReplication StartReplicationError error // PromoteLag is the time for which Promote will stall PromoteLag time.Duration // PrimaryStatusError is used by PrimaryStatus PrimaryStatusError error // CurrentSourceHost is returned by ReplicationStatus CurrentSourceHost string // CurrentSourcePort is returned by ReplicationStatus CurrentSourcePort int // ReplicationLagSeconds is returned by ReplicationStatus ReplicationLagSeconds uint // ReadOnly is the current value of the flag ReadOnly bool // SuperReadOnly is the current value of the flag SuperReadOnly bool // SetReplicationPositionPos is matched against the input of SetReplicationPosition. // If it doesn't match, SetReplicationPosition will return an error. SetReplicationPositionPos mysql.Position // StartReplicationUntilAfterPos is matched against the input StartReplicationUntilAfterPos mysql.Position // SetReplicationSourceInputs are matched against the input of SetReplicationSource // (as "%v:%v"). If all of them don't match, SetReplicationSource will return an error. SetReplicationSourceInputs []string // SetReplicationSourceError is used by SetReplicationSource SetReplicationSourceError error // WaitPrimaryPositions is checked by WaitSourcePos, if the value is found // in it, then the function returns nil, else the function returns an error WaitPrimaryPositions []mysql.Position // PromoteResult is returned by Promote PromoteResult mysql.Position // PromoteError is used by Promote PromoteError error // SchemaFunc provides the return value for GetSchema. // If not defined, the "Schema" field will be used instead, see below. SchemaFunc func() (*tabletmanagerdatapb.SchemaDefinition, error) // Schema will be returned by GetSchema. If nil we'll // return an error. Schema *tabletmanagerdatapb.SchemaDefinition // PreflightSchemaChangeResult will be returned by PreflightSchemaChange. // If nil we'll return an error. PreflightSchemaChangeResult []*tabletmanagerdatapb.SchemaChangeResult // ApplySchemaChangeResult will be returned by ApplySchemaChange. // If nil we'll return an error. ApplySchemaChangeResult *tabletmanagerdatapb.SchemaChangeResult // ExpectedExecuteSuperQueryList is what we expect // ExecuteSuperQueryList to be called with. If it doesn't // match, ExecuteSuperQueryList will return an error. // Note each string is just a substring if it begins with SUB, // so we support partial queries (useful when queries contain // data fields like timestamps) ExpectedExecuteSuperQueryList []string // ExpectedExecuteSuperQueryCurrent is the current index of the queries // we expect ExpectedExecuteSuperQueryCurrent int // FetchSuperQueryResults is used by FetchSuperQuery FetchSuperQueryMap map[string]*sqltypes.Result // BinlogPlayerEnabled is used by {Enable,Disable}BinlogPlayer BinlogPlayerEnabled sync2.AtomicBool // SemiSyncPrimaryEnabled represents the state of rpl_semi_sync_master_enabled. SemiSyncPrimaryEnabled bool // SemiSyncReplicaEnabled represents the state of rpl_semi_sync_slave_enabled. SemiSyncReplicaEnabled bool // TimeoutHook is a func that can be called at the beginning of any method to fake a timeout. // all a test needs to do is make it { return context.DeadlineExceeded } TimeoutHook func() error // contains filtered or unexported fields }
FakeMysqlDaemon implements MysqlDaemon and allows the user to fake everything.
func NewFakeMysqlDaemon ¶
func NewFakeMysqlDaemon(db *fakesqldb.DB) *FakeMysqlDaemon
NewFakeMysqlDaemon returns a FakeMysqlDaemon where mysqld appears to be running, based on a fakesqldb.DB. 'db' can be nil if the test doesn't use a database at all.
func (*FakeMysqlDaemon) ApplySchemaChange ¶
func (fmd *FakeMysqlDaemon) ApplySchemaChange(ctx context.Context, dbName string, change *tmutils.SchemaChange) (*tabletmanagerdatapb.SchemaChangeResult, error)
ApplySchemaChange is part of the MysqlDaemon interface
func (*FakeMysqlDaemon) CheckSuperQueryList ¶
func (fmd *FakeMysqlDaemon) CheckSuperQueryList() error
CheckSuperQueryList returns an error if all the queries we expected haven't been seen.
func (*FakeMysqlDaemon) Close ¶
func (fmd *FakeMysqlDaemon) Close()
Close is part of the MysqlDaemon interface
func (*FakeMysqlDaemon) CurrentPrimaryPositionLocked ¶ added in v0.11.0
func (fmd *FakeMysqlDaemon) CurrentPrimaryPositionLocked(pos mysql.Position)
CurrentPrimaryPositionLocked is thread-safe
func (*FakeMysqlDaemon) DisableBinlogPlayback ¶
func (fmd *FakeMysqlDaemon) DisableBinlogPlayback() error
DisableBinlogPlayback disable playback of binlog events
func (*FakeMysqlDaemon) EnableBinlogPlayback ¶
func (fmd *FakeMysqlDaemon) EnableBinlogPlayback() error
EnableBinlogPlayback is part of the MysqlDaemon interface
func (*FakeMysqlDaemon) ExecuteSuperQueryList ¶
func (fmd *FakeMysqlDaemon) ExecuteSuperQueryList(ctx context.Context, queryList []string) error
ExecuteSuperQueryList is part of the MysqlDaemon interface
func (*FakeMysqlDaemon) FetchSuperQuery ¶
func (fmd *FakeMysqlDaemon) FetchSuperQuery(ctx context.Context, query string) (*sqltypes.Result, error)
FetchSuperQuery returns the results from the map, if any
func (*FakeMysqlDaemon) GetAllPrivsConnection ¶
func (fmd *FakeMysqlDaemon) GetAllPrivsConnection(ctx context.Context) (*dbconnpool.DBConnection, error)
GetAllPrivsConnection is part of the MysqlDaemon interface.
func (*FakeMysqlDaemon) GetAppConnection ¶
func (fmd *FakeMysqlDaemon) GetAppConnection(ctx context.Context) (*dbconnpool.PooledDBConnection, error)
GetAppConnection is part of the MysqlDaemon interface.
func (*FakeMysqlDaemon) GetBinlogInformation ¶ added in v0.14.0
func (fmd *FakeMysqlDaemon) GetBinlogInformation(ctx context.Context) (binlogFormat string, logEnabled bool, logReplicaUpdate bool, binlogRowImage string, err error)
GetBinlogInformation is part of the MysqlDaemon interface.
func (*FakeMysqlDaemon) GetColumns ¶
func (fmd *FakeMysqlDaemon) GetColumns(ctx context.Context, dbName, table string) ([]*querypb.Field, []string, error)
GetColumns is part of the MysqlDaemon interface
func (*FakeMysqlDaemon) GetDbaConnection ¶
func (fmd *FakeMysqlDaemon) GetDbaConnection(ctx context.Context) (*dbconnpool.DBConnection, error)
GetDbaConnection is part of the MysqlDaemon interface.
func (*FakeMysqlDaemon) GetGTIDMode ¶ added in v0.14.0
func (fmd *FakeMysqlDaemon) GetGTIDMode(ctx context.Context) (gtidMode string, err error)
GetGTIDMode is part of the MysqlDaemon interface.
func (*FakeMysqlDaemon) GetGTIDPurged ¶ added in v0.14.0
GetGTIDPurged is part of the MysqlDaemon interface
func (*FakeMysqlDaemon) GetMysqlPort ¶
func (fmd *FakeMysqlDaemon) GetMysqlPort() (int32, error)
GetMysqlPort is part of the MysqlDaemon interface
func (*FakeMysqlDaemon) GetPrimaryKeyColumns ¶
func (fmd *FakeMysqlDaemon) GetPrimaryKeyColumns(ctx context.Context, dbName, table string) ([]string, error)
GetPrimaryKeyColumns is part of the MysqlDaemon interface
func (*FakeMysqlDaemon) GetPrimaryKeyEquivalentColumns ¶ added in v0.14.0
func (fmd *FakeMysqlDaemon) GetPrimaryKeyEquivalentColumns(ctx context.Context, dbName, table string) ([]string, error)
GetPrimaryKeyEquivalentColumns is part of the MysqlDaemon interface
func (*FakeMysqlDaemon) GetSchema ¶
func (fmd *FakeMysqlDaemon) GetSchema(ctx context.Context, dbName string, tables, excludeTables []string, includeViews bool) (*tabletmanagerdatapb.SchemaDefinition, error)
GetSchema is part of the MysqlDaemon interface
func (*FakeMysqlDaemon) GetServerID ¶ added in v0.14.0
func (fmd *FakeMysqlDaemon) GetServerID(ctx context.Context) (uint32, error)
GetServerID is part of the MysqlDaemon interface
func (*FakeMysqlDaemon) GetServerUUID ¶ added in v0.14.0
func (fmd *FakeMysqlDaemon) GetServerUUID(ctx context.Context) (string, error)
GetServerUUID is part of the MysqlDaemon interface
func (*FakeMysqlDaemon) GetVersionComment ¶ added in v0.14.0
func (fmd *FakeMysqlDaemon) GetVersionComment(ctx context.Context) string
GetVersionComment is part of the MysqlDeamon interface.
func (*FakeMysqlDaemon) GetVersionString ¶ added in v0.13.0
func (fmd *FakeMysqlDaemon) GetVersionString() string
GetVersionString is part of the MysqlDeamon interface.
func (*FakeMysqlDaemon) IsReadOnly ¶
func (fmd *FakeMysqlDaemon) IsReadOnly() (bool, error)
IsReadOnly is part of the MysqlDaemon interface
func (*FakeMysqlDaemon) PreflightSchemaChange ¶
func (fmd *FakeMysqlDaemon) PreflightSchemaChange(ctx context.Context, dbName string, changes []string) ([]*tabletmanagerdatapb.SchemaChangeResult, error)
PreflightSchemaChange is part of the MysqlDaemon interface
func (*FakeMysqlDaemon) PrimaryPosition ¶ added in v0.11.0
func (fmd *FakeMysqlDaemon) PrimaryPosition() (mysql.Position, error)
PrimaryPosition is part of the MysqlDaemon interface
func (*FakeMysqlDaemon) PrimaryStatus ¶ added in v0.11.0
func (fmd *FakeMysqlDaemon) PrimaryStatus(ctx context.Context) (mysql.PrimaryStatus, error)
PrimaryStatus is part of the MysqlDaemon interface
func (*FakeMysqlDaemon) RefreshConfig ¶
RefreshConfig is part of the MysqlDaemon interface
func (*FakeMysqlDaemon) ReinitConfig ¶
ReinitConfig is part of the MysqlDaemon interface
func (*FakeMysqlDaemon) ReplicationStatus ¶
func (fmd *FakeMysqlDaemon) ReplicationStatus() (mysql.ReplicationStatus, error)
ReplicationStatus is part of the MysqlDaemon interface
func (*FakeMysqlDaemon) ResetReplication ¶
func (fmd *FakeMysqlDaemon) ResetReplication(ctx context.Context) error
ResetReplication is part of the MysqlDaemon interface.
func (*FakeMysqlDaemon) ResetReplicationParameters ¶ added in v0.14.0
func (fmd *FakeMysqlDaemon) ResetReplicationParameters(ctx context.Context) error
ResetReplicationParameters is part of the MysqlDaemon interface.
func (*FakeMysqlDaemon) RestartReplication ¶
func (fmd *FakeMysqlDaemon) RestartReplication(hookExtraEnv map[string]string) error
RestartReplication is part of the MysqlDaemon interface.
func (*FakeMysqlDaemon) RunMysqlUpgrade ¶
func (fmd *FakeMysqlDaemon) RunMysqlUpgrade() error
RunMysqlUpgrade is part of the MysqlDaemon interface
func (*FakeMysqlDaemon) SemiSyncClients ¶ added in v0.14.0
func (fmd *FakeMysqlDaemon) SemiSyncClients() uint32
SemiSyncClients is part of the MysqlDaemon interface.
func (*FakeMysqlDaemon) SemiSyncEnabled ¶
func (fmd *FakeMysqlDaemon) SemiSyncEnabled() (primary, replica bool)
SemiSyncEnabled is part of the MysqlDaemon interface.
func (*FakeMysqlDaemon) SemiSyncReplicationStatus ¶
func (fmd *FakeMysqlDaemon) SemiSyncReplicationStatus() (bool, error)
SemiSyncReplicationStatus is part of the MysqlDaemon interface.
func (*FakeMysqlDaemon) SemiSyncSettings ¶ added in v0.14.0
func (fmd *FakeMysqlDaemon) SemiSyncSettings() (timeout uint64, numReplicas uint32)
SemiSyncSettings is part of the MysqlDaemon interface.
func (*FakeMysqlDaemon) SemiSyncStatus ¶ added in v0.14.0
func (fmd *FakeMysqlDaemon) SemiSyncStatus() (bool, bool)
SemiSyncStatus is part of the MysqlDaemon interface.
func (*FakeMysqlDaemon) SetReadOnly ¶
func (fmd *FakeMysqlDaemon) SetReadOnly(on bool) error
SetReadOnly is part of the MysqlDaemon interface
func (*FakeMysqlDaemon) SetReplicationPosition ¶
SetReplicationPosition is part of the MysqlDaemon interface.
func (*FakeMysqlDaemon) SetReplicationSource ¶ added in v0.11.0
func (fmd *FakeMysqlDaemon) SetReplicationSource(ctx context.Context, host string, port int, stopReplicationBefore bool, startReplicationAfter bool) error
SetReplicationSource is part of the MysqlDaemon interface.
func (*FakeMysqlDaemon) SetSemiSyncEnabled ¶
func (fmd *FakeMysqlDaemon) SetSemiSyncEnabled(primary, replica bool) error
SetSemiSyncEnabled is part of the MysqlDaemon interface.
func (*FakeMysqlDaemon) SetSuperReadOnly ¶
func (fmd *FakeMysqlDaemon) SetSuperReadOnly(on bool) error
SetSuperReadOnly is part of the MysqlDaemon interface
func (*FakeMysqlDaemon) Shutdown ¶
func (fmd *FakeMysqlDaemon) Shutdown(ctx context.Context, cnf *mysqlctl.Mycnf, waitForMysqld bool) error
Shutdown is part of the MysqlDaemon interface
func (*FakeMysqlDaemon) Start ¶
func (fmd *FakeMysqlDaemon) Start(ctx context.Context, cnf *mysqlctl.Mycnf, mysqldArgs ...string) error
Start is part of the MysqlDaemon interface
func (*FakeMysqlDaemon) StartReplication ¶
func (fmd *FakeMysqlDaemon) StartReplication(hookExtraEnv map[string]string) error
StartReplication is part of the MysqlDaemon interface.
func (*FakeMysqlDaemon) StartReplicationUntilAfter ¶
func (fmd *FakeMysqlDaemon) StartReplicationUntilAfter(ctx context.Context, pos mysql.Position) error
StartReplicationUntilAfter is part of the MysqlDaemon interface.
func (*FakeMysqlDaemon) StopIOThread ¶
func (fmd *FakeMysqlDaemon) StopIOThread(ctx context.Context) error
StopIOThread is part of the MysqlDaemon interface.
func (*FakeMysqlDaemon) StopReplication ¶
func (fmd *FakeMysqlDaemon) StopReplication(hookExtraEnv map[string]string) error
StopReplication is part of the MysqlDaemon interface.
func (*FakeMysqlDaemon) WaitForReparentJournal ¶
func (fmd *FakeMysqlDaemon) WaitForReparentJournal(ctx context.Context, timeCreatedNS int64) error
WaitForReparentJournal is part of the MysqlDaemon interface
func (*FakeMysqlDaemon) WaitSourcePos ¶ added in v0.11.0
WaitSourcePos is part of the MysqlDaemon interface