Documentation ¶
Index ¶
- Variables
- func NewRPCServer(config *config.Config, dom *domain.Domain, sm util.SessionManager) *grpc.Server
- type Ballast
- type ColumnInfo
- type CorsHandler
- type FrameItem
- type IDriver
- type IndexRegions
- type MockConn
- type OptimizeTraceHandler
- type PlanReplayerHandler
- type PreparedStatement
- type RangeDetail
- type RegionDetail
- type RegionMeta
- type ResultSet
- type Server
- func (s *Server) CheckOldRunningTxn(job2ver map[int64]int64, job2ids map[int64]string)
- func (s *Server) Close()
- func (s *Server) ConnectionCount() int
- func (s *Server) DeleteInternalSession(se interface{})
- func (s *Server) GetInternalSessionStartTSList() []uint64
- func (s *Server) GetMinStartTS(lowerBound uint64) (ts uint64)
- func (s *Server) GetProcessInfo(id uint64) (*util.ProcessInfo, bool)
- func (s *Server) GetScope(status string) variable.ScopeFlag
- func (s *Server) GracefulDown(ctx context.Context, done chan struct{})
- func (s *Server) InitGlobalConnID(serverIDGetter func() uint64)
- func (s *Server) InternalSessionExists(se interface{}) bool
- func (s *Server) Kill(connectionID uint64, query bool)
- func (s *Server) KillAllConnections()
- func (s *Server) KillNonFlashbackClusterConn()
- func (s *Server) KillSysProcesses()
- func (s *Server) Run() error
- func (s *Server) ServerID() uint64
- func (s *Server) SetDomain(dom *domain.Domain)
- func (s *Server) ShowProcessList() map[uint64]*util.ProcessInfo
- func (s *Server) ShowTxnList() []*txninfo.TxnInfo
- func (s *Server) Stats(vars *variable.SessionVars) (map[string]interface{}, error)
- func (s *Server) StoreInternalSession(se interface{})
- func (s *Server) TryGracefulDown()
- func (s *Server) UpdateTLSConfig(cfg *tls.Config)
- type StatsHandler
- type StatsHistoryHandler
- type TableRanges
- type TableRegions
- type TiDBContext
- func (tc *TiDBContext) Close() error
- func (tc *TiDBContext) DecodeSessionStates(ctx context.Context, sctx sessionctx.Context, ...) error
- func (tc *TiDBContext) EncodeSessionStates(ctx context.Context, sctx sessionctx.Context, ...) error
- func (tc *TiDBContext) ExecuteStmt(ctx context.Context, stmt ast.StmtNode) (ResultSet, error)
- func (tc *TiDBContext) FieldList(table string) (columns []*ColumnInfo, err error)
- func (tc *TiDBContext) GetStatement(stmtID int) PreparedStatement
- func (tc *TiDBContext) GetStmtStats() *stmtstats.StatementStats
- func (tc *TiDBContext) GetWarnings() []stmtctx.SQLWarn
- func (tc *TiDBContext) Prepare(sql string) (statement PreparedStatement, columns, params []*ColumnInfo, err error)
- func (tc *TiDBContext) WarningCount() uint16
- type TiDBDriver
- type TiDBStatement
- func (ts *TiDBStatement) AppendParam(paramID int, data []byte) error
- func (ts *TiDBStatement) BoundParams() [][]byte
- func (ts *TiDBStatement) Close() error
- func (ts *TiDBStatement) Execute(ctx context.Context, args []expression.Expression) (rs ResultSet, err error)
- func (ts *TiDBStatement) GetParamsType() []byte
- func (ts *TiDBStatement) GetResultSet() ResultSet
- func (ts *TiDBStatement) ID() int
- func (ts *TiDBStatement) NumParams() int
- func (ts *TiDBStatement) Reset()
- func (ts *TiDBStatement) SetParamsType(paramsType []byte)
- func (ts *TiDBStatement) StoreResultSet(rs ResultSet)
- type Token
- type TokenLimiter
Constants ¶
This section is empty.
Variables ¶
var ( // RunInGoTest represents whether we are run code in test. RunInGoTest bool )
Functions ¶
func NewRPCServer ¶
NewRPCServer creates a new rpc server.
Types ¶
type Ballast ¶
type Ballast struct {
// contains filtered or unexported fields
}
Ballast try to reduce the GC frequency by using Ballast Object
func (*Ballast) GenHTTPHandler ¶
func (b *Ballast) GenHTTPHandler() func(w http.ResponseWriter, r *http.Request)
GenHTTPHandler generate a HTTP handler to get/set the size of this ballast object
type ColumnInfo ¶
type ColumnInfo struct { Schema string Table string OrgTable string Name string OrgName string ColumnLength uint32 Charset uint16 Flag uint16 Decimal uint8 Type uint8 DefaultValueLength uint64 DefaultValue []byte }
ColumnInfo contains information of a column
func (*ColumnInfo) Dump ¶
func (column *ColumnInfo) Dump(buffer []byte, d *resultEncoder) []byte
Dump dumps ColumnInfo to bytes.
type CorsHandler ¶
type CorsHandler struct {
// contains filtered or unexported fields
}
CorsHandler adds Cors Header if `cors` config is set.
func (CorsHandler) ServeHTTP ¶
func (h CorsHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)
type FrameItem ¶
type FrameItem struct { DBName string `json:"db_name"` TableName string `json:"table_name"` TableID int64 `json:"table_id"` IsRecord bool `json:"is_record"` RecordID int64 `json:"record_id,omitempty"` IndexName string `json:"index_name,omitempty"` IndexID int64 `json:"index_id,omitempty"` IndexValues []string `json:"index_values,omitempty"` }
FrameItem includes a index's or record's meta data with table's info.
type IDriver ¶
type IDriver interface { // OpenCtx opens an IContext with connection id, client capability, collation, dbname and optionally the tls state. OpenCtx(connID uint64, capability uint32, collation uint8, dbname string, tlsState *tls.ConnectionState, extensions *extension.SessionExtensions) (*TiDBContext, error) }
IDriver opens IContext.
type IndexRegions ¶
type IndexRegions struct { Name string `json:"name"` ID int64 `json:"id"` Regions []RegionMeta `json:"regions"` }
IndexRegions is the region info for one index.
type MockConn ¶
type MockConn interface { // HandleQuery executes a statement HandleQuery(ctx context.Context, sql string) error // Context gets the TiDBContext Context() *TiDBContext // Dispatch executes command according to the command type Dispatch(ctx context.Context, data []byte) error // Close releases resources Close() // ID returns the connection ID. ID() uint64 }
MockConn is a mock connection.
type OptimizeTraceHandler ¶
type OptimizeTraceHandler struct {
// contains filtered or unexported fields
}
OptimizeTraceHandler serve http
func (OptimizeTraceHandler) ServeHTTP ¶
func (oth OptimizeTraceHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)
type PlanReplayerHandler ¶
type PlanReplayerHandler struct {
// contains filtered or unexported fields
}
PlanReplayerHandler is the handler for dumping plan replayer file.
func (PlanReplayerHandler) ServeHTTP ¶
func (prh PlanReplayerHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)
type PreparedStatement ¶
type PreparedStatement interface { // ID returns statement ID ID() int // Execute executes the statement. Execute(context.Context, []expression.Expression) (ResultSet, error) // AppendParam appends parameter to the statement. AppendParam(paramID int, data []byte) error // NumParams returns number of parameters. NumParams() int // BoundParams returns bound parameters. BoundParams() [][]byte // SetParamsType sets type for parameters. SetParamsType([]byte) // GetParamsType returns the type for parameters. GetParamsType() []byte // StoreResultSet stores ResultSet for subsequent stmt fetching StoreResultSet(rs ResultSet) // GetResultSet gets ResultSet associated this statement GetResultSet() ResultSet // Reset removes all bound parameters. Reset() // Close closes the statement. Close() error }
PreparedStatement is the interface to use a prepared statement.
type RangeDetail ¶
type RangeDetail struct { StartKey []byte `json:"start_key"` EndKey []byte `json:"end_key"` StartKeyHex string `json:"start_key_hex"` EndKeyHex string `json:"end_key_hex"` }
RangeDetail contains detail information about a particular range
type RegionDetail ¶
type RegionDetail struct { RangeDetail `json:",inline"` RegionID uint64 `json:"region_id"` Frames []*helper.FrameItem `json:"frames"` }
RegionDetail is the response data for get region by ID it includes indices and records detail in current region.
type RegionMeta ¶
type RegionMeta struct { ID uint64 `json:"region_id"` Leader *metapb.Peer `json:"leader"` Peers []*metapb.Peer `json:"peers"` RegionEpoch *metapb.RegionEpoch `json:"region_epoch"` }
RegionMeta contains a region's peer detail
type ResultSet ¶
type ResultSet interface { Columns() []*ColumnInfo NewChunk(chunk.Allocator) *chunk.Chunk Next(context.Context, *chunk.Chunk) error StoreFetchedRows(rows []chunk.Row) GetFetchedRows() []chunk.Row Close() error // IsClosed checks whether the result set is closed. IsClosed() bool }
ResultSet is the result set of an query.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the MySQL protocol server
func CreateMockServer ¶
CreateMockServer creates a mock server.
func (*Server) CheckOldRunningTxn ¶
CheckOldRunningTxn implements SessionManager interface.
func (*Server) ConnectionCount ¶
ConnectionCount gets current connection count.
func (*Server) DeleteInternalSession ¶
func (s *Server) DeleteInternalSession(se interface{})
DeleteInternalSession implements SessionManager interface. @param addr The address of a session.session struct variable
func (*Server) GetInternalSessionStartTSList ¶
GetInternalSessionStartTSList implements SessionManager interface.
func (*Server) GetMinStartTS ¶
GetMinStartTS implements SessionManager interface.
func (*Server) GetProcessInfo ¶
func (s *Server) GetProcessInfo(id uint64) (*util.ProcessInfo, bool)
GetProcessInfo implements the SessionManager interface.
func (*Server) GracefulDown ¶
GracefulDown waits all clients to close.
func (*Server) InitGlobalConnID ¶
InitGlobalConnID initialize global connection id.
func (*Server) InternalSessionExists ¶
InternalSessionExists is used for test
func (*Server) KillAllConnections ¶
func (s *Server) KillAllConnections()
KillAllConnections kills all connections when server is not gracefully shutdown.
func (*Server) KillNonFlashbackClusterConn ¶
func (s *Server) KillNonFlashbackClusterConn()
KillNonFlashbackClusterConn implements SessionManager interface.
func (*Server) KillSysProcesses ¶
func (s *Server) KillSysProcesses()
KillSysProcesses kill sys processes such as auto analyze.
func (*Server) ShowProcessList ¶
func (s *Server) ShowProcessList() map[uint64]*util.ProcessInfo
ShowProcessList implements the SessionManager interface.
func (*Server) ShowTxnList ¶
ShowTxnList shows all txn info for displaying in `TIDB_TRX`
func (*Server) Stats ¶
func (s *Server) Stats(vars *variable.SessionVars) (map[string]interface{}, error)
Stats returns the server statistics.
func (*Server) StoreInternalSession ¶
func (s *Server) StoreInternalSession(se interface{})
StoreInternalSession implements SessionManager interface. @param addr The address of a session.session struct variable
func (*Server) TryGracefulDown ¶
func (s *Server) TryGracefulDown()
TryGracefulDown will try to gracefully close all connection first with timeout. if timeout, will close all connection directly.
func (*Server) UpdateTLSConfig ¶
UpdateTLSConfig implements the SessionManager interface.
type StatsHandler ¶
type StatsHandler struct {
// contains filtered or unexported fields
}
StatsHandler is the handler for dumping statistics.
func (StatsHandler) ServeHTTP ¶
func (sh StatsHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)
type StatsHistoryHandler ¶
type StatsHistoryHandler struct {
// contains filtered or unexported fields
}
StatsHistoryHandler is the handler for dumping statistics.
func (StatsHistoryHandler) ServeHTTP ¶
func (sh StatsHistoryHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)
type TableRanges ¶
type TableRanges struct { TableName string `json:"name"` TableID int64 `json:"id"` Range RangeDetail `json:"table"` Record RangeDetail `json:"record"` Index RangeDetail `json:"index"` Indices map[string]RangeDetail `json:"indices,omitempty"` }
TableRanges is the response data for list table's ranges. It contains ranges list for record and indices as well as the whole table.
type TableRegions ¶
type TableRegions struct { TableName string `json:"name"` TableID int64 `json:"id"` RecordRegions []RegionMeta `json:"record_regions"` Indices []IndexRegions `json:"indices"` }
TableRegions is the response data for list table's regions. It contains regions list for record and indices.
type TiDBContext ¶
TiDBContext implements QueryCtx.
func (*TiDBContext) Close ¶
func (tc *TiDBContext) Close() error
Close implements QueryCtx Close method.
func (*TiDBContext) DecodeSessionStates ¶
func (tc *TiDBContext) DecodeSessionStates(ctx context.Context, sctx sessionctx.Context, sessionStates *sessionstates.SessionStates) error
DecodeSessionStates implements SessionStatesHandler.DecodeSessionStates interface.
func (*TiDBContext) EncodeSessionStates ¶
func (tc *TiDBContext) EncodeSessionStates(ctx context.Context, sctx sessionctx.Context, sessionStates *sessionstates.SessionStates) error
EncodeSessionStates implements SessionStatesHandler.EncodeSessionStates interface.
func (*TiDBContext) ExecuteStmt ¶
ExecuteStmt implements QueryCtx interface.
func (*TiDBContext) FieldList ¶
func (tc *TiDBContext) FieldList(table string) (columns []*ColumnInfo, err error)
FieldList implements QueryCtx FieldList method.
func (*TiDBContext) GetStatement ¶
func (tc *TiDBContext) GetStatement(stmtID int) PreparedStatement
GetStatement implements QueryCtx GetStatement method.
func (*TiDBContext) GetStmtStats ¶
func (tc *TiDBContext) GetStmtStats() *stmtstats.StatementStats
GetStmtStats implements the sessionctx.Context interface.
func (*TiDBContext) GetWarnings ¶
func (tc *TiDBContext) GetWarnings() []stmtctx.SQLWarn
GetWarnings implements QueryCtx GetWarnings method.
func (*TiDBContext) Prepare ¶
func (tc *TiDBContext) Prepare(sql string) (statement PreparedStatement, columns, params []*ColumnInfo, err error)
Prepare implements QueryCtx Prepare method.
func (*TiDBContext) WarningCount ¶
func (tc *TiDBContext) WarningCount() uint16
WarningCount implements QueryCtx WarningCount method.
type TiDBDriver ¶
type TiDBDriver struct {
// contains filtered or unexported fields
}
TiDBDriver implements IDriver.
func NewTiDBDriver ¶
func NewTiDBDriver(store kv.Storage) *TiDBDriver
NewTiDBDriver creates a new TiDBDriver.
func (*TiDBDriver) OpenCtx ¶
func (qd *TiDBDriver) OpenCtx(connID uint64, capability uint32, collation uint8, dbname string, tlsState *tls.ConnectionState, extensions *extension.SessionExtensions) (*TiDBContext, error)
OpenCtx implements IDriver.
type TiDBStatement ¶
type TiDBStatement struct {
// contains filtered or unexported fields
}
TiDBStatement implements PreparedStatement.
func (*TiDBStatement) AppendParam ¶
func (ts *TiDBStatement) AppendParam(paramID int, data []byte) error
AppendParam implements PreparedStatement AppendParam method.
func (*TiDBStatement) BoundParams ¶
func (ts *TiDBStatement) BoundParams() [][]byte
BoundParams implements PreparedStatement BoundParams method.
func (*TiDBStatement) Close ¶
func (ts *TiDBStatement) Close() error
Close implements PreparedStatement Close method.
func (*TiDBStatement) Execute ¶
func (ts *TiDBStatement) Execute(ctx context.Context, args []expression.Expression) (rs ResultSet, err error)
Execute implements PreparedStatement Execute method.
func (*TiDBStatement) GetParamsType ¶
func (ts *TiDBStatement) GetParamsType() []byte
GetParamsType implements PreparedStatement GetParamsType method.
func (*TiDBStatement) GetResultSet ¶
func (ts *TiDBStatement) GetResultSet() ResultSet
GetResultSet gets ResultSet associated this statement
func (*TiDBStatement) ID ¶
func (ts *TiDBStatement) ID() int
ID implements PreparedStatement ID method.
func (*TiDBStatement) NumParams ¶
func (ts *TiDBStatement) NumParams() int
NumParams implements PreparedStatement NumParams method.
func (*TiDBStatement) Reset ¶
func (ts *TiDBStatement) Reset()
Reset implements PreparedStatement Reset method.
func (*TiDBStatement) SetParamsType ¶
func (ts *TiDBStatement) SetParamsType(paramsType []byte)
SetParamsType implements PreparedStatement SetParamsType method.
func (*TiDBStatement) StoreResultSet ¶
func (ts *TiDBStatement) StoreResultSet(rs ResultSet)
StoreResultSet stores ResultSet for stmt fetching
type TokenLimiter ¶
type TokenLimiter struct {
// contains filtered or unexported fields
}
TokenLimiter is used to limit the number of concurrent tasks.
func NewTokenLimiter ¶
func NewTokenLimiter(count uint) *TokenLimiter
NewTokenLimiter creates a TokenLimiter with count tokens.