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
partition
stringclasses
1 value
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
vitessio/vitess
go/pools/resource_pool.go
SetIdleTimeout
func (rp *ResourcePool) SetIdleTimeout(idleTimeout time.Duration) { if rp.idleTimer == nil { panic("SetIdleTimeout called when timer not initialized") } rp.idleTimeout.Set(idleTimeout) rp.idleTimer.SetInterval(idleTimeout / 10) }
go
func (rp *ResourcePool) SetIdleTimeout(idleTimeout time.Duration) { if rp.idleTimer == nil { panic("SetIdleTimeout called when timer not initialized") } rp.idleTimeout.Set(idleTimeout) rp.idleTimer.SetInterval(idleTimeout / 10) }
[ "func", "(", "rp", "*", "ResourcePool", ")", "SetIdleTimeout", "(", "idleTimeout", "time", ".", "Duration", ")", "{", "if", "rp", ".", "idleTimer", "==", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "rp", ".", "idleTimeout", ".", "Se...
// SetIdleTimeout sets the idle timeout. It can only be used if there was an // idle timeout set when the pool was created.
[ "SetIdleTimeout", "sets", "the", "idle", "timeout", ".", "It", "can", "only", "be", "used", "if", "there", "was", "an", "idle", "timeout", "set", "when", "the", "pool", "was", "created", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/pools/resource_pool.go#L279-L286
train
vitessio/vitess
go/pools/resource_pool.go
StatsJSON
func (rp *ResourcePool) StatsJSON() string { return fmt.Sprintf(`{"Capacity": %v, "Available": %v, "Active": %v, "InUse": %v, "MaxCapacity": %v, "WaitCount": %v, "WaitTime": %v, "IdleTimeout": %v, "IdleClosed": %v}`, rp.Capacity(), rp.Available(), rp.Active(), rp.InUse(), rp.MaxCap(), rp.WaitCount(), rp....
go
func (rp *ResourcePool) StatsJSON() string { return fmt.Sprintf(`{"Capacity": %v, "Available": %v, "Active": %v, "InUse": %v, "MaxCapacity": %v, "WaitCount": %v, "WaitTime": %v, "IdleTimeout": %v, "IdleClosed": %v}`, rp.Capacity(), rp.Available(), rp.Active(), rp.InUse(), rp.MaxCap(), rp.WaitCount(), rp....
[ "func", "(", "rp", "*", "ResourcePool", ")", "StatsJSON", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "`{\"Capacity\": %v, \"Available\": %v, \"Active\": %v, \"InUse\": %v, \"MaxCapacity\": %v, \"WaitCount\": %v, \"WaitTime\": %v, \"IdleTimeout\": %v, \"IdleClosed\...
// StatsJSON returns the stats in JSON format.
[ "StatsJSON", "returns", "the", "stats", "in", "JSON", "format", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/pools/resource_pool.go#L289-L301
train
vitessio/vitess
go/vt/topo/cells_aliases.go
GetCellsAliases
func (ts *Server) GetCellsAliases(ctx context.Context, strongRead bool) (ret map[string]*topodatapb.CellsAlias, err error) { conn := ts.globalCell if !strongRead { conn = ts.globalReadOnlyCell } entries, err := ts.globalCell.ListDir(ctx, CellsAliasesPath, false /*full*/) switch { case IsErrType(err, NoNode): ...
go
func (ts *Server) GetCellsAliases(ctx context.Context, strongRead bool) (ret map[string]*topodatapb.CellsAlias, err error) { conn := ts.globalCell if !strongRead { conn = ts.globalReadOnlyCell } entries, err := ts.globalCell.ListDir(ctx, CellsAliasesPath, false /*full*/) switch { case IsErrType(err, NoNode): ...
[ "func", "(", "ts", "*", "Server", ")", "GetCellsAliases", "(", "ctx", "context", ".", "Context", ",", "strongRead", "bool", ")", "(", "ret", "map", "[", "string", "]", "*", "topodatapb", ".", "CellsAlias", ",", "err", "error", ")", "{", "conn", ":=", ...
// GetCellsAliases returns the names of the existing cells. They are // sorted by name.
[ "GetCellsAliases", "returns", "the", "names", "of", "the", "existing", "cells", ".", "They", "are", "sorted", "by", "name", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/cells_aliases.go#L43-L75
train
vitessio/vitess
go/vt/topo/cells_aliases.go
DeleteCellsAlias
func (ts *Server) DeleteCellsAlias(ctx context.Context, alias string) error { ts.clearCellAliasesCache() filePath := pathForCellsAlias(alias) return ts.globalCell.Delete(ctx, filePath, nil) }
go
func (ts *Server) DeleteCellsAlias(ctx context.Context, alias string) error { ts.clearCellAliasesCache() filePath := pathForCellsAlias(alias) return ts.globalCell.Delete(ctx, filePath, nil) }
[ "func", "(", "ts", "*", "Server", ")", "DeleteCellsAlias", "(", "ctx", "context", ".", "Context", ",", "alias", "string", ")", "error", "{", "ts", ".", "clearCellAliasesCache", "(", ")", "\n\n", "filePath", ":=", "pathForCellsAlias", "(", "alias", ")", "\n...
// DeleteCellsAlias deletes the specified CellsAlias
[ "DeleteCellsAlias", "deletes", "the", "specified", "CellsAlias" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/cells_aliases.go#L78-L83
train
vitessio/vitess
go/vt/topo/cells_aliases.go
CreateCellsAlias
func (ts *Server) CreateCellsAlias(ctx context.Context, alias string, cellsAlias *topodatapb.CellsAlias) error { currentAliases, err := ts.GetCellsAliases(ctx, true) if err != nil { return err } if overlappingAliases(currentAliases, cellsAlias) { return fmt.Errorf("unsupported: you can't over overlapping alias...
go
func (ts *Server) CreateCellsAlias(ctx context.Context, alias string, cellsAlias *topodatapb.CellsAlias) error { currentAliases, err := ts.GetCellsAliases(ctx, true) if err != nil { return err } if overlappingAliases(currentAliases, cellsAlias) { return fmt.Errorf("unsupported: you can't over overlapping alias...
[ "func", "(", "ts", "*", "Server", ")", "CreateCellsAlias", "(", "ctx", "context", ".", "Context", ",", "alias", "string", ",", "cellsAlias", "*", "topodatapb", ".", "CellsAlias", ")", "error", "{", "currentAliases", ",", "err", ":=", "ts", ".", "GetCellsAl...
// CreateCellsAlias creates a new CellInfo with the provided content.
[ "CreateCellsAlias", "creates", "a", "new", "CellInfo", "with", "the", "provided", "content", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/cells_aliases.go#L86-L109
train
vitessio/vitess
go/vt/topo/cells_aliases.go
UpdateCellsAlias
func (ts *Server) UpdateCellsAlias(ctx context.Context, alias string, update func(*topodatapb.CellsAlias) error) error { ts.clearCellAliasesCache() filePath := pathForCellsAlias(alias) for { ca := &topodatapb.CellsAlias{} // Read the file, unpack the contents. contents, version, err := ts.globalCell.Get(ctx,...
go
func (ts *Server) UpdateCellsAlias(ctx context.Context, alias string, update func(*topodatapb.CellsAlias) error) error { ts.clearCellAliasesCache() filePath := pathForCellsAlias(alias) for { ca := &topodatapb.CellsAlias{} // Read the file, unpack the contents. contents, version, err := ts.globalCell.Get(ctx,...
[ "func", "(", "ts", "*", "Server", ")", "UpdateCellsAlias", "(", "ctx", "context", ".", "Context", ",", "alias", "string", ",", "update", "func", "(", "*", "topodatapb", ".", "CellsAlias", ")", "error", ")", "error", "{", "ts", ".", "clearCellAliasesCache",...
// UpdateCellsAlias updates cells for a given alias
[ "UpdateCellsAlias", "updates", "cells", "for", "a", "given", "alias" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/cells_aliases.go#L112-L160
train
vitessio/vitess
go/vt/mysqlctl/permissions.go
GetPermissions
func GetPermissions(mysqld MysqlDaemon) (*tabletmanagerdatapb.Permissions, error) { ctx := context.TODO() permissions := &tabletmanagerdatapb.Permissions{} // get Users qr, err := mysqld.FetchSuperQuery(ctx, "SELECT * FROM mysql.user ORDER BY host, user") if err != nil { return nil, err } for _, row := range ...
go
func GetPermissions(mysqld MysqlDaemon) (*tabletmanagerdatapb.Permissions, error) { ctx := context.TODO() permissions := &tabletmanagerdatapb.Permissions{} // get Users qr, err := mysqld.FetchSuperQuery(ctx, "SELECT * FROM mysql.user ORDER BY host, user") if err != nil { return nil, err } for _, row := range ...
[ "func", "GetPermissions", "(", "mysqld", "MysqlDaemon", ")", "(", "*", "tabletmanagerdatapb", ".", "Permissions", ",", "error", ")", "{", "ctx", ":=", "context", ".", "TODO", "(", ")", "\n", "permissions", ":=", "&", "tabletmanagerdatapb", ".", "Permissions", ...
// GetPermissions lists the permissions on the mysqld. // The rows are sorted in primary key order to help with comparing // permissions between tablets.
[ "GetPermissions", "lists", "the", "permissions", "on", "the", "mysqld", ".", "The", "rows", "are", "sorted", "in", "primary", "key", "order", "to", "help", "with", "comparing", "permissions", "between", "tablets", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/permissions.go#L28-L51
train
vitessio/vitess
go/json2/marshal.go
MarshalPB
func MarshalPB(pb proto.Message) ([]byte, error) { buf := new(bytes.Buffer) m := jsonpb.Marshaler{} if err := m.Marshal(buf, pb); err != nil { return nil, err } return buf.Bytes(), nil }
go
func MarshalPB(pb proto.Message) ([]byte, error) { buf := new(bytes.Buffer) m := jsonpb.Marshaler{} if err := m.Marshal(buf, pb); err != nil { return nil, err } return buf.Bytes(), nil }
[ "func", "MarshalPB", "(", "pb", "proto", ".", "Message", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "buf", ":=", "new", "(", "bytes", ".", "Buffer", ")", "\n", "m", ":=", "jsonpb", ".", "Marshaler", "{", "}", "\n", "if", "err", ":=", "...
// MarshalPB marshals a proto.
[ "MarshalPB", "marshals", "a", "proto", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/json2/marshal.go#L27-L34
train
vitessio/vitess
go/json2/marshal.go
MarshalIndentPB
func MarshalIndentPB(pb proto.Message, indent string) ([]byte, error) { buf := new(bytes.Buffer) m := jsonpb.Marshaler{ Indent: indent, } if err := m.Marshal(buf, pb); err != nil { return nil, err } return buf.Bytes(), nil }
go
func MarshalIndentPB(pb proto.Message, indent string) ([]byte, error) { buf := new(bytes.Buffer) m := jsonpb.Marshaler{ Indent: indent, } if err := m.Marshal(buf, pb); err != nil { return nil, err } return buf.Bytes(), nil }
[ "func", "MarshalIndentPB", "(", "pb", "proto", ".", "Message", ",", "indent", "string", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "buf", ":=", "new", "(", "bytes", ".", "Buffer", ")", "\n", "m", ":=", "jsonpb", ".", "Marshaler", "{", "Ind...
// MarshalIndentPB MarshalIndents a proto.
[ "MarshalIndentPB", "MarshalIndents", "a", "proto", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/json2/marshal.go#L37-L46
train
vitessio/vitess
go/stats/prometheusbackend/prometheusbackend.go
Init
func Init(namespace string) { http.Handle("/metrics", promhttp.Handler()) be.namespace = namespace stats.Register(be.publishPrometheusMetric) }
go
func Init(namespace string) { http.Handle("/metrics", promhttp.Handler()) be.namespace = namespace stats.Register(be.publishPrometheusMetric) }
[ "func", "Init", "(", "namespace", "string", ")", "{", "http", ".", "Handle", "(", "\"", "\"", ",", "promhttp", ".", "Handler", "(", ")", ")", "\n", "be", ".", "namespace", "=", "namespace", "\n", "stats", ".", "Register", "(", "be", ".", "publishProm...
// Init initializes the Prometheus be with the given namespace.
[ "Init", "initializes", "the", "Prometheus", "be", "with", "the", "given", "namespace", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/prometheusbackend/prometheusbackend.go#L24-L28
train
vitessio/vitess
go/stats/prometheusbackend/prometheusbackend.go
buildPromName
func (be PromBackend) buildPromName(name string) string { s := strings.TrimPrefix(normalizeMetric(name), be.namespace+"_") return prometheus.BuildFQName("", be.namespace, s) }
go
func (be PromBackend) buildPromName(name string) string { s := strings.TrimPrefix(normalizeMetric(name), be.namespace+"_") return prometheus.BuildFQName("", be.namespace, s) }
[ "func", "(", "be", "PromBackend", ")", "buildPromName", "(", "name", "string", ")", "string", "{", "s", ":=", "strings", ".", "TrimPrefix", "(", "normalizeMetric", "(", "name", ")", ",", "be", ".", "namespace", "+", "\"", "\"", ")", "\n", "return", "pr...
// buildPromName specifies the namespace as a prefix to the metric name
[ "buildPromName", "specifies", "the", "namespace", "as", "a", "prefix", "to", "the", "metric", "name" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/prometheusbackend/prometheusbackend.go#L78-L81
train
vitessio/vitess
go/stats/prometheusbackend/prometheusbackend.go
normalizeMetric
func normalizeMetric(name string) string { // Special cases r := strings.NewReplacer("VSchema", "vschema", "VtGate", "vtgate") name = r.Replace(name) return stats.GetSnakeName(name) }
go
func normalizeMetric(name string) string { // Special cases r := strings.NewReplacer("VSchema", "vschema", "VtGate", "vtgate") name = r.Replace(name) return stats.GetSnakeName(name) }
[ "func", "normalizeMetric", "(", "name", "string", ")", "string", "{", "// Special cases", "r", ":=", "strings", ".", "NewReplacer", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "name", "=", "r", ".", "Replace", "(", ...
// normalizeMetricForPrometheus produces a compliant name by applying // special case conversions and then applying a camel case to snake case converter.
[ "normalizeMetricForPrometheus", "produces", "a", "compliant", "name", "by", "applying", "special", "case", "conversions", "and", "then", "applying", "a", "camel", "case", "to", "snake", "case", "converter", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/prometheusbackend/prometheusbackend.go#L93-L99
train
vitessio/vitess
go/vt/vtgate/executor.go
NewExecutor
func NewExecutor(ctx context.Context, serv srvtopo.Server, cell, statsName string, resolver *Resolver, normalize bool, streamSize int, queryPlanCacheSize int64, legacyAutocommit bool) *Executor { e := &Executor{ serv: serv, cell: cell, resolver: resolver, scatterConn: resol...
go
func NewExecutor(ctx context.Context, serv srvtopo.Server, cell, statsName string, resolver *Resolver, normalize bool, streamSize int, queryPlanCacheSize int64, legacyAutocommit bool) *Executor { e := &Executor{ serv: serv, cell: cell, resolver: resolver, scatterConn: resol...
[ "func", "NewExecutor", "(", "ctx", "context", ".", "Context", ",", "serv", "srvtopo", ".", "Server", ",", "cell", ",", "statsName", "string", ",", "resolver", "*", "Resolver", ",", "normalize", "bool", ",", "streamSize", "int", ",", "queryPlanCacheSize", "in...
// NewExecutor creates a new Executor.
[ "NewExecutor", "creates", "a", "new", "Executor", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/executor.go#L93-L122
train
vitessio/vitess
go/vt/vtgate/executor.go
Execute
func (e *Executor) Execute(ctx context.Context, method string, safeSession *SafeSession, sql string, bindVars map[string]*querypb.BindVariable) (result *sqltypes.Result, err error) { span, ctx := trace.NewSpan(ctx, "executor.Execute") span.Annotate("method", method) trace.AnnotateSQL(span, sql) defer span.Finish() ...
go
func (e *Executor) Execute(ctx context.Context, method string, safeSession *SafeSession, sql string, bindVars map[string]*querypb.BindVariable) (result *sqltypes.Result, err error) { span, ctx := trace.NewSpan(ctx, "executor.Execute") span.Annotate("method", method) trace.AnnotateSQL(span, sql) defer span.Finish() ...
[ "func", "(", "e", "*", "Executor", ")", "Execute", "(", "ctx", "context", ".", "Context", ",", "method", "string", ",", "safeSession", "*", "SafeSession", ",", "sql", "string", ",", "bindVars", "map", "[", "string", "]", "*", "querypb", ".", "BindVariabl...
// Execute executes a non-streaming query.
[ "Execute", "executes", "a", "non", "-", "streaming", "query", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/executor.go#L125-L142
train
vitessio/vitess
go/vt/vtgate/executor.go
StreamExecute
func (e *Executor) StreamExecute(ctx context.Context, method string, safeSession *SafeSession, sql string, bindVars map[string]*querypb.BindVariable, target querypb.Target, callback func(*sqltypes.Result) error) (err error) { logStats := NewLogStats(ctx, method, sql, bindVars) logStats.StmtType = sqlparser.StmtType(s...
go
func (e *Executor) StreamExecute(ctx context.Context, method string, safeSession *SafeSession, sql string, bindVars map[string]*querypb.BindVariable, target querypb.Target, callback func(*sqltypes.Result) error) (err error) { logStats := NewLogStats(ctx, method, sql, bindVars) logStats.StmtType = sqlparser.StmtType(s...
[ "func", "(", "e", "*", "Executor", ")", "StreamExecute", "(", "ctx", "context", ".", "Context", ",", "method", "string", ",", "safeSession", "*", "SafeSession", ",", "sql", "string", ",", "bindVars", "map", "[", "string", "]", "*", "querypb", ".", "BindV...
// StreamExecute executes a streaming query.
[ "StreamExecute", "executes", "a", "streaming", "query", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/executor.go#L1060-L1138
train
vitessio/vitess
go/vt/vtgate/executor.go
MessageStream
func (e *Executor) MessageStream(ctx context.Context, keyspace string, shard string, keyRange *topodatapb.KeyRange, name string, callback func(*sqltypes.Result) error) error { err := e.resolver.MessageStream( ctx, keyspace, shard, keyRange, name, callback, ) return formatError(err) }
go
func (e *Executor) MessageStream(ctx context.Context, keyspace string, shard string, keyRange *topodatapb.KeyRange, name string, callback func(*sqltypes.Result) error) error { err := e.resolver.MessageStream( ctx, keyspace, shard, keyRange, name, callback, ) return formatError(err) }
[ "func", "(", "e", "*", "Executor", ")", "MessageStream", "(", "ctx", "context", ".", "Context", ",", "keyspace", "string", ",", "shard", "string", ",", "keyRange", "*", "topodatapb", ".", "KeyRange", ",", "name", "string", ",", "callback", "func", "(", "...
// MessageStream is part of the vtgate service API. This is a V2 level API that's sent // to the Resolver.
[ "MessageStream", "is", "part", "of", "the", "vtgate", "service", "API", ".", "This", "is", "a", "V2", "level", "API", "that", "s", "sent", "to", "the", "Resolver", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/executor.go#L1172-L1182
train
vitessio/vitess
go/vt/vtgate/executor.go
IsKeyspaceRangeBasedSharded
func (e *Executor) IsKeyspaceRangeBasedSharded(keyspace string) bool { vschema := e.VSchema() ks, ok := vschema.Keyspaces[keyspace] if !ok { return false } if ks.Keyspace == nil { return false } return ks.Keyspace.Sharded }
go
func (e *Executor) IsKeyspaceRangeBasedSharded(keyspace string) bool { vschema := e.VSchema() ks, ok := vschema.Keyspaces[keyspace] if !ok { return false } if ks.Keyspace == nil { return false } return ks.Keyspace.Sharded }
[ "func", "(", "e", "*", "Executor", ")", "IsKeyspaceRangeBasedSharded", "(", "keyspace", "string", ")", "bool", "{", "vschema", ":=", "e", ".", "VSchema", "(", ")", "\n", "ks", ",", "ok", ":=", "vschema", ".", "Keyspaces", "[", "keyspace", "]", "\n", "i...
// IsKeyspaceRangeBasedSharded returns true if the keyspace in the vschema is // marked as sharded.
[ "IsKeyspaceRangeBasedSharded", "returns", "true", "if", "the", "keyspace", "in", "the", "vschema", "is", "marked", "as", "sharded", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/executor.go#L1238-L1248
train
vitessio/vitess
go/vt/vtgate/executor.go
VSchema
func (e *Executor) VSchema() *vindexes.VSchema { e.mu.Lock() defer e.mu.Unlock() return e.vschema }
go
func (e *Executor) VSchema() *vindexes.VSchema { e.mu.Lock() defer e.mu.Unlock() return e.vschema }
[ "func", "(", "e", "*", "Executor", ")", "VSchema", "(", ")", "*", "vindexes", ".", "VSchema", "{", "e", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "e", ".", "mu", ".", "Unlock", "(", ")", "\n", "return", "e", ".", "vschema", "\n", "}" ]
// VSchema returns the VSchema.
[ "VSchema", "returns", "the", "VSchema", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/executor.go#L1251-L1255
train
vitessio/vitess
go/vt/vtgate/executor.go
SaveVSchema
func (e *Executor) SaveVSchema(vschema *vindexes.VSchema, stats *VSchemaStats) { e.mu.Lock() defer e.mu.Unlock() e.vschema = vschema e.vschemaStats = stats e.plans.Clear() if vschemaCounters != nil { vschemaCounters.Add("Reload", 1) } }
go
func (e *Executor) SaveVSchema(vschema *vindexes.VSchema, stats *VSchemaStats) { e.mu.Lock() defer e.mu.Unlock() e.vschema = vschema e.vschemaStats = stats e.plans.Clear() if vschemaCounters != nil { vschemaCounters.Add("Reload", 1) } }
[ "func", "(", "e", "*", "Executor", ")", "SaveVSchema", "(", "vschema", "*", "vindexes", ".", "VSchema", ",", "stats", "*", "VSchemaStats", ")", "{", "e", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "e", ".", "mu", ".", "Unlock", "(", ")", "\...
// SaveVSchema updates the vschema and stats
[ "SaveVSchema", "updates", "the", "vschema", "and", "stats" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/executor.go#L1258-L1269
train
vitessio/vitess
go/vt/vtgate/executor.go
ParseDestinationTarget
func (e *Executor) ParseDestinationTarget(targetString string) (string, topodatapb.TabletType, key.Destination, error) { destKeyspace, destTabletType, dest, err := topoproto.ParseDestination(targetString, defaultTabletType) // Set default keyspace if destKeyspace == "" && len(e.VSchema().Keyspaces) == 1 { for k :=...
go
func (e *Executor) ParseDestinationTarget(targetString string) (string, topodatapb.TabletType, key.Destination, error) { destKeyspace, destTabletType, dest, err := topoproto.ParseDestination(targetString, defaultTabletType) // Set default keyspace if destKeyspace == "" && len(e.VSchema().Keyspaces) == 1 { for k :=...
[ "func", "(", "e", "*", "Executor", ")", "ParseDestinationTarget", "(", "targetString", "string", ")", "(", "string", ",", "topodatapb", ".", "TabletType", ",", "key", ".", "Destination", ",", "error", ")", "{", "destKeyspace", ",", "destTabletType", ",", "de...
// ParseDestinationTarget parses destination target string and sets default keyspace if possible.
[ "ParseDestinationTarget", "parses", "destination", "target", "string", "and", "sets", "default", "keyspace", "if", "possible", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/executor.go#L1272-L1281
train
vitessio/vitess
go/vt/vtgate/executor.go
getPlan
func (e *Executor) getPlan(vcursor *vcursorImpl, sql string, comments sqlparser.MarginComments, bindVars map[string]*querypb.BindVariable, skipQueryPlanCache bool, logStats *LogStats) (*engine.Plan, error) { if logStats != nil { logStats.SQL = comments.Leading + sql + comments.Trailing logStats.BindVariables = bin...
go
func (e *Executor) getPlan(vcursor *vcursorImpl, sql string, comments sqlparser.MarginComments, bindVars map[string]*querypb.BindVariable, skipQueryPlanCache bool, logStats *LogStats) (*engine.Plan, error) { if logStats != nil { logStats.SQL = comments.Leading + sql + comments.Trailing logStats.BindVariables = bin...
[ "func", "(", "e", "*", "Executor", ")", "getPlan", "(", "vcursor", "*", "vcursorImpl", ",", "sql", "string", ",", "comments", "sqlparser", ".", "MarginComments", ",", "bindVars", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable", ",", "skipQue...
// getPlan computes the plan for the given query. If one is in // the cache, it reuses it.
[ "getPlan", "computes", "the", "plan", "for", "the", "given", "query", ".", "If", "one", "is", "in", "the", "cache", "it", "reuses", "it", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/executor.go#L1285-L1335
train
vitessio/vitess
go/vt/vtgate/executor.go
skipQueryPlanCache
func skipQueryPlanCache(safeSession *SafeSession) bool { if safeSession == nil || safeSession.Options == nil { return false } return safeSession.Options.SkipQueryPlanCache }
go
func skipQueryPlanCache(safeSession *SafeSession) bool { if safeSession == nil || safeSession.Options == nil { return false } return safeSession.Options.SkipQueryPlanCache }
[ "func", "skipQueryPlanCache", "(", "safeSession", "*", "SafeSession", ")", "bool", "{", "if", "safeSession", "==", "nil", "||", "safeSession", ".", "Options", "==", "nil", "{", "return", "false", "\n", "}", "\n", "return", "safeSession", ".", "Options", ".",...
// skipQueryPlanCache extracts SkipQueryPlanCache from session
[ "skipQueryPlanCache", "extracts", "SkipQueryPlanCache", "from", "session" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/executor.go#L1338-L1343
train
vitessio/vitess
go/vt/vtgate/executor.go
ServeHTTP
func (e *Executor) ServeHTTP(response http.ResponseWriter, request *http.Request) { if err := acl.CheckAccessHTTP(request, acl.DEBUGGING); err != nil { acl.SendError(response, err) return } if request.URL.Path == "/debug/query_plans" { keys := e.plans.Keys() response.Header().Set("Content-Type", "text/plain"...
go
func (e *Executor) ServeHTTP(response http.ResponseWriter, request *http.Request) { if err := acl.CheckAccessHTTP(request, acl.DEBUGGING); err != nil { acl.SendError(response, err) return } if request.URL.Path == "/debug/query_plans" { keys := e.plans.Keys() response.Header().Set("Content-Type", "text/plain"...
[ "func", "(", "e", "*", "Executor", ")", "ServeHTTP", "(", "response", "http", ".", "ResponseWriter", ",", "request", "*", "http", ".", "Request", ")", "{", "if", "err", ":=", "acl", ".", "CheckAccessHTTP", "(", "request", ",", "acl", ".", "DEBUGGING", ...
// ServeHTTP shows the current plans in the query cache.
[ "ServeHTTP", "shows", "the", "current", "plans", "in", "the", "query", "cache", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/executor.go#L1346-L1379
train
vitessio/vitess
go/vt/vtgate/executor.go
VSchemaStats
func (e *Executor) VSchemaStats() *VSchemaStats { e.mu.Lock() defer e.mu.Unlock() if e.vschemaStats == nil { return &VSchemaStats{ Error: "No VSchema loaded yet.", } } return e.vschemaStats }
go
func (e *Executor) VSchemaStats() *VSchemaStats { e.mu.Lock() defer e.mu.Unlock() if e.vschemaStats == nil { return &VSchemaStats{ Error: "No VSchema loaded yet.", } } return e.vschemaStats }
[ "func", "(", "e", "*", "Executor", ")", "VSchemaStats", "(", ")", "*", "VSchemaStats", "{", "e", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "e", ".", "mu", ".", "Unlock", "(", ")", "\n", "if", "e", ".", "vschemaStats", "==", "nil", "{", "...
// VSchemaStats returns the loaded vschema stats.
[ "VSchemaStats", "returns", "the", "loaded", "vschema", "stats", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/executor.go#L1387-L1396
train
vitessio/vitess
go/vt/workflow/reshardingworkflowgen/workflow.go
initCheckpoint
func initCheckpoint(keyspace string, vtworkers []string, shardsToSplit [][][]string, minHealthyRdonlyTablets, splitCmd, splitDiffDestTabletType, phaseEnableApprovals string, skipStartWorkflows bool) (*workflowpb.WorkflowCheckpoint, error) { sourceShards := 0 destShards := 0 for _, shardToSplit := range shardsToSplit...
go
func initCheckpoint(keyspace string, vtworkers []string, shardsToSplit [][][]string, minHealthyRdonlyTablets, splitCmd, splitDiffDestTabletType, phaseEnableApprovals string, skipStartWorkflows bool) (*workflowpb.WorkflowCheckpoint, error) { sourceShards := 0 destShards := 0 for _, shardToSplit := range shardsToSplit...
[ "func", "initCheckpoint", "(", "keyspace", "string", ",", "vtworkers", "[", "]", "string", ",", "shardsToSplit", "[", "]", "[", "]", "[", "]", "string", ",", "minHealthyRdonlyTablets", ",", "splitCmd", ",", "splitDiffDestTabletType", ",", "phaseEnableApprovals", ...
// initCheckpoint initialize the checkpoint for keyspace reshard
[ "initCheckpoint", "initialize", "the", "checkpoint", "for", "keyspace", "reshard" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/reshardingworkflowgen/workflow.go#L191-L239
train
vitessio/vitess
go/vt/srvtopo/resolver.go
GetAllKeyspaces
func (r *Resolver) GetAllKeyspaces(ctx context.Context) ([]string, error) { keyspaces, err := r.topoServ.GetSrvKeyspaceNames(ctx, r.localCell) if err != nil { return nil, vterrors.Errorf(vtrpcpb.Code_UNKNOWN, "keyspace names fetch error: %v", err) } // FIXME(alainjobart) this should be unnecessary. The results /...
go
func (r *Resolver) GetAllKeyspaces(ctx context.Context) ([]string, error) { keyspaces, err := r.topoServ.GetSrvKeyspaceNames(ctx, r.localCell) if err != nil { return nil, vterrors.Errorf(vtrpcpb.Code_UNKNOWN, "keyspace names fetch error: %v", err) } // FIXME(alainjobart) this should be unnecessary. The results /...
[ "func", "(", "r", "*", "Resolver", ")", "GetAllKeyspaces", "(", "ctx", "context", ".", "Context", ")", "(", "[", "]", "string", ",", "error", ")", "{", "keyspaces", ",", "err", ":=", "r", ".", "topoServ", ".", "GetSrvKeyspaceNames", "(", "ctx", ",", ...
// GetAllKeyspaces returns all the known keyspaces in the local cell.
[ "GetAllKeyspaces", "returns", "all", "the", "known", "keyspaces", "in", "the", "local", "cell", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/srvtopo/resolver.go#L151-L161
train
vitessio/vitess
go/vt/srvtopo/resolver.go
ResolveDestination
func (r *Resolver) ResolveDestination(ctx context.Context, keyspace string, tabletType topodatapb.TabletType, destination key.Destination) ([]*ResolvedShard, error) { rss, _, err := r.ResolveDestinations(ctx, keyspace, tabletType, nil, []key.Destination{destination}) return rss, err }
go
func (r *Resolver) ResolveDestination(ctx context.Context, keyspace string, tabletType topodatapb.TabletType, destination key.Destination) ([]*ResolvedShard, error) { rss, _, err := r.ResolveDestinations(ctx, keyspace, tabletType, nil, []key.Destination{destination}) return rss, err }
[ "func", "(", "r", "*", "Resolver", ")", "ResolveDestination", "(", "ctx", "context", ".", "Context", ",", "keyspace", "string", ",", "tabletType", "topodatapb", ".", "TabletType", ",", "destination", "key", ".", "Destination", ")", "(", "[", "]", "*", "Res...
// ResolveDestination is a shortcut to ResolveDestinations with only // one Destination, and no ids.
[ "ResolveDestination", "is", "a", "shortcut", "to", "ResolveDestinations", "with", "only", "one", "Destination", "and", "no", "ids", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/srvtopo/resolver.go#L228-L231
train
vitessio/vitess
go/vt/srvtopo/resolver.go
ValuesEqual
func ValuesEqual(vss1, vss2 [][]*querypb.Value) bool { if len(vss1) != len(vss2) { return false } for i, vs1 := range vss1 { if len(vs1) != len(vss2[i]) { return false } for j, v1 := range vs1 { if !proto.Equal(v1, vss2[i][j]) { return false } } } return true }
go
func ValuesEqual(vss1, vss2 [][]*querypb.Value) bool { if len(vss1) != len(vss2) { return false } for i, vs1 := range vss1 { if len(vs1) != len(vss2[i]) { return false } for j, v1 := range vs1 { if !proto.Equal(v1, vss2[i][j]) { return false } } } return true }
[ "func", "ValuesEqual", "(", "vss1", ",", "vss2", "[", "]", "[", "]", "*", "querypb", ".", "Value", ")", "bool", "{", "if", "len", "(", "vss1", ")", "!=", "len", "(", "vss2", ")", "{", "return", "false", "\n", "}", "\n", "for", "i", ",", "vs1", ...
// ValuesEqual is a helper method to compare arrays of values.
[ "ValuesEqual", "is", "a", "helper", "method", "to", "compare", "arrays", "of", "values", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/srvtopo/resolver.go#L234-L249
train
vitessio/vitess
go/vt/vttablet/endtoend/framework/server.go
StartServer
func StartServer(connParams, connAppDebugParams mysql.ConnParams, dbName string) error { // Setup a fake vtgate server. protocol := "resolveTest" *vtgateconn.VtgateProtocol = protocol vtgateconn.RegisterDialer(protocol, func(context.Context, string) (vtgateconn.Impl, error) { return &txResolver{ FakeVTGateConn...
go
func StartServer(connParams, connAppDebugParams mysql.ConnParams, dbName string) error { // Setup a fake vtgate server. protocol := "resolveTest" *vtgateconn.VtgateProtocol = protocol vtgateconn.RegisterDialer(protocol, func(context.Context, string) (vtgateconn.Impl, error) { return &txResolver{ FakeVTGateConn...
[ "func", "StartServer", "(", "connParams", ",", "connAppDebugParams", "mysql", ".", "ConnParams", ",", "dbName", "string", ")", "error", "{", "// Setup a fake vtgate server.", "protocol", ":=", "\"", "\"", "\n", "*", "vtgateconn", ".", "VtgateProtocol", "=", "proto...
// StartServer starts the server and initializes // all the global variables. This function should only be called // once at the beginning of the test.
[ "StartServer", "starts", "the", "server", "and", "initializes", "all", "the", "global", "variables", ".", "This", "function", "should", "only", "be", "called", "once", "at", "the", "beginning", "of", "the", "test", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/endtoend/framework/server.go#L54-L103
train
vitessio/vitess
go/vt/vtgate/engine/vindex_func.go
MarshalJSON
func (vf *VindexFunc) MarshalJSON() ([]byte, error) { v := struct { Opcode VindexOpcode Fields []*querypb.Field Cols []int Vindex string Value sqltypes.PlanValue }{ Opcode: vf.Opcode, Fields: vf.Fields, Cols: vf.Cols, Vindex: vf.Vindex.String(), Value: vf.Value, } return json.Marshal(v) }
go
func (vf *VindexFunc) MarshalJSON() ([]byte, error) { v := struct { Opcode VindexOpcode Fields []*querypb.Field Cols []int Vindex string Value sqltypes.PlanValue }{ Opcode: vf.Opcode, Fields: vf.Fields, Cols: vf.Cols, Vindex: vf.Vindex.String(), Value: vf.Value, } return json.Marshal(v) }
[ "func", "(", "vf", "*", "VindexFunc", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "v", ":=", "struct", "{", "Opcode", "VindexOpcode", "\n", "Fields", "[", "]", "*", "querypb", ".", "Field", "\n", "Cols", "[", "]", ...
// MarshalJSON serializes the VindexFunc into a JSON representation. // It's used for testing and diagnostics.
[ "MarshalJSON", "serializes", "the", "VindexFunc", "into", "a", "JSON", "representation", ".", "It", "s", "used", "for", "testing", "and", "diagnostics", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/engine/vindex_func.go#L45-L60
train
vitessio/vitess
go/trace/opentracing.go
Annotate
func (js openTracingSpan) Annotate(key string, value interface{}) { js.otSpan.SetTag(key, value) }
go
func (js openTracingSpan) Annotate(key string, value interface{}) { js.otSpan.SetTag(key, value) }
[ "func", "(", "js", "openTracingSpan", ")", "Annotate", "(", "key", "string", ",", "value", "interface", "{", "}", ")", "{", "js", ".", "otSpan", ".", "SetTag", "(", "key", ",", "value", ")", "\n", "}" ]
// Annotate will add information to an existing span
[ "Annotate", "will", "add", "information", "to", "an", "existing", "span" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/trace/opentracing.go#L37-L39
train
vitessio/vitess
go/trace/opentracing.go
AddGrpcServerOptions
func (jf openTracingService) AddGrpcServerOptions(addInterceptors func(s grpc.StreamServerInterceptor, u grpc.UnaryServerInterceptor)) { addInterceptors(otgrpc.OpenTracingStreamServerInterceptor(jf.Tracer), otgrpc.OpenTracingServerInterceptor(jf.Tracer)) }
go
func (jf openTracingService) AddGrpcServerOptions(addInterceptors func(s grpc.StreamServerInterceptor, u grpc.UnaryServerInterceptor)) { addInterceptors(otgrpc.OpenTracingStreamServerInterceptor(jf.Tracer), otgrpc.OpenTracingServerInterceptor(jf.Tracer)) }
[ "func", "(", "jf", "openTracingService", ")", "AddGrpcServerOptions", "(", "addInterceptors", "func", "(", "s", "grpc", ".", "StreamServerInterceptor", ",", "u", "grpc", ".", "UnaryServerInterceptor", ")", ")", "{", "addInterceptors", "(", "otgrpc", ".", "OpenTrac...
// AddGrpcServerOptions is part of an interface implementation
[ "AddGrpcServerOptions", "is", "part", "of", "an", "interface", "implementation" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/trace/opentracing.go#L48-L50
train
vitessio/vitess
go/trace/opentracing.go
AddGrpcClientOptions
func (jf openTracingService) AddGrpcClientOptions(addInterceptors func(s grpc.StreamClientInterceptor, u grpc.UnaryClientInterceptor)) { addInterceptors(otgrpc.OpenTracingStreamClientInterceptor(jf.Tracer), otgrpc.OpenTracingClientInterceptor(jf.Tracer)) }
go
func (jf openTracingService) AddGrpcClientOptions(addInterceptors func(s grpc.StreamClientInterceptor, u grpc.UnaryClientInterceptor)) { addInterceptors(otgrpc.OpenTracingStreamClientInterceptor(jf.Tracer), otgrpc.OpenTracingClientInterceptor(jf.Tracer)) }
[ "func", "(", "jf", "openTracingService", ")", "AddGrpcClientOptions", "(", "addInterceptors", "func", "(", "s", "grpc", ".", "StreamClientInterceptor", ",", "u", "grpc", ".", "UnaryClientInterceptor", ")", ")", "{", "addInterceptors", "(", "otgrpc", ".", "OpenTrac...
// AddGrpcClientOptions is part of an interface implementation
[ "AddGrpcClientOptions", "is", "part", "of", "an", "interface", "implementation" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/trace/opentracing.go#L53-L55
train
vitessio/vitess
go/trace/opentracing.go
NewClientSpan
func (jf openTracingService) NewClientSpan(parent Span, serviceName, label string) Span { span := jf.New(parent, label) span.Annotate("peer.service", serviceName) return span }
go
func (jf openTracingService) NewClientSpan(parent Span, serviceName, label string) Span { span := jf.New(parent, label) span.Annotate("peer.service", serviceName) return span }
[ "func", "(", "jf", "openTracingService", ")", "NewClientSpan", "(", "parent", "Span", ",", "serviceName", ",", "label", "string", ")", "Span", "{", "span", ":=", "jf", ".", "New", "(", "parent", ",", "label", ")", "\n", "span", ".", "Annotate", "(", "\...
// NewClientSpan is part of an interface implementation
[ "NewClientSpan", "is", "part", "of", "an", "interface", "implementation" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/trace/opentracing.go#L58-L62
train