executor

package
v0.0.0-...-dfd9850 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Executor

type Executor struct {
	sync.Mutex

	// SQL channel
	SQLCh chan *types.SQL
	// Since we must ensure no other transactions commit or begin between the transaction start time points of abtest
	// when a transaction begins/commits/rollbacks, generator wait for it ready for both A/B side
	// This channel is for sending signal to generator when both A/B side's begin/commit/rollback are ready
	TxnReadyCh chan struct{}
	// ErrCh for waiting SQL execution finish
	// and pass execution error
	ErrCh chan error
	// OnlineTable record tables which are manipulated in transaction for avoiding online DDL
	OnlineTable []string
	TiFlash     bool
	// contains filtered or unexported fields
}

Executor define test executor

func New

func New(dsn string, opt *Option, tiFlash bool) (*Executor, error)

New create Executor

func NewABTest

func NewABTest(dsn1, dsn2 string, opt *Option, tiFlash bool) (*Executor, error)

NewABTest create abtest Executor

func NewDMTest

func NewDMTest(dsn1, dsn2, dsn3 string, opt *Option, start bool) (*Executor, error)

NewDMTest creates a DM test Executor. one `Start` for one executor.

func (*Executor) ABTestDelete

func (e *Executor) ABTestDelete(sql string) error

ABTestDelete expose abTestDelete

func (*Executor) ABTestExecDDL

func (e *Executor) ABTestExecDDL(sql string) error

ABTestExecDDL expose abTestExecDDL

func (*Executor) ABTestIfTxn

func (e *Executor) ABTestIfTxn() bool

ABTestIfTxn expose abTestIfTxn

func (*Executor) ABTestInsert

func (e *Executor) ABTestInsert(sql string) error

ABTestInsert expose abTestInsert

func (*Executor) ABTestSelect

func (e *Executor) ABTestSelect(sql string) error

ABTestSelect expose abTestSelect

func (*Executor) ABTestTxnBegin

func (e *Executor) ABTestTxnBegin() error

ABTestTxnBegin export abTestTxnBegin

func (*Executor) ABTestTxnCommit

func (e *Executor) ABTestTxnCommit() error

ABTestTxnCommit export abTestTxnCommit

func (*Executor) ABTestTxnRollback

func (e *Executor) ABTestTxnRollback() error

ABTestTxnRollback export abTestTxnRollback

func (*Executor) ABTestUpdate

func (e *Executor) ABTestUpdate(sql string) error

ABTestUpdate expose abTestUpdate

func (*Executor) BeginWithOnlineTables

func (e *Executor) BeginWithOnlineTables()

BeginWithOnlineTables begins transaction with online tables

func (*Executor) Close

func (e *Executor) Close() error

Close close connection

func (*Executor) DMSelectEqual

func (e *Executor) DMSelectEqual(sql string, conn1, conn2 *connection.Connection) error

DMSelectEqual check data equal by `SELECT`.

func (*Executor) Delete

func (e *Executor) Delete(stmt string) error

Delete offer unified method for single & abtest

func (*Executor) EndTransaction

func (e *Executor) EndTransaction()

EndTransaction clear online tables

func (*Executor) Exec

func (e *Executor) Exec(sql string) error

Exec function for quick executor some SQLs

func (*Executor) ExecDDL

func (e *Executor) ExecDDL(stmt string) error

ExecDDL offer unified method for single & abtest

func (*Executor) ExecIgnoreErr

func (e *Executor) ExecIgnoreErr(sql string)

ExecIgnoreErr function for quick executor some SQLs with error tolerance

func (*Executor) ExecSQL

func (e *Executor) ExecSQL(sql *types.SQL) error

ExecSQL add sql into exec queue

func (*Executor) GenerateDDLAlterTable

func (e *Executor) GenerateDDLAlterTable(opt *generator.DDLOptions) (*types.SQL, error)

GenerateDDLAlterTable rand alter table statement

func (*Executor) GenerateDDLCreateIndex

func (e *Executor) GenerateDDLCreateIndex(opt *generator.DDLOptions) (*types.SQL, error)

GenerateDDLCreateIndex rand create index statement

func (*Executor) GenerateDDLCreateTable

func (e *Executor) GenerateDDLCreateTable() (*types.SQL, error)

GenerateDDLCreateTable rand create table statement

func (*Executor) GenerateDMLDelete

func (e *Executor) GenerateDMLDelete() (*types.SQL, error)

GenerateDMLDelete rand update statement

func (*Executor) GenerateDMLInsert

func (e *Executor) GenerateDMLInsert() (*types.SQL, error)

GenerateDMLInsert rand insert statement

func (*Executor) GenerateDMLSelect

func (e *Executor) GenerateDMLSelect() (*types.SQL, error)

GenerateDMLSelect rand select statement

