Documentation ¶
Index ¶
- Constants
- Variables
- func AllowQueries(dbconfig dbconfigs.DBConfig, schemaOverrides []SchemaOverride, qrs *QueryRules)
- func DisallowQueries(forRestart bool)
- func GetCurrentInvalidationPosition() (invalidationPosition []byte, err error)
- func GetSessionId() int64
- func InvalidateForDDL(ddlInvalidate *proto.DDLInvalidate)
- func InvalidateForDml(cacheInvalidate *proto.CacheInvalidate)
- func IsCachePoolAvailable() bool
- func PurgeRowCache()
- func Rand() int64
- func RegisterCacheInvalidator()
- func RegisterQueryService(config Config)
- func ReloadSchema()
- func SetQueryRules(qrs *QueryRules)
- func ShouldInvalidatorRun() bool
- func StartRowCacheInvalidation()
- func StopRowCacheInvalidation()
- type Action
- type ActivePool
- func (ap *ActivePool) Close()
- func (ap *ActivePool) Open(ConnFactory CreateConnectionFunc)
- func (ap *ActivePool) Put(id int64)
- func (ap *ActivePool) QueryKiller()
- func (ap *ActivePool) Remove(id int64)
- func (ap *ActivePool) SetIdleTimeout(idleTimeout time.Duration)
- func (ap *ActivePool) SetTimeout(timeout time.Duration)
- func (ap *ActivePool) Stats() (size int, timeout time.Duration)
- func (ap *ActivePool) StatsJSON() string
- func (ap *ActivePool) Timeout() time.Duration
- type ActiveTxPool
- func (axp *ActiveTxPool) Close()
- func (axp *ActiveTxPool) Get(transactionId int64) (conn *TxConnection)
- func (axp *ActiveTxPool) Open()
- func (axp *ActiveTxPool) Rollback(transactionId int64)
- func (axp *ActiveTxPool) SafeBegin(conn PoolConnection) (transactionId int64, err error)
- func (axp *ActiveTxPool) SafeCommit(transactionId int64) (invalidList map[string]DirtyKeys, err error)
- func (axp *ActiveTxPool) SetTimeout(timeout time.Duration)
- func (axp *ActiveTxPool) Stats() (size int, timeout time.Duration)
- func (axp *ActiveTxPool) StatsJSON() string
- func (axp *ActiveTxPool) Timeout() time.Duration
- func (axp *ActiveTxPool) TransactionKiller()
- func (axp *ActiveTxPool) WaitForEmpty()
- type BindVarCond
- type Cache
- type CacheInvalidator
- type CachePool
- func (cp *CachePool) Close()
- func (cp *CachePool) Get() *Cache
- func (cp *CachePool) IsClosed() bool
- func (cp *CachePool) Open(connFactory CreateCacheFunc)
- func (cp *CachePool) Put(conn *Cache)
- func (cp *CachePool) ServeHTTP(response http.ResponseWriter, request *http.Request)
- func (cp *CachePool) SetCapacity(capacity int) (err error)
- func (cp *CachePool) SetIdleTimeout(idleTimeout time.Duration)
- func (cp *CachePool) StatsJSON() string
- type CompiledPlan
- type Config
- type ConnectionPool
- func (cp *ConnectionPool) Close()
- func (cp *ConnectionPool) Get() PoolConnection
- func (cp *ConnectionPool) Open(connFactory CreateConnectionFunc)
- func (cp *ConnectionPool) Put(conn PoolConnection)
- func (cp *ConnectionPool) SafeGet() (PoolConnection, error)
- func (cp *ConnectionPool) SetCapacity(capacity int) (err error)
- func (cp *ConnectionPool) SetIdleTimeout(idleTimeout time.Duration)
- func (cp *ConnectionPool) StatsJSON() string
- func (cp *ConnectionPool) TryGet() PoolConnection
- type Consolidator
- type CreateCacheFunc
- type CreateConnectionFunc
- type DBConnection
- type DirtyKeys
- type ExecPlan
- type GenericCache
- type InvalidationError
- type InvalidationProcessor
- type Operator
- type PoolConnection
- type QueryEngine
- func (qe *QueryEngine) Begin(logStats *sqlQueryStats, connectionId int64) (transactionId int64)
- func (qe *QueryEngine) Close(forRestart bool)
- func (qe *QueryEngine) CloseReserved(connectionId int64)
- func (qe *QueryEngine) Commit(logStats *sqlQueryStats, transactionId int64)
- func (qe *QueryEngine) CreateReserved() (connectionId int64)
- func (qe *QueryEngine) Execute(logStats *sqlQueryStats, query *proto.Query) (reply *mproto.QueryResult)
- func (qe *QueryEngine) Invalidate(cacheInvalidate *proto.CacheInvalidate)
- func (qe *QueryEngine) InvalidateForDDL(ddlInvalidate *proto.DDLInvalidate)
- func (qe *QueryEngine) Open(dbconfig dbconfigs.DBConfig, schemaOverrides []SchemaOverride, qrs *QueryRules)
- func (qe *QueryEngine) Rollback(logStats *sqlQueryStats, transactionId int64)
- func (qe *QueryEngine) StreamExecute(logStats *sqlQueryStats, query *proto.Query, ...)
- type QueryRule
- func (qr *QueryRule) AddBindVarCond(name string, onAbsent, onMismatch bool, op Operator, value interface{}) error
- func (qr *QueryRule) AddPlanCond(planType sqlparser.PlanType)
- func (qr *QueryRule) Copy() (newqr *QueryRule)
- func (qr *QueryRule) SetIPCond(pattern string) (err error)
- func (qr *QueryRule) SetQueryCond(pattern string) (err error)
- func (qr *QueryRule) SetUserCond(pattern string) (err error)
- type QueryRules
- type RCResult
- type ReservedPool
- func (rp *ReservedPool) Close()
- func (rp *ReservedPool) CloseConnection(connectionId int64)
- func (rp *ReservedPool) CreateConnection() (connectionId int64)
- func (rp *ReservedPool) Get(connectionId int64) PoolConnection
- func (rp *ReservedPool) Open(connFactory CreateConnectionFunc)
- func (rp *ReservedPool) Stats() (size int)
- func (rp *ReservedPool) StatsJSON() string
- type Result
- type RowCache
- type SchemaInfo
- func (si *SchemaInfo) Close()
- func (si *SchemaInfo) CreateTable(tableName string)
- func (si *SchemaInfo) DropTable(tableName string)
- func (si *SchemaInfo) GetPlan(logStats *sqlQueryStats, sql string) (plan *ExecPlan)
- func (si *SchemaInfo) GetRules() (qrs *QueryRules)
- func (si *SchemaInfo) GetStreamPlan(sql string) *sqlparser.ParsedQuery
- func (si *SchemaInfo) GetTable(tableName string) *TableInfo
- func (si *SchemaInfo) Open(connFactory CreateConnectionFunc, schemaOverrides []SchemaOverride, ...)
- func (si *SchemaInfo) Reload()
- func (si *SchemaInfo) ServeHTTP(response http.ResponseWriter, request *http.Request)
- func (si *SchemaInfo) SetQueryCacheSize(size int)
- func (si *SchemaInfo) SetReloadTime(reloadTime time.Duration)
- func (si *SchemaInfo) SetRules(qrs *QueryRules)
- type SchemaOverride
- type SqlQuery
- func (sq *SqlQuery) Begin(context *rpcproto.Context, session *proto.Session, ...) (err error)
- func (sq *SqlQuery) CloseReserved(session *proto.Session, noOutput *string) (err error)
- func (sq *SqlQuery) Commit(context *rpcproto.Context, session *proto.Session, noOutput *string) (err error)
- func (sq *SqlQuery) CreateReserved(session *proto.Session, connectionInfo *proto.ConnectionInfo) (err error)
- func (sq *SqlQuery) Execute(context *rpcproto.Context, query *proto.Query, reply *mproto.QueryResult) (err error)
- func (sq *SqlQuery) ExecuteBatch(context *rpcproto.Context, queryList *proto.QueryList, ...) (err error)
- func (sq *SqlQuery) GetSessionId(sessionParams *proto.SessionParams, sessionInfo *proto.SessionInfo) error
- func (sq *SqlQuery) Rollback(context *rpcproto.Context, session *proto.Session, noOutput *string) (err error)
- func (sq *SqlQuery) StreamExecute(context *rpcproto.Context, query *proto.Query, ...) (err error)
- type TableInfo
- type TabletError
- type TxConnection
Constants ¶
const ( TX_CLOSE = "close" TX_COMMIT = "commit" TX_ROLLBACK = "rollback" TX_KILL = "kill" )
const ( MAX_RESULT_NAME = "_vtMaxResultSize" ROWCACHE_INVALIDATION_POSITION = "ROWCACHE_INVALIDATION_POSITION" )
const ( QR_NOOP = Operator(iota) QR_EQ QR_NE QR_LT QR_GE QR_GT QR_LE QR_MATCH QR_NOMATCH QR_IN QR_NOTIN )
const ( QR_OK = iota QR_MISMATCH QR_OUT_OF_RANGE )
const ( DISABLED = iota ENABLED )
const ( // Fatal Errors FATAL_ERROR = "InvalidatorFatal" // Skippable errors, recorded and skipped. INVALID_EVENT = "InvalidatorEvent" )
Error types for rowcache invalidator.
const ( NOT_SERVING = iota CLOSED CONNECTING ABORT INITIALIZING OPEN SHUTTING_DOWN )
exclusive transitions can be executed without a lock NOT_SERVING/CLOSED -> CONNECTING CONNECTING -> ABORT ABORT -> CLOSED (exclusive) CONNECTING -> INITIALIZING -> OPEN/NOT_SERVING OPEN -> SHUTTING_DOWN -> CLOSED
const ( QUERY_SOURCE_ROWCACHE = 1 << iota QUERY_SOURCE_CONSOLIDATOR QUERY_SOURCE_MYSQL )
const ( FAIL = iota RETRY FATAL TX_POOL_FULL )
const (
DUPLICATE_KEY = 1062 // MySQL error number
)
const QR_CONTINUE = Action(0)
const QR_FAIL_QUERY = Action(1)
const (
RC_DELETED = 1
)
const TRAILING_COMMENT = "_trailingComment"
Variables ¶
var ( BEGIN = "begin" COMMIT = "commit" ROLLBACK = "rollback" )
var QueryLogger *relog.Logger
var SqlQueryLogger = streamlog.New("SqlQuery", 50)
var TxLogger = streamlog.New("TxLog", 10)
TxLogger can be used to enable logging of transactions. Call TxLogger.ServeLogs in your main program to enable logging. The log format can be inferred by looking at TxConnection.Format.
Functions ¶
func AllowQueries ¶
func AllowQueries(dbconfig dbconfigs.DBConfig, schemaOverrides []SchemaOverride, qrs *QueryRules)
AllowQueries can take an indefinite amount of time to return because it keeps retrying until it obtains a valid connection to the database.
func DisallowQueries ¶
func DisallowQueries(forRestart bool)
DisallowQueries can take a long time to return (not indefinite) because it has to wait for queries & transactions to be completed or killed, and also for house keeping goroutines to be terminated.
func GetSessionId ¶
func GetSessionId() int64
func InvalidateForDDL ¶
func InvalidateForDDL(ddlInvalidate *proto.DDLInvalidate)
func InvalidateForDml ¶
func InvalidateForDml(cacheInvalidate *proto.CacheInvalidate)
func IsCachePoolAvailable ¶
func IsCachePoolAvailable() bool
func PurgeRowCache ¶
func PurgeRowCache()
func RegisterCacheInvalidator ¶
func RegisterCacheInvalidator()
func RegisterQueryService ¶
func RegisterQueryService(config Config)
func ReloadSchema ¶
func ReloadSchema()
Reload the schema. If the query service is not running, nothing will happen
func SetQueryRules ¶
func SetQueryRules(qrs *QueryRules)
func ShouldInvalidatorRun ¶
func ShouldInvalidatorRun() bool
func StartRowCacheInvalidation ¶
func StartRowCacheInvalidation()
func StopRowCacheInvalidation ¶
func StopRowCacheInvalidation()
Types ¶
type Action ¶
type Action int
Action speficies the list of actions to perform when a QueryRule is triggered.
type ActivePool ¶
type ActivePool struct {
// contains filtered or unexported fields
}
func NewActivePool ¶
func NewActivePool(queryTimeout, idleTimeout time.Duration) *ActivePool
func (*ActivePool) Close ¶
func (ap *ActivePool) Close()
func (*ActivePool) Open ¶
func (ap *ActivePool) Open(ConnFactory CreateConnectionFunc)
func (*ActivePool) Put ¶
func (ap *ActivePool) Put(id int64)
func (*ActivePool) QueryKiller ¶
func (ap *ActivePool) QueryKiller()
func (*ActivePool) Remove ¶
func (ap *ActivePool) Remove(id int64)
func (*ActivePool) SetIdleTimeout ¶
func (ap *ActivePool) SetIdleTimeout(idleTimeout time.Duration)
func (*ActivePool) SetTimeout ¶
func (ap *ActivePool) SetTimeout(timeout time.Duration)
func (*ActivePool) StatsJSON ¶
func (ap *ActivePool) StatsJSON() string
func (*ActivePool) Timeout ¶
func (ap *ActivePool) Timeout() time.Duration
type ActiveTxPool ¶
type ActiveTxPool struct {
// contains filtered or unexported fields
}
func NewActiveTxPool ¶
func NewActiveTxPool(timeout time.Duration) *ActiveTxPool
func (*ActiveTxPool) Close ¶
func (axp *ActiveTxPool) Close()
func (*ActiveTxPool) Get ¶
func (axp *ActiveTxPool) Get(transactionId int64) (conn *TxConnection)
You must call Recycle on TxConnection once done.
func (*ActiveTxPool) Open ¶
func (axp *ActiveTxPool) Open()
func (*ActiveTxPool) Rollback ¶
func (axp *ActiveTxPool) Rollback(transactionId int64)
func (*ActiveTxPool) SafeBegin ¶
func (axp *ActiveTxPool) SafeBegin(conn PoolConnection) (transactionId int64, err error)
func (*ActiveTxPool) SafeCommit ¶
func (axp *ActiveTxPool) SafeCommit(transactionId int64) (invalidList map[string]DirtyKeys, err error)
func (*ActiveTxPool) SetTimeout ¶
func (axp *ActiveTxPool) SetTimeout(timeout time.Duration)
func (*ActiveTxPool) StatsJSON ¶
func (axp *ActiveTxPool) StatsJSON() string
func (*ActiveTxPool) Timeout ¶
func (axp *ActiveTxPool) Timeout() time.Duration
func (*ActiveTxPool) TransactionKiller ¶
func (axp *ActiveTxPool) TransactionKiller()
func (*ActiveTxPool) WaitForEmpty ¶
func (axp *ActiveTxPool) WaitForEmpty()
type BindVarCond ¶
type BindVarCond struct {
// contains filtered or unexported fields
}
BindVarCond represents a bind var condition.
type Cache ¶
type Cache struct { *memcache.Connection // contains filtered or unexported fields }
Cache re-exposes memcache.Connection
type CacheInvalidator ¶
CacheInvalidator provides the abstraction needed for an instant invalidation vs. delayed invalidation in the case of in-transaction dmls
type CachePool ¶
type CachePool struct { DeleteExpiry uint64 // contains filtered or unexported fields }
CachePool re-exposes ResourcePool as a pool of Memcache connection objects
func NewCachePool ¶
func (*CachePool) Open ¶
func (cp *CachePool) Open(connFactory CreateCacheFunc)
func (*CachePool) ServeHTTP ¶
func (cp *CachePool) ServeHTTP(response http.ResponseWriter, request *http.Request)
func (*CachePool) SetCapacity ¶
func (*CachePool) SetIdleTimeout ¶
type CompiledPlan ¶
type ConnectionPool ¶
type ConnectionPool struct {
// contains filtered or unexported fields
}
ConnectionPool re-exposes ResourcePool as a pool of DBConnection objects
func NewConnectionPool ¶
func NewConnectionPool(capacity int, idleTimeout time.Duration) *ConnectionPool
func (*ConnectionPool) Close ¶
func (cp *ConnectionPool) Close()
func (*ConnectionPool) Get ¶
func (cp *ConnectionPool) Get() PoolConnection
You must call Recycle on the PoolConnection once done.
func (*ConnectionPool) Open ¶
func (cp *ConnectionPool) Open(connFactory CreateConnectionFunc)
func (*ConnectionPool) Put ¶
func (cp *ConnectionPool) Put(conn PoolConnection)
func (*ConnectionPool) SafeGet ¶
func (cp *ConnectionPool) SafeGet() (PoolConnection, error)
You must call Recycle on the PoolConnection once done.
func (*ConnectionPool) SetCapacity ¶
func (cp *ConnectionPool) SetCapacity(capacity int) (err error)
func (*ConnectionPool) SetIdleTimeout ¶
func (cp *ConnectionPool) SetIdleTimeout(idleTimeout time.Duration)
func (*ConnectionPool) StatsJSON ¶
func (cp *ConnectionPool) StatsJSON() string
func (*ConnectionPool) TryGet ¶
func (cp *ConnectionPool) TryGet() PoolConnection
You must call Recycle on the PoolConnection once done.
type Consolidator ¶
type Consolidator struct {
// contains filtered or unexported fields
}
func NewConsolidator ¶
func NewConsolidator() *Consolidator
func (*Consolidator) ServeHTTP ¶
func (co *Consolidator) ServeHTTP(response http.ResponseWriter, request *http.Request)
type CreateCacheFunc ¶
type CreateCacheFunc func() (*memcache.Connection, error)
func CacheCreator ¶
func CacheCreator(dbconfig dbconfigs.DBConfig) CreateCacheFunc
type CreateConnectionFunc ¶
type CreateConnectionFunc func() (connection *DBConnection, err error)
func GenericConnectionCreator ¶
func GenericConnectionCreator(info mysql.ConnectionParams) CreateConnectionFunc
type DBConnection ¶
type DBConnection struct {
*mysql.Connection
}
DBConnection re-exposes mysql.Connection with some wrapping.
func CreateGenericConnection ¶
func CreateGenericConnection(info mysql.ConnectionParams) (*DBConnection, error)
func (*DBConnection) ExecuteFetch ¶
func (dbc *DBConnection) ExecuteFetch(query string, maxrows int, wantfields bool) (*proto.QueryResult, error)
func (*DBConnection) ExecuteStreamFetch ¶
func (conn *DBConnection) ExecuteStreamFetch(query string, callback func(interface{}) error, streamBufferSize int) error
func (*DBConnection) VerifyStrict ¶
func (conn *DBConnection) VerifyStrict() bool
type ExecPlan ¶
type ExecPlan struct { *sqlparser.ExecPlan TableInfo *TableInfo Fields []mproto.Field Rules *QueryRules QueryCount int64 Time time.Duration RowCount int64 ErrorCount int64 // contains filtered or unexported fields }
type GenericCache ¶
type GenericCache struct {
// contains filtered or unexported fields
}
func NewGenericCache ¶
func NewGenericCache(cachePool *CachePool) *GenericCache
func (*GenericCache) PurgeCache ¶
func (gc *GenericCache) PurgeCache()
type InvalidationError ¶
type InvalidationError struct {
// contains filtered or unexported fields
}
func NewInvalidationError ¶
func NewInvalidationError(errType, msg, pos string) *InvalidationError
func (*InvalidationError) Error ¶
func (err *InvalidationError) Error() string
type InvalidationProcessor ¶
type InvalidationProcessor struct {
// contains filtered or unexported fields
}
var CacheInvalidationProcessor *InvalidationProcessor
func NewInvalidationProcessor ¶
func NewInvalidationProcessor() *InvalidationProcessor
type PoolConnection ¶
type QueryEngine ¶
type QueryEngine struct {
// contains filtered or unexported fields
}
-----------------------------------------------
func NewQueryEngine ¶
func NewQueryEngine(config Config) *QueryEngine
func (*QueryEngine) Begin ¶
func (qe *QueryEngine) Begin(logStats *sqlQueryStats, connectionId int64) (transactionId int64)
func (*QueryEngine) Close ¶
func (qe *QueryEngine) Close(forRestart bool)
func (*QueryEngine) CloseReserved ¶
func (qe *QueryEngine) CloseReserved(connectionId int64)
func (*QueryEngine) Commit ¶
func (qe *QueryEngine) Commit(logStats *sqlQueryStats, transactionId int64)
func (*QueryEngine) CreateReserved ¶
func (qe *QueryEngine) CreateReserved() (connectionId int64)
func (*QueryEngine) Execute ¶
func (qe *QueryEngine) Execute(logStats *sqlQueryStats, query *proto.Query) (reply *mproto.QueryResult)
func (*QueryEngine) Invalidate ¶
func (qe *QueryEngine) Invalidate(cacheInvalidate *proto.CacheInvalidate)
func (*QueryEngine) InvalidateForDDL ¶
func (qe *QueryEngine) InvalidateForDDL(ddlInvalidate *proto.DDLInvalidate)
func (*QueryEngine) Open ¶
func (qe *QueryEngine) Open(dbconfig dbconfigs.DBConfig, schemaOverrides []SchemaOverride, qrs *QueryRules)
func (*QueryEngine) Rollback ¶
func (qe *QueryEngine) Rollback(logStats *sqlQueryStats, transactionId int64)
func (*QueryEngine) StreamExecute ¶
func (qe *QueryEngine) StreamExecute(logStats *sqlQueryStats, query *proto.Query, sendReply func(reply interface{}) error)
the first QueryResult will have Fields set (and Rows nil) the subsequent QueryResult will have Rows set (and Fields nil)
type QueryRule ¶
QueryRule represents one rule (conditions-action). Name is meant to uniquely identify a rule. Description is a human readable comment that describes the rule. For a QueryRule to fire, all conditions of the QueryRule have to match. For example, an empty QueryRule will match all requests. Every QueryRule has an associated Action. If all the conditions of the QueryRule are met, then the Action is triggerred.
func NewQueryRule ¶
NewQueryRule creates a new QueryRule.
func (*QueryRule) AddBindVarCond ¶
func (qr *QueryRule) AddBindVarCond(name string, onAbsent, onMismatch bool, op Operator, value interface{}) error
AddBindVarCond adds a bind variable restriction to the QueryRule. All bind var conditions have to be satisfied for the QueryRule to be a match. name represents the name (not regexp) of the bind variable. onAbsent specifies the value of the condition if the bind variable is absent. onMismatch specifies the value of the condition if there's a type mismatch on the condition. For inequalities, the bindvar is the left operand and the value in the condition is the right operand: bindVar Operator value. Value & operator rules Type Operators Bindvar nil NOOP any type uint64 EQ, NE, LT, GE, GT, LE whole numbers int64 EQ, NE, LT, GE, GT, LE whole numbers string EQ, NE, LT, GE, GT, LE, MATCH, NOMATCH []byte, string KeyRange IN, NOTIN whole numbers whole numbers can be: int, int8, int16, int32, int64, uint64
func (*QueryRule) AddPlanCond ¶
AddPlanCond adds to the list of plans that can be matched for the rule to fire. Unlke all other condtions, this function acts as an OR: Any plan id match is considered a match.
func (*QueryRule) SetIPCond ¶
SetIPCond adds a regular expression condition for the client IP. It has to be a full match (not substring).
func (*QueryRule) SetQueryCond ¶
SetQueryCond adds a regular expression condition for the query.
func (*QueryRule) SetUserCond ¶
SetUserCond adds a regular expression condition for the user name used by the client.
type QueryRules ¶
type QueryRules struct {
// contains filtered or unexported fields
}
QueryRules is used to store and execute rules for the tabletserver.
func GetQueryRules ¶
func GetQueryRules() (qrs *QueryRules)
func (*QueryRules) Add ¶
func (qrs *QueryRules) Add(qr *QueryRule)
Add adds a QueryRule to QueryRules. It does not check for duplicates.
func (*QueryRules) Copy ¶
func (qrs *QueryRules) Copy() (newqrs *QueryRules)
Copy performs a deep copy of QueryRules. A nil input produces a nil output.
func (*QueryRules) Delete ¶
func (qrs *QueryRules) Delete(name string) (qr *QueryRule)
Delete deletes a QueryRule by name and returns the rule that was deleted. It returns nil if the rule was not found.
func (*QueryRules) Find ¶
func (qrs *QueryRules) Find(name string) (qr *QueryRule)
Find finds the first occurrence of a QueryRule by matching the Name field. It returns nil if the rule was not found.
func (*QueryRules) UnmarshalJSON ¶
func (qrs *QueryRules) UnmarshalJSON(data []byte) (err error)
type ReservedPool ¶
type ReservedPool struct {
// contains filtered or unexported fields
}
func NewReservedPool ¶
func NewReservedPool() *ReservedPool
func (*ReservedPool) Close ¶
func (rp *ReservedPool) Close()
func (*ReservedPool) CloseConnection ¶
func (rp *ReservedPool) CloseConnection(connectionId int64)
func (*ReservedPool) CreateConnection ¶
func (rp *ReservedPool) CreateConnection() (connectionId int64)
func (*ReservedPool) Get ¶
func (rp *ReservedPool) Get(connectionId int64) PoolConnection
You must call Recycle on the PoolConnection once done.
func (*ReservedPool) Open ¶
func (rp *ReservedPool) Open(connFactory CreateConnectionFunc)
func (*ReservedPool) Stats ¶
func (rp *ReservedPool) Stats() (size int)
func (*ReservedPool) StatsJSON ¶
func (rp *ReservedPool) StatsJSON() string
type Result ¶
type Result struct { Result *proto.QueryResult Err error // contains filtered or unexported fields }
type RowCache ¶
type RowCache struct {
// contains filtered or unexported fields
}
func NewRowCache ¶
type SchemaInfo ¶
type SchemaInfo struct {
// contains filtered or unexported fields
}
func NewSchemaInfo ¶
func (*SchemaInfo) Close ¶
func (si *SchemaInfo) Close()
func (*SchemaInfo) CreateTable ¶
func (si *SchemaInfo) CreateTable(tableName string)
func (*SchemaInfo) DropTable ¶
func (si *SchemaInfo) DropTable(tableName string)
func (*SchemaInfo) GetPlan ¶
func (si *SchemaInfo) GetPlan(logStats *sqlQueryStats, sql string) (plan *ExecPlan)
func (*SchemaInfo) GetRules ¶
func (si *SchemaInfo) GetRules() (qrs *QueryRules)
func (*SchemaInfo) GetStreamPlan ¶
func (si *SchemaInfo) GetStreamPlan(sql string) *sqlparser.ParsedQuery
GetStreamPlan is similar to GetPlan, but doesn't use the cache and doesn't enforce a limit. It also just returns the parsed query.
func (*SchemaInfo) GetTable ¶
func (si *SchemaInfo) GetTable(tableName string) *TableInfo
func (*SchemaInfo) Open ¶
func (si *SchemaInfo) Open(connFactory CreateConnectionFunc, schemaOverrides []SchemaOverride, cachePool *CachePool, qrs *QueryRules)
func (*SchemaInfo) Reload ¶
func (si *SchemaInfo) Reload()
func (*SchemaInfo) ServeHTTP ¶
func (si *SchemaInfo) ServeHTTP(response http.ResponseWriter, request *http.Request)
func (*SchemaInfo) SetQueryCacheSize ¶
func (si *SchemaInfo) SetQueryCacheSize(size int)
func (*SchemaInfo) SetReloadTime ¶
func (si *SchemaInfo) SetReloadTime(reloadTime time.Duration)
func (*SchemaInfo) SetRules ¶
func (si *SchemaInfo) SetRules(qrs *QueryRules)
type SchemaOverride ¶
type SqlQuery ¶
type SqlQuery struct {
// contains filtered or unexported fields
}
----------------------------------------------- RPC API
var SqlQueryRpcService *SqlQuery
func NewSqlQuery ¶
func (*SqlQuery) CloseReserved ¶
func (*SqlQuery) CreateReserved ¶
func (*SqlQuery) ExecuteBatch ¶
func (*SqlQuery) GetSessionId ¶
func (sq *SqlQuery) GetSessionId(sessionParams *proto.SessionParams, sessionInfo *proto.SessionInfo) error
type TableInfo ¶
func NewTableInfo ¶
type TabletError ¶
func NewTabletError ¶
func NewTabletError(errorType int, format string, args ...interface{}) *TabletError
func NewTabletErrorSql ¶
func NewTabletErrorSql(errorType int, err error) *TabletError
func (*TabletError) Error ¶
func (te *TabletError) Error() string
func (*TabletError) RecordStats ¶
func (te *TabletError) RecordStats()
type TxConnection ¶
type TxConnection struct { PoolConnection // contains filtered or unexported fields }
func (*TxConnection) DirtyKeys ¶
func (txc *TxConnection) DirtyKeys(tableName string) DirtyKeys
func (*TxConnection) RecordQuery ¶
func (txc *TxConnection) RecordQuery(query string)
func (*TxConnection) Recycle ¶
func (txc *TxConnection) Recycle()