tabletserver

package
v2.0.0-alpha1+incompat... Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2015 License: BSD-3-Clause Imports: 60 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QR_CONTINUE = Action(iota)
	QR_FAIL
	QR_FAIL_RETRY
)
View Source
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
)
View Source
const (
	QR_OK = iota
	QR_MISMATCH
	QR_OUT_OF_RANGE
)
View Source
const (
	// StateNotServing is the not serving state.
	StateNotServing = iota
	// StateInitializing is the initializing state.
	// This is a transient state. It's only informational.
	StateInitializing
	// StateServing is the serving state.
	// All operations are allowed.
	StateServing
	// StateShuttingTx means that the query service is shutting
	// down and has disallowed new transactions.
	// New queries are still allowed as long as they
	// are part of an existing transaction. We remain in this state
	// until all existing transactions are completed.
	StateShuttingTx
	// StateShuttingQueries comes after StateShuttingTx.
	// It means that the query service has disallowed
	// new queries. We enter this state after all existing
	// transactions have completed. We remain in this
	// state until all existing queries are completed.
	// The next state after this is StateNotServing.
	StateShuttingQueries
)

Allowed state transitions: StateNotServing -> StateInitializing -> StateServing/StateNotServing, StateServing -> StateShuttingTx StateShuttingTx -> StateShuttingQueries StateShuttingQueries -> StateNotServing

View Source
const (
	// QuerySourceRowcache means query result is found in rowcache.
	QuerySourceRowcache = 1 << iota
	// QuerySourceConsolidator means query result is found in consolidator.
	QuerySourceConsolidator
	// QuerySourceMySQL means query result is returned from MySQL.
	QuerySourceMySQL
)
View Source
const (
	// ErrFail is returned when a query fails
	ErrFail = iota

	// ErrRetry is returned when a query can be retried
	ErrRetry

	// ErrFatal is returned when a query cannot be retried
	ErrFatal

	// ErrTxPoolFull is returned when we can't get a connection
	ErrTxPoolFull

	// ErrNotInTx is returned when we're not in a transaction but should be
	ErrNotInTx
)
View Source
const (
	TxClose    = "close"
	TxCommit   = "commit"
	TxRollback = "rollback"
	TxKill     = "kill"
)

These consts identify how a transaction was resolved.

View Source
const TRAILING_COMMENT = "_trailingComment"

Variables

View Source
var DefaultQsConfig = Config{
	PoolSize:             16,
	StreamPoolSize:       750,
	TransactionCap:       20,
	TransactionTimeout:   30,
	MaxResultSize:        10000,
	MaxDMLRows:           500,
	QueryCacheSize:       5000,
	SchemaReloadTime:     30 * 60,
	QueryTimeout:         0,
	TxPoolTimeout:        1,
	IdleTimeout:          30 * 60,
	StreamBufferSize:     32 * 1024,
	RowCache:             RowCacheConfig{Memory: -1, Connections: -1, Threads: -1},
	SpotCheckRatio:       0,
	StrictMode:           true,
	StrictTableAcl:       false,
	TerseErrors:          false,
	EnablePublishStats:   true,
	EnableAutoCommit:     false,
	EnableTableAclDryRun: false,
	StatsPrefix:          "",
	DebugURLPrefix:       "/debug",
	PoolNamePrefix:       "",
	TableAclExemptACL:    "",
}

DefaultQSConfig is the default value for the query service config.

The value for StreamBufferSize was chosen after trying out a few of them. Too small buffers force too many packets to be sent. Too big buffers force the clients to read them in multiple chunks and make memory copies. so with the encoding overhead, this seems to work great (the overhead makes the final packets on the wire about twice bigger than this).

View Source
var ErrConnPoolClosed = NewTabletError(ErrFatal, "connection pool is closed")

ErrConnPoolClosed is returned / panicked when the connection pool is closed.

View Source
var QueryRuleSources = NewQueryRuleInfo()

Global variable to keep track of every registered query rule source

View Source
var QueryServiceControlRegisterFunctions []QueryServiceControlRegisterFunction

QueryServiceControlRegisterFunctions is an array of all the QueryServiceControlRegisterFunction that will be called upon Register() on a QueryServiceControl

View Source
var (
	// RPCErrorOnlyInReply is the flag to control how errors will be sent over RPCs for all queryservice implementations.
	RPCErrorOnlyInReply = flag.Bool("rpc-error-only-in-reply", false, "if true, supported RPC calls will only return errors as part of the RPC server response")
)
View Source
var SqlQueryLogger = streamlog.New("SqlQuery", 50)

SqlQueryLogger is the main stream logger object

View Source
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 AddTabletErrorToBeginResponse

func AddTabletErrorToBeginResponse(err error, reply *proto.BeginResponse)

AddTabletErrorToBeginResponse will mutate a BeginResponse struct to fill in the Err field with details from the TabletError.

func AddTabletErrorToCommitResponse

func AddTabletErrorToCommitResponse(err error, reply *proto.CommitResponse)

AddTabletErrorToCommitResponse will mutate a CommitResponse struct to fill in the Err field with details from the TabletError.

func AddTabletErrorToQueryResult

func AddTabletErrorToQueryResult(err error, reply *mproto.QueryResult)

AddTabletErrorToQueryResult will mutate a QueryResult struct to fill in the Err field with details from the TabletError.

func AddTabletErrorToQueryResultList

func AddTabletErrorToQueryResultList(err error, reply *proto.QueryResultList)

AddTabletErrorToQueryResultList will mutate a QueryResultList struct to fill in the Err field with details from the TabletError.

func AddTabletErrorToRollbackResponse

func AddTabletErrorToRollbackResponse(err error, reply *proto.RollbackResponse)

AddTabletErrorToRollbackResponse will mutate a RollbackResponse struct to fill in the Err field with details from the TabletError.

func AddTabletErrorToSessionInfo

func AddTabletErrorToSessionInfo(err error, reply *proto.SessionInfo)

AddTabletErrorToSessionInfo will mutate a SessionInfo struct to fill in the Err field with details from the TabletError.

func AddTabletErrorToSplitQueryResult