func (*Executor) GenerateDMLSelectForUpdate

func (e *Executor) GenerateDMLSelectForUpdate() (*types.SQL, error)

GenerateDMLSelectForUpdate rand update statement

func (*Executor) GenerateDMLUpdate

func (e *Executor) GenerateDMLUpdate() (*types.SQL, error)

GenerateDMLUpdate rand update statement

func (*Executor) GenerateSleep

func (e *Executor) GenerateSleep() *types.SQL

GenerateSleep rand insert statement

func (*Executor) GenerateTxnBegin

func (e *Executor) GenerateTxnBegin() *types.SQL

GenerateTxnBegin start transaction

func (*Executor) GenerateTxnCommit

func (e *Executor) GenerateTxnCommit() *types.SQL

GenerateTxnCommit commit transaction

func (*Executor) GenerateTxnRollback

func (e *Executor) GenerateTxnRollback() *types.SQL

GenerateTxnRollback rollback transaction

func (*Executor) GetConn

func (e *Executor) GetConn() *connection.Connection

GetConn get connection of first connection

func (*Executor) GetConn1

func (e *Executor) GetConn1() *connection.Connection

GetConn1 get connection of first connection

func (*Executor) GetConn2

func (e *Executor) GetConn2() *connection.Connection

GetConn2 get connection of second connection

func (*Executor) GetConn3

func (e *Executor) GetConn3() *connection.Connection

GetConn3 get connection of third connection.

func (*Executor) GetID

func (e *Executor) GetID() int

GetID return executor id

func (*Executor) IfTxn

func (e *Executor) IfTxn() bool

IfTxn show if in a transaction

func (*Executor) Insert

func (e *Executor) Insert(stmt string) error

Insert offer unified method for single & abtest

func (*Executor) PrintSchema

func (e *Executor) PrintSchema() error

PrintSchema print schema information and return

func (*Executor) ReConnect

func (e *Executor) ReConnect() error

ReConnect rebuild connection

func (*Executor) ReloadSchema

func (e *Executor) ReloadSchema() error

ReloadSchema expose reloadSchema

func (*Executor) Select

func (e *Executor) Select(stmt string) error

Select offer unified method for single & abtest

func (*Executor) SingleTestDelete

func (e *Executor) SingleTestDelete(sql string) error

SingleTestDelete expose singleTestDelete

func (*Executor) SingleTestExecDDL

func (e *Executor) SingleTestExecDDL(sql string) error

SingleTestExecDDL expose singleTestExecDDL

func (*Executor) SingleTestIfTxn

func (e *Executor) SingleTestIfTxn() bool

SingleTestIfTxn expose singleTestIfTxn

func (*Executor) SingleTestInsert

func (e *Executor) SingleTestInsert(sql string) error

SingleTestInsert expose singleTestInsert

func (*Executor) SingleTestSelect

func (e *Executor) SingleTestSelect(sql string) error

SingleTestSelect expose singleTestSelect

func (*Executor) SingleTestTxnBegin

func (e *Executor) SingleTestTxnBegin() error

SingleTestTxnBegin export singleTestTxnBegin

func (*Executor) SingleTestTxnCommit

func (e *Executor) SingleTestTxnCommit() error

SingleTestTxnCommit export singleTestTxnCommit

func (*Executor) SingleTestTxnRollback

func (e *Executor) SingleTestTxnRollback() error

SingleTestTxnRollback export singleTestTxnRollback

func (*Executor) SingleTestUpdate

func (e *Executor) SingleTestUpdate(sql string) error

SingleTestUpdate expose singleTestUpdate

func (*Executor) Start

func (e *Executor) Start()

Start start test

func (*Executor) Stop

func (e *Executor) Stop(msg string)

Stop exit process

func (*Executor) TxnBegin

func (e *Executor) TxnBegin() error

TxnBegin offer unified method for single & abtest

func (*Executor) TxnCommit

func (e *Executor) TxnCommit() error

TxnCommit offer unified method for single & abtest

func (*Executor) TxnRollback

func (e *Executor) TxnRollback() error

TxnRollback offer unified method for single & abtest

func (*Executor) Update

func (e *Executor) Update(stmt string) error

Update offer unified method for single & abtest

func (*Executor) WaitTiFlashTableSync

func (e *Executor) WaitTiFlashTableSync(table string) error

WaitTiFlashTableSync waits table sync to TiFlash

type Option

type Option struct {
	ID         int
	Clear      bool
	Log        string
	LogSuffix  string
	Reproduce  string
	Stable     bool
	Mute       bool
	OnlineDDL  bool
	GeneralLog bool
	Hint       bool
	TiFlash    bool
}

Option struct

func (*Option) Clone

func (o *Option) Clone() *Option

Clone option

Jump to

Keyboard shortcuts

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