Documentation ¶
Index ¶
- func CloseBaseDB(logCtx *tcontext.Context, baseDB *conn.BaseDB)
- func CloseUpstreamConn(tctx *tcontext.Context, conn *UpStreamConn)
- func GetCharsetAndCollationInfo(tctx *tcontext.Context, conn *DBConn) (map[string]string, map[int]string, error)
- func GetParserForConn(tctx *tcontext.Context, dbConn *DBConn) (*parser.Parser, error)
- func GetSchemaCreateSQL(tctx *tcontext.Context, conn *DBConn, schemaID string) (sql string, err error)
- func GetTableCreateSQL(tctx *tcontext.Context, conn *DBConn, tableID string) (sql string, err error)
- func NewTCPConnWithIOCounter(conn *net.TCPConn, c *atomic.Uint64) net.Conn
- type DBConn
- func (conn *DBConn) ExecuteSQL(tctx *tcontext.Context, metricProxies *metrics.Proxies, queries []string, ...) (int, error)
- func (conn *DBConn) ExecuteSQLAutoSplit(tctx *tcontext.Context, metricProxies *metrics.Proxies, queries []string, ...) error
- func (conn *DBConn) ExecuteSQLWithIgnore(tctx *tcontext.Context, metricProxies *metrics.Proxies, ...) (int, error)
- func (conn *DBConn) QuerySQL(tctx *tcontext.Context, metricProxies *metrics.Proxies, query string, ...) (*sql.Rows, error)
- func (conn *DBConn) ResetConn(tctx *tcontext.Context) error
- func (conn *DBConn) Scope() terror.ErrScope
- type TCPConnWithIOCounter
- type UpStreamConn
- func (c *UpStreamConn) FetchAllDoTables(ctx context.Context, bw *filter.Filter) (map[string][]string, error)
- func (c *UpStreamConn) GetMasterStatus(ctx *tcontext.Context, flavor string) (mysql.Position, mysql.GTIDSet, error)
- func (c *UpStreamConn) GetParser(ctx context.Context) (*parser.Parser, error)
- func (c *UpStreamConn) GetServerUUID(ctx context.Context, flavor string) (string, error)
- func (c *UpStreamConn) GetServerUnixTS(ctx context.Context) (int64, error)
- func (c *UpStreamConn) KillConn(ctx context.Context, connID uint32) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloseBaseDB ¶
CloseBaseDB closes baseDB to release all connection generated by this baseDB and this baseDB.
func CloseUpstreamConn ¶
func CloseUpstreamConn(tctx *tcontext.Context, conn *UpStreamConn)
CloseUpstreamConn closes the UpStreamConn.
func GetCharsetAndCollationInfo ¶
func GetCharsetAndCollationInfo(tctx *tcontext.Context, conn *DBConn) (map[string]string, map[int]string, error)
GetCharsetAndCollationInfo returns charset and collation info.
func GetParserForConn ¶
func GetSchemaCreateSQL ¶
func GetSchemaCreateSQL(tctx *tcontext.Context, conn *DBConn, schemaID string) (sql string, err error)
GetSchemaCreateSQL gets table create sql by 'show create table schema.table'.
Types ¶
type DBConn ¶
type DBConn struct { // generate new BaseConn and close old one ResetBaseConnFn func(*tcontext.Context, *conn.BaseConn) (*conn.BaseConn, error) // contains filtered or unexported fields }
DBConn represents a live DB connection it's not thread-safe.
func CreateConns ¶
func CreateConns(tctx *tcontext.Context, cfg *config.SubTaskConfig, dbCfg conn.ScopedDBConfig, count int, ioCounter *atomic.Uint64, uuid string) (*conn.BaseDB, []*DBConn, error)
CreateConns returns a opened DB from dbCfg and number of `count` connections of that DB.
func (*DBConn) ExecuteSQL ¶
func (conn *DBConn) ExecuteSQL( tctx *tcontext.Context, metricProxies *metrics.Proxies, queries []string, args ...[]interface{}, ) (int, error)
ExecuteSQL does some SQL executions.
func (*DBConn) ExecuteSQLAutoSplit ¶
func (conn *DBConn) ExecuteSQLAutoSplit( tctx *tcontext.Context, metricProxies *metrics.Proxies, queries []string, args ...[]interface{}, ) error
ExecuteSQLAutoSplit wraps BaseConn.ExecuteSQLAutoSplit. TODO: refine DBConn and BaseConn.
func (*DBConn) ExecuteSQLWithIgnore ¶
func (conn *DBConn) ExecuteSQLWithIgnore( tctx *tcontext.Context, metricProxies *metrics.Proxies, ignoreError func(error) bool, queries []string, args ...[]interface{}, ) (int, error)
ExecuteSQLWithIgnore do some SQL executions and can ignore some error by `ignoreError`.
func (*DBConn) QuerySQL ¶
func (conn *DBConn) QuerySQL( tctx *tcontext.Context, metricProxies *metrics.Proxies, query string, args ...interface{}, ) (*sql.Rows, error)
QuerySQL does one query.
type TCPConnWithIOCounter ¶
TCPConnWithIOCounter is a wrapper of net.TCPConn with counter that accumulates the bytes this connection reads/writes.
type UpStreamConn ¶
UpStreamConn connect to upstream DB Normally, we need to get some upstream information through some helper functions these helper functions are all easy query functions, so we use a pool of connections here maybe change to one connection some day.
func (*UpStreamConn) FetchAllDoTables ¶
func (c *UpStreamConn) FetchAllDoTables(ctx context.Context, bw *filter.Filter) (map[string][]string, error)
FetchAllDoTables returns tables matches allow-list.
func (*UpStreamConn) GetMasterStatus ¶
func (c *UpStreamConn) GetMasterStatus(ctx *tcontext.Context, flavor string) (mysql.Position, mysql.GTIDSet, error)
GetMasterStatus returns binlog location that extracted from SHOW MASTER STATUS.
func (*UpStreamConn) GetServerUUID ¶
GetServerUUID returns upstream server UUID.
func (*UpStreamConn) GetServerUnixTS ¶
func (c *UpStreamConn) GetServerUnixTS(ctx context.Context) (int64, error)
GetServerUnixTS returns the result of current timestamp in upstream.