func AddTabletErrorToSplitQueryResult(err error, reply *proto.SplitQueryResult)

AddTabletErrorToSplitQueryResult will mutate a SplitQueryResult struct to fill in the Err field with details from the TabletError.

func AddTabletErrorToTransactionInfo

func AddTabletErrorToTransactionInfo(err error, reply *proto.TransactionInfo)

AddTabletErrorToTransactionInfo will mutate a TransactionInfo struct to fill in the Err field with details from the TabletError.

func InitQueryService

func InitQueryService(qsc QueryServiceControl)

InitQueryService registers the query service, after loading any necessary config files. It also starts any relevant streaming logs.

func IsConnErr

func IsConnErr(err error) bool

IsConnErr returns true if the error is a connection error. If the error is of type TabletError or hasNumber, it checks the error code. Otherwise, it parses the string looking for (errno xxxx) and uses the extracted value to determine if it's a conn error.

func PrefixTabletError

func PrefixTabletError(errorType int, err error, prefix string) error

PrefixTabletError attempts to add a string prefix to a TabletError, while preserving its ErrorType. If the given error is not a TabletError, a new TabletError is returned with the desired ErrorType.

func Rand

func Rand() int64

Rand generates a pseudo-random int64 number.

func TabletErrorToRPCError

func TabletErrorToRPCError(err error) *vtrpc.RPCError

TabletErrorToRPCError transforms the provided error to a RPCError, if any.

Types

type Action

type Action int

Action speficies the list of actions to perform when a QueryRule is triggered.

type BindVarCond

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

BindVarCond represents a bind var condition.

type CacheInvalidator

type CacheInvalidator interface {
	Delete(key string)
}

CacheInvalidator provides the abstraction needed for an instant invalidation vs. delayed invalidation in the case of in-transaction dmls

type CachePool

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

CachePool re-exposes ResourcePool as a pool of Memcache connection objects.

func NewCachePool

func NewCachePool(
	name string,
	rowCacheConfig RowCacheConfig,
	idleTimeout time.Duration,
	statsURL string,
	enablePublishStats bool,
	queryServiceStats *QueryServiceStats) *CachePool

NewCachePool creates a new pool for rowcache connections.

func (*CachePool) Available

func (cp *CachePool) Available() int64

Available returns the number of available connections in the pool.

func (*CachePool) Capacity

func (cp *CachePool) Capacity() int64

Capacity returns the current capacity of the pool.

func (*CachePool) Close

func (cp *CachePool) Close()

Close closes the CachePool. It also shuts down memcache. You can call Open again after Close.

func (*CachePool) Get

Get returns a memcache connection from the pool. You must call Put after Get.

func (*CachePool) IdleTimeout

func (cp *CachePool) IdleTimeout() time.Duration

IdleTimeout returns the connection idle timeout.

func (*CachePool) IsClosed

func (cp *CachePool) IsClosed() bool

IsClosed returns true if CachePool is closed.

func (*CachePool) MaxCap

func (cp *CachePool) MaxCap() int64

MaxCap returns the extent to which the pool capacity can be increased.

func (*CachePool) Open

func (cp *CachePool) Open()

Open opens the pool. It launches memcache and waits till it's up.

func (*CachePool) Put

func (cp *CachePool) Put(conn cacheservice.CacheService)

Put returns the connection to the pool.

func (*CachePool) ServeHTTP

func (cp *CachePool) ServeHTTP(response http.ResponseWriter, request *http.Request)

ServeHTTP serves memcache stats as HTTP.

func (*CachePool) StatsJSON

func (cp *CachePool) StatsJSON() string

StatsJSON returns a JSON version of the CachePool stats.

func (*CachePool) WaitCount

func (cp *CachePool) WaitCount() int64

WaitCount returns the number of times we had to wait to get a connection from the pool.

func (*CachePool) WaitTime

func (cp *CachePool) WaitTime() time.Duration

WaitTime returns the total amount of time spent waiting for a connection.

type Config

type Config struct {
	PoolSize             int
	StreamPoolSize       int
	TransactionCap       int
	TransactionTimeout   float64
	MaxResultSize        int
	MaxDMLRows           int
	StreamBufferSize     int
	QueryCacheSize       int
	SchemaReloadTime     float64
	QueryTimeout         float64
	TxPoolTimeout        float64
	IdleTimeout          float64
	RowCache             RowCacheConfig
	SpotCheckRatio       float64
	StrictMode           bool
	StrictTableAcl       bool
	TerseErrors          bool
	EnablePublishStats   bool
	EnableAutoCommit     bool
	EnableTableAclDryRun bool
	StatsPrefix          string
	DebugURLPrefix       string
	PoolNamePrefix       string
	TableAclExemptACL    string
}

Config contains all the configuration for query service

type ConnPool

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

ConnPool implements a custom connection pool for tabletserver. It's similar to dbconnpool.ConnPool, but the connections it creates come with built-in ability to kill in-flight queries. These connections also trigger a CheckMySQL call if we fail to connect to MySQL. Other than the connection type, ConnPool maintains an additional pool of dba connections that are used to kill connections.

func NewConnPool

func NewConnPool(
	name string,
	capacity int,
	idleTimeout time.Duration,
	enablePublishStats bool,
	queryServiceStats *QueryServiceStats) *ConnPool

NewConnPool creates a new ConnPool. The name is used to publish stats only.

func (*ConnPool) Available

func (cp *ConnPool) Available() int64

Available returns the number of available connections in the pool

func (*ConnPool) Capacity

func (cp *ConnPool) Capacity() int64

Capacity returns the pool capacity.

func (*ConnPool) Close

func (cp *ConnPool) Close()

Close will close the pool and wait for connections to be returned before exiting.

func (*ConnPool) Get

func (cp *ConnPool) Get(ctx context.Context) (*DBConn, error)

Get returns a connection. You must call Recycle on DBConn once done.

func (*ConnPool) IdleTimeout

func (cp *ConnPool) IdleTimeout() time.Duration

IdleTimeout returns the idle timeout for the pool.

func (*ConnPool) MaxCap

