id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
134,900
vitessio/vitess
go/vt/srvtopo/resilient_server.go
StatusAsHTML
func (st *SrvKeyspaceCacheStatus) StatusAsHTML() template.HTML { if st.Value == nil { return template.HTML("No Data") } result := "<b>Partitions:</b><br>" for _, keyspacePartition := range st.Value.Partitions { result += "&nbsp;<b>" + keyspacePartition.ServedType.String() + ":</b>" for _, shard := range keys...
go
func (st *SrvKeyspaceCacheStatus) StatusAsHTML() template.HTML { if st.Value == nil { return template.HTML("No Data") } result := "<b>Partitions:</b><br>" for _, keyspacePartition := range st.Value.Partitions { result += "&nbsp;<b>" + keyspacePartition.ServedType.String() + ":</b>" for _, shard := range keys...
[ "func", "(", "st", "*", "SrvKeyspaceCacheStatus", ")", "StatusAsHTML", "(", ")", "template", ".", "HTML", "{", "if", "st", ".", "Value", "==", "nil", "{", "return", "template", ".", "HTML", "(", "\"", "\"", ")", "\n", "}", "\n\n", "result", ":=", "\"...
// StatusAsHTML returns an HTML version of our status. // It works best if there is data in the cache.
[ "StatusAsHTML", "returns", "an", "HTML", "version", "of", "our", "status", ".", "It", "works", "best", "if", "there", "is", "data", "in", "the", "cache", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/srvtopo/resilient_server.go#L599-L626
134,901
vitessio/vitess
go/vt/srvtopo/resilient_server.go
CacheStatus
func (server *ResilientServer) CacheStatus() *ResilientServerCacheStatus { result := &ResilientServerCacheStatus{} server.mutex.Lock() for _, entry := range server.srvKeyspaceNamesCache { entry.mutex.Lock() result.SrvKeyspaceNames = append(result.SrvKeyspaceNames, &SrvKeyspaceNamesCacheStatus{ Cell: ...
go
func (server *ResilientServer) CacheStatus() *ResilientServerCacheStatus { result := &ResilientServerCacheStatus{} server.mutex.Lock() for _, entry := range server.srvKeyspaceNamesCache { entry.mutex.Lock() result.SrvKeyspaceNames = append(result.SrvKeyspaceNames, &SrvKeyspaceNamesCacheStatus{ Cell: ...
[ "func", "(", "server", "*", "ResilientServer", ")", "CacheStatus", "(", ")", "*", "ResilientServerCacheStatus", "{", "result", ":=", "&", "ResilientServerCacheStatus", "{", "}", "\n", "server", ".", "mutex", ".", "Lock", "(", ")", "\n\n", "for", "_", ",", ...
// CacheStatus returns a displayable version of the cache
[ "CacheStatus", "returns", "a", "displayable", "version", "of", "the", "cache" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/srvtopo/resilient_server.go#L654-L699
134,902
vitessio/vitess
go/vt/srvtopo/resilient_server.go
ttlTime
func ttlTime(expirationTime time.Time) template.HTML { ttl := time.Until(expirationTime).Round(time.Second) if ttl < 0 { return template.HTML("<b>Expired</b>") } return template.HTML(ttl.String()) }
go
func ttlTime(expirationTime time.Time) template.HTML { ttl := time.Until(expirationTime).Round(time.Second) if ttl < 0 { return template.HTML("<b>Expired</b>") } return template.HTML(ttl.String()) }
[ "func", "ttlTime", "(", "expirationTime", "time", ".", "Time", ")", "template", ".", "HTML", "{", "ttl", ":=", "time", ".", "Until", "(", "expirationTime", ")", ".", "Round", "(", "time", ".", "Second", ")", "\n", "if", "ttl", "<", "0", "{", "return"...
// Returns the ttl for the cached entry or "Expired" if it is in the past
[ "Returns", "the", "ttl", "for", "the", "cached", "entry", "or", "Expired", "if", "it", "is", "in", "the", "past" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/srvtopo/resilient_server.go#L702-L708
134,903
vitessio/vitess
go/vt/schemamanager/ui_controller.go
NewUIController
func NewUIController( sqlStr string, keyspace string, writer http.ResponseWriter) *UIController { controller := &UIController{ sqls: make([]string, 0, 32), keyspace: keyspace, writer: writer, } for _, sql := range strings.Split(sqlStr, ";") { s := strings.TrimSpace(sql) if s != "" { controller.sq...
go
func NewUIController( sqlStr string, keyspace string, writer http.ResponseWriter) *UIController { controller := &UIController{ sqls: make([]string, 0, 32), keyspace: keyspace, writer: writer, } for _, sql := range strings.Split(sqlStr, ";") { s := strings.TrimSpace(sql) if s != "" { controller.sq...
[ "func", "NewUIController", "(", "sqlStr", "string", ",", "keyspace", "string", ",", "writer", "http", ".", "ResponseWriter", ")", "*", "UIController", "{", "controller", ":=", "&", "UIController", "{", "sqls", ":", "make", "(", "[", "]", "string", ",", "0"...
// NewUIController creates a UIController instance
[ "NewUIController", "creates", "a", "UIController", "instance" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/ui_controller.go#L37-L52
134,904
vitessio/vitess
go/vt/schemamanager/ui_controller.go
OnReadSuccess
func (controller *UIController) OnReadSuccess(ctx context.Context) error { controller.writer.Write( []byte(fmt.Sprintf("OnReadSuccess, sqls: %v\n", controller.sqls))) return nil }
go
func (controller *UIController) OnReadSuccess(ctx context.Context) error { controller.writer.Write( []byte(fmt.Sprintf("OnReadSuccess, sqls: %v\n", controller.sqls))) return nil }
[ "func", "(", "controller", "*", "UIController", ")", "OnReadSuccess", "(", "ctx", "context", ".", "Context", ")", "error", "{", "controller", ".", "writer", ".", "Write", "(", "[", "]", "byte", "(", "fmt", ".", "Sprintf", "(", "\"", "\\n", "\"", ",", ...
// OnReadSuccess is no-op
[ "OnReadSuccess", "is", "no", "-", "op" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/ui_controller.go#L74-L78
134,905
vitessio/vitess
go/mysql/ldapauthserver/auth_server_ldap.go
ValidateHash
func (asl *AuthServerLdap) ValidateHash(salt []byte, user string, authResponse []byte, remoteAddr net.Addr) (mysql.Getter, error) { panic("unimplemented") }
go
func (asl *AuthServerLdap) ValidateHash(salt []byte, user string, authResponse []byte, remoteAddr net.Addr) (mysql.Getter, error) { panic("unimplemented") }
[ "func", "(", "asl", "*", "AuthServerLdap", ")", "ValidateHash", "(", "salt", "[", "]", "byte", ",", "user", "string", ",", "authResponse", "[", "]", "byte", ",", "remoteAddr", "net", ".", "Addr", ")", "(", "mysql", ".", "Getter", ",", "error", ")", "...
// ValidateHash is unimplemented for AuthServerLdap.
[ "ValidateHash", "is", "unimplemented", "for", "AuthServerLdap", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/ldapauthserver/auth_server_ldap.go#L98-L100
134,906
vitessio/vitess
go/mysql/ldapauthserver/auth_server_ldap.go
Negotiate
func (asl *AuthServerLdap) Negotiate(c *mysql.Conn, user string, remoteAddr net.Addr) (mysql.Getter, error) { // Finish the negotiation. password, err := mysql.AuthServerNegotiateClearOrDialog(c, asl.Method) if err != nil { return nil, err } return asl.validate(user, password) }
go
func (asl *AuthServerLdap) Negotiate(c *mysql.Conn, user string, remoteAddr net.Addr) (mysql.Getter, error) { // Finish the negotiation. password, err := mysql.AuthServerNegotiateClearOrDialog(c, asl.Method) if err != nil { return nil, err } return asl.validate(user, password) }
[ "func", "(", "asl", "*", "AuthServerLdap", ")", "Negotiate", "(", "c", "*", "mysql", ".", "Conn", ",", "user", "string", ",", "remoteAddr", "net", ".", "Addr", ")", "(", "mysql", ".", "Getter", ",", "error", ")", "{", "// Finish the negotiation.", "passw...
// Negotiate is part of the AuthServer interface.
[ "Negotiate", "is", "part", "of", "the", "AuthServer", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/ldapauthserver/auth_server_ldap.go#L103-L110
134,907
vitessio/vitess
go/mysql/ldapauthserver/auth_server_ldap.go
getGroups
func (asl *AuthServerLdap) getGroups(username string) ([]string, error) { err := asl.Client.Bind(asl.User, asl.Password) if err != nil { return nil, err } req := ldap.NewSearchRequest( asl.GroupQuery, ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false, fmt.Sprintf("(memberUid=%s)", username), []s...
go
func (asl *AuthServerLdap) getGroups(username string) ([]string, error) { err := asl.Client.Bind(asl.User, asl.Password) if err != nil { return nil, err } req := ldap.NewSearchRequest( asl.GroupQuery, ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false, fmt.Sprintf("(memberUid=%s)", username), []s...
[ "func", "(", "asl", "*", "AuthServerLdap", ")", "getGroups", "(", "username", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "err", ":=", "asl", ".", "Client", ".", "Bind", "(", "asl", ".", "User", ",", "asl", ".", "Password", ")",...
//this needs to be passed an already connected client...should check for this
[ "this", "needs", "to", "be", "passed", "an", "already", "connected", "client", "...", "should", "check", "for", "this" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/ldapauthserver/auth_server_ldap.go#L128-L151
134,908
vitessio/vitess
go/mysql/ldapauthserver/auth_server_ldap.go
Get
func (lud *LdapUserData) Get() *querypb.VTGateCallerID { if int64(time.Since(lud.lastUpdated).Seconds()) > lud.asl.RefreshSeconds { go lud.update() } return &querypb.VTGateCallerID{Username: lud.username, Groups: lud.groups} }
go
func (lud *LdapUserData) Get() *querypb.VTGateCallerID { if int64(time.Since(lud.lastUpdated).Seconds()) > lud.asl.RefreshSeconds { go lud.update() } return &querypb.VTGateCallerID{Username: lud.username, Groups: lud.groups} }
[ "func", "(", "lud", "*", "LdapUserData", ")", "Get", "(", ")", "*", "querypb", ".", "VTGateCallerID", "{", "if", "int64", "(", "time", ".", "Since", "(", "lud", ".", "lastUpdated", ")", ".", "Seconds", "(", ")", ")", ">", "lud", ".", "asl", ".", ...
// Get returns wrapped username and LDAP groups and possibly updates the cache
[ "Get", "returns", "wrapped", "username", "and", "LDAP", "groups", "and", "possibly", "updates", "the", "cache" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/ldapauthserver/auth_server_ldap.go#L191-L196
134,909
vitessio/vitess
go/mysql/ldapauthserver/auth_server_ldap.go
Connect
func (lci *ClientImpl) Connect(network string, config *ServerConfig) error { conn, err := ldap.Dial(network, config.LdapServer) if err != nil { return err } lci.Conn = conn // Reconnect with TLS ... why don't we simply DialTLS directly? serverName, _, err := netutil.SplitHostPort(config.LdapServer) if err != n...
go
func (lci *ClientImpl) Connect(network string, config *ServerConfig) error { conn, err := ldap.Dial(network, config.LdapServer) if err != nil { return err } lci.Conn = conn // Reconnect with TLS ... why don't we simply DialTLS directly? serverName, _, err := netutil.SplitHostPort(config.LdapServer) if err != n...
[ "func", "(", "lci", "*", "ClientImpl", ")", "Connect", "(", "network", "string", ",", "config", "*", "ServerConfig", ")", "error", "{", "conn", ",", "err", ":=", "ldap", ".", "Dial", "(", "network", ",", "config", ".", "LdapServer", ")", "\n", "if", ...
// Connect calls ldap.Dial and then upgrades the connection to TLS // This must be called before any other methods
[ "Connect", "calls", "ldap", ".", "Dial", "and", "then", "upgrades", "the", "connection", "to", "TLS", "This", "must", "be", "called", "before", "any", "other", "methods" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/ldapauthserver/auth_server_ldap.go#L222-L242
134,910
vitessio/vitess
go/vt/vttablet/tabletmanager/rpc_actions.go
GetPermissions
func (agent *ActionAgent) GetPermissions(ctx context.Context) (*tabletmanagerdatapb.Permissions, error) { return mysqlctl.GetPermissions(agent.MysqlDaemon) }
go
func (agent *ActionAgent) GetPermissions(ctx context.Context) (*tabletmanagerdatapb.Permissions, error) { return mysqlctl.GetPermissions(agent.MysqlDaemon) }
[ "func", "(", "agent", "*", "ActionAgent", ")", "GetPermissions", "(", "ctx", "context", ".", "Context", ")", "(", "*", "tabletmanagerdatapb", ".", "Permissions", ",", "error", ")", "{", "return", "mysqlctl", ".", "GetPermissions", "(", "agent", ".", "MysqlDa...
// GetPermissions returns the db permissions.
[ "GetPermissions", "returns", "the", "db", "permissions", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/rpc_actions.go#L46-L48
134,911
vitessio/vitess
go/vt/vttablet/tabletmanager/rpc_actions.go
SetReadOnly
func (agent *ActionAgent) SetReadOnly(ctx context.Context, rdonly bool) error { if err := agent.lock(ctx); err != nil { return err } defer agent.unlock() return agent.MysqlDaemon.SetReadOnly(rdonly) }
go
func (agent *ActionAgent) SetReadOnly(ctx context.Context, rdonly bool) error { if err := agent.lock(ctx); err != nil { return err } defer agent.unlock() return agent.MysqlDaemon.SetReadOnly(rdonly) }
[ "func", "(", "agent", "*", "ActionAgent", ")", "SetReadOnly", "(", "ctx", "context", ".", "Context", ",", "rdonly", "bool", ")", "error", "{", "if", "err", ":=", "agent", ".", "lock", "(", "ctx", ")", ";", "err", "!=", "nil", "{", "return", "err", ...
// SetReadOnly makes the mysql instance read-only or read-write.
[ "SetReadOnly", "makes", "the", "mysql", "instance", "read", "-", "only", "or", "read", "-", "write", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/rpc_actions.go#L51-L58
134,912
vitessio/vitess
go/vt/vttablet/tabletmanager/rpc_actions.go
ChangeType
func (agent *ActionAgent) ChangeType(ctx context.Context, tabletType topodatapb.TabletType) error { if err := agent.lock(ctx); err != nil { return err } defer agent.unlock() // We don't want to allow multiple callers to claim a tablet as drained. There is a race that could happen during // horizontal resharding...
go
func (agent *ActionAgent) ChangeType(ctx context.Context, tabletType topodatapb.TabletType) error { if err := agent.lock(ctx); err != nil { return err } defer agent.unlock() // We don't want to allow multiple callers to claim a tablet as drained. There is a race that could happen during // horizontal resharding...
[ "func", "(", "agent", "*", "ActionAgent", ")", "ChangeType", "(", "ctx", "context", ".", "Context", ",", "tabletType", "topodatapb", ".", "TabletType", ")", "error", "{", "if", "err", ":=", "agent", ".", "lock", "(", "ctx", ")", ";", "err", "!=", "nil"...
// ChangeType changes the tablet type
[ "ChangeType", "changes", "the", "tablet", "type" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/rpc_actions.go#L61-L92
134,913
vitessio/vitess
go/vt/vttablet/tabletmanager/rpc_actions.go
Sleep
func (agent *ActionAgent) Sleep(ctx context.Context, duration time.Duration) { if err := agent.lock(ctx); err != nil { // client gave up return } defer agent.unlock() time.Sleep(duration) }
go
func (agent *ActionAgent) Sleep(ctx context.Context, duration time.Duration) { if err := agent.lock(ctx); err != nil { // client gave up return } defer agent.unlock() time.Sleep(duration) }
[ "func", "(", "agent", "*", "ActionAgent", ")", "Sleep", "(", "ctx", "context", ".", "Context", ",", "duration", "time", ".", "Duration", ")", "{", "if", "err", ":=", "agent", ".", "lock", "(", "ctx", ")", ";", "err", "!=", "nil", "{", "// client gave...
// Sleep sleeps for the duration
[ "Sleep", "sleeps", "for", "the", "duration" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/rpc_actions.go#L95-L103
134,914
vitessio/vitess
go/vt/vttablet/tabletmanager/rpc_actions.go
ExecuteHook
func (agent *ActionAgent) ExecuteHook(ctx context.Context, hk *hook.Hook) *hook.HookResult { if err := agent.lock(ctx); err != nil { // client gave up return &hook.HookResult{} } defer agent.unlock() // Execute the hooks topotools.ConfigureTabletHook(hk, agent.TabletAlias) hr := hk.Execute() // We never kn...
go
func (agent *ActionAgent) ExecuteHook(ctx context.Context, hk *hook.Hook) *hook.HookResult { if err := agent.lock(ctx); err != nil { // client gave up return &hook.HookResult{} } defer agent.unlock() // Execute the hooks topotools.ConfigureTabletHook(hk, agent.TabletAlias) hr := hk.Execute() // We never kn...
[ "func", "(", "agent", "*", "ActionAgent", ")", "ExecuteHook", "(", "ctx", "context", ".", "Context", ",", "hk", "*", "hook", ".", "Hook", ")", "*", "hook", ".", "HookResult", "{", "if", "err", ":=", "agent", ".", "lock", "(", "ctx", ")", ";", "err"...
// ExecuteHook executes the provided hook locally, and returns the result.
[ "ExecuteHook", "executes", "the", "provided", "hook", "locally", "and", "returns", "the", "result", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/rpc_actions.go#L106-L123
134,915
vitessio/vitess
go/vt/vttablet/tabletmanager/rpc_actions.go
RefreshState
func (agent *ActionAgent) RefreshState(ctx context.Context) error { if err := agent.lock(ctx); err != nil { return err } defer agent.unlock() return agent.refreshTablet(ctx, "RefreshState") }
go
func (agent *ActionAgent) RefreshState(ctx context.Context) error { if err := agent.lock(ctx); err != nil { return err } defer agent.unlock() return agent.refreshTablet(ctx, "RefreshState") }
[ "func", "(", "agent", "*", "ActionAgent", ")", "RefreshState", "(", "ctx", "context", ".", "Context", ")", "error", "{", "if", "err", ":=", "agent", ".", "lock", "(", "ctx", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defe...
// RefreshState reload the tablet record from the topo server.
[ "RefreshState", "reload", "the", "tablet", "record", "from", "the", "topo", "server", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/rpc_actions.go#L126-L133
134,916
vitessio/vitess
go/vt/vttablet/tabletmanager/rpc_actions.go
IgnoreHealthError
func (agent *ActionAgent) IgnoreHealthError(ctx context.Context, pattern string) error { var expr *regexp.Regexp if pattern != "" { var err error if expr, err = regexp.Compile(fmt.Sprintf("^%s$", pattern)); err != nil { return err } } agent.mutex.Lock() agent._ignoreHealthErrorExpr = expr agent.mutex.Unl...
go
func (agent *ActionAgent) IgnoreHealthError(ctx context.Context, pattern string) error { var expr *regexp.Regexp if pattern != "" { var err error if expr, err = regexp.Compile(fmt.Sprintf("^%s$", pattern)); err != nil { return err } } agent.mutex.Lock() agent._ignoreHealthErrorExpr = expr agent.mutex.Unl...
[ "func", "(", "agent", "*", "ActionAgent", ")", "IgnoreHealthError", "(", "ctx", "context", ".", "Context", ",", "pattern", "string", ")", "error", "{", "var", "expr", "*", "regexp", ".", "Regexp", "\n", "if", "pattern", "!=", "\"", "\"", "{", "var", "e...
// IgnoreHealthError sets the regexp for health check errors to ignore.
[ "IgnoreHealthError", "sets", "the", "regexp", "for", "health", "check", "errors", "to", "ignore", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/rpc_actions.go#L141-L153
134,917
vitessio/vitess
go/vt/vtgate/planbuilder/route.go
Resolve
func (rb *route) Resolve() *route { for rb.Redirect != nil { rb = rb.Redirect } return rb }
go
func (rb *route) Resolve() *route { for rb.Redirect != nil { rb = rb.Redirect } return rb }
[ "func", "(", "rb", "*", "route", ")", "Resolve", "(", ")", "*", "route", "{", "for", "rb", ".", "Redirect", "!=", "nil", "{", "rb", "=", "rb", ".", "Redirect", "\n", "}", "\n", "return", "rb", "\n", "}" ]
// Resolve resolves redirects, and returns the last // un-redirected route.
[ "Resolve", "resolves", "redirects", "and", "returns", "the", "last", "un", "-", "redirected", "route", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/route.go#L74-L79
134,918
vitessio/vitess
go/vt/vtgate/planbuilder/route.go
PushFilter
func (rb *route) PushFilter(pb *primitiveBuilder, filter sqlparser.Expr, whereType string, _ builder) error { sel := rb.Select.(*sqlparser.Select) switch whereType { case sqlparser.WhereStr: sel.AddWhere(filter) case sqlparser.HavingStr: sel.AddHaving(filter) } rb.UpdatePlans(pb, filter) return nil }
go
func (rb *route) PushFilter(pb *primitiveBuilder, filter sqlparser.Expr, whereType string, _ builder) error { sel := rb.Select.(*sqlparser.Select) switch whereType { case sqlparser.WhereStr: sel.AddWhere(filter) case sqlparser.HavingStr: sel.AddHaving(filter) } rb.UpdatePlans(pb, filter) return nil }
[ "func", "(", "rb", "*", "route", ")", "PushFilter", "(", "pb", "*", "primitiveBuilder", ",", "filter", "sqlparser", ".", "Expr", ",", "whereType", "string", ",", "_", "builder", ")", "error", "{", "sel", ":=", "rb", ".", "Select", ".", "(", "*", "sql...
// PushFilter satisfies the builder interface. // The primitive will be updated if the new filter improves the plan.
[ "PushFilter", "satisfies", "the", "builder", "interface", ".", "The", "primitive", "will", "be", "updated", "if", "the", "new", "filter", "improves", "the", "plan", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/route.go#L108-L118
134,919
vitessio/vitess
go/vt/vtgate/planbuilder/route.go
MakeDistinct
func (rb *route) MakeDistinct() error { rb.Select.(*sqlparser.Select).Distinct = sqlparser.DistinctStr return nil }
go
func (rb *route) MakeDistinct() error { rb.Select.(*sqlparser.Select).Distinct = sqlparser.DistinctStr return nil }
[ "func", "(", "rb", "*", "route", ")", "MakeDistinct", "(", ")", "error", "{", "rb", ".", "Select", ".", "(", "*", "sqlparser", ".", "Select", ")", ".", "Distinct", "=", "sqlparser", ".", "DistinctStr", "\n", "return", "nil", "\n", "}" ]
// MakeDistinct sets the DISTINCT property to the select.
[ "MakeDistinct", "sets", "the", "DISTINCT", "property", "to", "the", "select", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/route.go#L153-L156
134,920
vitessio/vitess
go/vt/vtgate/planbuilder/route.go
SetGroupBy
func (rb *route) SetGroupBy(groupBy sqlparser.GroupBy) error { rb.Select.(*sqlparser.Select).GroupBy = groupBy return nil }
go
func (rb *route) SetGroupBy(groupBy sqlparser.GroupBy) error { rb.Select.(*sqlparser.Select).GroupBy = groupBy return nil }
[ "func", "(", "rb", "*", "route", ")", "SetGroupBy", "(", "groupBy", "sqlparser", ".", "GroupBy", ")", "error", "{", "rb", ".", "Select", ".", "(", "*", "sqlparser", ".", "Select", ")", ".", "GroupBy", "=", "groupBy", "\n", "return", "nil", "\n", "}" ...
// SetGroupBy sets the GROUP BY clause for the route.
[ "SetGroupBy", "sets", "the", "GROUP", "BY", "clause", "for", "the", "route", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/route.go#L159-L162
134,921
vitessio/vitess
go/vt/vtgate/planbuilder/route.go
PushOrderBy
func (rb *route) PushOrderBy(order *sqlparser.Order) error { // By this time, if any single shard options were already present, // multi-sharded options would have already been removed. So, this // call is only for checking if the route has single shard options. if rb.removeMultishardOptions() { rb.Select.AddOrde...
go
func (rb *route) PushOrderBy(order *sqlparser.Order) error { // By this time, if any single shard options were already present, // multi-sharded options would have already been removed. So, this // call is only for checking if the route has single shard options. if rb.removeMultishardOptions() { rb.Select.AddOrde...
[ "func", "(", "rb", "*", "route", ")", "PushOrderBy", "(", "order", "*", "sqlparser", ".", "Order", ")", "error", "{", "// By this time, if any single shard options were already present,", "// multi-sharded options would have already been removed. So, this", "// call is only for c...
// PushOrderBy sets the order by for the route.
[ "PushOrderBy", "sets", "the", "order", "by", "for", "the", "route", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/route.go#L165-L208
134,922
vitessio/vitess
go/vt/vtgate/planbuilder/route.go
PushOrderByNull
func (rb *route) PushOrderByNull() { rb.Select.(*sqlparser.Select).OrderBy = sqlparser.OrderBy{&sqlparser.Order{Expr: &sqlparser.NullVal{}}} }
go
func (rb *route) PushOrderByNull() { rb.Select.(*sqlparser.Select).OrderBy = sqlparser.OrderBy{&sqlparser.Order{Expr: &sqlparser.NullVal{}}} }
[ "func", "(", "rb", "*", "route", ")", "PushOrderByNull", "(", ")", "{", "rb", ".", "Select", ".", "(", "*", "sqlparser", ".", "Select", ")", ".", "OrderBy", "=", "sqlparser", ".", "OrderBy", "{", "&", "sqlparser", ".", "Order", "{", "Expr", ":", "&...
// PushOrderByNull satisfies the builder interface.
[ "PushOrderByNull", "satisfies", "the", "builder", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/route.go#L211-L213
134,923
vitessio/vitess
go/vt/vtgate/planbuilder/route.go
PushOrderByRand
func (rb *route) PushOrderByRand() { rb.Select.(*sqlparser.Select).OrderBy = sqlparser.OrderBy{&sqlparser.Order{Expr: &sqlparser.FuncExpr{Name: sqlparser.NewColIdent("rand")}}} }
go
func (rb *route) PushOrderByRand() { rb.Select.(*sqlparser.Select).OrderBy = sqlparser.OrderBy{&sqlparser.Order{Expr: &sqlparser.FuncExpr{Name: sqlparser.NewColIdent("rand")}}} }
[ "func", "(", "rb", "*", "route", ")", "PushOrderByRand", "(", ")", "{", "rb", ".", "Select", ".", "(", "*", "sqlparser", ".", "Select", ")", ".", "OrderBy", "=", "sqlparser", ".", "OrderBy", "{", "&", "sqlparser", ".", "Order", "{", "Expr", ":", "&...
// PushOrderByRand satisfies the builder interface.
[ "PushOrderByRand", "satisfies", "the", "builder", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/route.go#L216-L218
134,924
vitessio/vitess
go/vt/vtgate/planbuilder/route.go
SetLimit
func (rb *route) SetLimit(limit *sqlparser.Limit) { rb.Select.SetLimit(limit) }
go
func (rb *route) SetLimit(limit *sqlparser.Limit) { rb.Select.SetLimit(limit) }
[ "func", "(", "rb", "*", "route", ")", "SetLimit", "(", "limit", "*", "sqlparser", ".", "Limit", ")", "{", "rb", ".", "Select", ".", "SetLimit", "(", "limit", ")", "\n", "}" ]
// SetLimit adds a LIMIT clause to the route.
[ "SetLimit", "adds", "a", "LIMIT", "clause", "to", "the", "route", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/route.go#L221-L223
134,925
vitessio/vitess
go/vt/vtgate/planbuilder/route.go
SetUpperLimit
func (rb *route) SetUpperLimit(count *sqlparser.SQLVal) { rb.Select.SetLimit(&sqlparser.Limit{Rowcount: count}) }
go
func (rb *route) SetUpperLimit(count *sqlparser.SQLVal) { rb.Select.SetLimit(&sqlparser.Limit{Rowcount: count}) }
[ "func", "(", "rb", "*", "route", ")", "SetUpperLimit", "(", "count", "*", "sqlparser", ".", "SQLVal", ")", "{", "rb", ".", "Select", ".", "SetLimit", "(", "&", "sqlparser", ".", "Limit", "{", "Rowcount", ":", "count", "}", ")", "\n", "}" ]
// SetUpperLimit satisfies the builder interface. // The route pushes the limit regardless of the plan. // If it's a scatter query, the rows returned will be // more than the upper limit, but enough for the limit // primitive to chop off where needed.
[ "SetUpperLimit", "satisfies", "the", "builder", "interface", ".", "The", "route", "pushes", "the", "limit", "regardless", "of", "the", "plan", ".", "If", "it", "s", "a", "scatter", "query", "the", "rows", "returned", "will", "be", "more", "than", "the", "u...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/route.go#L230-L232
134,926
vitessio/vitess
go/vt/vtgate/planbuilder/route.go
procureValues
func (rb *route) procureValues(bldr builder, jt *jointab, val sqlparser.Expr) (sqltypes.PlanValue, error) { switch val := val.(type) { case sqlparser.ValTuple: pv := sqltypes.PlanValue{} for _, val := range val { v, err := rb.procureValues(bldr, jt, val) if err != nil { return pv, err } pv.Values ...
go
func (rb *route) procureValues(bldr builder, jt *jointab, val sqlparser.Expr) (sqltypes.PlanValue, error) { switch val := val.(type) { case sqlparser.ValTuple: pv := sqltypes.PlanValue{} for _, val := range val { v, err := rb.procureValues(bldr, jt, val) if err != nil { return pv, err } pv.Values ...
[ "func", "(", "rb", "*", "route", ")", "procureValues", "(", "bldr", "builder", ",", "jt", "*", "jointab", ",", "val", "sqlparser", ".", "Expr", ")", "(", "sqltypes", ".", "PlanValue", ",", "error", ")", "{", "switch", "val", ":=", "val", ".", "(", ...
// procureValues procures and converts the input into // the expected types for rb.Values.
[ "procureValues", "procures", "and", "converts", "the", "input", "into", "the", "expected", "types", "for", "rb", ".", "Values", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/route.go#L375-L393
134,927
vitessio/vitess
go/vt/vtgate/planbuilder/route.go
generateFieldQuery
func (rb *route) generateFieldQuery(sel sqlparser.SelectStatement, jt *jointab) string { formatter := func(buf *sqlparser.TrackedBuffer, node sqlparser.SQLNode) { switch node := node.(type) { case *sqlparser.ColName: if !rb.isLocal(node) { _, joinVar := jt.Lookup(node) buf.Myprintf("%a", ":"+joinVar) ...
go
func (rb *route) generateFieldQuery(sel sqlparser.SelectStatement, jt *jointab) string { formatter := func(buf *sqlparser.TrackedBuffer, node sqlparser.SQLNode) { switch node := node.(type) { case *sqlparser.ColName: if !rb.isLocal(node) { _, joinVar := jt.Lookup(node) buf.Myprintf("%a", ":"+joinVar) ...
[ "func", "(", "rb", "*", "route", ")", "generateFieldQuery", "(", "sel", "sqlparser", ".", "SelectStatement", ",", "jt", "*", "jointab", ")", "string", "{", "formatter", ":=", "func", "(", "buf", "*", "sqlparser", ".", "TrackedBuffer", ",", "node", "sqlpars...
// generateFieldQuery generates a query with an impossible where. // This will be used on the RHS node to fetch field info if the LHS // returns no result.
[ "generateFieldQuery", "generates", "a", "query", "with", "an", "impossible", "where", ".", "This", "will", "be", "used", "on", "the", "RHS", "node", "to", "fetch", "field", "info", "if", "the", "LHS", "returns", "no", "result", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/route.go#L402-L423
134,928
vitessio/vitess
go/vt/vtgate/planbuilder/route.go
MergeSubquery
func (rb *route) MergeSubquery(pb *primitiveBuilder, inner *route) bool { var mergedRouteOptions []*routeOption outer: for _, lro := range rb.routeOptions { for _, rro := range inner.routeOptions { if lro.SubqueryCanMerge(pb, rro) { lro.MergeSubquery(rro) mergedRouteOptions = append(mergedRouteOptions, l...
go
func (rb *route) MergeSubquery(pb *primitiveBuilder, inner *route) bool { var mergedRouteOptions []*routeOption outer: for _, lro := range rb.routeOptions { for _, rro := range inner.routeOptions { if lro.SubqueryCanMerge(pb, rro) { lro.MergeSubquery(rro) mergedRouteOptions = append(mergedRouteOptions, l...
[ "func", "(", "rb", "*", "route", ")", "MergeSubquery", "(", "pb", "*", "primitiveBuilder", ",", "inner", "*", "route", ")", "bool", "{", "var", "mergedRouteOptions", "[", "]", "*", "routeOption", "\n", "outer", ":", "for", "_", ",", "lro", ":=", "range...
// MergeSubquery returns true if the subquery route could successfully be merged // with the outer route.
[ "MergeSubquery", "returns", "true", "if", "the", "subquery", "route", "could", "successfully", "be", "merged", "with", "the", "outer", "route", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/route.go#L491-L509
134,929
vitessio/vitess
go/vt/vtgate/planbuilder/route.go
MergeUnion
func (rb *route) MergeUnion(right *route) bool { var mergedRouteOptions []*routeOption outer: for _, lro := range rb.routeOptions { for _, rro := range right.routeOptions { if lro.UnionCanMerge(rro) { lro.MergeUnion(rro) mergedRouteOptions = append(mergedRouteOptions, lro) continue outer } } } ...
go
func (rb *route) MergeUnion(right *route) bool { var mergedRouteOptions []*routeOption outer: for _, lro := range rb.routeOptions { for _, rro := range right.routeOptions { if lro.UnionCanMerge(rro) { lro.MergeUnion(rro) mergedRouteOptions = append(mergedRouteOptions, lro) continue outer } } } ...
[ "func", "(", "rb", "*", "route", ")", "MergeUnion", "(", "right", "*", "route", ")", "bool", "{", "var", "mergedRouteOptions", "[", "]", "*", "routeOption", "\n", "outer", ":", "for", "_", ",", "lro", ":=", "range", "rb", ".", "routeOptions", "{", "f...
// MergeUnion returns true if the rhs route could successfully be merged // with the rb route.
[ "MergeUnion", "returns", "true", "if", "the", "rhs", "route", "could", "successfully", "be", "merged", "with", "the", "rb", "route", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/route.go#L513-L531
134,930
vitessio/vitess
go/vt/vtgate/planbuilder/route.go
removeMultishardOptions
func (rb *route) removeMultishardOptions() bool { return rb.removeOptions(func(ro *routeOption) bool { switch ro.eroute.Opcode { case engine.SelectUnsharded, engine.SelectDBA, engine.SelectNext, engine.SelectEqualUnique, engine.SelectReference: return true } return false }) }
go
func (rb *route) removeMultishardOptions() bool { return rb.removeOptions(func(ro *routeOption) bool { switch ro.eroute.Opcode { case engine.SelectUnsharded, engine.SelectDBA, engine.SelectNext, engine.SelectEqualUnique, engine.SelectReference: return true } return false }) }
[ "func", "(", "rb", "*", "route", ")", "removeMultishardOptions", "(", ")", "bool", "{", "return", "rb", ".", "removeOptions", "(", "func", "(", "ro", "*", "routeOption", ")", "bool", "{", "switch", "ro", ".", "eroute", ".", "Opcode", "{", "case", "engi...
// removeMultishardOptions removes all multi-shard options from the // route. It returns false if no such options exist.
[ "removeMultishardOptions", "removes", "all", "multi", "-", "shard", "options", "from", "the", "route", ".", "It", "returns", "false", "if", "no", "such", "options", "exist", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/route.go#L535-L543
134,931
vitessio/vitess
go/vt/vtgate/planbuilder/route.go
removeShardedOptions
func (rb *route) removeShardedOptions() bool { return rb.removeOptions(func(ro *routeOption) bool { return ro.eroute.Opcode == engine.SelectUnsharded }) }
go
func (rb *route) removeShardedOptions() bool { return rb.removeOptions(func(ro *routeOption) bool { return ro.eroute.Opcode == engine.SelectUnsharded }) }
[ "func", "(", "rb", "*", "route", ")", "removeShardedOptions", "(", ")", "bool", "{", "return", "rb", ".", "removeOptions", "(", "func", "(", "ro", "*", "routeOption", ")", "bool", "{", "return", "ro", ".", "eroute", ".", "Opcode", "==", "engine", ".", ...
// removeShardedOptions removes all sharded options from the // route. It returns false if no such options exist. // This is used for constructs that are only supported for unsharded // keyspaces like last_insert_id.
[ "removeShardedOptions", "removes", "all", "sharded", "options", "from", "the", "route", ".", "It", "returns", "false", "if", "no", "such", "options", "exist", ".", "This", "is", "used", "for", "constructs", "that", "are", "only", "supported", "for", "unsharded...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/route.go#L549-L553
134,932
vitessio/vitess
go/vt/vtgate/planbuilder/route.go
removeOptionsWithUnmatchedKeyspace
func (rb *route) removeOptionsWithUnmatchedKeyspace(keyspace string) bool { return rb.removeOptions(func(ro *routeOption) bool { return ro.eroute.Keyspace.Name == keyspace }) }
go
func (rb *route) removeOptionsWithUnmatchedKeyspace(keyspace string) bool { return rb.removeOptions(func(ro *routeOption) bool { return ro.eroute.Keyspace.Name == keyspace }) }
[ "func", "(", "rb", "*", "route", ")", "removeOptionsWithUnmatchedKeyspace", "(", "keyspace", "string", ")", "bool", "{", "return", "rb", ".", "removeOptions", "(", "func", "(", "ro", "*", "routeOption", ")", "bool", "{", "return", "ro", ".", "eroute", ".",...
// removeOptionsWithUnmatchedKeyspace removes all options that don't match // the specified keyspace. It returns false if no such options exist.
[ "removeOptionsWithUnmatchedKeyspace", "removes", "all", "options", "that", "don", "t", "match", "the", "specified", "keyspace", ".", "It", "returns", "false", "if", "no", "such", "options", "exist", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/route.go#L557-L561
134,933
vitessio/vitess
go/vt/vtgate/planbuilder/route.go
removeOptions
func (rb *route) removeOptions(match func(*routeOption) bool) bool { var newOptions []*routeOption for _, ro := range rb.routeOptions { if match(ro) { newOptions = append(newOptions, ro) } } if len(newOptions) == 0 { return false } rb.routeOptions = newOptions return true }
go
func (rb *route) removeOptions(match func(*routeOption) bool) bool { var newOptions []*routeOption for _, ro := range rb.routeOptions { if match(ro) { newOptions = append(newOptions, ro) } } if len(newOptions) == 0 { return false } rb.routeOptions = newOptions return true }
[ "func", "(", "rb", "*", "route", ")", "removeOptions", "(", "match", "func", "(", "*", "routeOption", ")", "bool", ")", "bool", "{", "var", "newOptions", "[", "]", "*", "routeOption", "\n", "for", "_", ",", "ro", ":=", "range", "rb", ".", "routeOptio...
// removeOptions removes all options that don't match on // the criteria function. It returns false if no such options exist.
[ "removeOptions", "removes", "all", "options", "that", "don", "t", "match", "on", "the", "criteria", "function", ".", "It", "returns", "false", "if", "no", "such", "options", "exist", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/route.go#L565-L577
134,934
vitessio/vitess
go/vt/vtgate/planbuilder/route.go
queryTimeout
func queryTimeout(d sqlparser.CommentDirectives) int { if d == nil { return 0 } val, ok := d[sqlparser.DirectiveQueryTimeout] if !ok { return 0 } intVal, ok := val.(int) if ok { return intVal } return 0 }
go
func queryTimeout(d sqlparser.CommentDirectives) int { if d == nil { return 0 } val, ok := d[sqlparser.DirectiveQueryTimeout] if !ok { return 0 } intVal, ok := val.(int) if ok { return intVal } return 0 }
[ "func", "queryTimeout", "(", "d", "sqlparser", ".", "CommentDirectives", ")", "int", "{", "if", "d", "==", "nil", "{", "return", "0", "\n", "}", "\n\n", "val", ",", "ok", ":=", "d", "[", "sqlparser", ".", "DirectiveQueryTimeout", "]", "\n", "if", "!", ...
// queryTimeout returns DirectiveQueryTimeout value if set, otherwise returns 0.
[ "queryTimeout", "returns", "DirectiveQueryTimeout", "value", "if", "set", "otherwise", "returns", "0", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/route.go#L580-L595
134,935
vitessio/vitess
go/vt/vtgate/planbuilder/builder.go
Build
func Build(query string, vschema ContextVSchema) (*engine.Plan, error) { stmt, err := sqlparser.Parse(query) if err != nil { return nil, err } return BuildFromStmt(query, stmt, vschema) }
go
func Build(query string, vschema ContextVSchema) (*engine.Plan, error) { stmt, err := sqlparser.Parse(query) if err != nil { return nil, err } return BuildFromStmt(query, stmt, vschema) }
[ "func", "Build", "(", "query", "string", ",", "vschema", "ContextVSchema", ")", "(", "*", "engine", ".", "Plan", ",", "error", ")", "{", "stmt", ",", "err", ":=", "sqlparser", ".", "Parse", "(", "query", ")", "\n", "if", "err", "!=", "nil", "{", "r...
// Build builds a plan for a query based on the specified vschema. // It's the main entry point for this package.
[ "Build", "builds", "a", "plan", "for", "a", "query", "based", "on", "the", "specified", "vschema", ".", "It", "s", "the", "main", "entry", "point", "for", "this", "package", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/builder.go#L120-L126
134,936
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
stateInfo
func stateInfo(state int64) string { if state == StateServing { return "SERVING" } return fmt.Sprintf("%s (%s)", stateName[state], stateDetail[state]) }
go
func stateInfo(state int64) string { if state == StateServing { return "SERVING" } return fmt.Sprintf("%s (%s)", stateName[state], stateDetail[state]) }
[ "func", "stateInfo", "(", "state", "int64", ")", "string", "{", "if", "state", "==", "StateServing", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "stateName", "[", "state", "]", ",", "stateDetail", ...
// stateInfo returns a string representation of the state and optional detail // about the reason for the state transition
[ "stateInfo", "returns", "a", "string", "representation", "of", "the", "state", "and", "optional", "detail", "about", "the", "reason", "for", "the", "state", "transition" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L117-L122
134,937
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
NewServer
func NewServer(topoServer *topo.Server, alias topodatapb.TabletAlias) *TabletServer { return NewTabletServer(tabletenv.Config, topoServer, alias) }
go
func NewServer(topoServer *topo.Server, alias topodatapb.TabletAlias) *TabletServer { return NewTabletServer(tabletenv.Config, topoServer, alias) }
[ "func", "NewServer", "(", "topoServer", "*", "topo", ".", "Server", ",", "alias", "topodatapb", ".", "TabletAlias", ")", "*", "TabletServer", "{", "return", "NewTabletServer", "(", "tabletenv", ".", "Config", ",", "topoServer", ",", "alias", ")", "\n", "}" ]
// NewServer creates a new TabletServer based on the command line flags.
[ "NewServer", "creates", "a", "new", "TabletServer", "based", "on", "the", "command", "line", "flags", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L210-L212
134,938
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
NewTabletServerWithNilTopoServer
func NewTabletServerWithNilTopoServer(config tabletenv.TabletConfig) *TabletServer { return NewTabletServer(config, nil, topodatapb.TabletAlias{}) }
go
func NewTabletServerWithNilTopoServer(config tabletenv.TabletConfig) *TabletServer { return NewTabletServer(config, nil, topodatapb.TabletAlias{}) }
[ "func", "NewTabletServerWithNilTopoServer", "(", "config", "tabletenv", ".", "TabletConfig", ")", "*", "TabletServer", "{", "return", "NewTabletServer", "(", "config", ",", "nil", ",", "topodatapb", ".", "TabletAlias", "{", "}", ")", "\n", "}" ]
// NewTabletServerWithNilTopoServer is typically used in tests that // don't need a topoServer member.
[ "NewTabletServerWithNilTopoServer", "is", "typically", "used", "in", "tests", "that", "don", "t", "need", "a", "topoServer", "member", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L259-L261
134,939
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
NewTabletServer
func NewTabletServer(config tabletenv.TabletConfig, topoServer *topo.Server, alias topodatapb.TabletAlias) *TabletServer { tsv := &TabletServer{ QueryTimeout: sync2.NewAtomicDuration(time.Duration(config.QueryTimeout * 1e9)), BeginTimeout: sync2.NewAtomicDuration(time.Duration(config.TxPoolTime...
go
func NewTabletServer(config tabletenv.TabletConfig, topoServer *topo.Server, alias topodatapb.TabletAlias) *TabletServer { tsv := &TabletServer{ QueryTimeout: sync2.NewAtomicDuration(time.Duration(config.QueryTimeout * 1e9)), BeginTimeout: sync2.NewAtomicDuration(time.Duration(config.TxPoolTime...
[ "func", "NewTabletServer", "(", "config", "tabletenv", ".", "TabletConfig", ",", "topoServer", "*", "topo", ".", "Server", ",", "alias", "topodatapb", ".", "TabletAlias", ")", "*", "TabletServer", "{", "tsv", ":=", "&", "TabletServer", "{", "QueryTimeout", ":"...
// NewTabletServer creates an instance of TabletServer. Only the first // instance of TabletServer will expose its state variables.
[ "NewTabletServer", "creates", "an", "instance", "of", "TabletServer", ".", "Only", "the", "first", "instance", "of", "TabletServer", "will", "expose", "its", "state", "variables", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L265-L312
134,940
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
Register
func (tsv *TabletServer) Register() { for _, f := range RegisterFunctions { f(tsv) } tsv.registerDebugHealthHandler() tsv.registerQueryzHandler() tsv.registerStreamQueryzHandlers() tsv.registerTwopczHandler() }
go
func (tsv *TabletServer) Register() { for _, f := range RegisterFunctions { f(tsv) } tsv.registerDebugHealthHandler() tsv.registerQueryzHandler() tsv.registerStreamQueryzHandlers() tsv.registerTwopczHandler() }
[ "func", "(", "tsv", "*", "TabletServer", ")", "Register", "(", ")", "{", "for", "_", ",", "f", ":=", "range", "RegisterFunctions", "{", "f", "(", "tsv", ")", "\n", "}", "\n", "tsv", ".", "registerDebugHealthHandler", "(", ")", "\n", "tsv", ".", "regi...
// Register prepares TabletServer for serving by calling // all the registrations functions.
[ "Register", "prepares", "TabletServer", "for", "serving", "by", "calling", "all", "the", "registrations", "functions", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L316-L324
134,941
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
RegisterQueryRuleSource
func (tsv *TabletServer) RegisterQueryRuleSource(ruleSource string) { tsv.qe.queryRuleSources.RegisterSource(ruleSource) }
go
func (tsv *TabletServer) RegisterQueryRuleSource(ruleSource string) { tsv.qe.queryRuleSources.RegisterSource(ruleSource) }
[ "func", "(", "tsv", "*", "TabletServer", ")", "RegisterQueryRuleSource", "(", "ruleSource", "string", ")", "{", "tsv", ".", "qe", ".", "queryRuleSources", ".", "RegisterSource", "(", "ruleSource", ")", "\n", "}" ]
// RegisterQueryRuleSource registers ruleSource for setting query rules.
[ "RegisterQueryRuleSource", "registers", "ruleSource", "for", "setting", "query", "rules", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L327-L329
134,942
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
UnRegisterQueryRuleSource
func (tsv *TabletServer) UnRegisterQueryRuleSource(ruleSource string) { tsv.qe.queryRuleSources.UnRegisterSource(ruleSource) }
go
func (tsv *TabletServer) UnRegisterQueryRuleSource(ruleSource string) { tsv.qe.queryRuleSources.UnRegisterSource(ruleSource) }
[ "func", "(", "tsv", "*", "TabletServer", ")", "UnRegisterQueryRuleSource", "(", "ruleSource", "string", ")", "{", "tsv", ".", "qe", ".", "queryRuleSources", ".", "UnRegisterSource", "(", "ruleSource", ")", "\n", "}" ]
// UnRegisterQueryRuleSource unregisters ruleSource from query rules.
[ "UnRegisterQueryRuleSource", "unregisters", "ruleSource", "from", "query", "rules", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L332-L334
134,943
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
SetQueryRules
func (tsv *TabletServer) SetQueryRules(ruleSource string, qrs *rules.Rules) error { err := tsv.qe.queryRuleSources.SetRules(ruleSource, qrs) if err != nil { return err } tsv.qe.ClearQueryPlanCache() return nil }
go
func (tsv *TabletServer) SetQueryRules(ruleSource string, qrs *rules.Rules) error { err := tsv.qe.queryRuleSources.SetRules(ruleSource, qrs) if err != nil { return err } tsv.qe.ClearQueryPlanCache() return nil }
[ "func", "(", "tsv", "*", "TabletServer", ")", "SetQueryRules", "(", "ruleSource", "string", ",", "qrs", "*", "rules", ".", "Rules", ")", "error", "{", "err", ":=", "tsv", ".", "qe", ".", "queryRuleSources", ".", "SetRules", "(", "ruleSource", ",", "qrs",...
// SetQueryRules sets the query rules for a registered ruleSource.
[ "SetQueryRules", "sets", "the", "query", "rules", "for", "a", "registered", "ruleSource", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L337-L344
134,944
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
GetState
func (tsv *TabletServer) GetState() string { if tsv.lameduck.Get() != 0 { return "NOT_SERVING" } tsv.mu.Lock() name := stateName[tsv.state] tsv.mu.Unlock() return name }
go
func (tsv *TabletServer) GetState() string { if tsv.lameduck.Get() != 0 { return "NOT_SERVING" } tsv.mu.Lock() name := stateName[tsv.state] tsv.mu.Unlock() return name }
[ "func", "(", "tsv", "*", "TabletServer", ")", "GetState", "(", ")", "string", "{", "if", "tsv", ".", "lameduck", ".", "Get", "(", ")", "!=", "0", "{", "return", "\"", "\"", "\n", "}", "\n", "tsv", ".", "mu", ".", "Lock", "(", ")", "\n", "name",...
// GetState returns the name of the current TabletServer state.
[ "GetState", "returns", "the", "name", "of", "the", "current", "TabletServer", "state", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L347-L355
134,945
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
setState
func (tsv *TabletServer) setState(state int64) { log.Infof("TabletServer state: %s -> %s", stateInfo(tsv.state), stateInfo(state)) tsv.state = state tsv.history.Add(&historyRecord{ Time: time.Now(), ServingState: stateInfo(state), TabletType: tsv.target.TabletType.String(), }) }
go
func (tsv *TabletServer) setState(state int64) { log.Infof("TabletServer state: %s -> %s", stateInfo(tsv.state), stateInfo(state)) tsv.state = state tsv.history.Add(&historyRecord{ Time: time.Now(), ServingState: stateInfo(state), TabletType: tsv.target.TabletType.String(), }) }
[ "func", "(", "tsv", "*", "TabletServer", ")", "setState", "(", "state", "int64", ")", "{", "log", ".", "Infof", "(", "\"", "\"", ",", "stateInfo", "(", "tsv", ".", "state", ")", ",", "stateInfo", "(", "state", ")", ")", "\n", "tsv", ".", "state", ...
// setState changes the state and logs the event. // It requires the caller to hold a lock on mu.
[ "setState", "changes", "the", "state", "and", "logs", "the", "event", ".", "It", "requires", "the", "caller", "to", "hold", "a", "lock", "on", "mu", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L359-L367
134,946
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
transition
func (tsv *TabletServer) transition(newState int64) { tsv.mu.Lock() tsv.setState(newState) tsv.mu.Unlock() }
go
func (tsv *TabletServer) transition(newState int64) { tsv.mu.Lock() tsv.setState(newState) tsv.mu.Unlock() }
[ "func", "(", "tsv", "*", "TabletServer", ")", "transition", "(", "newState", "int64", ")", "{", "tsv", ".", "mu", ".", "Lock", "(", ")", "\n", "tsv", ".", "setState", "(", "newState", ")", "\n", "tsv", ".", "mu", ".", "Unlock", "(", ")", "\n", "}...
// transition obtains a lock and changes the state.
[ "transition", "obtains", "a", "lock", "and", "changes", "the", "state", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L370-L374
134,947
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
InitDBConfig
func (tsv *TabletServer) InitDBConfig(target querypb.Target, dbcfgs *dbconfigs.DBConfigs) error { tsv.mu.Lock() defer tsv.mu.Unlock() if tsv.state != StateNotConnected { return vterrors.Errorf(vtrpcpb.Code_UNKNOWN, "InitDBConfig failed, current state: %s", stateName[tsv.state]) } tsv.target = target tsv.dbconfi...
go
func (tsv *TabletServer) InitDBConfig(target querypb.Target, dbcfgs *dbconfigs.DBConfigs) error { tsv.mu.Lock() defer tsv.mu.Unlock() if tsv.state != StateNotConnected { return vterrors.Errorf(vtrpcpb.Code_UNKNOWN, "InitDBConfig failed, current state: %s", stateName[tsv.state]) } tsv.target = target tsv.dbconfi...
[ "func", "(", "tsv", "*", "TabletServer", ")", "InitDBConfig", "(", "target", "querypb", ".", "Target", ",", "dbcfgs", "*", "dbconfigs", ".", "DBConfigs", ")", "error", "{", "tsv", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "tsv", ".", "mu", "."...
// InitDBConfig initializes the db config variables for TabletServer. You must call this function before // calling SetServingType.
[ "InitDBConfig", "initializes", "the", "db", "config", "variables", "for", "TabletServer", ".", "You", "must", "call", "this", "function", "before", "calling", "SetServingType", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L383-L401
134,948
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
InitACL
func (tsv *TabletServer) InitACL(tableACLConfigFile string, enforceTableACLConfig bool) { tsv.initACL(tableACLConfigFile, enforceTableACLConfig) sigChan := make(chan os.Signal, 1) signal.Notify(sigChan, syscall.SIGHUP) go func() { for range sigChan { tsv.initACL(tableACLConfigFile, enforceTableACLConfig) } ...
go
func (tsv *TabletServer) InitACL(tableACLConfigFile string, enforceTableACLConfig bool) { tsv.initACL(tableACLConfigFile, enforceTableACLConfig) sigChan := make(chan os.Signal, 1) signal.Notify(sigChan, syscall.SIGHUP) go func() { for range sigChan { tsv.initACL(tableACLConfigFile, enforceTableACLConfig) } ...
[ "func", "(", "tsv", "*", "TabletServer", ")", "InitACL", "(", "tableACLConfigFile", "string", ",", "enforceTableACLConfig", "bool", ")", "{", "tsv", ".", "initACL", "(", "tableACLConfigFile", ",", "enforceTableACLConfig", ")", "\n\n", "sigChan", ":=", "make", "(...
// InitACL loads the table ACL and sets up a SIGHUP handler for reloading it.
[ "InitACL", "loads", "the", "table", "ACL", "and", "sets", "up", "a", "SIGHUP", "handler", "for", "reloading", "it", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L420-L430
134,949
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
StartService
func (tsv *TabletServer) StartService(target querypb.Target, dbcfgs *dbconfigs.DBConfigs) (err error) { // Save tablet type away to prevent data races tabletType := target.TabletType err = tsv.InitDBConfig(target, dbcfgs) if err != nil { return err } _ /* state changed */, err = tsv.SetServingType(tabletType, t...
go
func (tsv *TabletServer) StartService(target querypb.Target, dbcfgs *dbconfigs.DBConfigs) (err error) { // Save tablet type away to prevent data races tabletType := target.TabletType err = tsv.InitDBConfig(target, dbcfgs) if err != nil { return err } _ /* state changed */, err = tsv.SetServingType(tabletType, t...
[ "func", "(", "tsv", "*", "TabletServer", ")", "StartService", "(", "target", "querypb", ".", "Target", ",", "dbcfgs", "*", "dbconfigs", ".", "DBConfigs", ")", "(", "err", "error", ")", "{", "// Save tablet type away to prevent data races", "tabletType", ":=", "t...
// StartService is a convenience function for InitDBConfig->SetServingType // with serving=true.
[ "StartService", "is", "a", "convenience", "function", "for", "InitDBConfig", "-", ">", "SetServingType", "with", "serving", "=", "true", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L434-L443
134,950
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
SetServingType
func (tsv *TabletServer) SetServingType(tabletType topodatapb.TabletType, serving bool, alsoAllow []topodatapb.TabletType) (stateChanged bool, err error) { defer tsv.ExitLameduck() action, err := tsv.decideAction(tabletType, serving, alsoAllow) if err != nil { return false, err } switch action { case actionNon...
go
func (tsv *TabletServer) SetServingType(tabletType topodatapb.TabletType, serving bool, alsoAllow []topodatapb.TabletType) (stateChanged bool, err error) { defer tsv.ExitLameduck() action, err := tsv.decideAction(tabletType, serving, alsoAllow) if err != nil { return false, err } switch action { case actionNon...
[ "func", "(", "tsv", "*", "TabletServer", ")", "SetServingType", "(", "tabletType", "topodatapb", ".", "TabletType", ",", "serving", "bool", ",", "alsoAllow", "[", "]", "topodatapb", ".", "TabletType", ")", "(", "stateChanged", "bool", ",", "err", "error", ")...
// SetServingType changes the serving type of the tabletserver. It starts or // stops internal services as deemed necessary. The tabletType determines the // primary serving type, while alsoAllow specifies other tablet types that // should also be honored for serving. // Returns true if the state of QueryService or the...
[ "SetServingType", "changes", "the", "serving", "type", "of", "the", "tabletserver", ".", "It", "starts", "or", "stops", "internal", "services", "as", "deemed", "necessary", ".", "The", "tabletType", "determines", "the", "primary", "serving", "type", "while", "al...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L470-L497
134,951
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
StopService
func (tsv *TabletServer) StopService() { defer close(tsv.setTimeBomb()) defer tabletenv.LogError() tsv.mu.Lock() if tsv.state != StateServing && tsv.state != StateNotServing { tsv.mu.Unlock() return } tsv.setState(StateShuttingDown) tsv.mu.Unlock() log.Infof("Executing complete shutdown.") tsv.waitForShu...
go
func (tsv *TabletServer) StopService() { defer close(tsv.setTimeBomb()) defer tabletenv.LogError() tsv.mu.Lock() if tsv.state != StateServing && tsv.state != StateNotServing { tsv.mu.Unlock() return } tsv.setState(StateShuttingDown) tsv.mu.Unlock() log.Infof("Executing complete shutdown.") tsv.waitForShu...
[ "func", "(", "tsv", "*", "TabletServer", ")", "StopService", "(", ")", "{", "defer", "close", "(", "tsv", ".", "setTimeBomb", "(", ")", ")", "\n", "defer", "tabletenv", ".", "LogError", "(", ")", "\n\n", "tsv", ".", "mu", ".", "Lock", "(", ")", "\n...
// StopService shuts down the tabletserver to the uninitialized state. // It first transitions to StateShuttingDown, then waits for active // services to shut down. Then it shuts down QueryEngine. This function // should be called before process termination, or if MySQL is unreachable. // Under normal circumstances, Se...
[ "StopService", "shuts", "down", "the", "tabletserver", "to", "the", "uninitialized", "state", ".", "It", "first", "transitions", "to", "StateShuttingDown", "then", "waits", "for", "active", "services", "to", "shut", "down", ".", "Then", "it", "shuts", "down", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L608-L629
134,952
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
closeAll
func (tsv *TabletServer) closeAll() { tsv.messager.Close() tsv.hr.Close() tsv.hw.Close() tsv.teCtrl.StopGently() tsv.watcher.Close() tsv.updateStreamList.Stop() tsv.qe.Close() tsv.se.Close() tsv.txThrottler.Close() tsv.transition(StateNotConnected) }
go
func (tsv *TabletServer) closeAll() { tsv.messager.Close() tsv.hr.Close() tsv.hw.Close() tsv.teCtrl.StopGently() tsv.watcher.Close() tsv.updateStreamList.Stop() tsv.qe.Close() tsv.se.Close() tsv.txThrottler.Close() tsv.transition(StateNotConnected) }
[ "func", "(", "tsv", "*", "TabletServer", ")", "closeAll", "(", ")", "{", "tsv", ".", "messager", ".", "Close", "(", ")", "\n", "tsv", ".", "hr", ".", "Close", "(", ")", "\n", "tsv", ".", "hw", ".", "Close", "(", ")", "\n", "tsv", ".", "teCtrl",...
// closeAll is called if TabletServer fails to start. // It forcibly shuts down everything.
[ "closeAll", "is", "called", "if", "TabletServer", "fails", "to", "start", ".", "It", "forcibly", "shuts", "down", "everything", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L648-L659
134,953
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
CheckMySQL
func (tsv *TabletServer) CheckMySQL() { if !tsv.checkMySQLThrottler.TryAcquire() { return } go func() { defer func() { tabletenv.LogError() time.Sleep(1 * time.Second) tsv.checkMySQLThrottler.Release() }() if tsv.isMySQLReachable() { return } log.Info("Check MySQL failed. Shutting down query ...
go
func (tsv *TabletServer) CheckMySQL() { if !tsv.checkMySQLThrottler.TryAcquire() { return } go func() { defer func() { tabletenv.LogError() time.Sleep(1 * time.Second) tsv.checkMySQLThrottler.Release() }() if tsv.isMySQLReachable() { return } log.Info("Check MySQL failed. Shutting down query ...
[ "func", "(", "tsv", "*", "TabletServer", ")", "CheckMySQL", "(", ")", "{", "if", "!", "tsv", ".", "checkMySQLThrottler", ".", "TryAcquire", "(", ")", "{", "return", "\n", "}", "\n", "go", "func", "(", ")", "{", "defer", "func", "(", ")", "{", "tabl...
// CheckMySQL initiates a check to see if MySQL is reachable. // If not, it shuts down the query service. The check is rate-limited // to no more than once per second.
[ "CheckMySQL", "initiates", "a", "check", "to", "see", "if", "MySQL", "is", "reachable", ".", "If", "not", "it", "shuts", "down", "the", "query", "service", ".", "The", "check", "is", "rate", "-", "limited", "to", "no", "more", "than", "once", "per", "s...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L705-L721
134,954
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
isMySQLReachable
func (tsv *TabletServer) isMySQLReachable() bool { tsv.mu.Lock() switch tsv.state { case StateServing: // Prevent transition out of this state by // reserving a request. tsv.requests.Add(1) defer tsv.requests.Done() case StateNotServing: // Prevent transition out of this state by // temporarily switchin...
go
func (tsv *TabletServer) isMySQLReachable() bool { tsv.mu.Lock() switch tsv.state { case StateServing: // Prevent transition out of this state by // reserving a request. tsv.requests.Add(1) defer tsv.requests.Done() case StateNotServing: // Prevent transition out of this state by // temporarily switchin...
[ "func", "(", "tsv", "*", "TabletServer", ")", "isMySQLReachable", "(", ")", "bool", "{", "tsv", ".", "mu", ".", "Lock", "(", ")", "\n", "switch", "tsv", ".", "state", "{", "case", "StateServing", ":", "// Prevent transition out of this state by", "// reserving...
// isMySQLReachable returns true if we can connect to MySQL. // The function returns false only if the query service is // in StateServing or StateNotServing.
[ "isMySQLReachable", "returns", "true", "if", "we", "can", "connect", "to", "MySQL", ".", "The", "function", "returns", "false", "only", "if", "the", "query", "service", "is", "in", "StateServing", "or", "StateNotServing", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L726-L747
134,955
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
ReloadSchema
func (tsv *TabletServer) ReloadSchema(ctx context.Context) error { return tsv.se.Reload(ctx) }
go
func (tsv *TabletServer) ReloadSchema(ctx context.Context) error { return tsv.se.Reload(ctx) }
[ "func", "(", "tsv", "*", "TabletServer", ")", "ReloadSchema", "(", "ctx", "context", ".", "Context", ")", "error", "{", "return", "tsv", ".", "se", ".", "Reload", "(", "ctx", ")", "\n", "}" ]
// ReloadSchema reloads the schema.
[ "ReloadSchema", "reloads", "the", "schema", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L750-L752
134,956
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
Begin
func (tsv *TabletServer) Begin(ctx context.Context, target *querypb.Target, options *querypb.ExecuteOptions) (transactionID int64, err error) { err = tsv.execRequest( ctx, tsv.BeginTimeout.Get(), "Begin", "begin", nil, target, options, true /* isBegin */, false, /* allowOnShutdown */ func(ctx context.Context, ...
go
func (tsv *TabletServer) Begin(ctx context.Context, target *querypb.Target, options *querypb.ExecuteOptions) (transactionID int64, err error) { err = tsv.execRequest( ctx, tsv.BeginTimeout.Get(), "Begin", "begin", nil, target, options, true /* isBegin */, false, /* allowOnShutdown */ func(ctx context.Context, ...
[ "func", "(", "tsv", "*", "TabletServer", ")", "Begin", "(", "ctx", "context", ".", "Context", ",", "target", "*", "querypb", ".", "Target", ",", "options", "*", "querypb", ".", "ExecuteOptions", ")", "(", "transactionID", "int64", ",", "err", "error", ")...
// Begin starts a new transaction. This is allowed only if the state is StateServing.
[ "Begin", "starts", "a", "new", "transaction", ".", "This", "is", "allowed", "only", "if", "the", "state", "is", "StateServing", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L773-L802
134,957
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
Rollback
func (tsv *TabletServer) Rollback(ctx context.Context, target *querypb.Target, transactionID int64) (err error) { return tsv.execRequest( ctx, tsv.QueryTimeout.Get(), "Rollback", "rollback", nil, target, nil, false /* isBegin */, true, /* allowOnShutdown */ func(ctx context.Context, logStats *tabletenv.LogStat...
go
func (tsv *TabletServer) Rollback(ctx context.Context, target *querypb.Target, transactionID int64) (err error) { return tsv.execRequest( ctx, tsv.QueryTimeout.Get(), "Rollback", "rollback", nil, target, nil, false /* isBegin */, true, /* allowOnShutdown */ func(ctx context.Context, logStats *tabletenv.LogStat...
[ "func", "(", "tsv", "*", "TabletServer", ")", "Rollback", "(", "ctx", "context", ".", "Context", ",", "target", "*", "querypb", ".", "Target", ",", "transactionID", "int64", ")", "(", "err", "error", ")", "{", "return", "tsv", ".", "execRequest", "(", ...
// Rollback rollsback the specified transaction.
[ "Rollback", "rollsback", "the", "specified", "transaction", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L831-L842
134,958
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
Execute
func (tsv *TabletServer) Execute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]*querypb.BindVariable, transactionID int64, options *querypb.ExecuteOptions) (result *sqltypes.Result, err error) { span, ctx := trace.NewSpan(ctx, "TabletServer.Execute") trace.AnnotateSQL(span, sql) d...
go
func (tsv *TabletServer) Execute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]*querypb.BindVariable, transactionID int64, options *querypb.ExecuteOptions) (result *sqltypes.Result, err error) { span, ctx := trace.NewSpan(ctx, "TabletServer.Execute") trace.AnnotateSQL(span, sql) d...
[ "func", "(", "tsv", "*", "TabletServer", ")", "Execute", "(", "ctx", "context", ".", "Context", ",", "target", "*", "querypb", ".", "Target", ",", "sql", "string", ",", "bindVariables", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable", ",",...
// Execute executes the query and returns the result as response.
[ "Execute", "executes", "the", "query", "and", "returns", "the", "result", "as", "response", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L994-L1035
134,959
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
ExecuteBatch
func (tsv *TabletServer) ExecuteBatch(ctx context.Context, target *querypb.Target, queries []*querypb.BoundQuery, asTransaction bool, transactionID int64, options *querypb.ExecuteOptions) (results []sqltypes.Result, err error) { span, ctx := trace.NewSpan(ctx, "TabletServer.ExecuteBatch") defer span.Finish() if len...
go
func (tsv *TabletServer) ExecuteBatch(ctx context.Context, target *querypb.Target, queries []*querypb.BoundQuery, asTransaction bool, transactionID int64, options *querypb.ExecuteOptions) (results []sqltypes.Result, err error) { span, ctx := trace.NewSpan(ctx, "TabletServer.ExecuteBatch") defer span.Finish() if len...
[ "func", "(", "tsv", "*", "TabletServer", ")", "ExecuteBatch", "(", "ctx", "context", ".", "Context", ",", "target", "*", "querypb", ".", "Target", ",", "queries", "[", "]", "*", "querypb", ".", "BoundQuery", ",", "asTransaction", "bool", ",", "transactionI...
// 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.
[ "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", "AsTrans...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L1074-L1158
134,960
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
BeginExecute
func (tsv *TabletServer) BeginExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]*querypb.BindVariable, options *querypb.ExecuteOptions) (*sqltypes.Result, int64, error) { if tsv.enableHotRowProtection { txDone, err := tsv.beginWaitForSameRangeTransactions(ctx, target, options,...
go
func (tsv *TabletServer) BeginExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]*querypb.BindVariable, options *querypb.ExecuteOptions) (*sqltypes.Result, int64, error) { if tsv.enableHotRowProtection { txDone, err := tsv.beginWaitForSameRangeTransactions(ctx, target, options,...
[ "func", "(", "tsv", "*", "TabletServer", ")", "BeginExecute", "(", "ctx", "context", ".", "Context", ",", "target", "*", "querypb", ".", "Target", ",", "sql", "string", ",", "bindVariables", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable", ...
// BeginExecute combines Begin and Execute.
[ "BeginExecute", "combines", "Begin", "and", "Execute", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L1161-L1179
134,961
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
MessageStream
func (tsv *TabletServer) MessageStream(ctx context.Context, target *querypb.Target, name string, callback func(*sqltypes.Result) error) (err error) { return tsv.execRequest( ctx, 0, "MessageStream", "stream", nil, target, nil, false /* isBegin */, false, /* allowOnShutdown */ func(ctx context.Context, logStats...
go
func (tsv *TabletServer) MessageStream(ctx context.Context, target *querypb.Target, name string, callback func(*sqltypes.Result) error) (err error) { return tsv.execRequest( ctx, 0, "MessageStream", "stream", nil, target, nil, false /* isBegin */, false, /* allowOnShutdown */ func(ctx context.Context, logStats...
[ "func", "(", "tsv", "*", "TabletServer", ")", "MessageStream", "(", "ctx", "context", ".", "Context", ",", "target", "*", "querypb", ".", "Target", ",", "name", "string", ",", "callback", "func", "(", "*", "sqltypes", ".", "Result", ")", "error", ")", ...
// MessageStream streams messages from the requested table.
[ "MessageStream", "streams", "messages", "from", "the", "requested", "table", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L1270-L1290
134,962
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
MessageAck
func (tsv *TabletServer) MessageAck(ctx context.Context, target *querypb.Target, name string, ids []*querypb.Value) (count int64, err error) { sids := make([]string, 0, len(ids)) for _, val := range ids { sids = append(sids, sqltypes.ProtoToValue(val).ToString()) } count, err = tsv.execDML(ctx, target, func() (st...
go
func (tsv *TabletServer) MessageAck(ctx context.Context, target *querypb.Target, name string, ids []*querypb.Value) (count int64, err error) { sids := make([]string, 0, len(ids)) for _, val := range ids { sids = append(sids, sqltypes.ProtoToValue(val).ToString()) } count, err = tsv.execDML(ctx, target, func() (st...
[ "func", "(", "tsv", "*", "TabletServer", ")", "MessageAck", "(", "ctx", "context", ".", "Context", ",", "target", "*", "querypb", ".", "Target", ",", "name", "string", ",", "ids", "[", "]", "*", "querypb", ".", "Value", ")", "(", "count", "int64", ",...
// MessageAck acks the list of messages for a given message table. // It returns the number of messages successfully acked.
[ "MessageAck", "acks", "the", "list", "of", "messages", "for", "a", "given", "message", "table", ".", "It", "returns", "the", "number", "of", "messages", "successfully", "acked", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L1294-L1307
134,963
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
PostponeMessages
func (tsv *TabletServer) PostponeMessages(ctx context.Context, target *querypb.Target, name string, ids []string) (count int64, err error) { return tsv.execDML(ctx, target, func() (string, map[string]*querypb.BindVariable, error) { return tsv.messager.GeneratePostponeQuery(name, ids) }) }
go
func (tsv *TabletServer) PostponeMessages(ctx context.Context, target *querypb.Target, name string, ids []string) (count int64, err error) { return tsv.execDML(ctx, target, func() (string, map[string]*querypb.BindVariable, error) { return tsv.messager.GeneratePostponeQuery(name, ids) }) }
[ "func", "(", "tsv", "*", "TabletServer", ")", "PostponeMessages", "(", "ctx", "context", ".", "Context", ",", "target", "*", "querypb", ".", "Target", ",", "name", "string", ",", "ids", "[", "]", "string", ")", "(", "count", "int64", ",", "err", "error...
// PostponeMessages postpones the list of messages for a given message table. // It returns the number of messages successfully postponed.
[ "PostponeMessages", "postpones", "the", "list", "of", "messages", "for", "a", "given", "message", "table", ".", "It", "returns", "the", "number", "of", "messages", "successfully", "postponed", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L1311-L1315
134,964
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
PurgeMessages
func (tsv *TabletServer) PurgeMessages(ctx context.Context, target *querypb.Target, name string, timeCutoff int64) (count int64, err error) { return tsv.execDML(ctx, target, func() (string, map[string]*querypb.BindVariable, error) { return tsv.messager.GeneratePurgeQuery(name, timeCutoff) }) }
go
func (tsv *TabletServer) PurgeMessages(ctx context.Context, target *querypb.Target, name string, timeCutoff int64) (count int64, err error) { return tsv.execDML(ctx, target, func() (string, map[string]*querypb.BindVariable, error) { return tsv.messager.GeneratePurgeQuery(name, timeCutoff) }) }
[ "func", "(", "tsv", "*", "TabletServer", ")", "PurgeMessages", "(", "ctx", "context", ".", "Context", ",", "target", "*", "querypb", ".", "Target", ",", "name", "string", ",", "timeCutoff", "int64", ")", "(", "count", "int64", ",", "err", "error", ")", ...
// PurgeMessages purges messages older than specified time in Unix Nanoseconds. // It purges at most 500 messages. It returns the number of messages successfully purged.
[ "PurgeMessages", "purges", "messages", "older", "than", "specified", "time", "in", "Unix", "Nanoseconds", ".", "It", "purges", "at", "most", "500", "messages", ".", "It", "returns", "the", "number", "of", "messages", "successfully", "purged", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L1319-L1323
134,965
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
VStream
func (tsv *TabletServer) VStream(ctx context.Context, target *querypb.Target, startPos string, filter *binlogdatapb.Filter, send func([]*binlogdatapb.VEvent) error) error { if err := tsv.verifyTarget(ctx, target); err != nil { return err } return tsv.vstreamer.Stream(ctx, startPos, filter, send) }
go
func (tsv *TabletServer) VStream(ctx context.Context, target *querypb.Target, startPos string, filter *binlogdatapb.Filter, send func([]*binlogdatapb.VEvent) error) error { if err := tsv.verifyTarget(ctx, target); err != nil { return err } return tsv.vstreamer.Stream(ctx, startPos, filter, send) }
[ "func", "(", "tsv", "*", "TabletServer", ")", "VStream", "(", "ctx", "context", ".", "Context", ",", "target", "*", "querypb", ".", "Target", ",", "startPos", "string", ",", "filter", "*", "binlogdatapb", ".", "Filter", ",", "send", "func", "(", "[", "...
// VStream streams VReplication events.
[ "VStream", "streams", "VReplication", "events", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L1361-L1366
134,966
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
VStreamRows
func (tsv *TabletServer) VStreamRows(ctx context.Context, target *querypb.Target, query string, lastpk *querypb.QueryResult, send func(*binlogdatapb.VStreamRowsResponse) error) error { if err := tsv.verifyTarget(ctx, target); err != nil { return err } var row []sqltypes.Value if lastpk != nil { r := sqltypes.Pr...
go
func (tsv *TabletServer) VStreamRows(ctx context.Context, target *querypb.Target, query string, lastpk *querypb.QueryResult, send func(*binlogdatapb.VStreamRowsResponse) error) error { if err := tsv.verifyTarget(ctx, target); err != nil { return err } var row []sqltypes.Value if lastpk != nil { r := sqltypes.Pr...
[ "func", "(", "tsv", "*", "TabletServer", ")", "VStreamRows", "(", "ctx", "context", ".", "Context", ",", "target", "*", "querypb", ".", "Target", ",", "query", "string", ",", "lastpk", "*", "querypb", ".", "QueryResult", ",", "send", "func", "(", "*", ...
// VStreamRows streams rows from the specified starting point.
[ "VStreamRows", "streams", "rows", "from", "the", "specified", "starting", "point", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L1369-L1382
134,967
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
execRequest
func (tsv *TabletServer) execRequest( ctx context.Context, timeout time.Duration, requestName, sql string, bindVariables map[string]*querypb.BindVariable, target *querypb.Target, options *querypb.ExecuteOptions, isBegin, allowOnShutdown bool, exec func(ctx context.Context, logStats *tabletenv.LogStats) error, ) (er...
go
func (tsv *TabletServer) execRequest( ctx context.Context, timeout time.Duration, requestName, sql string, bindVariables map[string]*querypb.BindVariable, target *querypb.Target, options *querypb.ExecuteOptions, isBegin, allowOnShutdown bool, exec func(ctx context.Context, logStats *tabletenv.LogStats) error, ) (er...
[ "func", "(", "tsv", "*", "TabletServer", ")", "execRequest", "(", "ctx", "context", ".", "Context", ",", "timeout", "time", ".", "Duration", ",", "requestName", ",", "sql", "string", ",", "bindVariables", "map", "[", "string", "]", "*", "querypb", ".", "...
// execRequest performs verifications, sets up the necessary environments // and calls the supplied function for executing the request.
[ "execRequest", "performs", "verifications", "sets", "up", "the", "necessary", "environments", "and", "calls", "the", "supplied", "function", "for", "executing", "the", "request", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L1449-L1487
134,968
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
verifyTarget
func (tsv *TabletServer) verifyTarget(ctx context.Context, target *querypb.Target) error { tsv.mu.Lock() defer tsv.mu.Unlock() if target != nil { // a valid target needs to be used switch { case target.Keyspace != tsv.target.Keyspace: return vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "invalid keyspace ...
go
func (tsv *TabletServer) verifyTarget(ctx context.Context, target *querypb.Target) error { tsv.mu.Lock() defer tsv.mu.Unlock() if target != nil { // a valid target needs to be used switch { case target.Keyspace != tsv.target.Keyspace: return vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "invalid keyspace ...
[ "func", "(", "tsv", "*", "TabletServer", ")", "verifyTarget", "(", "ctx", "context", ".", "Context", ",", "target", "*", "querypb", ".", "Target", ")", "error", "{", "tsv", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "tsv", ".", "mu", ".", "Un...
// verifyTarget allows requests to be executed even in non-serving state.
[ "verifyTarget", "allows", "requests", "to", "be", "executed", "even", "in", "non", "-", "serving", "state", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L1490-L1513
134,969
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
validateSplitQueryParameters
func validateSplitQueryParameters( target *querypb.Target, query *querypb.BoundQuery, splitCount int64, numRowsPerQueryPart int64, algorithm querypb.SplitQueryRequest_Algorithm, ) error { // Check that the caller requested a RDONLY tablet. // Since we're called by VTGate this should not normally be violated. if...
go
func validateSplitQueryParameters( target *querypb.Target, query *querypb.BoundQuery, splitCount int64, numRowsPerQueryPart int64, algorithm querypb.SplitQueryRequest_Algorithm, ) error { // Check that the caller requested a RDONLY tablet. // Since we're called by VTGate this should not normally be violated. if...
[ "func", "validateSplitQueryParameters", "(", "target", "*", "querypb", ".", "Target", ",", "query", "*", "querypb", ".", "BoundQuery", ",", "splitCount", "int64", ",", "numRowsPerQueryPart", "int64", ",", "algorithm", "querypb", ".", "SplitQueryRequest_Algorithm", "...
// validateSplitQueryParameters perform some validations on the SplitQuery parameters // returns an error that can be returned to the user if a validation fails.
[ "validateSplitQueryParameters", "perform", "some", "validations", "on", "the", "SplitQuery", "parameters", "returns", "an", "error", "that", "can", "be", "returned", "to", "the", "user", "if", "a", "validation", "fails", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L1723-L1771
134,970
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
newSplitQuerySQLExecuter
func newSplitQuerySQLExecuter( ctx context.Context, logStats *tabletenv.LogStats, tsv *TabletServer, ) (*splitQuerySQLExecuter, error) { queryExecutor := &QueryExecutor{ ctx: ctx, logStats: logStats, tsv: tsv, } result := &splitQuerySQLExecuter{ queryExecutor: queryExecutor, } var err error res...
go
func newSplitQuerySQLExecuter( ctx context.Context, logStats *tabletenv.LogStats, tsv *TabletServer, ) (*splitQuerySQLExecuter, error) { queryExecutor := &QueryExecutor{ ctx: ctx, logStats: logStats, tsv: tsv, } result := &splitQuerySQLExecuter{ queryExecutor: queryExecutor, } var err error res...
[ "func", "newSplitQuerySQLExecuter", "(", "ctx", "context", ".", "Context", ",", "logStats", "*", "tabletenv", ".", "LogStats", ",", "tsv", "*", "TabletServer", ",", ")", "(", "*", "splitQuerySQLExecuter", ",", "error", ")", "{", "queryExecutor", ":=", "&", "...
// Constructs a new splitQuerySQLExecuter object. The 'done' method must be called on // the object after it's no longer used, to recycle the database connection.
[ "Constructs", "a", "new", "splitQuerySQLExecuter", "object", ".", "The", "done", "method", "must", "be", "called", "on", "the", "object", "after", "it", "s", "no", "longer", "used", "to", "recycle", "the", "database", "connection", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L1806-L1823
134,971
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
SQLExecute
func (se *splitQuerySQLExecuter) SQLExecute( sql string, bindVariables map[string]*querypb.BindVariable, ) (*sqltypes.Result, error) { // We need to parse the query since we're dealing with bind-vars. // TODO(erez): Add an SQLExecute() to SQLExecuterInterface that gets a parsed query so that // we don't have to par...
go
func (se *splitQuerySQLExecuter) SQLExecute( sql string, bindVariables map[string]*querypb.BindVariable, ) (*sqltypes.Result, error) { // We need to parse the query since we're dealing with bind-vars. // TODO(erez): Add an SQLExecute() to SQLExecuterInterface that gets a parsed query so that // we don't have to par...
[ "func", "(", "se", "*", "splitQuerySQLExecuter", ")", "SQLExecute", "(", "sql", "string", ",", "bindVariables", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable", ",", ")", "(", "*", "sqltypes", ".", "Result", ",", "error", ")", "{", "// We ...
// SQLExecute is part of the SQLExecuter interface.
[ "SQLExecute", "is", "part", "of", "the", "SQLExecuter", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L1830-L1850
134,972
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
StreamHealth
func (tsv *TabletServer) StreamHealth(ctx context.Context, callback func(*querypb.StreamHealthResponse) error) error { tsv.streamHealthMutex.Lock() shr := tsv.lastStreamHealthResponse shrExpiration := tsv.lastStreamHealthExpiration tsv.streamHealthMutex.Unlock() // Send current state immediately. if shr != nil &&...
go
func (tsv *TabletServer) StreamHealth(ctx context.Context, callback func(*querypb.StreamHealthResponse) error) error { tsv.streamHealthMutex.Lock() shr := tsv.lastStreamHealthResponse shrExpiration := tsv.lastStreamHealthExpiration tsv.streamHealthMutex.Unlock() // Send current state immediately. if shr != nil &&...
[ "func", "(", "tsv", "*", "TabletServer", ")", "StreamHealth", "(", "ctx", "context", ".", "Context", ",", "callback", "func", "(", "*", "querypb", ".", "StreamHealthResponse", ")", "error", ")", "error", "{", "tsv", ".", "streamHealthMutex", ".", "Lock", "...
// StreamHealth streams the health status to callback. // At the beginning, if TabletServer has a valid health // state, that response is immediately sent.
[ "StreamHealth", "streams", "the", "health", "status", "to", "callback", ".", "At", "the", "beginning", "if", "TabletServer", "has", "a", "valid", "health", "state", "that", "response", "is", "immediately", "sent", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L1870-L1902
134,973
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
BroadcastHealth
func (tsv *TabletServer) BroadcastHealth(terTimestamp int64, stats *querypb.RealtimeStats, maxCache time.Duration) { tsv.mu.Lock() target := tsv.target tsv.mu.Unlock() shr := &querypb.StreamHealthResponse{ Target: &target, TabletAlias: &tsv.alias, Serving: ...
go
func (tsv *TabletServer) BroadcastHealth(terTimestamp int64, stats *querypb.RealtimeStats, maxCache time.Duration) { tsv.mu.Lock() target := tsv.target tsv.mu.Unlock() shr := &querypb.StreamHealthResponse{ Target: &target, TabletAlias: &tsv.alias, Serving: ...
[ "func", "(", "tsv", "*", "TabletServer", ")", "BroadcastHealth", "(", "terTimestamp", "int64", ",", "stats", "*", "querypb", ".", "RealtimeStats", ",", "maxCache", "time", ".", "Duration", ")", "{", "tsv", ".", "mu", ".", "Lock", "(", ")", "\n", "target"...
// BroadcastHealth will broadcast the current health to all listeners
[ "BroadcastHealth", "will", "broadcast", "the", "current", "health", "to", "all", "listeners" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L1922-L1945
134,974
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
HeartbeatLag
func (tsv *TabletServer) HeartbeatLag() (time.Duration, error) { // If the reader is closed and we are not serving, then the // query service is shutdown and this value is not being updated. // We return healthy from this as a signal to the healtcheck to attempt // to start the query service again. If the query ser...
go
func (tsv *TabletServer) HeartbeatLag() (time.Duration, error) { // If the reader is closed and we are not serving, then the // query service is shutdown and this value is not being updated. // We return healthy from this as a signal to the healtcheck to attempt // to start the query service again. If the query ser...
[ "func", "(", "tsv", "*", "TabletServer", ")", "HeartbeatLag", "(", ")", "(", "time", ".", "Duration", ",", "error", ")", "{", "// If the reader is closed and we are not serving, then the", "// query service is shutdown and this value is not being updated.", "// We return health...
// HeartbeatLag returns the current lag as calculated by the heartbeat // package, if heartbeat is enabled. Otherwise returns 0.
[ "HeartbeatLag", "returns", "the", "current", "lag", "as", "calculated", "by", "the", "heartbeat", "package", "if", "heartbeat", "is", "enabled", ".", "Otherwise", "returns", "0", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L1949-L1959
134,975
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
UpdateStream
func (tsv *TabletServer) UpdateStream(ctx context.Context, target *querypb.Target, position string, timestamp int64, callback func(*querypb.StreamEvent) error) error { // Parse the position if needed. var p mysql.Position var err error if timestamp == 0 { if position != "" { p, err = mysql.DecodePosition(posit...
go
func (tsv *TabletServer) UpdateStream(ctx context.Context, target *querypb.Target, position string, timestamp int64, callback func(*querypb.StreamEvent) error) error { // Parse the position if needed. var p mysql.Position var err error if timestamp == 0 { if position != "" { p, err = mysql.DecodePosition(posit...
[ "func", "(", "tsv", "*", "TabletServer", ")", "UpdateStream", "(", "ctx", "context", ".", "Context", ",", "target", "*", "querypb", ".", "Target", ",", "position", "string", ",", "timestamp", "int64", ",", "callback", "func", "(", "*", "querypb", ".", "S...
// UpdateStream streams binlog events.
[ "UpdateStream", "streams", "binlog", "events", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L1967-L2005
134,976
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
HandlePanic
func (tsv *TabletServer) HandlePanic(err *error) { if x := recover(); x != nil { *err = fmt.Errorf("uncaught panic: %v\n. Stack-trace:\n%s", x, tb.Stack(4)) } }
go
func (tsv *TabletServer) HandlePanic(err *error) { if x := recover(); x != nil { *err = fmt.Errorf("uncaught panic: %v\n. Stack-trace:\n%s", x, tb.Stack(4)) } }
[ "func", "(", "tsv", "*", "TabletServer", ")", "HandlePanic", "(", "err", "*", "error", ")", "{", "if", "x", ":=", "recover", "(", ")", ";", "x", "!=", "nil", "{", "*", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\\n", "\\n", "\"", ",", "x", ...
// HandlePanic is part of the queryservice.QueryService interface
[ "HandlePanic", "is", "part", "of", "the", "queryservice", ".", "QueryService", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L2008-L2012
134,977
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
SetPoolSize
func (tsv *TabletServer) SetPoolSize(val int) { tsv.qe.conns.SetCapacity(val) }
go
func (tsv *TabletServer) SetPoolSize(val int) { tsv.qe.conns.SetCapacity(val) }
[ "func", "(", "tsv", "*", "TabletServer", ")", "SetPoolSize", "(", "val", "int", ")", "{", "tsv", ".", "qe", ".", "conns", ".", "SetCapacity", "(", "val", ")", "\n", "}" ]
// SetPoolSize changes the pool size to the specified value. // This function should only be used for testing.
[ "SetPoolSize", "changes", "the", "pool", "size", "to", "the", "specified", "value", ".", "This", "function", "should", "only", "be", "used", "for", "testing", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L2113-L2115
134,978
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
SetStreamPoolSize
func (tsv *TabletServer) SetStreamPoolSize(val int) { tsv.qe.streamConns.SetCapacity(val) }
go
func (tsv *TabletServer) SetStreamPoolSize(val int) { tsv.qe.streamConns.SetCapacity(val) }
[ "func", "(", "tsv", "*", "TabletServer", ")", "SetStreamPoolSize", "(", "val", "int", ")", "{", "tsv", ".", "qe", ".", "streamConns", ".", "SetCapacity", "(", "val", ")", "\n", "}" ]
// SetStreamPoolSize changes the pool size to the specified value. // This function should only be used for testing.
[ "SetStreamPoolSize", "changes", "the", "pool", "size", "to", "the", "specified", "value", ".", "This", "function", "should", "only", "be", "used", "for", "testing", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L2124-L2126
134,979
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
SetTxPoolSize
func (tsv *TabletServer) SetTxPoolSize(val int) { tsv.te.txPool.conns.SetCapacity(val) }
go
func (tsv *TabletServer) SetTxPoolSize(val int) { tsv.te.txPool.conns.SetCapacity(val) }
[ "func", "(", "tsv", "*", "TabletServer", ")", "SetTxPoolSize", "(", "val", "int", ")", "{", "tsv", ".", "te", ".", "txPool", ".", "conns", ".", "SetCapacity", "(", "val", ")", "\n", "}" ]
// SetTxPoolSize changes the tx pool size to the specified value. // This function should only be used for testing.
[ "SetTxPoolSize", "changes", "the", "tx", "pool", "size", "to", "the", "specified", "value", ".", "This", "function", "should", "only", "be", "used", "for", "testing", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L2135-L2137
134,980
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
TxPoolSize
func (tsv *TabletServer) TxPoolSize() int { return int(tsv.te.txPool.conns.Capacity()) }
go
func (tsv *TabletServer) TxPoolSize() int { return int(tsv.te.txPool.conns.Capacity()) }
[ "func", "(", "tsv", "*", "TabletServer", ")", "TxPoolSize", "(", ")", "int", "{", "return", "int", "(", "tsv", ".", "te", ".", "txPool", ".", "conns", ".", "Capacity", "(", ")", ")", "\n", "}" ]
// TxPoolSize returns the tx pool size.
[ "TxPoolSize", "returns", "the", "tx", "pool", "size", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L2140-L2142
134,981
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
SetTxTimeout
func (tsv *TabletServer) SetTxTimeout(val time.Duration) { tsv.te.txPool.SetTimeout(val) }
go
func (tsv *TabletServer) SetTxTimeout(val time.Duration) { tsv.te.txPool.SetTimeout(val) }
[ "func", "(", "tsv", "*", "TabletServer", ")", "SetTxTimeout", "(", "val", "time", ".", "Duration", ")", "{", "tsv", ".", "te", ".", "txPool", ".", "SetTimeout", "(", "val", ")", "\n", "}" ]
// SetTxTimeout changes the transaction timeout to the specified value. // This function should only be used for testing.
[ "SetTxTimeout", "changes", "the", "transaction", "timeout", "to", "the", "specified", "value", ".", "This", "function", "should", "only", "be", "used", "for", "testing", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L2146-L2148
134,982
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
SetAutoCommit
func (tsv *TabletServer) SetAutoCommit(auto bool) { tsv.qe.autoCommit.Set(auto) }
go
func (tsv *TabletServer) SetAutoCommit(auto bool) { tsv.qe.autoCommit.Set(auto) }
[ "func", "(", "tsv", "*", "TabletServer", ")", "SetAutoCommit", "(", "auto", "bool", ")", "{", "tsv", ".", "qe", ".", "autoCommit", ".", "Set", "(", "auto", ")", "\n", "}" ]
// SetAutoCommit sets autocommit on or off. // This function should only be used for testing.
[ "SetAutoCommit", "sets", "autocommit", "on", "or", "off", ".", "This", "function", "should", "only", "be", "used", "for", "testing", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L2168-L2170
134,983
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
SetMaxResultSize
func (tsv *TabletServer) SetMaxResultSize(val int) { tsv.qe.maxResultSize.Set(int64(val)) }
go
func (tsv *TabletServer) SetMaxResultSize(val int) { tsv.qe.maxResultSize.Set(int64(val)) }
[ "func", "(", "tsv", "*", "TabletServer", ")", "SetMaxResultSize", "(", "val", "int", ")", "{", "tsv", ".", "qe", ".", "maxResultSize", ".", "Set", "(", "int64", "(", "val", ")", ")", "\n", "}" ]
// SetMaxResultSize changes the max result size to the specified value. // This function should only be used for testing.
[ "SetMaxResultSize", "changes", "the", "max", "result", "size", "to", "the", "specified", "value", ".", "This", "function", "should", "only", "be", "used", "for", "testing", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L2174-L2176
134,984
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
SetWarnResultSize
func (tsv *TabletServer) SetWarnResultSize(val int) { tsv.qe.warnResultSize.Set(int64(val)) }
go
func (tsv *TabletServer) SetWarnResultSize(val int) { tsv.qe.warnResultSize.Set(int64(val)) }
[ "func", "(", "tsv", "*", "TabletServer", ")", "SetWarnResultSize", "(", "val", "int", ")", "{", "tsv", ".", "qe", ".", "warnResultSize", ".", "Set", "(", "int64", "(", "val", ")", ")", "\n", "}" ]
// SetWarnResultSize changes the warn result size to the specified value. // This function should only be used for testing.
[ "SetWarnResultSize", "changes", "the", "warn", "result", "size", "to", "the", "specified", "value", ".", "This", "function", "should", "only", "be", "used", "for", "testing", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L2185-L2187
134,985
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
SetMaxDMLRows
func (tsv *TabletServer) SetMaxDMLRows(val int) { tsv.qe.maxDMLRows.Set(int64(val)) }
go
func (tsv *TabletServer) SetMaxDMLRows(val int) { tsv.qe.maxDMLRows.Set(int64(val)) }
[ "func", "(", "tsv", "*", "TabletServer", ")", "SetMaxDMLRows", "(", "val", "int", ")", "{", "tsv", ".", "qe", ".", "maxDMLRows", ".", "Set", "(", "int64", "(", "val", ")", ")", "\n", "}" ]
// SetMaxDMLRows changes the max result size to the specified value. // This function should only be used for testing.
[ "SetMaxDMLRows", "changes", "the", "max", "result", "size", "to", "the", "specified", "value", ".", "This", "function", "should", "only", "be", "used", "for", "testing", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L2196-L2198
134,986
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
SetPassthroughDMLs
func (tsv *TabletServer) SetPassthroughDMLs(val bool) { planbuilder.PassthroughDMLs = true tsv.qe.passthroughDMLs.Set(val) }
go
func (tsv *TabletServer) SetPassthroughDMLs(val bool) { planbuilder.PassthroughDMLs = true tsv.qe.passthroughDMLs.Set(val) }
[ "func", "(", "tsv", "*", "TabletServer", ")", "SetPassthroughDMLs", "(", "val", "bool", ")", "{", "planbuilder", ".", "PassthroughDMLs", "=", "true", "\n", "tsv", ".", "qe", ".", "passthroughDMLs", ".", "Set", "(", "val", ")", "\n", "}" ]
// SetPassthroughDMLs changes the setting to pass through all DMLs // It should only be used for testing
[ "SetPassthroughDMLs", "changes", "the", "setting", "to", "pass", "through", "all", "DMLs", "It", "should", "only", "be", "used", "for", "testing" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L2207-L2210
134,987
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
SetQueryPoolTimeout
func (tsv *TabletServer) SetQueryPoolTimeout(val time.Duration) { tsv.qe.connTimeout.Set(val) }
go
func (tsv *TabletServer) SetQueryPoolTimeout(val time.Duration) { tsv.qe.connTimeout.Set(val) }
[ "func", "(", "tsv", "*", "TabletServer", ")", "SetQueryPoolTimeout", "(", "val", "time", ".", "Duration", ")", "{", "tsv", ".", "qe", ".", "connTimeout", ".", "Set", "(", "val", ")", "\n", "}" ]
// SetQueryPoolTimeout changes the timeout to get a connection from the // query pool // This function should only be used for testing.
[ "SetQueryPoolTimeout", "changes", "the", "timeout", "to", "get", "a", "connection", "from", "the", "query", "pool", "This", "function", "should", "only", "be", "used", "for", "testing", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L2221-L2223
134,988
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
SetQueryPoolWaiterCap
func (tsv *TabletServer) SetQueryPoolWaiterCap(val int64) { tsv.qe.queryPoolWaiterCap.Set(val) }
go
func (tsv *TabletServer) SetQueryPoolWaiterCap(val int64) { tsv.qe.queryPoolWaiterCap.Set(val) }
[ "func", "(", "tsv", "*", "TabletServer", ")", "SetQueryPoolWaiterCap", "(", "val", "int64", ")", "{", "tsv", ".", "qe", ".", "queryPoolWaiterCap", ".", "Set", "(", "val", ")", "\n", "}" ]
// SetQueryPoolWaiterCap changes the limit on the number of queries that can be // waiting for a connection from the pool // This function should only be used for testing.
[ "SetQueryPoolWaiterCap", "changes", "the", "limit", "on", "the", "number", "of", "queries", "that", "can", "be", "waiting", "for", "a", "connection", "from", "the", "pool", "This", "function", "should", "only", "be", "used", "for", "testing", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L2235-L2237
134,989
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
SetTxPoolWaiterCap
func (tsv *TabletServer) SetTxPoolWaiterCap(val int64) { tsv.te.txPool.waiterCap.Set(val) }
go
func (tsv *TabletServer) SetTxPoolWaiterCap(val int64) { tsv.te.txPool.waiterCap.Set(val) }
[ "func", "(", "tsv", "*", "TabletServer", ")", "SetTxPoolWaiterCap", "(", "val", "int64", ")", "{", "tsv", ".", "te", ".", "txPool", ".", "waiterCap", ".", "Set", "(", "val", ")", "\n", "}" ]
// SetTxPoolWaiterCap changes the limit on the number of queries that can be // waiting for a connection from the pool // This function should only be used for testing.
[ "SetTxPoolWaiterCap", "changes", "the", "limit", "on", "the", "number", "of", "queries", "that", "can", "be", "waiting", "for", "a", "connection", "from", "the", "pool", "This", "function", "should", "only", "be", "used", "for", "testing", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L2249-L2251
134,990
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
queryAsString
func queryAsString(sql string, bindVariables map[string]*querypb.BindVariable) string { buf := &bytes.Buffer{} fmt.Fprintf(buf, "Sql: %q", sql) fmt.Fprintf(buf, ", BindVars: {") var keys []string for key := range bindVariables { keys = append(keys, key) } sort.Strings(keys) var valString string for _, key :=...
go
func queryAsString(sql string, bindVariables map[string]*querypb.BindVariable) string { buf := &bytes.Buffer{} fmt.Fprintf(buf, "Sql: %q", sql) fmt.Fprintf(buf, ", BindVars: {") var keys []string for key := range bindVariables { keys = append(keys, key) } sort.Strings(keys) var valString string for _, key :=...
[ "func", "queryAsString", "(", "sql", "string", ",", "bindVariables", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable", ")", "string", "{", "buf", ":=", "&", "bytes", ".", "Buffer", "{", "}", "\n", "fmt", ".", "Fprintf", "(", "buf", ",", ...
// queryAsString returns a readable version of query+bind variables.
[ "queryAsString", "returns", "a", "readable", "version", "of", "query", "+", "bind", "variables", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L2268-L2284
134,991
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
withTimeout
func withTimeout(ctx context.Context, timeout time.Duration, options *querypb.ExecuteOptions) (context.Context, context.CancelFunc) { if timeout == 0 || options.GetWorkload() == querypb.ExecuteOptions_DBA || tabletenv.IsLocalContext(ctx) { return ctx, func() {} } return context.WithTimeout(ctx, timeout) }
go
func withTimeout(ctx context.Context, timeout time.Duration, options *querypb.ExecuteOptions) (context.Context, context.CancelFunc) { if timeout == 0 || options.GetWorkload() == querypb.ExecuteOptions_DBA || tabletenv.IsLocalContext(ctx) { return ctx, func() {} } return context.WithTimeout(ctx, timeout) }
[ "func", "withTimeout", "(", "ctx", "context", ".", "Context", ",", "timeout", "time", ".", "Duration", ",", "options", "*", "querypb", ".", "ExecuteOptions", ")", "(", "context", ".", "Context", ",", "context", ".", "CancelFunc", ")", "{", "if", "timeout",...
// withTimeout returns a context based on the specified timeout. // If the context is local or if timeout is 0, the // original context is returned as is.
[ "withTimeout", "returns", "a", "context", "based", "on", "the", "specified", "timeout", ".", "If", "the", "context", "is", "local", "or", "if", "timeout", "is", "0", "the", "original", "context", "is", "returned", "as", "is", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L2289-L2294
134,992
vitessio/vitess
go/vt/vttablet/tabletserver/tabletserver.go
skipQueryPlanCache
func skipQueryPlanCache(options *querypb.ExecuteOptions) bool { if options == nil { return false } return options.SkipQueryPlanCache }
go
func skipQueryPlanCache(options *querypb.ExecuteOptions) bool { if options == nil { return false } return options.SkipQueryPlanCache }
[ "func", "skipQueryPlanCache", "(", "options", "*", "querypb", ".", "ExecuteOptions", ")", "bool", "{", "if", "options", "==", "nil", "{", "return", "false", "\n", "}", "\n", "return", "options", ".", "SkipQueryPlanCache", "\n", "}" ]
// skipQueryPlanCache returns true if the query plan should be cached
[ "skipQueryPlanCache", "returns", "true", "if", "the", "query", "plan", "should", "be", "cached" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletserver.go#L2297-L2302
134,993
vitessio/vitess
go/vt/mysqlctl/cephbackupstorage/ceph.go
AbortBackup
func (bh *CephBackupHandle) AbortBackup(ctx context.Context) error { if bh.readOnly { return fmt.Errorf("AbortBackup cannot be called on read-only backup") } return bh.bs.RemoveBackup(ctx, bh.dir, bh.name) }
go
func (bh *CephBackupHandle) AbortBackup(ctx context.Context) error { if bh.readOnly { return fmt.Errorf("AbortBackup cannot be called on read-only backup") } return bh.bs.RemoveBackup(ctx, bh.dir, bh.name) }
[ "func", "(", "bh", "*", "CephBackupHandle", ")", "AbortBackup", "(", "ctx", "context", ".", "Context", ")", "error", "{", "if", "bh", ".", "readOnly", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "bh", ".", ...
// AbortBackup implements BackupHandle.
[ "AbortBackup", "implements", "BackupHandle", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/cephbackupstorage/ceph.go#L114-L119
134,994
vitessio/vitess
go/vt/mysqlctl/cephbackupstorage/ceph.go
client
func (bs *CephBackupStorage) client() (*minio.Client, error) { bs.mu.Lock() defer bs.mu.Unlock() if bs._client == nil { configFile, err := os.Open(*configFilePath) if err != nil { return nil, fmt.Errorf("file not present : %v", err) } defer configFile.Close() jsonParser := json.NewDecoder(configFile) ...
go
func (bs *CephBackupStorage) client() (*minio.Client, error) { bs.mu.Lock() defer bs.mu.Unlock() if bs._client == nil { configFile, err := os.Open(*configFilePath) if err != nil { return nil, fmt.Errorf("file not present : %v", err) } defer configFile.Close() jsonParser := json.NewDecoder(configFile) ...
[ "func", "(", "bs", "*", "CephBackupStorage", ")", "client", "(", ")", "(", "*", "minio", ".", "Client", ",", "error", ")", "{", "bs", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "bs", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "if", "bs",...
// client returns the Ceph Storage client instance. // If there isn't one yet, it tries to create one.
[ "client", "returns", "the", "Ceph", "Storage", "client", "instance", ".", "If", "there", "isn", "t", "one", "yet", "it", "tries", "to", "create", "one", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/cephbackupstorage/ceph.go#L259-L286
134,995
vitessio/vitess
go/vt/mysqlctl/cephbackupstorage/ceph.go
alterBucketName
func alterBucketName(dir string) string { bucket := strings.ToLower(dir) bucket = strings.Split(bucket, "/")[0] bucket = strings.Replace(bucket, "_", "-", -1) return bucket }
go
func alterBucketName(dir string) string { bucket := strings.ToLower(dir) bucket = strings.Split(bucket, "/")[0] bucket = strings.Replace(bucket, "_", "-", -1) return bucket }
[ "func", "alterBucketName", "(", "dir", "string", ")", "string", "{", "bucket", ":=", "strings", ".", "ToLower", "(", "dir", ")", "\n", "bucket", "=", "strings", ".", "Split", "(", "bucket", ",", "\"", "\"", ")", "[", "0", "]", "\n", "bucket", "=", ...
// keeping in view the bucket naming conventions for ceph // only keyspace informations is extracted and used for bucket name
[ "keeping", "in", "view", "the", "bucket", "naming", "conventions", "for", "ceph", "only", "keyspace", "informations", "is", "extracted", "and", "used", "for", "bucket", "name" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/cephbackupstorage/ceph.go#L301-L306
134,996
vitessio/vitess
go/vt/binlog/keyspace_id_resolver.go
newKeyspaceIDResolverFactory
func newKeyspaceIDResolverFactory(ctx context.Context, ts *topo.Server, keyspace string, cell string) (keyspaceIDResolverFactory, error) { if *useV3ReshardingMode { return newKeyspaceIDResolverFactoryV3(ctx, ts, keyspace, cell) } return newKeyspaceIDResolverFactoryV2(ctx, ts, keyspace) }
go
func newKeyspaceIDResolverFactory(ctx context.Context, ts *topo.Server, keyspace string, cell string) (keyspaceIDResolverFactory, error) { if *useV3ReshardingMode { return newKeyspaceIDResolverFactoryV3(ctx, ts, keyspace, cell) } return newKeyspaceIDResolverFactoryV2(ctx, ts, keyspace) }
[ "func", "newKeyspaceIDResolverFactory", "(", "ctx", "context", ".", "Context", ",", "ts", "*", "topo", ".", "Server", ",", "keyspace", "string", ",", "cell", "string", ")", "(", "keyspaceIDResolverFactory", ",", "error", ")", "{", "if", "*", "useV3ReshardingMo...
// newKeyspaceIDResolverFactory creates a new // keyspaceIDResolverFactory for the provided keyspace and cell.
[ "newKeyspaceIDResolverFactory", "creates", "a", "new", "keyspaceIDResolverFactory", "for", "the", "provided", "keyspace", "and", "cell", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/binlog/keyspace_id_resolver.go#L54-L60
134,997
vitessio/vitess
go/vt/binlog/keyspace_id_resolver.go
newKeyspaceIDResolverFactoryV3
func newKeyspaceIDResolverFactoryV3(ctx context.Context, ts *topo.Server, keyspace string, cell string) (keyspaceIDResolverFactory, error) { srvVSchema, err := ts.GetSrvVSchema(ctx, cell) if err != nil { return nil, err } kschema, ok := srvVSchema.Keyspaces[keyspace] if !ok { return nil, fmt.Errorf("SrvVSchema...
go
func newKeyspaceIDResolverFactoryV3(ctx context.Context, ts *topo.Server, keyspace string, cell string) (keyspaceIDResolverFactory, error) { srvVSchema, err := ts.GetSrvVSchema(ctx, cell) if err != nil { return nil, err } kschema, ok := srvVSchema.Keyspaces[keyspace] if !ok { return nil, fmt.Errorf("SrvVSchema...
[ "func", "newKeyspaceIDResolverFactoryV3", "(", "ctx", "context", ".", "Context", ",", "ts", "*", "topo", ".", "Server", ",", "keyspace", "string", ",", "cell", "string", ")", "(", "keyspaceIDResolverFactory", ",", "error", ")", "{", "srvVSchema", ",", "err", ...
// newKeyspaceIDResolverFactoryV3 finds the SrvVSchema in the cell, // gets the keyspace part, and uses it to find the column name.
[ "newKeyspaceIDResolverFactoryV3", "finds", "the", "SrvVSchema", "in", "the", "cell", "gets", "the", "keyspace", "part", "and", "uses", "it", "to", "find", "the", "column", "name", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/binlog/keyspace_id_resolver.go#L117-L157
134,998
vitessio/vitess
go/pools/resource_pool.go
closeIdleResources
func (rp *ResourcePool) closeIdleResources() { available := int(rp.Available()) idleTimeout := rp.IdleTimeout() for i := 0; i < available; i++ { var wrapper resourceWrapper select { case wrapper = <-rp.resources: default: // stop early if we don't get anything new from the pool return } if wrappe...
go
func (rp *ResourcePool) closeIdleResources() { available := int(rp.Available()) idleTimeout := rp.IdleTimeout() for i := 0; i < available; i++ { var wrapper resourceWrapper select { case wrapper = <-rp.resources: default: // stop early if we don't get anything new from the pool return } if wrappe...
[ "func", "(", "rp", "*", "ResourcePool", ")", "closeIdleResources", "(", ")", "{", "available", ":=", "int", "(", "rp", ".", "Available", "(", ")", ")", "\n", "idleTimeout", ":=", "rp", ".", "IdleTimeout", "(", ")", "\n\n", "for", "i", ":=", "0", ";",...
// closeIdleResources scans the pool for idle resources
[ "closeIdleResources", "scans", "the", "pool", "for", "idle", "resources" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/pools/resource_pool.go#L121-L143
134,999
vitessio/vitess
go/pools/resource_pool.go
Get
func (rp *ResourcePool) Get(ctx context.Context) (resource Resource, err error) { span, ctx := trace.NewSpan(ctx, "ResourcePool.Get") span.Annotate("capacity", rp.capacity.Get()) span.Annotate("in_use", rp.inUse.Get()) span.Annotate("available", rp.available.Get()) span.Annotate("active", rp.active.Get()) defer s...
go
func (rp *ResourcePool) Get(ctx context.Context) (resource Resource, err error) { span, ctx := trace.NewSpan(ctx, "ResourcePool.Get") span.Annotate("capacity", rp.capacity.Get()) span.Annotate("in_use", rp.inUse.Get()) span.Annotate("available", rp.available.Get()) span.Annotate("active", rp.active.Get()) defer s...
[ "func", "(", "rp", "*", "ResourcePool", ")", "Get", "(", "ctx", "context", ".", "Context", ")", "(", "resource", "Resource", ",", "err", "error", ")", "{", "span", ",", "ctx", ":=", "trace", ".", "NewSpan", "(", "ctx", ",", "\"", "\"", ")", "\n", ...
// Get will return the next available resource. If capacity // has not been reached, it will create a new one using the factory. Otherwise, // it will wait till the next resource becomes available or a timeout. // A timeout of 0 is an indefinite wait.
[ "Get", "will", "return", "the", "next", "available", "resource", ".", "If", "capacity", "has", "not", "been", "reached", "it", "will", "create", "a", "new", "one", "using", "the", "factory", ".", "Otherwise", "it", "will", "wait", "till", "the", "next", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/pools/resource_pool.go#L149-L157