id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
136,500
vitessio/vitess
go/vt/workflow/manager.go
Wait
func (m *Manager) Wait(ctx context.Context, uuid string) error { // Find the workflow. rw, err := m.runningWorkflow(uuid) if err != nil { return err } // Just wait for it. select { case <-rw.done: break case <-ctx.Done(): return ctx.Err() } return nil }
go
func (m *Manager) Wait(ctx context.Context, uuid string) error { // Find the workflow. rw, err := m.runningWorkflow(uuid) if err != nil { return err } // Just wait for it. select { case <-rw.done: break case <-ctx.Done(): return ctx.Err() } return nil }
[ "func", "(", "m", "*", "Manager", ")", "Wait", "(", "ctx", "context", ".", "Context", ",", "uuid", "string", ")", "error", "{", "// Find the workflow.", "rw", ",", "err", ":=", "m", ".", "runningWorkflow", "(", "uuid", ")", "\n", "if", "err", "!=", "...
// Wait waits for the provided workflow to end.
[ "Wait", "waits", "for", "the", "provided", "workflow", "to", "end", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/manager.go#L459-L474
136,501
vitessio/vitess
go/vt/workflow/manager.go
runningWorkflow
func (m *Manager) runningWorkflow(uuid string) (*runningWorkflow, error) { m.mu.Lock() defer m.mu.Unlock() rw, ok := m.workflows[uuid] if !ok { return nil, fmt.Errorf("no running workflow with uuid %v", uuid) } return rw, nil }
go
func (m *Manager) runningWorkflow(uuid string) (*runningWorkflow, error) { m.mu.Lock() defer m.mu.Unlock() rw, ok := m.workflows[uuid] if !ok { return nil, fmt.Errorf("no running workflow with uuid %v", uuid) } return rw, nil }
[ "func", "(", "m", "*", "Manager", ")", "runningWorkflow", "(", "uuid", "string", ")", "(", "*", "runningWorkflow", ",", "error", ")", "{", "m", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "rw"...
// runningWorkflow returns a runningWorkflow by uuid.
[ "runningWorkflow", "returns", "a", "runningWorkflow", "by", "uuid", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/manager.go#L498-L507
136,502
vitessio/vitess
go/vt/workflow/manager.go
Unregister
func Unregister(name string) { if _, ok := factories[name]; !ok { log.Warningf("workflow %v doesn't exist, cannot remove it", name) } else { delete(factories, name) } }
go
func Unregister(name string) { if _, ok := factories[name]; !ok { log.Warningf("workflow %v doesn't exist, cannot remove it", name) } else { delete(factories, name) } }
[ "func", "Unregister", "(", "name", "string", ")", "{", "if", "_", ",", "ok", ":=", "factories", "[", "name", "]", ";", "!", "ok", "{", "log", ".", "Warningf", "(", "\"", "\"", ",", "name", ")", "\n", "}", "else", "{", "delete", "(", "factories", ...
// Unregister removes a factory object. // Typically called from a flag to remove dangerous workflows.
[ "Unregister", "removes", "a", "factory", "object", ".", "Typically", "called", "from", "a", "flag", "to", "remove", "dangerous", "workflows", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/manager.go#L572-L578
136,503
vitessio/vitess
go/vt/workflow/manager.go
AvailableFactories
func AvailableFactories() map[string]bool { result := make(map[string]bool) for n := range factories { result[n] = true } return result }
go
func AvailableFactories() map[string]bool { result := make(map[string]bool) for n := range factories { result[n] = true } return result }
[ "func", "AvailableFactories", "(", ")", "map", "[", "string", "]", "bool", "{", "result", ":=", "make", "(", "map", "[", "string", "]", "bool", ")", "\n", "for", "n", ":=", "range", "factories", "{", "result", "[", "n", "]", "=", "true", "\n", "}",...
// AvailableFactories returns a map with the names of the available // factories as keys and 'true' as value.
[ "AvailableFactories", "returns", "a", "map", "with", "the", "names", "of", "the", "available", "factories", "as", "keys", "and", "true", "as", "value", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/manager.go#L582-L588
136,504
vitessio/vitess
go/vt/workflow/manager.go
StartManager
func StartManager(m *Manager) (*sync.WaitGroup, context.Context, context.CancelFunc) { ctx, cancel := context.WithCancel(context.Background()) wg := &sync.WaitGroup{} wg.Add(1) go func() { m.Run(ctx) wg.Done() }() m.WaitUntilRunning() return wg, ctx, cancel }
go
func StartManager(m *Manager) (*sync.WaitGroup, context.Context, context.CancelFunc) { ctx, cancel := context.WithCancel(context.Background()) wg := &sync.WaitGroup{} wg.Add(1) go func() { m.Run(ctx) wg.Done() }() m.WaitUntilRunning() return wg, ctx, cancel }
[ "func", "StartManager", "(", "m", "*", "Manager", ")", "(", "*", "sync", ".", "WaitGroup", ",", "context", ".", "Context", ",", "context", ".", "CancelFunc", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithCancel", "(", "context", ".", "Back...
// StartManager starts a manager. This function should only be used for tests purposes.
[ "StartManager", "starts", "a", "manager", ".", "This", "function", "should", "only", "be", "used", "for", "tests", "purposes", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/manager.go#L591-L603
136,505
vitessio/vitess
go/vt/worker/events/split_syslog.go
Syslog
func (ev *SplitClone) Syslog() (syslog.Priority, string) { return syslog.LOG_INFO, fmt.Sprintf("%s/%s/%s [split clone] %s", ev.Keyspace, ev.Shard, ev.Cell, ev.Status) }
go
func (ev *SplitClone) Syslog() (syslog.Priority, string) { return syslog.LOG_INFO, fmt.Sprintf("%s/%s/%s [split clone] %s", ev.Keyspace, ev.Shard, ev.Cell, ev.Status) }
[ "func", "(", "ev", "*", "SplitClone", ")", "Syslog", "(", ")", "(", "syslog", ".", "Priority", ",", "string", ")", "{", "return", "syslog", ".", "LOG_INFO", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "ev", ".", "Keyspace", ",", "ev", ".", ...
// Syslog writes a SplitClone event to syslog.
[ "Syslog", "writes", "a", "SplitClone", "event", "to", "syslog", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/events/split_syslog.go#L27-L30
136,506
vitessio/vitess
go/vt/vttablet/tabletserver/query_executor.go
Stream
func (qre *QueryExecutor) Stream(callback func(*sqltypes.Result) error) error { qre.logStats.OriginalSQL = qre.query qre.logStats.PlanType = qre.plan.PlanID.String() defer func(start time.Time) { tabletenv.QueryStats.Record(qre.plan.PlanID.String(), start) tabletenv.RecordUserQuery(qre.ctx, qre.plan.TableName()...
go
func (qre *QueryExecutor) Stream(callback func(*sqltypes.Result) error) error { qre.logStats.OriginalSQL = qre.query qre.logStats.PlanType = qre.plan.PlanID.String() defer func(start time.Time) { tabletenv.QueryStats.Record(qre.plan.PlanID.String(), start) tabletenv.RecordUserQuery(qre.ctx, qre.plan.TableName()...
[ "func", "(", "qre", "*", "QueryExecutor", ")", "Stream", "(", "callback", "func", "(", "*", "sqltypes", ".", "Result", ")", "error", ")", "error", "{", "qre", ".", "logStats", ".", "OriginalSQL", "=", "qre", ".", "query", "\n", "qre", ".", "logStats", ...
// Stream performs a streaming query execution.
[ "Stream", "performs", "a", "streaming", "query", "execution", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_executor.go#L204-L240
136,507
vitessio/vitess
go/vt/vttablet/tabletserver/query_executor.go
MessageStream
func (qre *QueryExecutor) MessageStream(callback func(*sqltypes.Result) error) error { qre.logStats.OriginalSQL = qre.query qre.logStats.PlanType = qre.plan.PlanID.String() defer func(start time.Time) { tabletenv.QueryStats.Record(qre.plan.PlanID.String(), start) tabletenv.RecordUserQuery(qre.ctx, qre.plan.Tabl...
go
func (qre *QueryExecutor) MessageStream(callback func(*sqltypes.Result) error) error { qre.logStats.OriginalSQL = qre.query qre.logStats.PlanType = qre.plan.PlanID.String() defer func(start time.Time) { tabletenv.QueryStats.Record(qre.plan.PlanID.String(), start) tabletenv.RecordUserQuery(qre.ctx, qre.plan.Tabl...
[ "func", "(", "qre", "*", "QueryExecutor", ")", "MessageStream", "(", "callback", "func", "(", "*", "sqltypes", ".", "Result", ")", "error", ")", "error", "{", "qre", ".", "logStats", ".", "OriginalSQL", "=", "qre", ".", "query", "\n", "qre", ".", "logS...
// MessageStream streams messages from a message table.
[ "MessageStream", "streams", "messages", "from", "a", "message", "table", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_executor.go#L243-L269
136,508
vitessio/vitess
go/vt/vttablet/tabletserver/query_executor.go
execDirect
func (qre *QueryExecutor) execDirect(conn *TxConnection) (*sqltypes.Result, error) { if qre.plan.Fields != nil { result, err := qre.txFetch(conn, qre.plan.FullQuery, qre.bindVars, nil, "", true, false) if err != nil { return nil, err } result.Fields = qre.plan.Fields return result, nil } return qre.txFe...
go
func (qre *QueryExecutor) execDirect(conn *TxConnection) (*sqltypes.Result, error) { if qre.plan.Fields != nil { result, err := qre.txFetch(conn, qre.plan.FullQuery, qre.bindVars, nil, "", true, false) if err != nil { return nil, err } result.Fields = qre.plan.Fields return result, nil } return qre.txFe...
[ "func", "(", "qre", "*", "QueryExecutor", ")", "execDirect", "(", "conn", "*", "TxConnection", ")", "(", "*", "sqltypes", ".", "Result", ",", "error", ")", "{", "if", "qre", ".", "plan", ".", "Fields", "!=", "nil", "{", "result", ",", "err", ":=", ...
// execDirect is for reads inside transactions. Always send to MySQL.
[ "execDirect", "is", "for", "reads", "inside", "transactions", ".", "Always", "send", "to", "MySQL", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_executor.go#L523-L533
136,509
vitessio/vitess
go/vt/vttablet/tabletserver/query_executor.go
execSelect
func (qre *QueryExecutor) execSelect() (*sqltypes.Result, error) { if qre.plan.Fields != nil { result, err := qre.qFetch(qre.logStats, qre.plan.FullQuery, qre.bindVars) if err != nil { return nil, err } // result is read-only. So, let's copy it before modifying. newResult := *result newResult.Fields = q...
go
func (qre *QueryExecutor) execSelect() (*sqltypes.Result, error) { if qre.plan.Fields != nil { result, err := qre.qFetch(qre.logStats, qre.plan.FullQuery, qre.bindVars) if err != nil { return nil, err } // result is read-only. So, let's copy it before modifying. newResult := *result newResult.Fields = q...
[ "func", "(", "qre", "*", "QueryExecutor", ")", "execSelect", "(", ")", "(", "*", "sqltypes", ".", "Result", ",", "error", ")", "{", "if", "qre", ".", "plan", ".", "Fields", "!=", "nil", "{", "result", ",", "err", ":=", "qre", ".", "qFetch", "(", ...
// execSelect sends a query to mysql only if another identical query is not running. Otherwise, it waits and // reuses the result. If the plan is missng field info, it sends the query to mysql requesting full info.
[ "execSelect", "sends", "a", "query", "to", "mysql", "only", "if", "another", "identical", "query", "is", "not", "running", ".", "Otherwise", "it", "waits", "and", "reuses", "the", "result", ".", "If", "the", "plan", "is", "missng", "field", "info", "it", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_executor.go#L537-L554
136,510
vitessio/vitess
go/vt/vttablet/tabletserver/query_executor.go
txFetch
func (qre *QueryExecutor) txFetch(conn *TxConnection, parsedQuery *sqlparser.ParsedQuery, bindVars map[string]*querypb.BindVariable, extras map[string]sqlparser.Encodable, buildStreamComment string, wantfields, record bool) (*sqltypes.Result, error) { sql, _, err := qre.generateFinalSQL(parsedQuery, bindVars, extras, ...
go
func (qre *QueryExecutor) txFetch(conn *TxConnection, parsedQuery *sqlparser.ParsedQuery, bindVars map[string]*querypb.BindVariable, extras map[string]sqlparser.Encodable, buildStreamComment string, wantfields, record bool) (*sqltypes.Result, error) { sql, _, err := qre.generateFinalSQL(parsedQuery, bindVars, extras, ...
[ "func", "(", "qre", "*", "QueryExecutor", ")", "txFetch", "(", "conn", "*", "TxConnection", ",", "parsedQuery", "*", "sqlparser", ".", "ParsedQuery", ",", "bindVars", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable", ",", "extras", "map", "["...
// txFetch fetches from a TxConnection.
[ "txFetch", "fetches", "from", "a", "TxConnection", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_executor.go#L861-L875
136,511
vitessio/vitess
go/vt/vttablet/tabletserver/query_executor.go
dbConnFetch
func (qre *QueryExecutor) dbConnFetch(conn *connpool.DBConn, parsedQuery *sqlparser.ParsedQuery, bindVars map[string]*querypb.BindVariable, buildStreamComment string, wantfields bool) (*sqltypes.Result, error) { sql, _, err := qre.generateFinalSQL(parsedQuery, bindVars, nil, buildStreamComment) if err != nil { retu...
go
func (qre *QueryExecutor) dbConnFetch(conn *connpool.DBConn, parsedQuery *sqlparser.ParsedQuery, bindVars map[string]*querypb.BindVariable, buildStreamComment string, wantfields bool) (*sqltypes.Result, error) { sql, _, err := qre.generateFinalSQL(parsedQuery, bindVars, nil, buildStreamComment) if err != nil { retu...
[ "func", "(", "qre", "*", "QueryExecutor", ")", "dbConnFetch", "(", "conn", "*", "connpool", ".", "DBConn", ",", "parsedQuery", "*", "sqlparser", ".", "ParsedQuery", ",", "bindVars", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable", ",", "buil...
// dbConnFetch fetches from a connpool.DBConn.
[ "dbConnFetch", "fetches", "from", "a", "connpool", ".", "DBConn", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_executor.go#L878-L884
136,512
vitessio/vitess
go/vt/vttablet/tabletserver/query_executor.go
streamFetch
func (qre *QueryExecutor) streamFetch(conn *connpool.DBConn, parsedQuery *sqlparser.ParsedQuery, bindVars map[string]*querypb.BindVariable, buildStreamComment string, callback func(*sqltypes.Result) error) error { sql, _, err := qre.generateFinalSQL(parsedQuery, bindVars, nil, buildStreamComment) if err != nil { re...
go
func (qre *QueryExecutor) streamFetch(conn *connpool.DBConn, parsedQuery *sqlparser.ParsedQuery, bindVars map[string]*querypb.BindVariable, buildStreamComment string, callback func(*sqltypes.Result) error) error { sql, _, err := qre.generateFinalSQL(parsedQuery, bindVars, nil, buildStreamComment) if err != nil { re...
[ "func", "(", "qre", "*", "QueryExecutor", ")", "streamFetch", "(", "conn", "*", "connpool", ".", "DBConn", ",", "parsedQuery", "*", "sqlparser", ".", "ParsedQuery", ",", "bindVars", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable", ",", "buil...
// streamFetch performs a streaming fetch.
[ "streamFetch", "performs", "a", "streaming", "fetch", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_executor.go#L887-L893
136,513
vitessio/vitess
go/vt/vtctl/fakevtctlclient/fakevtctlclient.go
FakeVtctlClientFactory
func (f *FakeVtctlClient) FakeVtctlClientFactory(addr string) (vtctlclient.VtctlClient, error) { return f, nil }
go
func (f *FakeVtctlClient) FakeVtctlClientFactory(addr string) (vtctlclient.VtctlClient, error) { return f, nil }
[ "func", "(", "f", "*", "FakeVtctlClient", ")", "FakeVtctlClientFactory", "(", "addr", "string", ")", "(", "vtctlclient", ".", "VtctlClient", ",", "error", ")", "{", "return", "f", ",", "nil", "\n", "}" ]
// FakeVtctlClientFactory always returns the current instance.
[ "FakeVtctlClientFactory", "always", "returns", "the", "current", "instance", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtctl/fakevtctlclient/fakevtctlclient.go#L41-L43
136,514
vitessio/vitess
go/vt/vtctl/fakevtctlclient/fakevtctlclient.go
ExecuteVtctlCommand
func (f *FakeVtctlClient) ExecuteVtctlCommand(ctx context.Context, args []string, actionTimeout time.Duration) (logutil.EventStream, error) { return f.FakeLoggerEventStreamingClient.StreamResult("" /* addr */, args) }
go
func (f *FakeVtctlClient) ExecuteVtctlCommand(ctx context.Context, args []string, actionTimeout time.Duration) (logutil.EventStream, error) { return f.FakeLoggerEventStreamingClient.StreamResult("" /* addr */, args) }
[ "func", "(", "f", "*", "FakeVtctlClient", ")", "ExecuteVtctlCommand", "(", "ctx", "context", ".", "Context", ",", "args", "[", "]", "string", ",", "actionTimeout", "time", ".", "Duration", ")", "(", "logutil", ".", "EventStream", ",", "error", ")", "{", ...
// ExecuteVtctlCommand is part of the vtctlclient interface.
[ "ExecuteVtctlCommand", "is", "part", "of", "the", "vtctlclient", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtctl/fakevtctlclient/fakevtctlclient.go#L46-L48
136,515
vitessio/vitess
go/vt/vttablet/tabletmanager/vreplication/replicator_plan.go
buildExecutionPlan
func (rp *ReplicatorPlan) buildExecutionPlan(fieldEvent *binlogdatapb.FieldEvent) (*TablePlan, error) { prelim := rp.TablePlans[fieldEvent.TableName] if prelim == nil { // Unreachable code. return nil, fmt.Errorf("plan not found for %s", fieldEvent.TableName) } if prelim.Insert != nil { tplanv := *prelim tp...
go
func (rp *ReplicatorPlan) buildExecutionPlan(fieldEvent *binlogdatapb.FieldEvent) (*TablePlan, error) { prelim := rp.TablePlans[fieldEvent.TableName] if prelim == nil { // Unreachable code. return nil, fmt.Errorf("plan not found for %s", fieldEvent.TableName) } if prelim.Insert != nil { tplanv := *prelim tp...
[ "func", "(", "rp", "*", "ReplicatorPlan", ")", "buildExecutionPlan", "(", "fieldEvent", "*", "binlogdatapb", ".", "FieldEvent", ")", "(", "*", "TablePlan", ",", "error", ")", "{", "prelim", ":=", "rp", ".", "TablePlans", "[", "fieldEvent", ".", "TableName", ...
// buildExecution plan uses the field info as input and the partially built // TablePlan for that table to build a full plan.
[ "buildExecution", "plan", "uses", "the", "field", "info", "as", "input", "and", "the", "partially", "built", "TablePlan", "for", "that", "table", "to", "build", "a", "full", "plan", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/vreplication/replicator_plan.go#L47-L65
136,516
vitessio/vitess
go/vt/vttablet/tabletserver/queryz.go
MysqlTimePQ
func (qzs *queryzRow) MysqlTimePQ() string { val := float64(qzs.mysqlTime) / (1e9 * float64(qzs.Count)) return fmt.Sprintf("%.6f", val) }
go
func (qzs *queryzRow) MysqlTimePQ() string { val := float64(qzs.mysqlTime) / (1e9 * float64(qzs.Count)) return fmt.Sprintf("%.6f", val) }
[ "func", "(", "qzs", "*", "queryzRow", ")", "MysqlTimePQ", "(", ")", "string", "{", "val", ":=", "float64", "(", "qzs", ".", "mysqlTime", ")", "/", "(", "1e9", "*", "float64", "(", "qzs", ".", "Count", ")", ")", "\n", "return", "fmt", ".", "Sprintf"...
// MysqlTimePQ returns the time per query as a string.
[ "MysqlTimePQ", "returns", "the", "time", "per", "query", "as", "a", "string", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/queryz.go#L106-L109
136,517
vitessio/vitess
go/vt/vttablet/tabletserver/queryz.go
RowsPQ
func (qzs *queryzRow) RowsPQ() string { val := float64(qzs.Rows) / float64(qzs.Count) return fmt.Sprintf("%.6f", val) }
go
func (qzs *queryzRow) RowsPQ() string { val := float64(qzs.Rows) / float64(qzs.Count) return fmt.Sprintf("%.6f", val) }
[ "func", "(", "qzs", "*", "queryzRow", ")", "RowsPQ", "(", ")", "string", "{", "val", ":=", "float64", "(", "qzs", ".", "Rows", ")", "/", "float64", "(", "qzs", ".", "Count", ")", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "val",...
// RowsPQ returns the row count per query as a string.
[ "RowsPQ", "returns", "the", "row", "count", "per", "query", "as", "a", "string", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/queryz.go#L112-L115
136,518
vitessio/vitess
go/vt/vttablet/tabletserver/queryz.go
ErrorsPQ
func (qzs *queryzRow) ErrorsPQ() string { return fmt.Sprintf("%.6f", float64(qzs.Errors)/float64(qzs.Count)) }
go
func (qzs *queryzRow) ErrorsPQ() string { return fmt.Sprintf("%.6f", float64(qzs.Errors)/float64(qzs.Count)) }
[ "func", "(", "qzs", "*", "queryzRow", ")", "ErrorsPQ", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "float64", "(", "qzs", ".", "Errors", ")", "/", "float64", "(", "qzs", ".", "Count", ")", ")", "\n", "}" ]
// ErrorsPQ returns the error count per query as a string.
[ "ErrorsPQ", "returns", "the", "error", "count", "per", "query", "as", "a", "string", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/queryz.go#L118-L120
136,519
vitessio/vitess
go/vt/worker/table_status.go
format
func (t *tableStatusList) format() ([]string, time.Time) { if !t.isInitialized() { return nil, time.Now() } copiedRows := uint64(0) rowCount := uint64(0) result := make([]string, len(t.tableStatuses)) for i, ts := range t.tableStatuses { ts.mu.Lock() if ts.isView { // views are not copied result[i] =...
go
func (t *tableStatusList) format() ([]string, time.Time) { if !t.isInitialized() { return nil, time.Now() } copiedRows := uint64(0) rowCount := uint64(0) result := make([]string, len(t.tableStatuses)) for i, ts := range t.tableStatuses { ts.mu.Lock() if ts.isView { // views are not copied result[i] =...
[ "func", "(", "t", "*", "tableStatusList", ")", "format", "(", ")", "(", "[", "]", "string", ",", "time", ".", "Time", ")", "{", "if", "!", "t", ".", "isInitialized", "(", ")", "{", "return", "nil", ",", "time", ".", "Now", "(", ")", "\n", "}", ...
// format returns a status for each table and the overall ETA.
[ "format", "returns", "a", "status", "for", "each", "table", "and", "the", "overall", "ETA", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/table_status.go#L104-L143
136,520
vitessio/vitess
go/vt/workflow/checkpoint.go
NewCheckpointWriter
func NewCheckpointWriter(ts *topo.Server, checkpoint *workflowpb.WorkflowCheckpoint, wi *topo.WorkflowInfo) *CheckpointWriter { return &CheckpointWriter{ topoServer: ts, checkpoint: checkpoint, wi: wi, } }
go
func NewCheckpointWriter(ts *topo.Server, checkpoint *workflowpb.WorkflowCheckpoint, wi *topo.WorkflowInfo) *CheckpointWriter { return &CheckpointWriter{ topoServer: ts, checkpoint: checkpoint, wi: wi, } }
[ "func", "NewCheckpointWriter", "(", "ts", "*", "topo", ".", "Server", ",", "checkpoint", "*", "workflowpb", ".", "WorkflowCheckpoint", ",", "wi", "*", "topo", ".", "WorkflowInfo", ")", "*", "CheckpointWriter", "{", "return", "&", "CheckpointWriter", "{", "topo...
// NewCheckpointWriter creates a CheckpointWriter.
[ "NewCheckpointWriter", "creates", "a", "CheckpointWriter", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/checkpoint.go#L41-L47
136,521
vitessio/vitess
go/vt/workflow/checkpoint.go
UpdateTask
func (c *CheckpointWriter) UpdateTask(taskID string, status workflowpb.TaskState, err error) error { c.mu.Lock() defer c.mu.Unlock() errorMessage := "" if err != nil { errorMessage = err.Error() } t := c.checkpoint.Tasks[taskID] t.State = status t.Error = errorMessage return c.saveLocked() }
go
func (c *CheckpointWriter) UpdateTask(taskID string, status workflowpb.TaskState, err error) error { c.mu.Lock() defer c.mu.Unlock() errorMessage := "" if err != nil { errorMessage = err.Error() } t := c.checkpoint.Tasks[taskID] t.State = status t.Error = errorMessage return c.saveLocked() }
[ "func", "(", "c", "*", "CheckpointWriter", ")", "UpdateTask", "(", "taskID", "string", ",", "status", "workflowpb", ".", "TaskState", ",", "err", "error", ")", "error", "{", "c", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "mu", ".", ...
// UpdateTask updates the task status in the checkpointing copy and // saves the full checkpoint to the topology server.
[ "UpdateTask", "updates", "the", "task", "status", "in", "the", "checkpointing", "copy", "and", "saves", "the", "full", "checkpoint", "to", "the", "topology", "server", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/checkpoint.go#L51-L64
136,522
vitessio/vitess
go/vt/vttablet/customrule/topocustomrule/topocustomrule.go
activateTopoCustomRules
func activateTopoCustomRules(qsc tabletserver.Controller) { if *rulePath != "" { qsc.RegisterQueryRuleSource(topoCustomRuleSource) cr, err := newTopoCustomRule(qsc, *ruleCell, *rulePath) if err != nil { log.Fatalf("cannot start TopoCustomRule: %v", err) } cr.start() servenv.OnTerm(cr.stop) } }
go
func activateTopoCustomRules(qsc tabletserver.Controller) { if *rulePath != "" { qsc.RegisterQueryRuleSource(topoCustomRuleSource) cr, err := newTopoCustomRule(qsc, *ruleCell, *rulePath) if err != nil { log.Fatalf("cannot start TopoCustomRule: %v", err) } cr.start() servenv.OnTerm(cr.stop) } }
[ "func", "activateTopoCustomRules", "(", "qsc", "tabletserver", ".", "Controller", ")", "{", "if", "*", "rulePath", "!=", "\"", "\"", "{", "qsc", ".", "RegisterQueryRuleSource", "(", "topoCustomRuleSource", ")", "\n\n", "cr", ",", "err", ":=", "newTopoCustomRule"...
// activateTopoCustomRules activates topo dynamic custom rule mechanism.
[ "activateTopoCustomRules", "activates", "topo", "dynamic", "custom", "rule", "mechanism", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/customrule/topocustomrule/topocustomrule.go#L189-L201
136,523
vitessio/vitess
go/vt/vtexplain/vtexplain_vttablet.go
CreateTransaction
func (t *explainTablet) CreateTransaction(ctx context.Context, target *querypb.Target, dtid string, participants []*querypb.Target) (err error) { t.mu.Lock() t.currentTime = batchTime.Wait() t.mu.Unlock() return t.tsv.CreateTransaction(ctx, target, dtid, participants) }
go
func (t *explainTablet) CreateTransaction(ctx context.Context, target *querypb.Target, dtid string, participants []*querypb.Target) (err error) { t.mu.Lock() t.currentTime = batchTime.Wait() t.mu.Unlock() return t.tsv.CreateTransaction(ctx, target, dtid, participants) }
[ "func", "(", "t", "*", "explainTablet", ")", "CreateTransaction", "(", "ctx", "context", ".", "Context", ",", "target", "*", "querypb", ".", "Target", ",", "dtid", "string", ",", "participants", "[", "]", "*", "querypb", ".", "Target", ")", "(", "err", ...
// CreateTransaction is part of the QueryService interface.
[ "CreateTransaction", "is", "part", "of", "the", "QueryService", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtexplain/vtexplain_vttablet.go#L186-L191
136,524
vitessio/vitess
go/vt/vtexplain/vtexplain_vttablet.go
Close
func (t *explainTablet) Close(ctx context.Context) error { return t.tsv.Close(ctx) }
go
func (t *explainTablet) Close(ctx context.Context) error { return t.tsv.Close(ctx) }
[ "func", "(", "t", "*", "explainTablet", ")", "Close", "(", "ctx", "context", ".", "Context", ")", "error", "{", "return", "t", ".", "tsv", ".", "Close", "(", "ctx", ")", "\n", "}" ]
// Close is part of the QueryService interface.
[ "Close", "is", "part", "of", "the", "QueryService", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtexplain/vtexplain_vttablet.go#L261-L263
136,525
vitessio/vitess
go/vt/discovery/topology_watcher.go
NewCellTabletsWatcher
func NewCellTabletsWatcher(ctx context.Context, topoServer *topo.Server, tr TabletRecorder, cell string, refreshInterval time.Duration, refreshKnownTablets bool, topoReadConcurrency int) *TopologyWatcher { return NewTopologyWatcher(ctx, topoServer, tr, cell, refreshInterval, refreshKnownTablets, topoReadConcurrency, f...
go
func NewCellTabletsWatcher(ctx context.Context, topoServer *topo.Server, tr TabletRecorder, cell string, refreshInterval time.Duration, refreshKnownTablets bool, topoReadConcurrency int) *TopologyWatcher { return NewTopologyWatcher(ctx, topoServer, tr, cell, refreshInterval, refreshKnownTablets, topoReadConcurrency, f...
[ "func", "NewCellTabletsWatcher", "(", "ctx", "context", ".", "Context", ",", "topoServer", "*", "topo", ".", "Server", ",", "tr", "TabletRecorder", ",", "cell", "string", ",", "refreshInterval", "time", ".", "Duration", ",", "refreshKnownTablets", "bool", ",", ...
// NewCellTabletsWatcher returns a TopologyWatcher that monitors all // the tablets in a cell, and starts refreshing.
[ "NewCellTabletsWatcher", "returns", "a", "TopologyWatcher", "that", "monitors", "all", "the", "tablets", "in", "a", "cell", "and", "starts", "refreshing", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/topology_watcher.go#L72-L76
136,526
vitessio/vitess
go/vt/discovery/topology_watcher.go
NewTopologyWatcher
func NewTopologyWatcher(ctx context.Context, topoServer *topo.Server, tr TabletRecorder, cell string, refreshInterval time.Duration, refreshKnownTablets bool, topoReadConcurrency int, getTablets func(tw *TopologyWatcher) ([]*topodatapb.TabletAlias, error)) *TopologyWatcher { tw := &TopologyWatcher{ topoServer: ...
go
func NewTopologyWatcher(ctx context.Context, topoServer *topo.Server, tr TabletRecorder, cell string, refreshInterval time.Duration, refreshKnownTablets bool, topoReadConcurrency int, getTablets func(tw *TopologyWatcher) ([]*topodatapb.TabletAlias, error)) *TopologyWatcher { tw := &TopologyWatcher{ topoServer: ...
[ "func", "NewTopologyWatcher", "(", "ctx", "context", ".", "Context", ",", "topoServer", "*", "topo", ".", "Server", ",", "tr", "TabletRecorder", ",", "cell", "string", ",", "refreshInterval", "time", ".", "Duration", ",", "refreshKnownTablets", "bool", ",", "t...
// NewTopologyWatcher returns a TopologyWatcher that monitors all // the tablets in a cell, and starts refreshing.
[ "NewTopologyWatcher", "returns", "a", "TopologyWatcher", "that", "monitors", "all", "the", "tablets", "in", "a", "cell", "and", "starts", "refreshing", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/topology_watcher.go#L141-L160
136,527
vitessio/vitess
go/vt/discovery/topology_watcher.go
RefreshLag
func (tw *TopologyWatcher) RefreshLag() time.Duration { tw.mu.Lock() defer tw.mu.Unlock() return time.Since(tw.lastRefresh) }
go
func (tw *TopologyWatcher) RefreshLag() time.Duration { tw.mu.Lock() defer tw.mu.Unlock() return time.Since(tw.lastRefresh) }
[ "func", "(", "tw", "*", "TopologyWatcher", ")", "RefreshLag", "(", ")", "time", ".", "Duration", "{", "tw", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "tw", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "return", "time", ".", "Since", "(", "t...
// RefreshLag returns the time since the last refresh
[ "RefreshLag", "returns", "the", "time", "since", "the", "last", "refresh" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/topology_watcher.go#L323-L328
136,528
vitessio/vitess
go/vt/discovery/topology_watcher.go
TopoChecksum
func (tw *TopologyWatcher) TopoChecksum() uint32 { tw.mu.Lock() defer tw.mu.Unlock() return tw.topoChecksum }
go
func (tw *TopologyWatcher) TopoChecksum() uint32 { tw.mu.Lock() defer tw.mu.Unlock() return tw.topoChecksum }
[ "func", "(", "tw", "*", "TopologyWatcher", ")", "TopoChecksum", "(", ")", "uint32", "{", "tw", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "tw", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "return", "tw", ".", "topoChecksum", "\n", "}" ]
// TopoChecksum returns the checksum of the current state of the topo
[ "TopoChecksum", "returns", "the", "checksum", "of", "the", "current", "state", "of", "the", "topo" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/topology_watcher.go#L331-L336
136,529
vitessio/vitess
go/vt/discovery/topology_watcher.go
NewFilterByShard
func NewFilterByShard(tr TabletRecorder, filters []string) (*FilterByShard, error) { m := make(map[string][]*filterShard) for _, filter := range filters { parts := strings.Split(filter, "|") if len(parts) != 2 { return nil, fmt.Errorf("invalid FilterByShard parameter: %v", filter) } keyspace := parts[0] ...
go
func NewFilterByShard(tr TabletRecorder, filters []string) (*FilterByShard, error) { m := make(map[string][]*filterShard) for _, filter := range filters { parts := strings.Split(filter, "|") if len(parts) != 2 { return nil, fmt.Errorf("invalid FilterByShard parameter: %v", filter) } keyspace := parts[0] ...
[ "func", "NewFilterByShard", "(", "tr", "TabletRecorder", ",", "filters", "[", "]", "string", ")", "(", "*", "FilterByShard", ",", "error", ")", "{", "m", ":=", "make", "(", "map", "[", "string", "]", "[", "]", "*", "filterShard", ")", "\n", "for", "_...
// NewFilterByShard creates a new FilterByShard on top of an existing // TabletRecorder. Each filter is a keyspace|shard entry, where shard // can either be a shard name, or a keyrange. All tablets that match // at least one keyspace|shard tuple will be forwarded to the // underlying TabletRecorder.
[ "NewFilterByShard", "creates", "a", "new", "FilterByShard", "on", "top", "of", "an", "existing", "TabletRecorder", ".", "Each", "filter", "is", "a", "keyspace|shard", "entry", "where", "shard", "can", "either", "be", "a", "shard", "name", "or", "a", "keyrange"...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/topology_watcher.go#L361-L396
136,530
vitessio/vitess
go/vt/discovery/topology_watcher.go
AddTablet
func (fbs *FilterByShard) AddTablet(tablet *topodatapb.Tablet, name string) { if fbs.isIncluded(tablet) { fbs.tr.AddTablet(tablet, name) } }
go
func (fbs *FilterByShard) AddTablet(tablet *topodatapb.Tablet, name string) { if fbs.isIncluded(tablet) { fbs.tr.AddTablet(tablet, name) } }
[ "func", "(", "fbs", "*", "FilterByShard", ")", "AddTablet", "(", "tablet", "*", "topodatapb", ".", "Tablet", ",", "name", "string", ")", "{", "if", "fbs", ".", "isIncluded", "(", "tablet", ")", "{", "fbs", ".", "tr", ".", "AddTablet", "(", "tablet", ...
// AddTablet is part of the TabletRecorder interface.
[ "AddTablet", "is", "part", "of", "the", "TabletRecorder", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/topology_watcher.go#L399-L403
136,531
vitessio/vitess
go/vt/discovery/topology_watcher.go
RemoveTablet
func (fbs *FilterByShard) RemoveTablet(tablet *topodatapb.Tablet) { if fbs.isIncluded(tablet) { fbs.tr.RemoveTablet(tablet) } }
go
func (fbs *FilterByShard) RemoveTablet(tablet *topodatapb.Tablet) { if fbs.isIncluded(tablet) { fbs.tr.RemoveTablet(tablet) } }
[ "func", "(", "fbs", "*", "FilterByShard", ")", "RemoveTablet", "(", "tablet", "*", "topodatapb", ".", "Tablet", ")", "{", "if", "fbs", ".", "isIncluded", "(", "tablet", ")", "{", "fbs", ".", "tr", ".", "RemoveTablet", "(", "tablet", ")", "\n", "}", "...
// RemoveTablet is part of the TabletRecorder interface.
[ "RemoveTablet", "is", "part", "of", "the", "TabletRecorder", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/topology_watcher.go#L406-L410
136,532
vitessio/vitess
go/vt/discovery/topology_watcher.go
ReplaceTablet
func (fbs *FilterByShard) ReplaceTablet(old, new *topodatapb.Tablet, name string) { if fbs.isIncluded(old) && fbs.isIncluded(new) { fbs.tr.ReplaceTablet(old, new, name) } }
go
func (fbs *FilterByShard) ReplaceTablet(old, new *topodatapb.Tablet, name string) { if fbs.isIncluded(old) && fbs.isIncluded(new) { fbs.tr.ReplaceTablet(old, new, name) } }
[ "func", "(", "fbs", "*", "FilterByShard", ")", "ReplaceTablet", "(", "old", ",", "new", "*", "topodatapb", ".", "Tablet", ",", "name", "string", ")", "{", "if", "fbs", ".", "isIncluded", "(", "old", ")", "&&", "fbs", ".", "isIncluded", "(", "new", ")...
// ReplaceTablet is part of the TabletRecorder interface.
[ "ReplaceTablet", "is", "part", "of", "the", "TabletRecorder", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/topology_watcher.go#L413-L417
136,533
vitessio/vitess
go/vt/discovery/topology_watcher.go
isIncluded
func (fbs *FilterByShard) isIncluded(tablet *topodatapb.Tablet) bool { canonical, kr, err := topo.ValidateShardName(tablet.Shard) if err != nil { log.Errorf("Error parsing shard name %v, will ignore tablet: %v", tablet.Shard, err) return false } for _, c := range fbs.filters[tablet.Keyspace] { if canonical =...
go
func (fbs *FilterByShard) isIncluded(tablet *topodatapb.Tablet) bool { canonical, kr, err := topo.ValidateShardName(tablet.Shard) if err != nil { log.Errorf("Error parsing shard name %v, will ignore tablet: %v", tablet.Shard, err) return false } for _, c := range fbs.filters[tablet.Keyspace] { if canonical =...
[ "func", "(", "fbs", "*", "FilterByShard", ")", "isIncluded", "(", "tablet", "*", "topodatapb", ".", "Tablet", ")", "bool", "{", "canonical", ",", "kr", ",", "err", ":=", "topo", ".", "ValidateShardName", "(", "tablet", ".", "Shard", ")", "\n", "if", "e...
// isIncluded returns true iff the tablet's keyspace and shard should be // forwarded to the underlying TabletRecorder.
[ "isIncluded", "returns", "true", "iff", "the", "tablet", "s", "keyspace", "and", "shard", "should", "be", "forwarded", "to", "the", "underlying", "TabletRecorder", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/topology_watcher.go#L421-L439
136,534
vitessio/vitess
go/vt/vtgate/scatter_conn.go
NewScatterConn
func NewScatterConn(statsName string, txConn *TxConn, gw gateway.Gateway, hc discovery.HealthCheck) *ScatterConn { tabletCallErrorCountStatsName := "" if statsName != "" { tabletCallErrorCountStatsName = statsName + "ErrorCount" } return &ScatterConn{ timings: stats.NewMultiTimings( statsName, "Scatter co...
go
func NewScatterConn(statsName string, txConn *TxConn, gw gateway.Gateway, hc discovery.HealthCheck) *ScatterConn { tabletCallErrorCountStatsName := "" if statsName != "" { tabletCallErrorCountStatsName = statsName + "ErrorCount" } return &ScatterConn{ timings: stats.NewMultiTimings( statsName, "Scatter co...
[ "func", "NewScatterConn", "(", "statsName", "string", ",", "txConn", "*", "TxConn", ",", "gw", "gateway", ".", "Gateway", ",", "hc", "discovery", ".", "HealthCheck", ")", "*", "ScatterConn", "{", "tabletCallErrorCountStatsName", ":=", "\"", "\"", "\n", "if", ...
// NewScatterConn creates a new ScatterConn.
[ "NewScatterConn", "creates", "a", "new", "ScatterConn", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/scatter_conn.go#L76-L94
136,535
vitessio/vitess
go/vt/vtgate/scatter_conn.go
Execute
func (stc *ScatterConn) Execute( ctx context.Context, query string, bindVars map[string]*querypb.BindVariable, rss []*srvtopo.ResolvedShard, tabletType topodatapb.TabletType, session *SafeSession, notInTransaction bool, options *querypb.ExecuteOptions, ) (*sqltypes.Result, error) { // mu protects qr var mu s...
go
func (stc *ScatterConn) Execute( ctx context.Context, query string, bindVars map[string]*querypb.BindVariable, rss []*srvtopo.ResolvedShard, tabletType topodatapb.TabletType, session *SafeSession, notInTransaction bool, options *querypb.ExecuteOptions, ) (*sqltypes.Result, error) { // mu protects qr var mu s...
[ "func", "(", "stc", "*", "ScatterConn", ")", "Execute", "(", "ctx", "context", ".", "Context", ",", "query", "string", ",", "bindVars", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable", ",", "rss", "[", "]", "*", "srvtopo", ".", "Resolved...
// Execute executes a non-streaming query on the specified shards.
[ "Execute", "executes", "a", "non", "-", "streaming", "query", "on", "the", "specified", "shards", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/scatter_conn.go#L120-L165
136,536
vitessio/vitess
go/vt/vtgate/scatter_conn.go
ExecuteMultiShard
func (stc *ScatterConn) ExecuteMultiShard( ctx context.Context, rss []*srvtopo.ResolvedShard, queries []*querypb.BoundQuery, tabletType topodatapb.TabletType, session *SafeSession, notInTransaction bool, autocommit bool, ) (qr *sqltypes.Result, errs []error) { // mu protects qr var mu sync.Mutex qr = new(sql...
go
func (stc *ScatterConn) ExecuteMultiShard( ctx context.Context, rss []*srvtopo.ResolvedShard, queries []*querypb.BoundQuery, tabletType topodatapb.TabletType, session *SafeSession, notInTransaction bool, autocommit bool, ) (qr *sqltypes.Result, errs []error) { // mu protects qr var mu sync.Mutex qr = new(sql...
[ "func", "(", "stc", "*", "ScatterConn", ")", "ExecuteMultiShard", "(", "ctx", "context", ".", "Context", ",", "rss", "[", "]", "*", "srvtopo", ".", "ResolvedShard", ",", "queries", "[", "]", "*", "querypb", ".", "BoundQuery", ",", "tabletType", "topodatapb...
// ExecuteMultiShard is like Execute, // but each shard gets its own Sql Queries and BindVariables. // // It always returns a non-nil query result and an array of // shard errors which may be nil so that callers can optionally // process a partially-successful operation.
[ "ExecuteMultiShard", "is", "like", "Execute", "but", "each", "shard", "gets", "its", "own", "Sql", "Queries", "and", "BindVariables", ".", "It", "always", "returns", "a", "non", "-", "nil", "query", "result", "and", "an", "array", "of", "shard", "errors", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/scatter_conn.go#L173-L223
136,537
vitessio/vitess
go/vt/vtgate/scatter_conn.go
ExecuteBatch
func (stc *ScatterConn) ExecuteBatch( ctx context.Context, batchRequest *scatterBatchRequest, tabletType topodatapb.TabletType, asTransaction bool, session *SafeSession, options *querypb.ExecuteOptions) (qrs []sqltypes.Result, err error) { allErrors := new(concurrency.AllErrorRecorder) results := make([]sqlty...
go
func (stc *ScatterConn) ExecuteBatch( ctx context.Context, batchRequest *scatterBatchRequest, tabletType topodatapb.TabletType, asTransaction bool, session *SafeSession, options *querypb.ExecuteOptions) (qrs []sqltypes.Result, err error) { allErrors := new(concurrency.AllErrorRecorder) results := make([]sqlty...
[ "func", "(", "stc", "*", "ScatterConn", ")", "ExecuteBatch", "(", "ctx", "context", ".", "Context", ",", "batchRequest", "*", "scatterBatchRequest", ",", "tabletType", "topodatapb", ".", "TabletType", ",", "asTransaction", "bool", ",", "session", "*", "SafeSessi...
// ExecuteBatch executes a batch of non-streaming queries on the specified shards.
[ "ExecuteBatch", "executes", "a", "batch", "of", "non", "-", "streaming", "queries", "on", "the", "specified", "shards", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/scatter_conn.go#L362-L422
136,538
vitessio/vitess
go/vt/vtgate/scatter_conn.go
StreamExecute
func (stc *ScatterConn) StreamExecute( ctx context.Context, query string, bindVars map[string]*querypb.BindVariable, rss []*srvtopo.ResolvedShard, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, callback func(reply *sqltypes.Result) error, ) error { // mu protects fieldSent, replyErr and cal...
go
func (stc *ScatterConn) StreamExecute( ctx context.Context, query string, bindVars map[string]*querypb.BindVariable, rss []*srvtopo.ResolvedShard, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, callback func(reply *sqltypes.Result) error, ) error { // mu protects fieldSent, replyErr and cal...
[ "func", "(", "stc", "*", "ScatterConn", ")", "StreamExecute", "(", "ctx", "context", ".", "Context", ",", "query", "string", ",", "bindVars", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable", ",", "rss", "[", "]", "*", "srvtopo", ".", "Re...
// StreamExecute executes a streaming query on vttablet. The retry rules are the same. // Note we guarantee the callback will not be called concurrently // by mutiple go routines, through processOneStreamingResult.
[ "StreamExecute", "executes", "a", "streaming", "query", "on", "vttablet", ".", "The", "retry", "rules", "are", "the", "same", ".", "Note", "we", "guarantee", "the", "callback", "will", "not", "be", "called", "concurrently", "by", "mutiple", "go", "routines", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/scatter_conn.go#L446-L466
136,539
vitessio/vitess
go/vt/vtgate/scatter_conn.go
Reset
func (tt *timeTracker) Reset(target *querypb.Target) { tt.mu.Lock() defer tt.mu.Unlock() delete(tt.timestamps, target) }
go
func (tt *timeTracker) Reset(target *querypb.Target) { tt.mu.Lock() defer tt.mu.Unlock() delete(tt.timestamps, target) }
[ "func", "(", "tt", "*", "timeTracker", ")", "Reset", "(", "target", "*", "querypb", ".", "Target", ")", "{", "tt", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "tt", ".", "mu", ".", "Unlock", "(", ")", "\n", "delete", "(", "tt", ".", "times...
// Reset resets the timestamp set by Record.
[ "Reset", "resets", "the", "timestamp", "set", "by", "Record", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/scatter_conn.go#L508-L512
136,540
vitessio/vitess
go/vt/vtgate/scatter_conn.go
Record
func (tt *timeTracker) Record(target *querypb.Target) time.Time { tt.mu.Lock() defer tt.mu.Unlock() last, ok := tt.timestamps[target] if !ok { last = time.Now() tt.timestamps[target] = last } return last }
go
func (tt *timeTracker) Record(target *querypb.Target) time.Time { tt.mu.Lock() defer tt.mu.Unlock() last, ok := tt.timestamps[target] if !ok { last = time.Now() tt.timestamps[target] = last } return last }
[ "func", "(", "tt", "*", "timeTracker", ")", "Record", "(", "target", "*", "querypb", ".", "Target", ")", "time", ".", "Time", "{", "tt", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "tt", ".", "mu", ".", "Unlock", "(", ")", "\n", "last", ",...
// Record records the time to Now if there was no previous timestamp, // and it keeps returning that value until the next Reset.
[ "Record", "records", "the", "time", "to", "Now", "if", "there", "was", "no", "previous", "timestamp", "and", "it", "keeps", "returning", "that", "value", "until", "the", "next", "Reset", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/scatter_conn.go#L516-L525
136,541
vitessio/vitess
go/vt/vtgate/scatter_conn.go
MessageStream
func (stc *ScatterConn) MessageStream(ctx context.Context, rss []*srvtopo.ResolvedShard, name string, callback func(*sqltypes.Result) error) error { // The cancelable context is used for handling errors // from individual streams. ctx, cancel := context.WithCancel(ctx) defer cancel() // mu is used to merge multip...
go
func (stc *ScatterConn) MessageStream(ctx context.Context, rss []*srvtopo.ResolvedShard, name string, callback func(*sqltypes.Result) error) error { // The cancelable context is used for handling errors // from individual streams. ctx, cancel := context.WithCancel(ctx) defer cancel() // mu is used to merge multip...
[ "func", "(", "stc", "*", "ScatterConn", ")", "MessageStream", "(", "ctx", "context", ".", "Context", ",", "rss", "[", "]", "*", "srvtopo", ".", "ResolvedShard", ",", "name", "string", ",", "callback", "func", "(", "*", "sqltypes", ".", "Result", ")", "...
// MessageStream streams messages from the specified shards. // Note we guarantee the callback will not be called concurrently // by mutiple go routines, through processOneStreamingResult.
[ "MessageStream", "streams", "messages", "from", "the", "specified", "shards", ".", "Note", "we", "guarantee", "the", "callback", "will", "not", "be", "called", "concurrently", "by", "mutiple", "go", "routines", "through", "processOneStreamingResult", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/scatter_conn.go#L530-L580
136,542
vitessio/vitess
go/vt/vtgate/scatter_conn.go
MessageAck
func (stc *ScatterConn) MessageAck(ctx context.Context, rss []*srvtopo.ResolvedShard, values [][]*querypb.Value, name string) (int64, error) { var mu sync.Mutex var totalCount int64 allErrors := stc.multiGo(ctx, "MessageAck", rss, topodatapb.TabletType_MASTER, func(rs *srvtopo.ResolvedShard, i int) error { count, ...
go
func (stc *ScatterConn) MessageAck(ctx context.Context, rss []*srvtopo.ResolvedShard, values [][]*querypb.Value, name string) (int64, error) { var mu sync.Mutex var totalCount int64 allErrors := stc.multiGo(ctx, "MessageAck", rss, topodatapb.TabletType_MASTER, func(rs *srvtopo.ResolvedShard, i int) error { count, ...
[ "func", "(", "stc", "*", "ScatterConn", ")", "MessageAck", "(", "ctx", "context", ".", "Context", ",", "rss", "[", "]", "*", "srvtopo", ".", "ResolvedShard", ",", "values", "[", "]", "[", "]", "*", "querypb", ".", "Value", ",", "name", "string", ")",...
// MessageAck acks messages across multiple shards.
[ "MessageAck", "acks", "messages", "across", "multiple", "shards", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/scatter_conn.go#L583-L597
136,543
vitessio/vitess
go/vt/vtgate/scatter_conn.go
UpdateStream
func (stc *ScatterConn) UpdateStream(ctx context.Context, rs *srvtopo.ResolvedShard, timestamp int64, position string, callback func(*querypb.StreamEvent) error) error { return rs.QueryService.UpdateStream(ctx, rs.Target, position, timestamp, callback) }
go
func (stc *ScatterConn) UpdateStream(ctx context.Context, rs *srvtopo.ResolvedShard, timestamp int64, position string, callback func(*querypb.StreamEvent) error) error { return rs.QueryService.UpdateStream(ctx, rs.Target, position, timestamp, callback) }
[ "func", "(", "stc", "*", "ScatterConn", ")", "UpdateStream", "(", "ctx", "context", ".", "Context", ",", "rs", "*", "srvtopo", ".", "ResolvedShard", ",", "timestamp", "int64", ",", "position", "string", ",", "callback", "func", "(", "*", "querypb", ".", ...
// UpdateStream just sends the query to the ResolvedShard, // and sends the results back.
[ "UpdateStream", "just", "sends", "the", "query", "to", "the", "ResolvedShard", "and", "sends", "the", "results", "back", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/scatter_conn.go#L601-L603
136,544
vitessio/vitess
go/vt/vtgate/scatter_conn.go
shuffleQueryParts
func shuffleQueryParts(splits []*vtgatepb.SplitQueryResponse_Part) { for i := len(splits) - 1; i >= 1; i-- { randIndex := shuffleQueryPartsRandomGenerator.Intn(i + 1) // swap splits[i], splits[randIndex] splits[randIndex], splits[i] = splits[i], splits[randIndex] } }
go
func shuffleQueryParts(splits []*vtgatepb.SplitQueryResponse_Part) { for i := len(splits) - 1; i >= 1; i-- { randIndex := shuffleQueryPartsRandomGenerator.Intn(i + 1) // swap splits[i], splits[randIndex] splits[randIndex], splits[i] = splits[i], splits[randIndex] } }
[ "func", "shuffleQueryParts", "(", "splits", "[", "]", "*", "vtgatepb", ".", "SplitQueryResponse_Part", ")", "{", "for", "i", ":=", "len", "(", "splits", ")", "-", "1", ";", "i", ">=", "1", ";", "i", "--", "{", "randIndex", ":=", "shuffleQueryPartsRandomG...
// shuffleQueryParts performs an in-place shuffle of the given array. // The result is a psuedo-random permutation of the array chosen uniformally // from the space of all permutations.
[ "shuffleQueryParts", "performs", "an", "in", "-", "place", "shuffle", "of", "the", "given", "array", ".", "The", "result", "is", "a", "psuedo", "-", "random", "permutation", "of", "the", "array", "chosen", "uniformally", "from", "the", "space", "of", "all", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/scatter_conn.go#L707-L713
136,545
vitessio/vitess
go/vt/vtgate/scatter_conn.go
multiGo
func (stc *ScatterConn) multiGo( ctx context.Context, name string, rss []*srvtopo.ResolvedShard, tabletType topodatapb.TabletType, action shardActionFunc, ) (allErrors *concurrency.AllErrorRecorder) { allErrors = new(concurrency.AllErrorRecorder) if len(rss) == 0 { return allErrors } oneShard := func(rs *sr...
go
func (stc *ScatterConn) multiGo( ctx context.Context, name string, rss []*srvtopo.ResolvedShard, tabletType topodatapb.TabletType, action shardActionFunc, ) (allErrors *concurrency.AllErrorRecorder) { allErrors = new(concurrency.AllErrorRecorder) if len(rss) == 0 { return allErrors } oneShard := func(rs *sr...
[ "func", "(", "stc", "*", "ScatterConn", ")", "multiGo", "(", "ctx", "context", ".", "Context", ",", "name", "string", ",", "rss", "[", "]", "*", "srvtopo", ".", "ResolvedShard", ",", "tabletType", "topodatapb", ".", "TabletType", ",", "action", "shardActio...
// multiGo performs the requested 'action' on the specified // shards in parallel. This does not handle any transaction state. // The action function must match the shardActionFunc2 signature.
[ "multiGo", "performs", "the", "requested", "action", "on", "the", "specified", "shards", "in", "parallel", ".", "This", "does", "not", "handle", "any", "transaction", "state", ".", "The", "action", "function", "must", "match", "the", "shardActionFunc2", "signatu...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/scatter_conn.go#L728-L763
136,546
vitessio/vitess
go/vt/vttablet/endtoend/framework/eventcatcher.go
Next
func (tc *TxCatcher) Next() (*tabletserver.TxConnection, error) { event, err := tc.catcher.next() if err != nil { return nil, err } return event.(*tabletserver.TxConnection), nil }
go
func (tc *TxCatcher) Next() (*tabletserver.TxConnection, error) { event, err := tc.catcher.next() if err != nil { return nil, err } return event.(*tabletserver.TxConnection), nil }
[ "func", "(", "tc", "*", "TxCatcher", ")", "Next", "(", ")", "(", "*", "tabletserver", ".", "TxConnection", ",", "error", ")", "{", "event", ",", "err", ":=", "tc", ".", "catcher", ".", "next", "(", ")", "\n", "if", "err", "!=", "nil", "{", "retur...
// Next fetches the next captured transaction. // If the wait is longer than one second, it returns an error.
[ "Next", "fetches", "the", "next", "captured", "transaction", ".", "If", "the", "wait", "is", "longer", "than", "one", "second", "it", "returns", "an", "error", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/endtoend/framework/eventcatcher.go#L47-L53
136,547
vitessio/vitess
go/vt/vttablet/endtoend/framework/eventcatcher.go
Next
func (qc *QueryCatcher) Next() (*tabletenv.LogStats, error) { event, err := qc.catcher.next() if err != nil { return nil, err } return event.(*tabletenv.LogStats), nil }
go
func (qc *QueryCatcher) Next() (*tabletenv.LogStats, error) { event, err := qc.catcher.next() if err != nil { return nil, err } return event.(*tabletenv.LogStats), nil }
[ "func", "(", "qc", "*", "QueryCatcher", ")", "Next", "(", ")", "(", "*", "tabletenv", ".", "LogStats", ",", "error", ")", "{", "event", ",", "err", ":=", "qc", ".", "catcher", ".", "next", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", ...
// Next fetches the next captured query. // If the wait is longer than one second, it returns an error.
[ "Next", "fetches", "the", "next", "captured", "query", ".", "If", "the", "wait", "is", "longer", "than", "one", "second", "it", "returns", "an", "error", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/endtoend/framework/eventcatcher.go#L74-L80
136,548
vitessio/vitess
go/vt/vttablet/endtoend/framework/eventcatcher.go
Close
func (catcher *eventCatcher) Close() { catcher.logger.Unsubscribe(catcher.in) close(catcher.in) }
go
func (catcher *eventCatcher) Close() { catcher.logger.Unsubscribe(catcher.in) close(catcher.in) }
[ "func", "(", "catcher", "*", "eventCatcher", ")", "Close", "(", ")", "{", "catcher", ".", "logger", ".", "Unsubscribe", "(", "catcher", ".", "in", ")", "\n", "close", "(", "catcher", ".", "in", ")", "\n", "}" ]
// Close closes the eventCatcher.
[ "Close", "closes", "the", "eventCatcher", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/endtoend/framework/eventcatcher.go#L111-L114
136,549
vitessio/vitess
go/vt/srvtopo/target_stats.go
Subscribe
func (tsm *TargetStatsMultiplexer) Subscribe() (int, <-chan (*TargetStatsEntry)) { i := tsm.nextIndex tsm.nextIndex++ c := make(chan (*TargetStatsEntry), 100) tsm.listeners[i] = c return i, c }
go
func (tsm *TargetStatsMultiplexer) Subscribe() (int, <-chan (*TargetStatsEntry)) { i := tsm.nextIndex tsm.nextIndex++ c := make(chan (*TargetStatsEntry), 100) tsm.listeners[i] = c return i, c }
[ "func", "(", "tsm", "*", "TargetStatsMultiplexer", ")", "Subscribe", "(", ")", "(", "int", ",", "<-", "chan", "(", "*", "TargetStatsEntry", ")", ")", "{", "i", ":=", "tsm", ".", "nextIndex", "\n", "tsm", ".", "nextIndex", "++", "\n", "c", ":=", "make...
// Subscribe adds a channel to the list. // Will change the list.
[ "Subscribe", "adds", "a", "channel", "to", "the", "list", ".", "Will", "change", "the", "list", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/srvtopo/target_stats.go#L78-L84
136,550
vitessio/vitess
go/vt/srvtopo/target_stats.go
Unsubscribe
func (tsm *TargetStatsMultiplexer) Unsubscribe(i int) error { c, ok := tsm.listeners[i] if !ok { return fmt.Errorf("TargetStatsMultiplexer.Unsubscribe(%v): not suc channel", i) } delete(tsm.listeners, i) close(c) return nil }
go
func (tsm *TargetStatsMultiplexer) Unsubscribe(i int) error { c, ok := tsm.listeners[i] if !ok { return fmt.Errorf("TargetStatsMultiplexer.Unsubscribe(%v): not suc channel", i) } delete(tsm.listeners, i) close(c) return nil }
[ "func", "(", "tsm", "*", "TargetStatsMultiplexer", ")", "Unsubscribe", "(", "i", "int", ")", "error", "{", "c", ",", "ok", ":=", "tsm", ".", "listeners", "[", "i", "]", "\n", "if", "!", "ok", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ...
// Unsubscribe removes a channel from the list. // Will change the list.
[ "Unsubscribe", "removes", "a", "channel", "from", "the", "list", ".", "Will", "change", "the", "list", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/srvtopo/target_stats.go#L88-L96
136,551
vitessio/vitess
go/vt/srvtopo/target_stats.go
Broadcast
func (tsm *TargetStatsMultiplexer) Broadcast(tse *TargetStatsEntry) { for _, c := range tsm.listeners { c <- tse } }
go
func (tsm *TargetStatsMultiplexer) Broadcast(tse *TargetStatsEntry) { for _, c := range tsm.listeners { c <- tse } }
[ "func", "(", "tsm", "*", "TargetStatsMultiplexer", ")", "Broadcast", "(", "tse", "*", "TargetStatsEntry", ")", "{", "for", "_", ",", "c", ":=", "range", "tsm", ".", "listeners", "{", "c", "<-", "tse", "\n", "}", "\n", "}" ]
// Broadcast sends an update to the list. // Will read the list.
[ "Broadcast", "sends", "an", "update", "to", "the", "list", ".", "Will", "read", "the", "list", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/srvtopo/target_stats.go#L106-L110
136,552
vitessio/vitess
go/vt/vtexplain/vtexplain.go
MarshalJSON
func (tq *TabletQuery) MarshalJSON() ([]byte, error) { // Convert Bindvars to strings for nicer output bindVars := make(map[string]string) for k, v := range tq.BindVars { var b strings.Builder sqlparser.EncodeValue(&b, v) bindVars[k] = b.String() } return jsonutil.MarshalNoEscape(&struct { Time int ...
go
func (tq *TabletQuery) MarshalJSON() ([]byte, error) { // Convert Bindvars to strings for nicer output bindVars := make(map[string]string) for k, v := range tq.BindVars { var b strings.Builder sqlparser.EncodeValue(&b, v) bindVars[k] = b.String() } return jsonutil.MarshalNoEscape(&struct { Time int ...
[ "func", "(", "tq", "*", "TabletQuery", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "// Convert Bindvars to strings for nicer output", "bindVars", ":=", "make", "(", "map", "[", "string", "]", "string", ")", "\n", "for", "k"...
// MarshalJSON renders the json structure
[ "MarshalJSON", "renders", "the", "json", "structure" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtexplain/vtexplain.go#L104-L122
136,553
vitessio/vitess
go/vt/vtexplain/vtexplain.go
Stop
func Stop() { // Cleanup all created fake dbs. if explainTopo != nil { for _, conn := range explainTopo.TabletConns { conn.tsv.StopService() } for _, conn := range explainTopo.TabletConns { conn.db.Close() } } }
go
func Stop() { // Cleanup all created fake dbs. if explainTopo != nil { for _, conn := range explainTopo.TabletConns { conn.tsv.StopService() } for _, conn := range explainTopo.TabletConns { conn.db.Close() } } }
[ "func", "Stop", "(", ")", "{", "// Cleanup all created fake dbs.", "if", "explainTopo", "!=", "nil", "{", "for", "_", ",", "conn", ":=", "range", "explainTopo", ".", "TabletConns", "{", "conn", ".", "tsv", ".", "StopService", "(", ")", "\n", "}", "\n", "...
// Stop and cleans up fake execution environment
[ "Stop", "and", "cleans", "up", "fake", "execution", "environment" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtexplain/vtexplain.go#L172-L182
136,554
vitessio/vitess
go/vt/vtexplain/vtexplain.go
Run
func Run(sql string) ([]*Explain, error) { explains := make([]*Explain, 0, 16) var ( rem string err error ) for { // Need to strip comments in a loop to handle multiple comments // in a row. for { s := sqlparser.StripLeadingComments(sql) if s == sql { break } sql = s } sql, rem, err...
go
func Run(sql string) ([]*Explain, error) { explains := make([]*Explain, 0, 16) var ( rem string err error ) for { // Need to strip comments in a loop to handle multiple comments // in a row. for { s := sqlparser.StripLeadingComments(sql) if s == sql { break } sql = s } sql, rem, err...
[ "func", "Run", "(", "sql", "string", ")", "(", "[", "]", "*", "Explain", ",", "error", ")", "{", "explains", ":=", "make", "(", "[", "]", "*", "Explain", ",", "0", ",", "16", ")", "\n\n", "var", "(", "rem", "string", "\n", "err", "error", "\n",...
// Run the explain analysis on the given queries
[ "Run", "the", "explain", "analysis", "on", "the", "given", "queries" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtexplain/vtexplain.go#L232-L277
136,555
vitessio/vitess
go/vt/vtexplain/vtexplain.go
ExplainsAsText
func ExplainsAsText(explains []*Explain) string { var b bytes.Buffer for _, explain := range explains { fmt.Fprintf(&b, "----------------------------------------------------------------------\n") fmt.Fprintf(&b, "%s\n\n", explain.SQL) queries := make([]outputQuery, 0, 4) for tablet, actions := range explain....
go
func ExplainsAsText(explains []*Explain) string { var b bytes.Buffer for _, explain := range explains { fmt.Fprintf(&b, "----------------------------------------------------------------------\n") fmt.Fprintf(&b, "%s\n\n", explain.SQL) queries := make([]outputQuery, 0, 4) for tablet, actions := range explain....
[ "func", "ExplainsAsText", "(", "explains", "[", "]", "*", "Explain", ")", "string", "{", "var", "b", "bytes", ".", "Buffer", "\n", "for", "_", ",", "explain", ":=", "range", "explains", "{", "fmt", ".", "Fprintf", "(", "&", "b", ",", "\"", "\\n", "...
// ExplainsAsText returns a text representation of the explains in logical time // order
[ "ExplainsAsText", "returns", "a", "text", "representation", "of", "the", "explains", "in", "logical", "time", "order" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtexplain/vtexplain.go#L300-L333
136,556
vitessio/vitess
go/vt/vtexplain/vtexplain.go
ExplainsAsJSON
func ExplainsAsJSON(explains []*Explain) string { explainJSON, _ := jsonutil.MarshalIndentNoEscape(explains, "", " ") return string(explainJSON) }
go
func ExplainsAsJSON(explains []*Explain) string { explainJSON, _ := jsonutil.MarshalIndentNoEscape(explains, "", " ") return string(explainJSON) }
[ "func", "ExplainsAsJSON", "(", "explains", "[", "]", "*", "Explain", ")", "string", "{", "explainJSON", ",", "_", ":=", "jsonutil", ".", "MarshalIndentNoEscape", "(", "explains", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "return", "string", "(", "expl...
// ExplainsAsJSON returns a json representation of the explains
[ "ExplainsAsJSON", "returns", "a", "json", "representation", "of", "the", "explains" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtexplain/vtexplain.go#L336-L339
136,557
vitessio/vitess
go/vt/vttablet/tabletmanager/replication_reporter.go
Report
func (r *replicationReporter) Report(isSlaveType, shouldQueryServiceBeRunning bool) (time.Duration, error) { if !isSlaveType { return 0, nil } status, statusErr := r.agent.MysqlDaemon.SlaveStatus() if statusErr == mysql.ErrNotSlave || (statusErr == nil && !status.SlaveSQLRunning && !status.SlaveIORunning) { ...
go
func (r *replicationReporter) Report(isSlaveType, shouldQueryServiceBeRunning bool) (time.Duration, error) { if !isSlaveType { return 0, nil } status, statusErr := r.agent.MysqlDaemon.SlaveStatus() if statusErr == mysql.ErrNotSlave || (statusErr == nil && !status.SlaveSQLRunning && !status.SlaveIORunning) { ...
[ "func", "(", "r", "*", "replicationReporter", ")", "Report", "(", "isSlaveType", ",", "shouldQueryServiceBeRunning", "bool", ")", "(", "time", ".", "Duration", ",", "error", ")", "{", "if", "!", "isSlaveType", "{", "return", "0", ",", "nil", "\n", "}", "...
// Report is part of the health.Reporter interface
[ "Report", "is", "part", "of", "the", "health", ".", "Reporter", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/replication_reporter.go#L52-L104
136,558
vitessio/vitess
go/vt/vttablet/tabletmanager/replication_reporter.go
repairReplication
func repairReplication(ctx context.Context, agent *ActionAgent) error { if *mysqlctl.DisableActiveReparents { return fmt.Errorf("can't repair replication with --disable_active_reparents") } ts := agent.TopoServer tablet := agent.Tablet() si, err := ts.GetShard(ctx, tablet.Keyspace, tablet.Shard) if err != nil...
go
func repairReplication(ctx context.Context, agent *ActionAgent) error { if *mysqlctl.DisableActiveReparents { return fmt.Errorf("can't repair replication with --disable_active_reparents") } ts := agent.TopoServer tablet := agent.Tablet() si, err := ts.GetShard(ctx, tablet.Keyspace, tablet.Shard) if err != nil...
[ "func", "repairReplication", "(", "ctx", "context", ".", "Context", ",", "agent", "*", "ActionAgent", ")", "error", "{", "if", "*", "mysqlctl", ".", "DisableActiveReparents", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "...
// repairReplication tries to connect this slave to whoever is // the current master of the shard, and start replicating.
[ "repairReplication", "tries", "to", "connect", "this", "slave", "to", "whoever", "is", "the", "current", "master", "of", "the", "shard", "and", "start", "replicating", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/replication_reporter.go#L113-L148
136,559
vitessio/vitess
go/vt/vtgate/gateway/discoverygateway.go
RegisterStats
func (dg *discoveryGateway) RegisterStats() { stats.NewGaugeDurationFunc( "TopologyWatcherMaxRefreshLag", "maximum time since the topology watcher refreshed a cell", dg.topologyWatcherMaxRefreshLag, ) stats.NewGaugeFunc( "TopologyWatcherChecksum", "crc32 checksum of the topology watcher state", dg.topol...
go
func (dg *discoveryGateway) RegisterStats() { stats.NewGaugeDurationFunc( "TopologyWatcherMaxRefreshLag", "maximum time since the topology watcher refreshed a cell", dg.topologyWatcherMaxRefreshLag, ) stats.NewGaugeFunc( "TopologyWatcherChecksum", "crc32 checksum of the topology watcher state", dg.topol...
[ "func", "(", "dg", "*", "discoveryGateway", ")", "RegisterStats", "(", ")", "{", "stats", ".", "NewGaugeDurationFunc", "(", "\"", "\"", ",", "\"", "\"", ",", "dg", ".", "topologyWatcherMaxRefreshLag", ",", ")", "\n\n", "stats", ".", "NewGaugeFunc", "(", "\...
// RegisterStats registers the stats to export the lag since the last refresh // and the checksum of the topology
[ "RegisterStats", "registers", "the", "stats", "to", "export", "the", "lag", "since", "the", "last", "refresh", "and", "the", "checksum", "of", "the", "topology" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/gateway/discoverygateway.go#L139-L151
136,560
vitessio/vitess
go/vt/vtgate/gateway/discoverygateway.go
topologyWatcherMaxRefreshLag
func (dg *discoveryGateway) topologyWatcherMaxRefreshLag() time.Duration { var lag time.Duration for _, tw := range dg.tabletsWatchers { cellLag := tw.RefreshLag() if cellLag > lag { lag = cellLag } } return lag }
go
func (dg *discoveryGateway) topologyWatcherMaxRefreshLag() time.Duration { var lag time.Duration for _, tw := range dg.tabletsWatchers { cellLag := tw.RefreshLag() if cellLag > lag { lag = cellLag } } return lag }
[ "func", "(", "dg", "*", "discoveryGateway", ")", "topologyWatcherMaxRefreshLag", "(", ")", "time", ".", "Duration", "{", "var", "lag", "time", ".", "Duration", "\n", "for", "_", ",", "tw", ":=", "range", "dg", ".", "tabletsWatchers", "{", "cellLag", ":=", ...
// topologyWatcherMaxRefreshLag returns the maximum lag since the watched // cells were refreshed from the topo server
[ "topologyWatcherMaxRefreshLag", "returns", "the", "maximum", "lag", "since", "the", "watched", "cells", "were", "refreshed", "from", "the", "topo", "server" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/gateway/discoverygateway.go#L155-L164
136,561
vitessio/vitess
go/vt/vtgate/gateway/discoverygateway.go
topologyWatcherChecksum
func (dg *discoveryGateway) topologyWatcherChecksum() int64 { var checksum int64 for _, tw := range dg.tabletsWatchers { checksum = checksum ^ int64(tw.TopoChecksum()) } return checksum }
go
func (dg *discoveryGateway) topologyWatcherChecksum() int64 { var checksum int64 for _, tw := range dg.tabletsWatchers { checksum = checksum ^ int64(tw.TopoChecksum()) } return checksum }
[ "func", "(", "dg", "*", "discoveryGateway", ")", "topologyWatcherChecksum", "(", ")", "int64", "{", "var", "checksum", "int64", "\n", "for", "_", ",", "tw", ":=", "range", "dg", ".", "tabletsWatchers", "{", "checksum", "=", "checksum", "^", "int64", "(", ...
// topologyWatcherChecksum returns a checksum of the topology watcher state
[ "topologyWatcherChecksum", "returns", "a", "checksum", "of", "the", "topology", "watcher", "state" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/gateway/discoverygateway.go#L167-L173
136,562
vitessio/vitess
go/vt/vtgate/gateway/discoverygateway.go
StatsUpdate
func (dg *discoveryGateway) StatsUpdate(ts *discovery.TabletStats) { dg.tsc.StatsUpdate(ts) if ts.Target.TabletType == topodatapb.TabletType_MASTER { dg.buffer.StatsUpdate(ts) } }
go
func (dg *discoveryGateway) StatsUpdate(ts *discovery.TabletStats) { dg.tsc.StatsUpdate(ts) if ts.Target.TabletType == topodatapb.TabletType_MASTER { dg.buffer.StatsUpdate(ts) } }
[ "func", "(", "dg", "*", "discoveryGateway", ")", "StatsUpdate", "(", "ts", "*", "discovery", ".", "TabletStats", ")", "{", "dg", ".", "tsc", ".", "StatsUpdate", "(", "ts", ")", "\n\n", "if", "ts", ".", "Target", ".", "TabletType", "==", "topodatapb", "...
// StatsUpdate forwards HealthCheck updates to TabletStatsCache and MasterBuffer. // It is part of the discovery.HealthCheckStatsListener interface.
[ "StatsUpdate", "forwards", "HealthCheck", "updates", "to", "TabletStatsCache", "and", "MasterBuffer", ".", "It", "is", "part", "of", "the", "discovery", ".", "HealthCheckStatsListener", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/gateway/discoverygateway.go#L177-L183
136,563
vitessio/vitess
go/vt/vtgate/gateway/discoverygateway.go
WaitForTablets
func (dg *discoveryGateway) WaitForTablets(ctx context.Context, tabletTypesToWait []topodatapb.TabletType) error { // Skip waiting for tablets if we are not told to do so. if len(tabletTypesToWait) == 0 { return nil } // Finds the targets to look for. targets, err := srvtopo.FindAllTargets(ctx, dg.srvTopoServer...
go
func (dg *discoveryGateway) WaitForTablets(ctx context.Context, tabletTypesToWait []topodatapb.TabletType) error { // Skip waiting for tablets if we are not told to do so. if len(tabletTypesToWait) == 0 { return nil } // Finds the targets to look for. targets, err := srvtopo.FindAllTargets(ctx, dg.srvTopoServer...
[ "func", "(", "dg", "*", "discoveryGateway", ")", "WaitForTablets", "(", "ctx", "context", ".", "Context", ",", "tabletTypesToWait", "[", "]", "topodatapb", ".", "TabletType", ")", "error", "{", "// Skip waiting for tablets if we are not told to do so.", "if", "len", ...
// WaitForTablets is part of the gateway.Gateway interface.
[ "WaitForTablets", "is", "part", "of", "the", "gateway", ".", "Gateway", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/gateway/discoverygateway.go#L186-L199
136,564
vitessio/vitess
go/vt/vtgate/gateway/discoverygateway.go
GetAggregateStats
func (dg *discoveryGateway) GetAggregateStats(target *querypb.Target) (*querypb.AggregateStats, queryservice.QueryService, error) { stats, err := dg.tsc.GetAggregateStats(target) return stats, dg, err }
go
func (dg *discoveryGateway) GetAggregateStats(target *querypb.Target) (*querypb.AggregateStats, queryservice.QueryService, error) { stats, err := dg.tsc.GetAggregateStats(target) return stats, dg, err }
[ "func", "(", "dg", "*", "discoveryGateway", ")", "GetAggregateStats", "(", "target", "*", "querypb", ".", "Target", ")", "(", "*", "querypb", ".", "AggregateStats", ",", "queryservice", ".", "QueryService", ",", "error", ")", "{", "stats", ",", "err", ":="...
// GetAggregateStats is part of the srvtopo.TargetStats interface.
[ "GetAggregateStats", "is", "part", "of", "the", "srvtopo", ".", "TargetStats", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/gateway/discoverygateway.go#L202-L205
136,565
vitessio/vitess
go/vt/vtgate/gateway/discoverygateway.go
GetMasterCell
func (dg *discoveryGateway) GetMasterCell(keyspace, shard string) (string, queryservice.QueryService, error) { cell, err := dg.tsc.GetMasterCell(keyspace, shard) return cell, dg, err }
go
func (dg *discoveryGateway) GetMasterCell(keyspace, shard string) (string, queryservice.QueryService, error) { cell, err := dg.tsc.GetMasterCell(keyspace, shard) return cell, dg, err }
[ "func", "(", "dg", "*", "discoveryGateway", ")", "GetMasterCell", "(", "keyspace", ",", "shard", "string", ")", "(", "string", ",", "queryservice", ".", "QueryService", ",", "error", ")", "{", "cell", ",", "err", ":=", "dg", ".", "tsc", ".", "GetMasterCe...
// GetMasterCell is part of the srvtopo.TargetStats interface.
[ "GetMasterCell", "is", "part", "of", "the", "srvtopo", ".", "TargetStats", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/gateway/discoverygateway.go#L208-L211
136,566
vitessio/vitess
go/vt/vtgate/gateway/discoverygateway.go
Close
func (dg *discoveryGateway) Close(ctx context.Context) error { dg.buffer.Shutdown() for _, ctw := range dg.tabletsWatchers { ctw.Stop() } return nil }
go
func (dg *discoveryGateway) Close(ctx context.Context) error { dg.buffer.Shutdown() for _, ctw := range dg.tabletsWatchers { ctw.Stop() } return nil }
[ "func", "(", "dg", "*", "discoveryGateway", ")", "Close", "(", "ctx", "context", ".", "Context", ")", "error", "{", "dg", ".", "buffer", ".", "Shutdown", "(", ")", "\n", "for", "_", ",", "ctw", ":=", "range", "dg", ".", "tabletsWatchers", "{", "ctw",...
// Close shuts down underlying connections. // This function hides the inner implementation.
[ "Close", "shuts", "down", "underlying", "connections", ".", "This", "function", "hides", "the", "inner", "implementation", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/gateway/discoverygateway.go#L215-L221
136,567
vitessio/vitess
go/vt/vtgate/gateway/discoverygateway.go
withRetry
func (dg *discoveryGateway) withRetry(ctx context.Context, target *querypb.Target, unused queryservice.QueryService, name string, inTransaction bool, inner func(ctx context.Context, target *querypb.Target, conn queryservice.QueryService) (bool, error)) error { var tabletLastUsed *topodatapb.Tablet var err error inva...
go
func (dg *discoveryGateway) withRetry(ctx context.Context, target *querypb.Target, unused queryservice.QueryService, name string, inTransaction bool, inner func(ctx context.Context, target *querypb.Target, conn queryservice.QueryService) (bool, error)) error { var tabletLastUsed *topodatapb.Tablet var err error inva...
[ "func", "(", "dg", "*", "discoveryGateway", ")", "withRetry", "(", "ctx", "context", ".", "Context", ",", "target", "*", "querypb", ".", "Target", ",", "unused", "queryservice", ".", "QueryService", ",", "name", "string", ",", "inTransaction", "bool", ",", ...
// withRetry gets available connections and executes the action. If there are retryable errors, // it retries retryCount times before failing. It does not retry if the connection is in // the middle of a transaction. While returning the error check if it maybe a result of // a resharding event, and set the re-resolve b...
[ "withRetry", "gets", "available", "connections", "and", "executes", "the", "action", ".", "If", "there", "are", "retryable", "errors", "it", "retries", "retryCount", "times", "before", "failing", ".", "It", "does", "not", "retry", "if", "the", "connection", "i...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/gateway/discoverygateway.go#L241-L331
136,568
vitessio/vitess
go/vt/vttablet/tabletserver/planbuilder/query_gen.go
GenerateFullQuery
func GenerateFullQuery(statement sqlparser.Statement) *sqlparser.ParsedQuery { buf := sqlparser.NewTrackedBuffer(nil) statement.Format(buf) return buf.ParsedQuery() }
go
func GenerateFullQuery(statement sqlparser.Statement) *sqlparser.ParsedQuery { buf := sqlparser.NewTrackedBuffer(nil) statement.Format(buf) return buf.ParsedQuery() }
[ "func", "GenerateFullQuery", "(", "statement", "sqlparser", ".", "Statement", ")", "*", "sqlparser", ".", "ParsedQuery", "{", "buf", ":=", "sqlparser", ".", "NewTrackedBuffer", "(", "nil", ")", "\n", "statement", ".", "Format", "(", "buf", ")", "\n", "return...
// GenerateFullQuery generates the full query from the ast.
[ "GenerateFullQuery", "generates", "the", "full", "query", "from", "the", "ast", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/planbuilder/query_gen.go#L25-L29
136,569
vitessio/vitess
go/vt/vttablet/tabletserver/planbuilder/query_gen.go
GenerateFieldQuery
func GenerateFieldQuery(statement sqlparser.Statement) *sqlparser.ParsedQuery { buf := sqlparser.NewTrackedBuffer(sqlparser.FormatImpossibleQuery).WriteNode(statement) if buf.HasBindVars() { return nil } return buf.ParsedQuery() }
go
func GenerateFieldQuery(statement sqlparser.Statement) *sqlparser.ParsedQuery { buf := sqlparser.NewTrackedBuffer(sqlparser.FormatImpossibleQuery).WriteNode(statement) if buf.HasBindVars() { return nil } return buf.ParsedQuery() }
[ "func", "GenerateFieldQuery", "(", "statement", "sqlparser", ".", "Statement", ")", "*", "sqlparser", ".", "ParsedQuery", "{", "buf", ":=", "sqlparser", ".", "NewTrackedBuffer", "(", "sqlparser", ".", "FormatImpossibleQuery", ")", ".", "WriteNode", "(", "statement...
// GenerateFieldQuery generates a query to just fetch the field info // by adding impossible where clauses as needed.
[ "GenerateFieldQuery", "generates", "a", "query", "to", "just", "fetch", "the", "field", "info", "by", "adding", "impossible", "where", "clauses", "as", "needed", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/planbuilder/query_gen.go#L33-L41
136,570
vitessio/vitess
go/vt/vttablet/tabletserver/planbuilder/query_gen.go
GenerateLimitQuery
func GenerateLimitQuery(selStmt sqlparser.SelectStatement) *sqlparser.ParsedQuery { buf := sqlparser.NewTrackedBuffer(nil) switch sel := selStmt.(type) { case *sqlparser.Select: limit := sel.Limit if limit == nil { sel.Limit = execLimit defer func() { sel.Limit = nil }() } case *sqlparser.Union: ...
go
func GenerateLimitQuery(selStmt sqlparser.SelectStatement) *sqlparser.ParsedQuery { buf := sqlparser.NewTrackedBuffer(nil) switch sel := selStmt.(type) { case *sqlparser.Select: limit := sel.Limit if limit == nil { sel.Limit = execLimit defer func() { sel.Limit = nil }() } case *sqlparser.Union: ...
[ "func", "GenerateLimitQuery", "(", "selStmt", "sqlparser", ".", "SelectStatement", ")", "*", "sqlparser", ".", "ParsedQuery", "{", "buf", ":=", "sqlparser", ".", "NewTrackedBuffer", "(", "nil", ")", "\n", "switch", "sel", ":=", "selStmt", ".", "(", "type", "...
// GenerateLimitQuery generates a select query with a limit clause.
[ "GenerateLimitQuery", "generates", "a", "select", "query", "with", "a", "limit", "clause", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/planbuilder/query_gen.go#L44-L67
136,571
vitessio/vitess
go/vt/vttablet/tabletserver/planbuilder/query_gen.go
GenerateInsertOuterQuery
func GenerateInsertOuterQuery(ins *sqlparser.Insert) *sqlparser.ParsedQuery { buf := sqlparser.NewTrackedBuffer(nil) buf.Myprintf("%s %v%sinto %v%v values %a", ins.Action, ins.Comments, ins.Ignore, ins.Table, ins.Columns, ":#values", ) return buf.ParsedQuery() }
go
func GenerateInsertOuterQuery(ins *sqlparser.Insert) *sqlparser.ParsedQuery { buf := sqlparser.NewTrackedBuffer(nil) buf.Myprintf("%s %v%sinto %v%v values %a", ins.Action, ins.Comments, ins.Ignore, ins.Table, ins.Columns, ":#values", ) return buf.ParsedQuery() }
[ "func", "GenerateInsertOuterQuery", "(", "ins", "*", "sqlparser", ".", "Insert", ")", "*", "sqlparser", ".", "ParsedQuery", "{", "buf", ":=", "sqlparser", ".", "NewTrackedBuffer", "(", "nil", ")", "\n", "buf", ".", "Myprintf", "(", "\"", "\"", ",", "ins", ...
// GenerateInsertOuterQuery generates the outer query for inserts.
[ "GenerateInsertOuterQuery", "generates", "the", "outer", "query", "for", "inserts", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/planbuilder/query_gen.go#L70-L81
136,572
vitessio/vitess
go/vt/vttablet/tabletserver/planbuilder/query_gen.go
GenerateUpdateOuterQuery
func GenerateUpdateOuterQuery(upd *sqlparser.Update, aliased *sqlparser.AliasedTableExpr, formatter sqlparser.NodeFormatter) *sqlparser.ParsedQuery { buf := sqlparser.NewTrackedBuffer(formatter) buf.Myprintf("update %v%v set %v where %a%v", upd.Comments, aliased.RemoveHints(), upd.Exprs, ":#pk", upd.OrderBy) return ...
go
func GenerateUpdateOuterQuery(upd *sqlparser.Update, aliased *sqlparser.AliasedTableExpr, formatter sqlparser.NodeFormatter) *sqlparser.ParsedQuery { buf := sqlparser.NewTrackedBuffer(formatter) buf.Myprintf("update %v%v set %v where %a%v", upd.Comments, aliased.RemoveHints(), upd.Exprs, ":#pk", upd.OrderBy) return ...
[ "func", "GenerateUpdateOuterQuery", "(", "upd", "*", "sqlparser", ".", "Update", ",", "aliased", "*", "sqlparser", ".", "AliasedTableExpr", ",", "formatter", "sqlparser", ".", "NodeFormatter", ")", "*", "sqlparser", ".", "ParsedQuery", "{", "buf", ":=", "sqlpars...
// GenerateUpdateOuterQuery generates the outer query for updates. // If there is no custom formatting needed, formatter can be nil.
[ "GenerateUpdateOuterQuery", "generates", "the", "outer", "query", "for", "updates", ".", "If", "there", "is", "no", "custom", "formatting", "needed", "formatter", "can", "be", "nil", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/planbuilder/query_gen.go#L85-L89
136,573
vitessio/vitess
go/vt/vttablet/tabletserver/planbuilder/query_gen.go
GenerateDeleteOuterQuery
func GenerateDeleteOuterQuery(del *sqlparser.Delete, aliased *sqlparser.AliasedTableExpr) *sqlparser.ParsedQuery { buf := sqlparser.NewTrackedBuffer(nil) buf.Myprintf("delete %vfrom %v where %a%v", del.Comments, aliased.RemoveHints(), ":#pk", del.OrderBy) return buf.ParsedQuery() }
go
func GenerateDeleteOuterQuery(del *sqlparser.Delete, aliased *sqlparser.AliasedTableExpr) *sqlparser.ParsedQuery { buf := sqlparser.NewTrackedBuffer(nil) buf.Myprintf("delete %vfrom %v where %a%v", del.Comments, aliased.RemoveHints(), ":#pk", del.OrderBy) return buf.ParsedQuery() }
[ "func", "GenerateDeleteOuterQuery", "(", "del", "*", "sqlparser", ".", "Delete", ",", "aliased", "*", "sqlparser", ".", "AliasedTableExpr", ")", "*", "sqlparser", ".", "ParsedQuery", "{", "buf", ":=", "sqlparser", ".", "NewTrackedBuffer", "(", "nil", ")", "\n"...
// GenerateDeleteOuterQuery generates the outer query for deletes.
[ "GenerateDeleteOuterQuery", "generates", "the", "outer", "query", "for", "deletes", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/planbuilder/query_gen.go#L92-L96
136,574
vitessio/vitess
go/vt/vttablet/tabletserver/planbuilder/query_gen.go
GenerateUpdateSubquery
func GenerateUpdateSubquery(upd *sqlparser.Update, table *schema.Table, aliased *sqlparser.AliasedTableExpr) *sqlparser.ParsedQuery { return GenerateSubquery( table.Indexes[0].Columns, aliased, upd.Where, upd.OrderBy, upd.Limit, true, ) }
go
func GenerateUpdateSubquery(upd *sqlparser.Update, table *schema.Table, aliased *sqlparser.AliasedTableExpr) *sqlparser.ParsedQuery { return GenerateSubquery( table.Indexes[0].Columns, aliased, upd.Where, upd.OrderBy, upd.Limit, true, ) }
[ "func", "GenerateUpdateSubquery", "(", "upd", "*", "sqlparser", ".", "Update", ",", "table", "*", "schema", ".", "Table", ",", "aliased", "*", "sqlparser", ".", "AliasedTableExpr", ")", "*", "sqlparser", ".", "ParsedQuery", "{", "return", "GenerateSubquery", "...
// GenerateUpdateSubquery generates the subquery for updates.
[ "GenerateUpdateSubquery", "generates", "the", "subquery", "for", "updates", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/planbuilder/query_gen.go#L99-L108
136,575
vitessio/vitess
go/vt/vttablet/tabletserver/planbuilder/query_gen.go
GenerateDeleteSubquery
func GenerateDeleteSubquery(del *sqlparser.Delete, table *schema.Table, aliased *sqlparser.AliasedTableExpr) *sqlparser.ParsedQuery { return GenerateSubquery( table.Indexes[0].Columns, aliased, del.Where, del.OrderBy, del.Limit, true, ) }
go
func GenerateDeleteSubquery(del *sqlparser.Delete, table *schema.Table, aliased *sqlparser.AliasedTableExpr) *sqlparser.ParsedQuery { return GenerateSubquery( table.Indexes[0].Columns, aliased, del.Where, del.OrderBy, del.Limit, true, ) }
[ "func", "GenerateDeleteSubquery", "(", "del", "*", "sqlparser", ".", "Delete", ",", "table", "*", "schema", ".", "Table", ",", "aliased", "*", "sqlparser", ".", "AliasedTableExpr", ")", "*", "sqlparser", ".", "ParsedQuery", "{", "return", "GenerateSubquery", "...
// GenerateDeleteSubquery generates the subquery for deletes.
[ "GenerateDeleteSubquery", "generates", "the", "subquery", "for", "deletes", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/planbuilder/query_gen.go#L111-L120
136,576
vitessio/vitess
go/vt/vttablet/tabletserver/planbuilder/query_gen.go
GenerateSubquery
func GenerateSubquery(columns []sqlparser.ColIdent, table *sqlparser.AliasedTableExpr, where *sqlparser.Where, order sqlparser.OrderBy, limit *sqlparser.Limit, forUpdate bool) *sqlparser.ParsedQuery { buf := sqlparser.NewTrackedBuffer(nil) if limit == nil { limit = execLimit } buf.WriteString("select ") prefix :...
go
func GenerateSubquery(columns []sqlparser.ColIdent, table *sqlparser.AliasedTableExpr, where *sqlparser.Where, order sqlparser.OrderBy, limit *sqlparser.Limit, forUpdate bool) *sqlparser.ParsedQuery { buf := sqlparser.NewTrackedBuffer(nil) if limit == nil { limit = execLimit } buf.WriteString("select ") prefix :...
[ "func", "GenerateSubquery", "(", "columns", "[", "]", "sqlparser", ".", "ColIdent", ",", "table", "*", "sqlparser", ".", "AliasedTableExpr", ",", "where", "*", "sqlparser", ".", "Where", ",", "order", "sqlparser", ".", "OrderBy", ",", "limit", "*", "sqlparse...
// GenerateSubquery generates a subquery based on the input parameters.
[ "GenerateSubquery", "generates", "a", "subquery", "based", "on", "the", "input", "parameters", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/planbuilder/query_gen.go#L123-L139
136,577
vitessio/vitess
go/vt/grpcclient/snappy.go
Compress
func (s SnappyCompressor) Compress(w io.Writer) (io.WriteCloser, error) { return snappy.NewBufferedWriter(w), nil }
go
func (s SnappyCompressor) Compress(w io.Writer) (io.WriteCloser, error) { return snappy.NewBufferedWriter(w), nil }
[ "func", "(", "s", "SnappyCompressor", ")", "Compress", "(", "w", "io", ".", "Writer", ")", "(", "io", ".", "WriteCloser", ",", "error", ")", "{", "return", "snappy", ".", "NewBufferedWriter", "(", "w", ")", ",", "nil", "\n", "}" ]
// Compress wraps with a SnappyReader
[ "Compress", "wraps", "with", "a", "SnappyReader" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/grpcclient/snappy.go#L25-L27
136,578
vitessio/vitess
go/vt/grpcclient/snappy.go
Decompress
func (s SnappyCompressor) Decompress(r io.Reader) (io.Reader, error) { return snappy.NewReader(r), nil }
go
func (s SnappyCompressor) Decompress(r io.Reader) (io.Reader, error) { return snappy.NewReader(r), nil }
[ "func", "(", "s", "SnappyCompressor", ")", "Decompress", "(", "r", "io", ".", "Reader", ")", "(", "io", ".", "Reader", ",", "error", ")", "{", "return", "snappy", ".", "NewReader", "(", "r", ")", ",", "nil", "\n", "}" ]
// Decompress wraps with a SnappyReader
[ "Decompress", "wraps", "with", "a", "SnappyReader" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/grpcclient/snappy.go#L30-L32
136,579
vitessio/vitess
go/vt/servenv/service_map.go
updateServiceMap
func updateServiceMap() { for _, s := range serviceMapFlag { if s[0] == '-' { delete(serviceMap, s[1:]) } else { serviceMap[s] = true } } }
go
func updateServiceMap() { for _, s := range serviceMapFlag { if s[0] == '-' { delete(serviceMap, s[1:]) } else { serviceMap[s] = true } } }
[ "func", "updateServiceMap", "(", ")", "{", "for", "_", ",", "s", ":=", "range", "serviceMapFlag", "{", "if", "s", "[", "0", "]", "==", "'-'", "{", "delete", "(", "serviceMap", ",", "s", "[", "1", ":", "]", ")", "\n", "}", "else", "{", "serviceMap...
// updateServiceMap takes the command line parameter, and updates the // ServiceMap accordingly
[ "updateServiceMap", "takes", "the", "command", "line", "parameter", "and", "updates", "the", "ServiceMap", "accordingly" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/servenv/service_map.go#L50-L58
136,580
vitessio/vitess
go/vt/topo/tablet.go
IsTrivialTypeChange
func IsTrivialTypeChange(oldTabletType, newTabletType topodatapb.TabletType) bool { switch oldTabletType { case topodatapb.TabletType_REPLICA, topodatapb.TabletType_RDONLY, topodatapb.TabletType_SPARE, topodatapb.TabletType_BACKUP, topodatapb.TabletType_EXPERIMENTAL, topodatapb.TabletType_DRAINED: switch newTabletT...
go
func IsTrivialTypeChange(oldTabletType, newTabletType topodatapb.TabletType) bool { switch oldTabletType { case topodatapb.TabletType_REPLICA, topodatapb.TabletType_RDONLY, topodatapb.TabletType_SPARE, topodatapb.TabletType_BACKUP, topodatapb.TabletType_EXPERIMENTAL, topodatapb.TabletType_DRAINED: switch newTabletT...
[ "func", "IsTrivialTypeChange", "(", "oldTabletType", ",", "newTabletType", "topodatapb", ".", "TabletType", ")", "bool", "{", "switch", "oldTabletType", "{", "case", "topodatapb", ".", "TabletType_REPLICA", ",", "topodatapb", ".", "TabletType_RDONLY", ",", "topodatapb...
// IsTrivialTypeChange returns if this db type be trivially reassigned // without changes to the replication graph
[ "IsTrivialTypeChange", "returns", "if", "this", "db", "type", "be", "trivially", "reassigned", "without", "changes", "to", "the", "replication", "graph" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/tablet.go#L41-L55
136,581
vitessio/vitess
go/vt/topo/tablet.go
IsInServingGraph
func IsInServingGraph(tt topodatapb.TabletType) bool { switch tt { case topodatapb.TabletType_MASTER, topodatapb.TabletType_REPLICA, topodatapb.TabletType_RDONLY: return true } return false }
go
func IsInServingGraph(tt topodatapb.TabletType) bool { switch tt { case topodatapb.TabletType_MASTER, topodatapb.TabletType_REPLICA, topodatapb.TabletType_RDONLY: return true } return false }
[ "func", "IsInServingGraph", "(", "tt", "topodatapb", ".", "TabletType", ")", "bool", "{", "switch", "tt", "{", "case", "topodatapb", ".", "TabletType_MASTER", ",", "topodatapb", ".", "TabletType_REPLICA", ",", "topodatapb", ".", "TabletType_RDONLY", ":", "return",...
// IsInServingGraph returns if a tablet appears in the serving graph
[ "IsInServingGraph", "returns", "if", "a", "tablet", "appears", "in", "the", "serving", "graph" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/tablet.go#L58-L64
136,582
vitessio/vitess
go/vt/topo/tablet.go
IsRunningQueryService
func IsRunningQueryService(tt topodatapb.TabletType) bool { switch tt { case topodatapb.TabletType_MASTER, topodatapb.TabletType_REPLICA, topodatapb.TabletType_RDONLY, topodatapb.TabletType_EXPERIMENTAL, topodatapb.TabletType_DRAINED: return true } return false }
go
func IsRunningQueryService(tt topodatapb.TabletType) bool { switch tt { case topodatapb.TabletType_MASTER, topodatapb.TabletType_REPLICA, topodatapb.TabletType_RDONLY, topodatapb.TabletType_EXPERIMENTAL, topodatapb.TabletType_DRAINED: return true } return false }
[ "func", "IsRunningQueryService", "(", "tt", "topodatapb", ".", "TabletType", ")", "bool", "{", "switch", "tt", "{", "case", "topodatapb", ".", "TabletType_MASTER", ",", "topodatapb", ".", "TabletType_REPLICA", ",", "topodatapb", ".", "TabletType_RDONLY", ",", "top...
// IsRunningQueryService returns if a tablet is running the query service
[ "IsRunningQueryService", "returns", "if", "a", "tablet", "is", "running", "the", "query", "service" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/tablet.go#L67-L73
136,583
vitessio/vitess
go/vt/topo/tablet.go
NewTablet
func NewTablet(uid uint32, cell, host string) *topodatapb.Tablet { return &topodatapb.Tablet{ Alias: &topodatapb.TabletAlias{ Cell: cell, Uid: uid, }, Hostname: host, PortMap: make(map[string]int32), } }
go
func NewTablet(uid uint32, cell, host string) *topodatapb.Tablet { return &topodatapb.Tablet{ Alias: &topodatapb.TabletAlias{ Cell: cell, Uid: uid, }, Hostname: host, PortMap: make(map[string]int32), } }
[ "func", "NewTablet", "(", "uid", "uint32", ",", "cell", ",", "host", "string", ")", "*", "topodatapb", ".", "Tablet", "{", "return", "&", "topodatapb", ".", "Tablet", "{", "Alias", ":", "&", "topodatapb", ".", "TabletAlias", "{", "Cell", ":", "cell", "...
// NewTablet create a new Tablet record with the given id, cell, and hostname.
[ "NewTablet", "create", "a", "new", "Tablet", "record", "with", "the", "given", "id", "cell", "and", "hostname", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/tablet.go#L121-L130
136,584
vitessio/vitess
go/vt/topo/tablet.go
String
func (ti *TabletInfo) String() string { return fmt.Sprintf("Tablet{%v}", topoproto.TabletAliasString(ti.Alias)) }
go
func (ti *TabletInfo) String() string { return fmt.Sprintf("Tablet{%v}", topoproto.TabletAliasString(ti.Alias)) }
[ "func", "(", "ti", "*", "TabletInfo", ")", "String", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "topoproto", ".", "TabletAliasString", "(", "ti", ".", "Alias", ")", ")", "\n", "}" ]
// String returns a string describing the tablet.
[ "String", "returns", "a", "string", "describing", "the", "tablet", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/tablet.go#L169-L171
136,585
vitessio/vitess
go/vt/topo/tablet.go
NewTabletInfo
func NewTabletInfo(tablet *topodatapb.Tablet, version Version) *TabletInfo { return &TabletInfo{version: version, Tablet: tablet} }
go
func NewTabletInfo(tablet *topodatapb.Tablet, version Version) *TabletInfo { return &TabletInfo{version: version, Tablet: tablet} }
[ "func", "NewTabletInfo", "(", "tablet", "*", "topodatapb", ".", "Tablet", ",", "version", "Version", ")", "*", "TabletInfo", "{", "return", "&", "TabletInfo", "{", "version", ":", "version", ",", "Tablet", ":", "tablet", "}", "\n", "}" ]
// NewTabletInfo returns a TabletInfo basing on tablet with the // version set. This function should be only used by Server // implementations.
[ "NewTabletInfo", "returns", "a", "TabletInfo", "basing", "on", "tablet", "with", "the", "version", "set", ".", "This", "function", "should", "be", "only", "used", "by", "Server", "implementations", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/tablet.go#L213-L215
136,586
vitessio/vitess
go/vt/topo/tablet.go
GetTablet
func (ts *Server) GetTablet(ctx context.Context, alias *topodatapb.TabletAlias) (*TabletInfo, error) { conn, err := ts.ConnForCell(ctx, alias.Cell) if err != nil { return nil, err } span, ctx := trace.NewSpan(ctx, "TopoServer.GetTablet") span.Annotate("tablet", topoproto.TabletAliasString(alias)) defer span.Fi...
go
func (ts *Server) GetTablet(ctx context.Context, alias *topodatapb.TabletAlias) (*TabletInfo, error) { conn, err := ts.ConnForCell(ctx, alias.Cell) if err != nil { return nil, err } span, ctx := trace.NewSpan(ctx, "TopoServer.GetTablet") span.Annotate("tablet", topoproto.TabletAliasString(alias)) defer span.Fi...
[ "func", "(", "ts", "*", "Server", ")", "GetTablet", "(", "ctx", "context", ".", "Context", ",", "alias", "*", "topodatapb", ".", "TabletAlias", ")", "(", "*", "TabletInfo", ",", "error", ")", "{", "conn", ",", "err", ":=", "ts", ".", "ConnForCell", "...
// GetTablet is a high level function to read tablet data. // It generates trace spans.
[ "GetTablet", "is", "a", "high", "level", "function", "to", "read", "tablet", "data", ".", "It", "generates", "trace", "spans", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/tablet.go#L219-L243
136,587
vitessio/vitess
go/vt/topo/tablet.go
UpdateTablet
func (ts *Server) UpdateTablet(ctx context.Context, ti *TabletInfo) error { conn, err := ts.ConnForCell(ctx, ti.Tablet.Alias.Cell) if err != nil { return err } span, ctx := trace.NewSpan(ctx, "TopoServer.UpdateTablet") span.Annotate("tablet", topoproto.TabletAliasString(ti.Alias)) defer span.Finish() data, e...
go
func (ts *Server) UpdateTablet(ctx context.Context, ti *TabletInfo) error { conn, err := ts.ConnForCell(ctx, ti.Tablet.Alias.Cell) if err != nil { return err } span, ctx := trace.NewSpan(ctx, "TopoServer.UpdateTablet") span.Annotate("tablet", topoproto.TabletAliasString(ti.Alias)) defer span.Finish() data, e...
[ "func", "(", "ts", "*", "Server", ")", "UpdateTablet", "(", "ctx", "context", ".", "Context", ",", "ti", "*", "TabletInfo", ")", "error", "{", "conn", ",", "err", ":=", "ts", ".", "ConnForCell", "(", "ctx", ",", "ti", ".", "Tablet", ".", "Alias", "...
// UpdateTablet updates the tablet data only - not associated replication paths. // It also uses a span, and sends the event.
[ "UpdateTablet", "updates", "the", "tablet", "data", "only", "-", "not", "associated", "replication", "paths", ".", "It", "also", "uses", "a", "span", "and", "sends", "the", "event", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/tablet.go#L247-L273
136,588
vitessio/vitess
go/vt/topo/tablet.go
UpdateTabletFields
func (ts *Server) UpdateTabletFields(ctx context.Context, alias *topodatapb.TabletAlias, update func(*topodatapb.Tablet) error) (*topodatapb.Tablet, error) { span, ctx := trace.NewSpan(ctx, "TopoServer.UpdateTabletFields") span.Annotate("tablet", topoproto.TabletAliasString(alias)) defer span.Finish() for { ti, ...
go
func (ts *Server) UpdateTabletFields(ctx context.Context, alias *topodatapb.TabletAlias, update func(*topodatapb.Tablet) error) (*topodatapb.Tablet, error) { span, ctx := trace.NewSpan(ctx, "TopoServer.UpdateTabletFields") span.Annotate("tablet", topoproto.TabletAliasString(alias)) defer span.Finish() for { ti, ...
[ "func", "(", "ts", "*", "Server", ")", "UpdateTabletFields", "(", "ctx", "context", ".", "Context", ",", "alias", "*", "topodatapb", ".", "TabletAlias", ",", "update", "func", "(", "*", "topodatapb", ".", "Tablet", ")", "error", ")", "(", "*", "topodatap...
// UpdateTabletFields is a high level helper to read a tablet record, call an // update function on it, and then write it back. If the write fails due to // a version mismatch, it will re-read the record and retry the update. // If the update succeeds, it returns the updated tablet. // If the update method returns ErrN...
[ "UpdateTabletFields", "is", "a", "high", "level", "helper", "to", "read", "a", "tablet", "record", "call", "an", "update", "function", "on", "it", "and", "then", "write", "it", "back", ".", "If", "the", "write", "fails", "due", "to", "a", "version", "mis...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/tablet.go#L281-L301
136,589
vitessio/vitess
go/vt/topo/tablet.go
Validate
func Validate(ctx context.Context, ts *Server, tabletAlias *topodatapb.TabletAlias) error { // read the tablet record, make sure it parses tablet, err := ts.GetTablet(ctx, tabletAlias) if err != nil { return err } if !topoproto.TabletAliasEqual(tablet.Alias, tabletAlias) { return vterrors.Errorf(vtrpc.Code_INV...
go
func Validate(ctx context.Context, ts *Server, tabletAlias *topodatapb.TabletAlias) error { // read the tablet record, make sure it parses tablet, err := ts.GetTablet(ctx, tabletAlias) if err != nil { return err } if !topoproto.TabletAliasEqual(tablet.Alias, tabletAlias) { return vterrors.Errorf(vtrpc.Code_INV...
[ "func", "Validate", "(", "ctx", "context", ".", "Context", ",", "ts", "*", "Server", ",", "tabletAlias", "*", "topodatapb", ".", "TabletAlias", ")", "error", "{", "// read the tablet record, make sure it parses", "tablet", ",", "err", ":=", "ts", ".", "GetTablet...
// Validate makes sure a tablet is represented correctly in the topology server.
[ "Validate", "makes", "sure", "a", "tablet", "is", "represented", "correctly", "in", "the", "topology", "server", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/tablet.go#L304-L325
136,590
vitessio/vitess
go/vt/topo/tablet.go
CreateTablet
func (ts *Server) CreateTablet(ctx context.Context, tablet *topodatapb.Tablet) error { conn, err := ts.ConnForCell(ctx, tablet.Alias.Cell) if err != nil { return err } data, err := proto.Marshal(tablet) if err != nil { return err } tabletPath := path.Join(TabletsPath, topoproto.TabletAliasString(tablet.Alia...
go
func (ts *Server) CreateTablet(ctx context.Context, tablet *topodatapb.Tablet) error { conn, err := ts.ConnForCell(ctx, tablet.Alias.Cell) if err != nil { return err } data, err := proto.Marshal(tablet) if err != nil { return err } tabletPath := path.Join(TabletsPath, topoproto.TabletAliasString(tablet.Alia...
[ "func", "(", "ts", "*", "Server", ")", "CreateTablet", "(", "ctx", "context", ".", "Context", ",", "tablet", "*", "topodatapb", ".", "Tablet", ")", "error", "{", "conn", ",", "err", ":=", "ts", ".", "ConnForCell", "(", "ctx", ",", "tablet", ".", "Ali...
// CreateTablet creates a new tablet and all associated paths for the // replication graph.
[ "CreateTablet", "creates", "a", "new", "tablet", "and", "all", "associated", "paths", "for", "the", "replication", "graph", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/tablet.go#L329-L355
136,591
vitessio/vitess
go/vt/topo/tablet.go
DeleteTablet
func (ts *Server) DeleteTablet(ctx context.Context, tabletAlias *topodatapb.TabletAlias) error { conn, err := ts.ConnForCell(ctx, tabletAlias.Cell) if err != nil { return err } // get the current tablet record, if any, to log the deletion ti, tErr := ts.GetTablet(ctx, tabletAlias) tabletPath := path.Join(Tabl...
go
func (ts *Server) DeleteTablet(ctx context.Context, tabletAlias *topodatapb.TabletAlias) error { conn, err := ts.ConnForCell(ctx, tabletAlias.Cell) if err != nil { return err } // get the current tablet record, if any, to log the deletion ti, tErr := ts.GetTablet(ctx, tabletAlias) tabletPath := path.Join(Tabl...
[ "func", "(", "ts", "*", "Server", ")", "DeleteTablet", "(", "ctx", "context", ".", "Context", ",", "tabletAlias", "*", "topodatapb", ".", "TabletAlias", ")", "error", "{", "conn", ",", "err", ":=", "ts", ".", "ConnForCell", "(", "ctx", ",", "tabletAlias"...
// DeleteTablet wraps the underlying conn.Delete // and dispatches the event.
[ "DeleteTablet", "wraps", "the", "underlying", "conn", ".", "Delete", "and", "dispatches", "the", "event", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/tablet.go#L359-L386
136,592
vitessio/vitess
go/vt/topo/tablet.go
UpdateTabletReplicationData
func UpdateTabletReplicationData(ctx context.Context, ts *Server, tablet *topodatapb.Tablet) error { return UpdateShardReplicationRecord(ctx, ts, tablet.Keyspace, tablet.Shard, tablet.Alias) }
go
func UpdateTabletReplicationData(ctx context.Context, ts *Server, tablet *topodatapb.Tablet) error { return UpdateShardReplicationRecord(ctx, ts, tablet.Keyspace, tablet.Shard, tablet.Alias) }
[ "func", "UpdateTabletReplicationData", "(", "ctx", "context", ".", "Context", ",", "ts", "*", "Server", ",", "tablet", "*", "topodatapb", ".", "Tablet", ")", "error", "{", "return", "UpdateShardReplicationRecord", "(", "ctx", ",", "ts", ",", "tablet", ".", "...
// UpdateTabletReplicationData creates or updates the replication // graph data for a tablet
[ "UpdateTabletReplicationData", "creates", "or", "updates", "the", "replication", "graph", "data", "for", "a", "tablet" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/tablet.go#L390-L392
136,593
vitessio/vitess
go/vt/topo/tablet.go
DeleteTabletReplicationData
func DeleteTabletReplicationData(ctx context.Context, ts *Server, tablet *topodatapb.Tablet) error { return RemoveShardReplicationRecord(ctx, ts, tablet.Alias.Cell, tablet.Keyspace, tablet.Shard, tablet.Alias) }
go
func DeleteTabletReplicationData(ctx context.Context, ts *Server, tablet *topodatapb.Tablet) error { return RemoveShardReplicationRecord(ctx, ts, tablet.Alias.Cell, tablet.Keyspace, tablet.Shard, tablet.Alias) }
[ "func", "DeleteTabletReplicationData", "(", "ctx", "context", ".", "Context", ",", "ts", "*", "Server", ",", "tablet", "*", "topodatapb", ".", "Tablet", ")", "error", "{", "return", "RemoveShardReplicationRecord", "(", "ctx", ",", "ts", ",", "tablet", ".", "...
// DeleteTabletReplicationData deletes replication data.
[ "DeleteTabletReplicationData", "deletes", "replication", "data", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/tablet.go#L395-L397
136,594
vitessio/vitess
go/vt/vttablet/tabletserver/tx_pool.go
NewTxPool
func NewTxPool( prefix string, capacity int, foundRowsCapacity int, timeout time.Duration, idleTimeout time.Duration, waiterCap int, checker connpool.MySQLChecker, limiter txlimiter.TxLimiter) *TxPool { axp := &TxPool{ conns: connpool.New(prefix+"TransactionPool", capacity, idleTimeout, checker), f...
go
func NewTxPool( prefix string, capacity int, foundRowsCapacity int, timeout time.Duration, idleTimeout time.Duration, waiterCap int, checker connpool.MySQLChecker, limiter txlimiter.TxLimiter) *TxPool { axp := &TxPool{ conns: connpool.New(prefix+"TransactionPool", capacity, idleTimeout, checker), f...
[ "func", "NewTxPool", "(", "prefix", "string", ",", "capacity", "int", ",", "foundRowsCapacity", "int", ",", "timeout", "time", ".", "Duration", ",", "idleTimeout", "time", ".", "Duration", ",", "waiterCap", "int", ",", "checker", "connpool", ".", "MySQLChecker...
// NewTxPool creates a new TxPool. It's not operational until it's Open'd.
[ "NewTxPool", "creates", "a", "new", "TxPool", ".", "It", "s", "not", "operational", "until", "it", "s", "Open", "d", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tx_pool.go#L106-L134
136,595
vitessio/vitess
go/vt/vttablet/tabletserver/tx_pool.go
Open
func (axp *TxPool) Open(appParams, dbaParams, appDebugParams *mysql.ConnParams) { log.Infof("Starting transaction id: %d", axp.lastID) axp.conns.Open(appParams, dbaParams, appDebugParams) foundRowsParam := *appParams foundRowsParam.EnableClientFoundRows() axp.foundRowsPool.Open(&foundRowsParam, dbaParams, appDebug...
go
func (axp *TxPool) Open(appParams, dbaParams, appDebugParams *mysql.ConnParams) { log.Infof("Starting transaction id: %d", axp.lastID) axp.conns.Open(appParams, dbaParams, appDebugParams) foundRowsParam := *appParams foundRowsParam.EnableClientFoundRows() axp.foundRowsPool.Open(&foundRowsParam, dbaParams, appDebug...
[ "func", "(", "axp", "*", "TxPool", ")", "Open", "(", "appParams", ",", "dbaParams", ",", "appDebugParams", "*", "mysql", ".", "ConnParams", ")", "{", "log", ".", "Infof", "(", "\"", "\"", ",", "axp", ".", "lastID", ")", "\n", "axp", ".", "conns", "...
// Open makes the TxPool operational. This also starts the transaction killer // that will kill long-running transactions.
[ "Open", "makes", "the", "TxPool", "operational", ".", "This", "also", "starts", "the", "transaction", "killer", "that", "will", "kill", "long", "-", "running", "transactions", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tx_pool.go#L138-L145
136,596
vitessio/vitess
go/vt/vttablet/tabletserver/tx_pool.go
Close
func (axp *TxPool) Close() { axp.ticks.Stop() for _, v := range axp.activePool.GetOutdated(time.Duration(0), "for closing") { conn := v.(*TxConnection) log.Warningf("killing transaction for shutdown: %s", conn.Format(nil)) tabletenv.InternalErrors.Add("StrayTransactions", 1) conn.Close() conn.conclude(TxClo...
go
func (axp *TxPool) Close() { axp.ticks.Stop() for _, v := range axp.activePool.GetOutdated(time.Duration(0), "for closing") { conn := v.(*TxConnection) log.Warningf("killing transaction for shutdown: %s", conn.Format(nil)) tabletenv.InternalErrors.Add("StrayTransactions", 1) conn.Close() conn.conclude(TxClo...
[ "func", "(", "axp", "*", "TxPool", ")", "Close", "(", ")", "{", "axp", ".", "ticks", ".", "Stop", "(", ")", "\n", "for", "_", ",", "v", ":=", "range", "axp", ".", "activePool", ".", "GetOutdated", "(", "time", ".", "Duration", "(", "0", ")", ",...
// Close closes the TxPool. A closed pool can be reopened.
[ "Close", "closes", "the", "TxPool", ".", "A", "closed", "pool", "can", "be", "reopened", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tx_pool.go#L148-L159
136,597
vitessio/vitess
go/vt/vttablet/tabletserver/tx_pool.go
AdjustLastID
func (axp *TxPool) AdjustLastID(id int64) { if current := axp.lastID.Get(); current < id { log.Infof("Adjusting transaction id to: %d", id) axp.lastID.Set(id) } }
go
func (axp *TxPool) AdjustLastID(id int64) { if current := axp.lastID.Get(); current < id { log.Infof("Adjusting transaction id to: %d", id) axp.lastID.Set(id) } }
[ "func", "(", "axp", "*", "TxPool", ")", "AdjustLastID", "(", "id", "int64", ")", "{", "if", "current", ":=", "axp", ".", "lastID", ".", "Get", "(", ")", ";", "current", "<", "id", "{", "log", ".", "Infof", "(", "\"", "\"", ",", "id", ")", "\n",...
// AdjustLastID adjusts the last transaction id to be at least // as large as the input value. This will ensure that there are // no dtid collisions with future transactions.
[ "AdjustLastID", "adjusts", "the", "last", "transaction", "id", "to", "be", "at", "least", "as", "large", "as", "the", "input", "value", ".", "This", "will", "ensure", "that", "there", "are", "no", "dtid", "collisions", "with", "future", "transactions", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tx_pool.go#L164-L169
136,598
vitessio/vitess
go/vt/vttablet/tabletserver/tx_pool.go
RollbackNonBusy
func (axp *TxPool) RollbackNonBusy(ctx context.Context) { for _, v := range axp.activePool.GetOutdated(time.Duration(0), "for transition") { axp.LocalConclude(ctx, v.(*TxConnection)) } }
go
func (axp *TxPool) RollbackNonBusy(ctx context.Context) { for _, v := range axp.activePool.GetOutdated(time.Duration(0), "for transition") { axp.LocalConclude(ctx, v.(*TxConnection)) } }
[ "func", "(", "axp", "*", "TxPool", ")", "RollbackNonBusy", "(", "ctx", "context", ".", "Context", ")", "{", "for", "_", ",", "v", ":=", "range", "axp", ".", "activePool", ".", "GetOutdated", "(", "time", ".", "Duration", "(", "0", ")", ",", "\"", "...
// RollbackNonBusy rolls back all transactions that are not in use. // Transactions can be in use for situations like executing statements // or in prepared state.
[ "RollbackNonBusy", "rolls", "back", "all", "transactions", "that", "are", "not", "in", "use", ".", "Transactions", "can", "be", "in", "use", "for", "situations", "like", "executing", "statements", "or", "in", "prepared", "state", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tx_pool.go#L174-L178
136,599
vitessio/vitess
go/vt/vttablet/tabletserver/tx_pool.go
Get
func (axp *TxPool) Get(transactionID int64, reason string) (*TxConnection, error) { v, err := axp.activePool.Get(transactionID, reason) if err != nil { return nil, vterrors.Errorf(vtrpcpb.Code_ABORTED, "transaction %d: %v", transactionID, err) } return v.(*TxConnection), nil }
go
func (axp *TxPool) Get(transactionID int64, reason string) (*TxConnection, error) { v, err := axp.activePool.Get(transactionID, reason) if err != nil { return nil, vterrors.Errorf(vtrpcpb.Code_ABORTED, "transaction %d: %v", transactionID, err) } return v.(*TxConnection), nil }
[ "func", "(", "axp", "*", "TxPool", ")", "Get", "(", "transactionID", "int64", ",", "reason", "string", ")", "(", "*", "TxConnection", ",", "error", ")", "{", "v", ",", "err", ":=", "axp", ".", "activePool", ".", "Get", "(", "transactionID", ",", "rea...
// Get fetches the connection associated to the transactionID. // You must call Recycle on TxConnection once done.
[ "Get", "fetches", "the", "connection", "associated", "to", "the", "transactionID", ".", "You", "must", "call", "Recycle", "on", "TxConnection", "once", "done", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tx_pool.go#L311-L317