func (cp *ConnPool) MaxCap() int64

MaxCap returns the maximum size of the pool

func (*ConnPool) Open

func (cp *ConnPool) Open(appParams, dbaParams *sqldb.ConnParams)

Open must be called before starting to use the pool.

func (*ConnPool) Put

func (cp *ConnPool) Put(conn *DBConn)

Put puts a connection into the pool.

func (*ConnPool) SetCapacity

func (cp *ConnPool) SetCapacity(capacity int) (err error)

SetCapacity alters the size of the pool at runtime.

func (*ConnPool) SetIdleTimeout

func (cp *ConnPool) SetIdleTimeout(idleTimeout time.Duration)

SetIdleTimeout sets the idleTimeout on the pool.

func (*ConnPool) StatsJSON

func (cp *ConnPool) StatsJSON() string

StatsJSON returns the pool stats as a JSOn object.

func (*ConnPool) WaitCount

func (cp *ConnPool) WaitCount() int64

WaitCount returns how many clients are waiting for a connection

func (*ConnPool) WaitTime

func (cp *ConnPool) WaitTime() time.Duration

WaitTime return the pool WaitTime.

type DBConn

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

DBConn is a db connection for tabletserver. It performs automatic reconnects as needed. Its Execute function has a timeout that can kill its own queries and the underlying connection. It will also trigger a CheckMySQL whenever applicable.

func NewDBConn

func NewDBConn(
	cp *ConnPool,
	appParams,
	dbaParams *sqldb.ConnParams,
	qStats *QueryServiceStats) (*DBConn, error)

NewDBConn creates a new DBConn. It triggers a CheckMySQL if creation fails.

func (*DBConn) Close

func (dbc *DBConn) Close()

Close closes the DBConn.

func (*DBConn) Current

func (dbc *DBConn) Current() string

Current returns the currently executing query.

func (*DBConn) Exec

func (dbc *DBConn) Exec(ctx context.Context, query string, maxrows int, wantfields bool) (*mproto.QueryResult, error)

Exec executes the specified query. If there is a connection error, it will reconnect and retry. A failed reconnect will trigger a CheckMySQL.

func (*DBConn) ExecOnce

func (dbc *DBConn) ExecOnce(ctx context.Context, query string, maxrows int, wantfields bool) (*mproto.QueryResult, error)

ExecOnce executes the specified query, but does not retry on connection errors.

func (*DBConn) ID

func (dbc *DBConn) ID() int64

ID returns the connection id.

func (*DBConn) IsClosed

func (dbc *DBConn) IsClosed() bool

IsClosed returns true if DBConn is closed.

func (*DBConn) Kill

func (dbc *DBConn) Kill() error

Kill kills the currently executing query both on MySQL side and on the connection side. If no query is executing, it's a no-op. Kill will also not kill a query more than once.

func (*DBConn) Recycle

func (dbc *DBConn) Recycle()

Recycle returns the DBConn to the pool.

func (*DBConn) Stream

func (dbc *DBConn) Stream(ctx context.Context, query string, callback func(*mproto.QueryResult) error, streamBufferSize int) error

Stream executes the query and streams the results.

func (*DBConn) VerifyStrict

func (dbc *DBConn) VerifyStrict() bool

VerifyStrict returns true if MySQL is in STRICT mode.

type DirtyKeys

type DirtyKeys map[string]bool

DirtyKeys provides a cache-like interface, where it just adds keys to its likst as Delete gets called.

func (DirtyKeys) Delete

func (dk DirtyKeys) Delete(key string)

Delete just keeps track of what needs to be deleted

type ExecPlan

type ExecPlan struct {
	*planbuilder.ExecPlan
	TableInfo  *TableInfo
	Fields     []mproto.Field
	Rules      *QueryRules
	Authorized tacl.ACL

	QueryCount int64
	Time       time.Duration
	RowCount   int64
	ErrorCount int64
	// contains filtered or unexported fields
}

ExecPlan wraps the planbuilder's exec plan to enforce additional rules and track stats.

func (*ExecPlan) AddStats

func (ep *ExecPlan) AddStats(queryCount int64, duration time.Duration, rowCount, errorCount int64)

AddStats updates the stats for the current ExecPlan.

func (*ExecPlan) Size

func (*ExecPlan) Size() int

Size allows ExecPlan to be in cache.LRUCache.

func (*ExecPlan) Stats

func (ep *ExecPlan) Stats() (queryCount int64, duration time.Duration, rowCount, errorCount int64)

Stats returns the current stats of ExecPlan.

type MemcacheStats

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

MemcacheStats exports the Memcache internal stats through stats package.

func NewMemcacheStats

func NewMemcacheStats(
	statsPrefix string,
	refreshFreq time.Duration,
	flags int64,
	queryServiceStats *QueryServiceStats,
	statsFunc RetrieveCacheStats) *MemcacheStats

NewMemcacheStats creates a new MemcacheStats. main, slabs and items specify the categories of stats that need to be exported.

func (*MemcacheStats) Close

func (memstats *MemcacheStats) Close()

Close clears the variable values and stops exporting the stats.

func (*MemcacheStats) Open

func (memstats *MemcacheStats) Open()

Open starts exporting the stats.

type Operator

type Operator int

Operator represents the list of operators.

func MapStrOperator

func MapStrOperator(strop string) (op Operator, err error)

type QueryDetail

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

QueryDetail is a simple wrapper for Query, Context and a killable conn.

func NewQueryDetail

func NewQueryDetail(ctx context.Context, conn killable) *QueryDetail

NewQueryDetail creates a new QueryDetail

type QueryDetailzRow

type QueryDetailzRow struct {
	Query             string
	ContextHTML       template.HTML
	Start             time.Time
	Duration          time.Duration
	ConnID            int64
	State             string
	ShowTerminateLink bool
}

QueryDetailzRow is used for rendering QueryDetail in a template

type QueryEngine

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

QueryEngine implements the core functionality of tabletserver. It assumes that no requests will be sent to it before Open is called and succeeds. Shutdown is done in the following order:

WaitForTxEmpty: There should be no more new calls to Begin once this function is called. This will return when there are no more pending transactions.

Close: There should be no more pending queries when this function is called.

Functions of QueryEngine do not return errors. They instead panic with NewTabletError as the error type. TODO(sougou): Switch to error return scheme.

func NewQueryEngine

func NewQueryEngine(config Config) *QueryEngine

NewQueryEngine creates a new QueryEngine. This is a singleton class. You must call this only once.

func (*QueryEngine) CheckMySQL

func (qe *QueryEngine) CheckMySQL() bool

CheckMySQL returns true if we can connect to MySQL.

func (*QueryEngine) Close

func (qe *QueryEngine) Close()

Close must be called to shut down QueryEngine. You must ensure that no more queries will be sent before calling Close.

func (*QueryEngine) Commit

func (qe *QueryEngine) Commit(ctx context.Context, logStats *SQLQueryStats, transactionID int64)

Commit commits the specified transaction.

func (*QueryEngine) Launch

func (qe *QueryEngine) Launch(f func())

Launch launches the specified function inside a goroutine. If Close or WaitForTxEmpty is called while a goroutine is running, QueryEngine will not return until the existing functions have completed. This functionality allows us to launch tasks with the assurance that the QueryEngine will not be closed underneath us.

func (*QueryEngine) Open

func (qe *QueryEngine) Open(dbconfigs *dbconfigs.DBConfigs, schemaOverrides []SchemaOverride, mysqld mysqlctl.MysqlDaemon)

Open must be called before sending requests to QueryEngine.

func (*QueryEngine) WaitForTxEmpty

func (qe *QueryEngine) WaitForTxEmpty()

WaitForTxEmpty must be called before calling Close. Before calling WaitForTxEmpty, you must ensure that there will be no more calls to Begin.

type QueryExecutor

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

QueryExecutor is used for executing a query request.

func (*QueryExecutor) Execute

func (qre *QueryExecutor) Execute() (reply *mproto.QueryResult, err error)

Execute performs a non-streaming query execution.

func (*QueryExecutor) Stream

func (qre *QueryExecutor) Stream(sendReply func(*mproto.QueryResult) error) error

Stream performs a streaming query execution.

type QueryList

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

QueryList holds a thread safe list of QueryDetails

func NewQueryList

func NewQueryList() *QueryList

NewQueryList creates a new QueryList

func (*QueryList) Add

func (ql *QueryList) Add(qd *QueryDetail)

Add adds a QueryDetail to QueryList

func (*QueryList) GetQueryzRows

func (ql *QueryList) GetQueryzRows() []QueryDetailzRow

GetQueryzRows returns a list of QueryDetailzRow sorted by start time

func (*QueryList) Remove

func (ql *QueryList) Remove(qd *QueryDetail)

Remove removes a QueryDetail from QueryList

func (*QueryList) Terminate

func (ql *QueryList) Terminate(connID int64) error

Terminate updates the query status and kills the connection

func (*QueryList) TerminateAll

func (ql *QueryList) TerminateAll()

TerminateAll terminates all queries and kills the MySQL connections

type QueryRule

type QueryRule struct {
	Description string
	Name        string
	// contains filtered or unexported fields
}

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 BuildQueryRule

func BuildQueryRule(ruleInfo map[string]interface{}) (qr *QueryRule, err error)

func NewQueryRule

func NewQueryRule(description, name string, act Action) (qr *QueryRule)

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

func (qr *QueryRule) AddPlanCond(planType planbuilder.PlanType)

AddPlanCond adds to the list of plans that can be matched for the rule to fire. This function acts as an OR: Any plan id match is considered a match.

func (*QueryRule) AddTableCond

func (qr *QueryRule) AddTableCond(tableName string)

AddTableCond adds to the list of tableNames that can be matched for the rule to fire. This function acts as an OR: Any tableName match is considered a match.

func (*QueryRule) Copy

func (qr *QueryRule) Copy() (newqr *QueryRule)

Copy performs a deep copy of a QueryRule.

func (*QueryRule) SetIPCond

func (qr *QueryRule) SetIPCond(pattern string) (err error)

SetIPCond adds a regular expression condition for the client IP. It has to be a full match (not substring).

func (*QueryRule) SetQueryCond

func (qr *QueryRule) SetQueryCond(pattern string) (err error)

SetQueryCond adds a regular expression condition for the query.

func (*QueryRule) SetUserCond

func (qr *QueryRule) SetUserCond(pattern string) (err error)

SetUserCond adds a regular expression condition for the user name used by the client.

type QueryRuleInfo

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

QueryRuleInfo is the maintainer of QueryRules from multiple sources

func NewQueryRuleInfo

func NewQueryRuleInfo() *QueryRuleInfo

NewQueryRuleInfo returns an empty QueryRuleInfo object for use

func (*QueryRuleInfo) GetRules

func (qri *QueryRuleInfo) GetRules(ruleSource string) (*QueryRules, error)

GetRules returns the corresponding QueryRules as designated by ruleSource parameter

func (*QueryRuleInfo) RegisterQueryRuleSource

func (qri *QueryRuleInfo) RegisterQueryRuleSource(ruleSource string)

RegisterQueryRuleSource registers a query rule source name with QueryRuleInfo

func (*QueryRuleInfo) SetRules

func (qri *QueryRuleInfo) SetRules(ruleSource string, newRules *QueryRules) error

SetRules takes an external QueryRules structure and overwrite one of the internal QueryRules as designated by ruleSource parameter

func (*QueryRuleInfo) UnRegisterQueryRuleSource

func (qri *QueryRuleInfo) UnRegisterQueryRuleSource(ruleSource string)

UnRegisterQueryRuleSource removes a registered query rule source name

type QueryRules

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

QueryRules is used to store and execute rules for the tabletserver.

func NewQueryRules

func NewQueryRules() *QueryRules

NewQueryRules creates a new QueryRules.

func (*QueryRules) Add

func (qrs *QueryRules) Add(qr *QueryRule)

Add adds a QueryRule to QueryRules. It does not check for duplicates.

func (*QueryRules) Append

