mysql_test

package
v0.9.24 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2019 License: Apache-2.0 Imports: 20 Imported by: 1

Documentation

Index

Constants

View Source
const DummyTableName = "dummy_table"
View Source
const TestDBPrefix = "__test_drc__"
View Source
const TestScanColumnTableIdPrimary = "test_scan_column_id_primary"
View Source
const TestScanColumnTableMultiPrimary = "test_scan_column_multiple_primary"
View Source
const TestScanColumnTableNoKey = "test_scan_column_no_key"
View Source
const TestScanColumnTableUniqueIndexEmailString = "test_scan_column_unique_index_email_string"
View Source
const TestScanColumnTableUniqueIndexTime = "test_scan_column_unique_index_time"
View Source
const TestTableName = "test_table"
View Source
const TestTableWithoutTs = "test_table_without_ts"
View Source
const TxnRouteTableName = "drc_routes"

Variables

View Source
var MaxConn = 2048

Functions

func CountTestTable

func CountTestTable(db *sql.DB, testDBName string, testTableName string) (int, error)

func DeleteTestTable

func DeleteTestTable(db *sql.DB, testDBName string, testTableName string, id int) error

func InsertIntoTestTable

func InsertIntoTestTable(db *sql.DB, testDBName string, testTableName string, args map[string]interface{}) error

func InsertIntoTestTableWithTxnRoute

func InsertIntoTestTableWithTxnRoute(db *sql.DB, testDBName string, testTableName string, args map[string]interface{}, region string) error

func IsDeadSignal

func IsDeadSignal(schema string, table string) bool

func IsTestDB

func IsTestDB(schemaName string) bool

func MustCreateSourceDBConn

func MustCreateSourceDBConn() *sql.DB

func MustCreateTargetDBConn

func MustCreateTargetDBConn() *sql.DB

func MustSetupSourceDB

func MustSetupSourceDB(dbName string) *sql.DB

MustSetupSourceDB setup a test db, so that we can use different db in different test cases

func MustSetupTargetDB

func MustSetupTargetDB(dbName string) *sql.DB

func QueryTestTable

func QueryTestTable(db *sql.DB, testDBName string, testTableName string, id int) (string, error)

func SendDeadSignal

func SendDeadSignal(db *sql.DB, pipeline string) error

func SetMySQLGlobalVars

func SetMySQLGlobalVars(db *sql.DB)

func SourceDBConfig

func SourceDBConfig() *utils.DBConfig

func TargetDBConfig

func TargetDBConfig() *utils.DBConfig

func TestChecksum

func TestChecksum(t *testing.T, tableNames []string, sourceDB *sql.DB, sourceDBName string, targetDB *sql.DB, targetDBName string)

func TestDBName

func TestDBName(name string) string

func UpdateTestTable

func UpdateTestTable(db *sql.DB, testDBName string, testTableName string, id int, newName string) error

func UpdateTestTableWithMultiRows

func UpdateTestTableWithMultiRows(db *sql.DB, testDBName string, testTableName string, whereClause string) error

Types

type Column

type Column struct {
	// contains filtered or unexported fields
}

type Generator

type Generator struct {
	GeneratorConfig

	SourceDB     *sql.DB
	SourceSchema string

	TargetDB     *sql.DB
	TargetSchema string
	// contains filtered or unexported fields
}

func (*Generator) ParallelUpdate

func (g *Generator) ParallelUpdate(ctx context.Context) *sync.WaitGroup

func (*Generator) SeedRows

func (g *Generator) SeedRows()

func (*Generator) SetupTestTables

func (g *Generator) SetupTestTables(createTarget bool) []string

func (*Generator) TestChecksum

func (g *Generator) TestChecksum() error

type GeneratorConfig

type GeneratorConfig struct {
	NrTables          int     `json:"nrTables" yaml:"nrTables"`
	NrSeedRows        int     `json:"nrSeedRows" yaml:"nrSeedRows"`
	DeleteRatio       float32 `json:"deleteRatio" yaml:"deleteRatio"`
	InsertRatio       float32 `json:"insertRatio" yaml:"insertRatio"`
	Concurrency       int     `json:"concurrency" yaml:"concurrency"`
	TransactionLength int     `json:"transactionLength" yaml:"transactionLength"`
}

type MysqlTableDataGenerator

type MysqlTableDataGenerator struct {
	*sync.Mutex
	// contains filtered or unexported fields
}

func NewMysqlTableDataGenerator

func NewMysqlTableDataGenerator(db *sql.DB, schema string, table string) MysqlTableDataGenerator

func (*MysqlTableDataGenerator) InitData

func (g *MysqlTableDataGenerator) InitData(num int, r *rand.Rand) (stmt string, args []interface{})

func (*MysqlTableDataGenerator) RandomStmt

func (g *MysqlTableDataGenerator) RandomStmt(deleteRatio float32, insertRatio float32, r *rand.Rand) (string, []interface{})

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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