Documentation
¶
Index ¶
- Constants
- func CheckIfBDRModeIsSupported(ctx context.Context, db *sql.DB) (bool, error)
- func CheckIsTiDB(ctx context.Context, db *sql.DB) (bool, error)
- func CreateMySQLDBConn(ctx context.Context, dsnStr string) (*sql.DB, error)
- func GenBasicDSN(sinkURI *url.URL, cfg *Config) (*dmysql.Config, error)
- func GenerateDSN(ctx context.Context, sinkURI *url.URL, cfg *Config, dbConnFactory Factory) (dsnStr string, err error)
- func GetTestDB(ctx context.Context, dbConfig *dmysql.Config, dbConnFactory Factory) (*sql.DB, error)
- func MockTestDB(adjustSQLMode bool) (*sql.DB, error)
- func QueryMaxAllowedPacket(ctx context.Context, db *sql.DB) (int64, error)
- func QueryMaxPreparedStmtCount(ctx context.Context, db *sql.DB) (int, error)
- type Config
- type Factory
Constants ¶
View Source
const ( // DefaultWorkerCount is the default number of workers. DefaultWorkerCount = 16 // DefaultMaxTxnRow is the default max number of rows in a transaction. DefaultMaxTxnRow = 256 // BackoffBaseDelay indicates the base delay time for retrying. BackoffBaseDelay = 500 * time.Millisecond // BackoffMaxDelay indicates the max delay time for retrying. BackoffMaxDelay = 60 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func CheckIfBDRModeIsSupported ¶
CheckIfBDRModeIsSupported checks if the downstream supports BDR mode.
func CheckIsTiDB ¶
CheckIsTiDB checks if the downstream is TiDB.
func CreateMySQLDBConn ¶
CreateMySQLDBConn creates a mysql database connection with the given dsn.
func GenBasicDSN ¶
GenBasicDSN generates a basic DSN from the given config.
func GenerateDSN ¶
func GenerateDSN(ctx context.Context, sinkURI *url.URL, cfg *Config, dbConnFactory Factory) (dsnStr string, err error)
GenerateDSN generates the dsn with the given config.
func GetTestDB ¶
func GetTestDB(ctx context.Context, dbConfig *dmysql.Config, dbConnFactory Factory) (*sql.DB, error)
GetTestDB checks and adjusts the password of the given DSN, it will return a DB instance opened with the adjusted password.
func MockTestDB ¶
MockTestDB creates a mock mysql database connection.
func QueryMaxAllowedPacket ¶
QueryMaxAllowedPacket gets the value of max_allowed_packet
Types ¶
type Config ¶
type Config struct { WorkerCount int MaxTxnRow int MaxMultiUpdateRowCount int MaxMultiUpdateRowSize int ReadTimeout string WriteTimeout string DialTimeout string SafeMode bool Timezone string TLS string ForceReplicate bool IsTiDB bool // IsTiDB is true if the downstream is TiDB // IsBDRModeSupported is true if the downstream is TiDB and write source is existed. // write source exists when the downstream is TiDB and version is greater than or equal to v6.5.0. IsWriteSourceExisted bool SourceID uint64 BatchDMLEnable bool MultiStmtEnable bool CachePrepStmts bool // contains filtered or unexported fields }
Config is the configs for MySQL backend.
Click to show internal directories.
Click to hide internal directories.