func (qrs *QueryRules) Append(otherqrs *QueryRules)

Append merges the rules from another QueryRules into the receiver

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 QueryServiceControl

type QueryServiceControl interface {
	// Register registers this query service with the RPC layer.
	Register()

	// AddStatusPart adds the status part to the status page
	AddStatusPart()

	// AllowQueries enables queries.
	AllowQueries(*pb.Target, *dbconfigs.DBConfigs, []SchemaOverride, mysqlctl.MysqlDaemon) error

	// DisallowQueries shuts down the query service.
	DisallowQueries()

	// IsServing returns true if the query service is running
	IsServing() bool

	// IsHealthy returns the health status of the QueryService
	IsHealthy() error

	// ReloadSchema makes the quey service reload its schema cache
	ReloadSchema()

	// SetQueryRules sets the query rules for this QueryService
	SetQueryRules(ruleSource string, qrs *QueryRules) error

	// QueryService returns the QueryService object used by this
	// QueryServiceControl
	QueryService() queryservice.QueryService

	// BroadcastHealth sends the current health to all listeners
	BroadcastHealth(terTimestamp int64, stats *pb.RealtimeStats)
}

QueryServiceControl is the interface implemented by the controller for the query service.

func NewQueryServiceControl

func NewQueryServiceControl() QueryServiceControl

NewQueryServiceControl returns a real implementation of QueryServiceControl

type QueryServiceControlRegisterFunction

type QueryServiceControlRegisterFunction func(QueryServiceControl)

QueryServiceControlRegisterFunction is a callback type to be called when we Register() a QueryServiceControl

type QueryServiceStats

type QueryServiceStats struct {
	// MySQLStats shows the time histogram for operations spent on mysql side.
	MySQLStats *stats.Timings
	// QueryStats shows the time histogram for each type of queries.
	QueryStats *stats.Timings
	// WaitStats shows the time histogram for wait operations
	WaitStats *stats.Timings
	// KillStats shows number of connections being killed.
	KillStats *stats.Counters
	// InfoErrors shows number of various non critical errors happened.
	InfoErrors *stats.Counters
	// ErrorStats shows number of critial erros happened.
	ErrorStats *stats.Counters
	// InternalErros shows number of errors from internal components.
	InternalErrors *stats.Counters
	// QPSRates shows the qps.
	QPSRates *stats.Rates
	// ResultStats shows the histogram of number of rows returned.
	ResultStats *stats.Histogram
	// SpotCheckCount shows the number of spot check events happened.
	SpotCheckCount *stats.Int
}

QueryServiceStats contains stats that used in queryservice level.

func NewQueryServiceStats

func NewQueryServiceStats(statsPrefix string, enablePublishStats bool) *QueryServiceStats

NewQueryServiceStats returns a new QueryServiceStats instance.

type QuerySplitter

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

QuerySplitter splits a BoundQuery into equally sized smaller queries. QuerySplits are generated by adding primary key range clauses to the original query. Only a limited set of queries are supported, see QuerySplitter.validateQuery() for details. Also, the table must have at least one primary key and the leading primary key must be numeric, see QuerySplitter.splitBoundaries()

func NewQuerySplitter

func NewQuerySplitter(
	query *proto.BoundQuery,
	splitColumn string,
	splitCount int,
	schemaInfo *SchemaInfo) *QuerySplitter

NewQuerySplitter creates a new QuerySplitter. query is the original query to split and splitCount is the desired number of splits. splitCount must be a positive int, if not it will be set to 1.

type RCResult

type RCResult struct {
	Row []sqltypes.Value
	Cas uint64
}

RCResult represents the result of a cache multi-fetch.

type RetrieveCacheStats

type RetrieveCacheStats func(key string) string

RetrieveCacheStats returns current memcache stats.

type RowCache

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

RowCache gives a table-level view into the rowcache.

func NewRowCache

func NewRowCache(tableInfo *TableInfo, cachePool *CachePool) *RowCache

NewRowCache creates a new RowCache.

func (*RowCache) Delete

func (rc *RowCache) Delete(ctx context.Context, key string)

Delete marks the row as deleted.

func (*RowCache) Get

func (rc *RowCache) Get(ctx context.Context, keys []string) (results map[string]RCResult)

Get fetches the values for the specified keys.

func (*RowCache) Set

func (rc *RowCache) Set(ctx context.Context, key string, row []sqltypes.Value, cas uint64)

Set pushes the specified row into the rowcache.

type RowCacheConfig

type RowCacheConfig struct {
	Binary      string
	Memory      int
	Socket      string
	Connections int
	Threads     int
	LockPaged   bool
	StatsPrefix string
}

RowCacheConfig encapsulates the configuration for RowCache

func (*RowCacheConfig) GetSubprocessFlags

func (c *RowCacheConfig) GetSubprocessFlags(socket string) []string

GetSubprocessFlags returns the flags to use to call memcached

type RowcacheInvalidator

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

RowcacheInvalidator runs the service to invalidate the rowcache based on binlog events.

func NewRowcacheInvalidator

func NewRowcacheInvalidator(statsPrefix string, qe *QueryEngine, enablePublishStats bool) *RowcacheInvalidator

NewRowcacheInvalidator creates a new RowcacheInvalidator. Just like QueryEngine, this is a singleton class. You must call this only once.

func (*RowcacheInvalidator) AppendGTID

func (rci *RowcacheInvalidator) AppendGTID(gtid myproto.GTID)

AppendGTID updates the current replication position by appending a GTID to the set of transactions that have been processed.

func (*RowcacheInvalidator) Close

func (rci *RowcacheInvalidator) Close()

Close terminates the invalidation loop. It returns only of the loop has terminated.

func (*RowcacheInvalidator) Open

func (rci *RowcacheInvalidator) Open(dbname string, mysqld mysqlctl.MysqlDaemon)

Open runs the invalidation loop.

func (*RowcacheInvalidator) Position

Position returns the current ReplicationPosition.

func (*RowcacheInvalidator) PositionString

func (rci *RowcacheInvalidator) PositionString() string

PositionString returns the current ReplicationPosition as a string.

