fakemysqldaemon

package
v3.0.0-rc.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

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

	// MysqlPort will be returned by GetMysqlPort(). Set to -1 to
	// return an error.
	MysqlPort int32

	// Replicating is updated when calling StartSlave / StopSlave
	// (it is not used at all when calling SlaveStatus, it is the
	// test owner responsability to have these two match)
	Replicating bool

	// CurrentMasterPosition is returned by MasterPosition
	// and SlaveStatus
	CurrentMasterPosition mysql.Position

	// SlaveStatusError is used by SlaveStatus
	SlaveStatusError error

	// CurrentMasterHost is returned by SlaveStatus
	CurrentMasterHost string

	// CurrentMasterport is returned by SlaveStatus
	CurrentMasterPort int

	// SecondsBehindMaster is returned by SlaveStatus
	SecondsBehindMaster uint

	// ReadOnly is the current value of the flag
	ReadOnly bool

	// SetSlavePositionPos is matched against the input of SetSlavePosition.
	// If it doesn't match, SetSlavePosition will return an error.
	SetSlavePositionPos mysql.Position

	// SetMasterInput is matched against the input of SetMaster
	// (as "%v:%v"). If it doesn't match, SetMaster will return an error.
	SetMasterInput string

	// DemoteMasterPosition is returned by DemoteMaster
	DemoteMasterPosition mysql.Position

	// WaitMasterPosition is checked by WaitMasterPos, if the
	// same it returns nil, if different it returns an error
	WaitMasterPosition mysql.Position

	// PromoteSlaveResult is returned by PromoteSlave
	PromoteSlaveResult mysql.Position

	// 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 (usefull 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

	// SemiSyncMasterEnabled represents the state of rpl_semi_sync_master_enabled.
	SemiSyncMasterEnabled bool
	// SemiSyncSlaveEnabled represents the state of rpl_semi_sync_slave_enabled.
	SemiSyncSlaveEnabled bool
	// 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(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) DemoteMaster

func (fmd *FakeMysqlDaemon) DemoteMaster() (mysql.Position, error)

DemoteMaster is part of the MysqlDaemon interface

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() (*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) GetDbaConnection

func (fmd *FakeMysqlDaemon) GetDbaConnection() (*dbconnpool.DBConnection, error)

GetDbaConnection is part of the MysqlDaemon interface.

func (*FakeMysqlDaemon) GetMysqlPort

func (fmd *FakeMysqlDaemon) GetMysqlPort() (int32, error)

GetMysqlPort is part of the MysqlDaemon interface

func (*FakeMysqlDaemon) GetSchema

func (fmd *FakeMysqlDaemon) GetSchema(dbName string, tables, excludeTables []string, includeViews bool) (*tabletmanagerdatapb.SchemaDefinition, error)

GetSchema is part of the MysqlDaemon interface

func (*FakeMysqlDaemon) IsReadOnly

func (fmd *FakeMysqlDaemon) IsReadOnly() (bool, error)

IsReadOnly is part of the MysqlDaemon interface

func (*FakeMysqlDaemon) MasterPosition

func (fmd *FakeMysqlDaemon) MasterPosition() (mysql.Position, error)

MasterPosition is part of the MysqlDaemon interface

func (*FakeMysqlDaemon) PreflightSchemaChange

func (fmd *FakeMysqlDaemon) PreflightSchemaChange(dbName string, changes []string) ([]*tabletmanagerdatapb.SchemaChangeResult, error)

PreflightSchemaChange is part of the MysqlDaemon interface

func (*FakeMysqlDaemon) PromoteSlave

func (fmd *FakeMysqlDaemon) PromoteSlave(hookExtraEnv map[string]string) (mysql.Position, error)

PromoteSlave is part of the MysqlDaemon interface

func (*FakeMysqlDaemon) RefreshConfig

func (fmd *FakeMysqlDaemon) RefreshConfig(ctx context.Context, cnf *mysqlctl.Mycnf) error

RefreshConfig is part of the MysqlDaemon interface

func (*FakeMysqlDaemon) ReinitConfig

func (fmd *FakeMysqlDaemon) ReinitConfig(ctx context.Context, cnf *mysqlctl.Mycnf) error

ReinitConfig 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) RunMysqlUpgrade

func (fmd *FakeMysqlDaemon) RunMysqlUpgrade() error

RunMysqlUpgrade is part of the MysqlDaemon interface

func (*FakeMysqlDaemon) SemiSyncEnabled

func (fmd *FakeMysqlDaemon) SemiSyncEnabled() (master, slave bool)

SemiSyncEnabled is part of the MysqlDaemon interface.

func (*FakeMysqlDaemon) SemiSyncSlaveStatus

func (fmd *FakeMysqlDaemon) SemiSyncSlaveStatus() (bool, error)

SemiSyncSlaveStatus is part of the MysqlDaemon interface.

func (*FakeMysqlDaemon) SetMaster

func (fmd *FakeMysqlDaemon) SetMaster(ctx context.Context, masterHost string, masterPort int, slaveStopBefore bool, slaveStartAfter bool) error

SetMaster 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) SetSemiSyncEnabled

func (fmd *FakeMysqlDaemon) SetSemiSyncEnabled(master, slave bool) error

SetSemiSyncEnabled is part of the MysqlDaemon interface.

func (*FakeMysqlDaemon) SetSlavePosition

func (fmd *FakeMysqlDaemon) SetSlavePosition(ctx context.Context, pos mysql.Position) error

SetSlavePosition 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) SlaveStatus

func (fmd *FakeMysqlDaemon) SlaveStatus() (mysql.SlaveStatus, error)

SlaveStatus 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) StartSlave

func (fmd *FakeMysqlDaemon) StartSlave(hookExtraEnv map[string]string) error

StartSlave is part of the MysqlDaemon interface.

func (*FakeMysqlDaemon) StopSlave

func (fmd *FakeMysqlDaemon) StopSlave(hookExtraEnv map[string]string) error

StopSlave is part of the MysqlDaemon interface.

func (*FakeMysqlDaemon) Wait

func (fmd *FakeMysqlDaemon) Wait(ctx context.Context, cnf *mysqlctl.Mycnf) error

Wait 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) WaitMasterPos

func (fmd *FakeMysqlDaemon) WaitMasterPos(_ context.Context, pos mysql.Position) error

WaitMasterPos is part of the MysqlDaemon interface

Jump to

Keyboard shortcuts

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