func (*RowcacheInvalidator) SetPosition

func (rci *RowcacheInvalidator) SetPosition(rp myproto.ReplicationPosition)

SetPosition sets the current ReplicationPosition.

type SQLQueryStats

type SQLQueryStats struct {
	Method        string
	PlanType      string
	OriginalSql   string
	BindVariables map[string]interface{}

	RowsAffected         int
	NumberOfQueries      int
	StartTime            time.Time
	EndTime              time.Time
	MysqlResponseTime    time.Duration
	WaitingForConnection time.Duration
	CacheHits            int64
	CacheAbsent          int64
	CacheMisses          int64
	CacheInvalidations   int64
	QuerySources         byte
	Rows                 [][]sqltypes.Value
	TransactionID        int64

	Error error
	// contains filtered or unexported fields
}

SQLQueryStats records the stats for a single query

func (*SQLQueryStats) AddRewrittenSql

func (stats *SQLQueryStats) AddRewrittenSql(sql string, start time.Time)

AddRewrittenSql adds a single sql statement to the rewritten list

func (*SQLQueryStats) ContextHTML

func (stats *SQLQueryStats) ContextHTML() template.HTML

ContextHTML returns the HTML version of the context that was used, or "". This is a method on SQLQueryStats instead of a field so that it doesn't need to be passed by value everywhere.

func (*SQLQueryStats) ErrorStr

func (stats *SQLQueryStats) ErrorStr() string

ErrorStr returns the error string or ""

func (*SQLQueryStats) FmtBindVariables

func (stats *SQLQueryStats) FmtBindVariables(full bool) string

FmtBindVariables returns the map of bind variables as JSON. For values that are strings or byte slices it only reports their type and length.

func (*SQLQueryStats) FmtQuerySources

func (stats *SQLQueryStats) FmtQuerySources() string

FmtQuerySources returns a comma separated list of query sources. If there were no query sources, it returns the string "none".

func (*SQLQueryStats) Format

func (stats *SQLQueryStats) Format(params url.Values) string

Format returns a tab separated list of logged fields.

func (*SQLQueryStats) RemoteAddrUsername

func (stats *SQLQueryStats) RemoteAddrUsername() (string, string)

RemoteAddrUsername returns some parts of CallInfo if set

func (*SQLQueryStats) RewrittenSql

func (stats *SQLQueryStats) RewrittenSql() string

RewrittenSql returns a semicolon separated list of SQL statements that were executed.

func (*SQLQueryStats) Send

func (stats *SQLQueryStats) Send()

Send finalizes a record and sends it

func (*SQLQueryStats) SizeOfResponse

func (stats *SQLQueryStats) SizeOfResponse() int

SizeOfResponse returns the approximate size of the response in bytes (this does not take in account BSON encoding). It will return 0 for streaming requests.

func (*SQLQueryStats) TotalTime

func (stats *SQLQueryStats) TotalTime() time.Duration

TotalTime returns how long this query has been running

type SchemaInfo

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

SchemaInfo stores the schema info and performs operations that keep itself and the rowcache up-to-date.

func NewSchemaInfo

func NewSchemaInfo(
	queryCacheSize int,
	statsPrefix string,
	endpoints map[string]string,
	reloadTime time.Duration,
	idleTimeout time.Duration,
	enablePublishStats bool,
	queryServiceStats *QueryServiceStats) *SchemaInfo

NewSchemaInfo creates a new SchemaInfo.

func (*SchemaInfo) ClearQueryPlanCache

func (si *SchemaInfo) ClearQueryPlanCache()

ClearQueryPlanCache should be called if query plan cache is potentially obsolete

func (*SchemaInfo) Close

func (si *SchemaInfo) Close()

Close shuts down SchemaInfo. It can be re-opened after Close.

func (*SchemaInfo) CreateOrUpdateTable

func (si *SchemaInfo) CreateOrUpdateTable(ctx context.Context, tableName string)

CreateOrUpdateTable must be called if a DDL was applied to that table.

func (*SchemaInfo) DropTable

func (si *SchemaInfo) DropTable(tableName string)

DropTable must be called if a table was dropped.

func (*SchemaInfo) GetPlan

func (si *SchemaInfo) GetPlan(ctx context.Context, logStats *SQLQueryStats, sql string) *ExecPlan

GetPlan returns the ExecPlan that for the query. Plans are cached in a cache.LRUCache.

func (*SchemaInfo) GetSchema

func (si *SchemaInfo) GetSchema() []*schema.Table

GetSchema returns a copy of the schema.

func (*SchemaInfo) GetStreamPlan

func (si *SchemaInfo) GetStreamPlan(sql string) *ExecPlan

GetStreamPlan is similar to GetPlan, but doesn't use the cache and doesn't enforce a limit. It just returns the parsed query.

func (*SchemaInfo) GetTable

func (si *SchemaInfo) GetTable(tableName string) *TableInfo

GetTable returns the TableInfo for a table.

func (*SchemaInfo) Open

func (si *SchemaInfo) Open(appParams, dbaParams *sqldb.ConnParams, schemaOverrides []SchemaOverride, cachePool *CachePool, strictMode bool)

Open initializes the current SchemaInfo for service by loading the necessary info from the specified database.

func (*SchemaInfo) Reload

func (si *SchemaInfo) Reload()

Reload reloads the schema info from the db. Any tables that have changed since the last load are updated.

func (*SchemaInfo) ReloadTime

func (si *SchemaInfo) ReloadTime() time.Duration

ReloadTime returns schema info reload time.

func (*SchemaInfo) ServeHTTP

func (si *SchemaInfo) ServeHTTP(response http.ResponseWriter, request *http.Request)

func (*SchemaInfo) SetQueryCacheSize

func (si *SchemaInfo) SetQueryCacheSize(size int)

SetQueryCacheSize sets the query cache size.

func (*SchemaInfo) SetReloadTime

func (si *SchemaInfo) SetReloadTime(reloadTime time.Duration)

SetReloadTime changes how often the schema is reloaded. This call also triggers an immediate reload.

type SchemaOverride

type SchemaOverride struct {
	Name      string
	PKColumns []string
	Cache     *struct {
		Type  string
		Table string
	}
}

SchemaOverride is a way to specify how the schema loaded by SchemaInfo must be overridden. Name is the name of the table, PKColumns specifies the new prmiary keys. Cache.Type specifies the rowcache operation for the table. It can be "R", which is read-only, or "RW" for read-write, and Table specifies the rowcache table to operate on. The purpose of this override is mainly to allow views to benefit from the rowcache. It has its downsides. Use carefully.

type SqlQuery

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

SqlQuery implements the RPC interface for the query service.

func NewSqlQuery

func NewSqlQuery(config Config) *SqlQuery

NewSqlQuery creates an instance of SqlQuery. Only one instance of SqlQuery can be created per process.

func (*SqlQuery) Begin

func (sq *SqlQuery) Begin(ctx context.Context, target *pb.Target, session *proto.Session, txInfo *proto.TransactionInfo) (err error)

Begin starts a new transaction. This is allowed only if the state is StateServing.

func (*SqlQuery) BroadcastHealth

func (sq *SqlQuery) BroadcastHealth(terTimestamp int64, stats *pb.RealtimeStats)

BroadcastHealth will broadcast the current health to all listeners

func (*SqlQuery) Commit

func (sq *SqlQuery) Commit(ctx context.Context, target *pb.Target, session *proto.Session) (err error)

Commit commits the specified transaction.

func (*SqlQuery) Execute

func (sq *SqlQuery) Execute(ctx context.Context, target *pb.Target, query *proto.Query, reply *mproto.QueryResult) (err error)

Execute executes the query and returns the result as response.

func (*SqlQuery) ExecuteBatch

func (sq *SqlQuery) ExecuteBatch(ctx context.Context, target *pb.Target, queryList *proto.QueryList, reply *proto.QueryResultList) (err error)

ExecuteBatch executes a group of queries and returns their results as a list. ExecuteBatch can be called for an existing transaction, or it can be called with the AsTransaction flag which will execute all statements inside an independent transaction. If AsTransaction is true, TransactionId must be 0.

func (*SqlQuery) GetSessionId

func (sq *SqlQuery) GetSessionId(sessionParams *proto.SessionParams, sessionInfo *proto.SessionInfo) error

GetSessionId returns a sessionInfo response if the state is StateServing.

func (*SqlQuery) GetState

func (sq *SqlQuery) GetState() string

GetState returns the name of the current SqlQuery state.

func (*SqlQuery) HandlePanic

func (sq *SqlQuery) HandlePanic(err *error)

HandlePanic is part of the queryservice.QueryService interface

func (*SqlQuery) Rollback

func (sq *SqlQuery) Rollback(ctx context.Context, target *pb.Target, session *proto.Session) (err error)

Rollback rollsback the specified transaction.

func (*SqlQuery) SplitQuery

func (sq *SqlQuery) SplitQuery(ctx context.Context, target *pb.Target, req *proto.SplitQueryRequest, reply *proto.SplitQueryResult) (err error)

SplitQuery splits a BoundQuery into smaller queries that return a subset of rows from the original query.

func (*SqlQuery) StreamExecute

func (sq *SqlQuery) StreamExecute(ctx context.Context, target *pb.Target, query *proto.Query, sendReply func(*mproto.QueryResult) error) (err error)

StreamExecute executes the query and streams the result. The first QueryResult will have Fields set (and Rows nil). The subsequent QueryResult will have Rows set (and Fields nil).

func (*SqlQuery) StreamHealthRegister

func (sq *SqlQuery) StreamHealthRegister(c chan<- *pb.StreamHealthResponse) (int, error)

StreamHealthRegister is part of queryservice.QueryService interface

func (*SqlQuery) StreamHealthUnregister

func (sq *SqlQuery) StreamHealthUnregister(id int) error

StreamHealthUnregister is part of queryservice.QueryService interface

type TableInfo

type TableInfo struct {
	*schema.Table
	Cache *RowCache
	// contains filtered or unexported fields
}

func NewTableInfo

func NewTableInfo(conn *DBConn, tableName string, tableType string, createTime sqltypes.Value, comment string, cachePool *CachePool) (ti *TableInfo, err error)

func (*TableInfo) SetPK

func (ti *TableInfo) SetPK(colnames []string) error

func (*TableInfo) Stats

func (ti *TableInfo) Stats() (hits, absent, misses, invalidations int64)

func (*TableInfo) StatsJSON

func (ti *TableInfo) StatsJSON() string

type TabletError

type TabletError struct {
	ErrorType int
	Message   string
	SqlError  int
}

TabletError is the error type we use in this library

func NewTabletError

func NewTabletError(errorType int, format string, args ...interface{}) *TabletError

NewTabletError returns a TabletError of the given type

func NewTabletErrorSql

func NewTabletErrorSql(errorType int, err error) *TabletError

NewTabletErrorSql returns a TabletError based on the error

func (*TabletError) Error

func (te *TabletError) Error() string

func (*TabletError) Prefix

func (te *TabletError) Prefix() string

Prefix returns the prefix for the error, like error, fatal, etc.

func (*TabletError) RecordStats

func (te *TabletError) RecordStats(queryServiceStats *QueryServiceStats)

RecordStats will record the error in the proper stat bucket

type TestQueryServiceControl

type TestQueryServiceControl struct {
	// QueryServiceEnabled is a state variable
	QueryServiceEnabled bool

	// AllowQueriesError is the return value for AllowQueries
	AllowQueriesError error

	// IsHealthy is the return value for IsHealthy
	IsHealthyError error

	// ReloadSchemaCount counts how many times ReloadSchema was called
	ReloadSchemaCount int
}

TestQueryServiceControl is a fake version of QueryServiceControl

func NewTestQueryServiceControl

func NewTestQueryServiceControl() *TestQueryServiceControl

NewTestQueryServiceControl returns an implementation of QueryServiceControl that is entirely fake

func (*TestQueryServiceControl) AddStatusPart

func (tqsc *TestQueryServiceControl) AddStatusPart()

AddStatusPart is part of the QueryServiceControl interface

func (*TestQueryServiceControl) AllowQueries

AllowQueries is part of the QueryServiceControl interface

func (*TestQueryServiceControl) BroadcastHealth

func (tqsc *TestQueryServiceControl) BroadcastHealth(terTimestamp int64, stats *pb.RealtimeStats)

BroadcastHealth is part of the QueryServiceControl interface

func (*TestQueryServiceControl) DisallowQueries

func (tqsc *TestQueryServiceControl) DisallowQueries()

DisallowQueries is part of the QueryServiceControl interface

func (*TestQueryServiceControl) IsHealthy

func (tqsc *TestQueryServiceControl) IsHealthy() error

IsHealthy is part of the QueryServiceControl interface

func (*TestQueryServiceControl) IsServing

func (tqsc *TestQueryServiceControl) IsServing() bool

IsServing is part of the QueryServiceControl interface

func (*TestQueryServiceControl) QueryService

func (tqsc *TestQueryServiceControl) QueryService() queryservice.QueryService

QueryService is part of the QueryServiceControl interface

func (*TestQueryServiceControl) Register

func (tqsc *TestQueryServiceControl) Register()

Register is part of the QueryServiceControl interface

func (*TestQueryServiceControl) ReloadSchema

func (tqsc *TestQueryServiceControl) ReloadSchema()

ReloadSchema is part of the QueryServiceControl interface

func (*TestQueryServiceControl) SetQueryRules

func (tqsc *TestQueryServiceControl) SetQueryRules(ruleSource string, qrs *QueryRules) error

SetQueryRules is part of the QueryServiceControl interface

type TxConnection

type TxConnection struct {
	*DBConn
	TransactionID int64

	StartTime time.Time
	EndTime   time.Time

	Queries    []string
	Conclusion string
	LogToFile  sync2.AtomicInt32
	// contains filtered or unexported fields
}

TxConnection is meant for executing transactions. It keeps track of dirty keys for rowcache invalidation. It can return itself to the tx pool correctly. It also does not retry statements if there are failures.

func (*TxConnection) DirtyKeys

func (txc *TxConnection) DirtyKeys(tableName string) DirtyKeys

DirtyKeys returns the list of rowcache keys that became dirty during the transaction.

func (*TxConnection) Exec

func (txc *TxConnection) Exec(ctx context.Context, query string, maxrows int, wantfields bool) (*proto.QueryResult, error)

Exec executes the statement for the current transaction.

func (*TxConnection) Format

func (txc *TxConnection) Format(params url.Values) string

Format returns a printable version of the connection info.

func (*TxConnection) RecordQuery

func (txc *TxConnection) RecordQuery(query string)

RecordQuery records the query against this transaction.

func (*TxConnection) Recycle

func (txc *TxConnection) Recycle()

Recycle returns the connection to the pool. The transaction remains active.

type TxPool

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

TxPool is the transaction pool for the query service.

func NewTxPool

func NewTxPool(
	name string,
	txStatsPrefix string,
	capacity int,
	timeout time.Duration,
	poolTimeout time.Duration,
	idleTimeout time.Duration,
	enablePublishStats bool,
	qStats *QueryServiceStats) *TxPool

NewTxPool creates a new TxPool. It's not operational until it's Open'd.

func (*TxPool) Begin

func (axp *TxPool) Begin(ctx context.Context) int64

Begin begins a transaction, and returns the associated transaction id. Subsequent statements can access the connection through the transaction id.

func (*TxPool) Close

func (axp *TxPool) Close()

Close closes the TxPool. A closed pool can be reopened.

func (*TxPool) Get

func (axp *TxPool) Get(transactionID int64) (conn *TxConnection)

Get fetches the connection associated to the transactionID. You must call Recycle on TxConnection once done.

func (*TxPool) LogActive

func (axp *TxPool) LogActive()

LogActive causes all existing transactions to be logged when they complete. The logging is throttled to no more than once every txLogInterval.

func (*TxPool) Open

func (axp *TxPool) Open(appParams, dbaParams *sqldb.ConnParams)

Open makes the TxPool operational. This also starts the transaction killer that will kill long-running transactions.

func (*TxPool) PoolTimeout

func (axp *TxPool) PoolTimeout() time.Duration

PoolTimeout returns the wait time for the tx pool.

func (*TxPool) Rollback

func (axp *TxPool) Rollback(ctx context.Context, transactionID int64)

Rollback rolls back the specified transaction.

func (*TxPool) SafeCommit

func (axp *TxPool) SafeCommit(ctx context.Context, transactionID int64) (invalidList map[string]DirtyKeys, err error)

SafeCommit commits the specified transaction. Unlike other functions, it returns an error on failure instead of panic. The connection becomes free and can be reused in the future.

func (*TxPool) SetPoolTimeout

func (axp *TxPool) SetPoolTimeout(timeout time.Duration)

SetPoolTimeout sets the wait time for the tx pool. TODO(sougou): move this to SqlQuery.

func (*TxPool) SetTimeout

func (axp *TxPool) SetTimeout(timeout time.Duration)

SetTimeout sets the transaction timeout.

func (*TxPool) Timeout

func (axp *TxPool) Timeout() time.Duration

Timeout returns the transaction timeout.

func (*TxPool) WaitForEmpty

func (axp *TxPool) WaitForEmpty()

WaitForEmpty waits until all active transactions are completed.

Directories

Path Synopsis
customrule
filecustomrule
Package filecustomrule implements static custom rule from a config file
Package filecustomrule implements static custom rule from a config file
Package fakecacheservice provides a fake implementation of cacheservice.CacheService
Package fakecacheservice provides a fake implementation of cacheservice.CacheService
Package queryservice contains the interface for the service definition of the Query Service.
Package queryservice contains the interface for the service definition of the Query Service.
Package tabletconntest provides the test methods to make sure a tabletconn/queryservice pair over RPC works correctly.
Package tabletconntest provides the test methods to make sure a tabletconn/queryservice pair over RPC works correctly.

Jump to

Keyboard shortcuts

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