repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
partition
stringclasses
1 value
vitessio/vitess
go/vt/vtgate/planbuilder/insert.go
swapBindVariables
func swapBindVariables(rows sqlparser.Values, colNum int, baseName string) (sqltypes.PlanValue, error) { pv := sqltypes.PlanValue{} for rowNum, row := range rows { innerpv, err := sqlparser.NewPlanValue(row[colNum]) if err != nil { return pv, fmt.Errorf("could not compute value for vindex or auto-inc column: %...
go
func swapBindVariables(rows sqlparser.Values, colNum int, baseName string) (sqltypes.PlanValue, error) { pv := sqltypes.PlanValue{} for rowNum, row := range rows { innerpv, err := sqlparser.NewPlanValue(row[colNum]) if err != nil { return pv, fmt.Errorf("could not compute value for vindex or auto-inc column: %...
[ "func", "swapBindVariables", "(", "rows", "sqlparser", ".", "Values", ",", "colNum", "int", ",", "baseName", "string", ")", "(", "sqltypes", ".", "PlanValue", ",", "error", ")", "{", "pv", ":=", "sqltypes", ".", "PlanValue", "{", "}", "\n", "for", "rowNu...
// swapBindVariables swaps in bind variable names at the specified // column position in the AST values and returns the converted values back. // Bind variable names are generated using baseName.
[ "swapBindVariables", "swaps", "in", "bind", "variable", "names", "at", "the", "specified", "column", "position", "in", "the", "AST", "values", "and", "returns", "the", "converted", "values", "back", ".", "Bind", "variable", "names", "are", "generated", "using", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/insert.go#L209-L220
train
vitessio/vitess
go/vt/vtgate/planbuilder/insert.go
findOrAddColumn
func findOrAddColumn(ins *sqlparser.Insert, col sqlparser.ColIdent) int { for i, column := range ins.Columns { if col.Equal(column) { return i } } ins.Columns = append(ins.Columns, col) rows := ins.Rows.(sqlparser.Values) for i := range rows { rows[i] = append(rows[i], &sqlparser.NullVal{}) } return len...
go
func findOrAddColumn(ins *sqlparser.Insert, col sqlparser.ColIdent) int { for i, column := range ins.Columns { if col.Equal(column) { return i } } ins.Columns = append(ins.Columns, col) rows := ins.Rows.(sqlparser.Values) for i := range rows { rows[i] = append(rows[i], &sqlparser.NullVal{}) } return len...
[ "func", "findOrAddColumn", "(", "ins", "*", "sqlparser", ".", "Insert", ",", "col", "sqlparser", ".", "ColIdent", ")", "int", "{", "for", "i", ",", "column", ":=", "range", "ins", ".", "Columns", "{", "if", "col", ".", "Equal", "(", "column", ")", "{...
// findOrAddColumn finds the position of a column in the insert. If it's // absent it appends it to the with NULL values and returns that position.
[ "findOrAddColumn", "finds", "the", "position", "of", "a", "column", "in", "the", "insert", ".", "If", "it", "s", "absent", "it", "appends", "it", "to", "the", "with", "NULL", "values", "and", "returns", "that", "position", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/insert.go#L224-L236
train
vitessio/vitess
go/vt/vtgate/planbuilder/insert.go
isVindexChanging
func isVindexChanging(setClauses sqlparser.UpdateExprs, colVindexes []*vindexes.ColumnVindex) bool { for _, assignment := range setClauses { for _, vcol := range colVindexes { for _, col := range vcol.Columns { if col.Equal(assignment.Name.Name) { valueExpr, isValuesFuncExpr := assignment.Expr.(*sqlparse...
go
func isVindexChanging(setClauses sqlparser.UpdateExprs, colVindexes []*vindexes.ColumnVindex) bool { for _, assignment := range setClauses { for _, vcol := range colVindexes { for _, col := range vcol.Columns { if col.Equal(assignment.Name.Name) { valueExpr, isValuesFuncExpr := assignment.Expr.(*sqlparse...
[ "func", "isVindexChanging", "(", "setClauses", "sqlparser", ".", "UpdateExprs", ",", "colVindexes", "[", "]", "*", "vindexes", ".", "ColumnVindex", ")", "bool", "{", "for", "_", ",", "assignment", ":=", "range", "setClauses", "{", "for", "_", ",", "vcol", ...
// isVindexChanging returns true if any of the update // expressions modify a vindex column.
[ "isVindexChanging", "returns", "true", "if", "any", "of", "the", "update", "expressions", "modify", "a", "vindex", "column", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/insert.go#L240-L258
train
vitessio/vitess
go/vt/hook/hook.go
NewHook
func NewHook(name string, params []string) *Hook { return &Hook{Name: name, Parameters: params} }
go
func NewHook(name string, params []string) *Hook { return &Hook{Name: name, Parameters: params} }
[ "func", "NewHook", "(", "name", "string", ",", "params", "[", "]", "string", ")", "*", "Hook", "{", "return", "&", "Hook", "{", "Name", ":", "name", ",", "Parameters", ":", "params", "}", "\n", "}" ]
// NewHook returns a Hook object with the provided name and params.
[ "NewHook", "returns", "a", "Hook", "object", "with", "the", "provided", "name", "and", "params", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/hook/hook.go#L79-L81
train
vitessio/vitess
go/vt/hook/hook.go
NewHookWithEnv
func NewHookWithEnv(name string, params []string, env map[string]string) *Hook { return &Hook{Name: name, Parameters: params, ExtraEnv: env} }
go
func NewHookWithEnv(name string, params []string, env map[string]string) *Hook { return &Hook{Name: name, Parameters: params, ExtraEnv: env} }
[ "func", "NewHookWithEnv", "(", "name", "string", ",", "params", "[", "]", "string", ",", "env", "map", "[", "string", "]", "string", ")", "*", "Hook", "{", "return", "&", "Hook", "{", "Name", ":", "name", ",", "Parameters", ":", "params", ",", "Extra...
// NewHookWithEnv returns a Hook object with the provided name, params and ExtraEnv.
[ "NewHookWithEnv", "returns", "a", "Hook", "object", "with", "the", "provided", "name", "params", "and", "ExtraEnv", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/hook/hook.go#L89-L91
train
vitessio/vitess
go/vt/hook/hook.go
findHook
func (hook *Hook) findHook() (*exec.Cmd, int, error) { // Check the hook path. if strings.Contains(hook.Name, "/") { return nil, HOOK_INVALID_NAME, fmt.Errorf("hook cannot contain '/'") } // Find our root. root, err := vtenv.VtRoot() if err != nil { return nil, HOOK_VTROOT_ERROR, fmt.Errorf("cannot get VTROO...
go
func (hook *Hook) findHook() (*exec.Cmd, int, error) { // Check the hook path. if strings.Contains(hook.Name, "/") { return nil, HOOK_INVALID_NAME, fmt.Errorf("hook cannot contain '/'") } // Find our root. root, err := vtenv.VtRoot() if err != nil { return nil, HOOK_VTROOT_ERROR, fmt.Errorf("cannot get VTROO...
[ "func", "(", "hook", "*", "Hook", ")", "findHook", "(", ")", "(", "*", "exec", ".", "Cmd", ",", "int", ",", "error", ")", "{", "// Check the hook path.", "if", "strings", ".", "Contains", "(", "hook", ".", "Name", ",", "\"", "\"", ")", "{", "return...
// findHook trie to locate the hook, and returns the exec.Cmd for it.
[ "findHook", "trie", "to", "locate", "the", "hook", "and", "returns", "the", "exec", ".", "Cmd", "for", "it", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/hook/hook.go#L94-L128
train
vitessio/vitess
go/vt/hook/hook.go
Execute
func (hook *Hook) Execute() (result *HookResult) { result = &HookResult{} // Find the hook. cmd, status, err := hook.findHook() if err != nil { result.ExitStatus = status result.Stderr = err.Error() + "\n" return result } // Run it. var stdout, stderr bytes.Buffer cmd.Stdout = &stdout cmd.Stderr = &std...
go
func (hook *Hook) Execute() (result *HookResult) { result = &HookResult{} // Find the hook. cmd, status, err := hook.findHook() if err != nil { result.ExitStatus = status result.Stderr = err.Error() + "\n" return result } // Run it. var stdout, stderr bytes.Buffer cmd.Stdout = &stdout cmd.Stderr = &std...
[ "func", "(", "hook", "*", "Hook", ")", "Execute", "(", ")", "(", "result", "*", "HookResult", ")", "{", "result", "=", "&", "HookResult", "{", "}", "\n\n", "// Find the hook.", "cmd", ",", "status", ",", "err", ":=", "hook", ".", "findHook", "(", ")"...
// Execute tries to execute the Hook and returns a HookResult.
[ "Execute", "tries", "to", "execute", "the", "Hook", "and", "returns", "a", "HookResult", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/hook/hook.go#L131-L163
train
vitessio/vitess
go/vt/hook/hook.go
ExecuteOptional
func (hook *Hook) ExecuteOptional() error { hr := hook.Execute() switch hr.ExitStatus { case HOOK_DOES_NOT_EXIST: log.Infof("%v hook doesn't exist", hook.Name) case HOOK_VTROOT_ERROR: log.Infof("VTROOT not set, so %v hook doesn't exist", hook.Name) case HOOK_SUCCESS: // nothing to do here default: return ...
go
func (hook *Hook) ExecuteOptional() error { hr := hook.Execute() switch hr.ExitStatus { case HOOK_DOES_NOT_EXIST: log.Infof("%v hook doesn't exist", hook.Name) case HOOK_VTROOT_ERROR: log.Infof("VTROOT not set, so %v hook doesn't exist", hook.Name) case HOOK_SUCCESS: // nothing to do here default: return ...
[ "func", "(", "hook", "*", "Hook", ")", "ExecuteOptional", "(", ")", "error", "{", "hr", ":=", "hook", ".", "Execute", "(", ")", "\n", "switch", "hr", ".", "ExitStatus", "{", "case", "HOOK_DOES_NOT_EXIST", ":", "log", ".", "Infof", "(", "\"", "\"", ",...
// ExecuteOptional executes an optional hook, logs if it doesn't // exist, and returns a printable error.
[ "ExecuteOptional", "executes", "an", "optional", "hook", "logs", "if", "it", "doesn", "t", "exist", "and", "returns", "a", "printable", "error", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/hook/hook.go#L167-L180
train
vitessio/vitess
go/vt/hook/hook.go
String
func (hr *HookResult) String() string { result := "result: " switch hr.ExitStatus { case HOOK_SUCCESS: result += "HOOK_SUCCESS" case HOOK_DOES_NOT_EXIST: result += "HOOK_DOES_NOT_EXIST" case HOOK_STAT_FAILED: result += "HOOK_STAT_FAILED" case HOOK_CANNOT_GET_EXIT_STATUS: result += "HOOK_CANNOT_GET_EXIT_ST...
go
func (hr *HookResult) String() string { result := "result: " switch hr.ExitStatus { case HOOK_SUCCESS: result += "HOOK_SUCCESS" case HOOK_DOES_NOT_EXIST: result += "HOOK_DOES_NOT_EXIST" case HOOK_STAT_FAILED: result += "HOOK_STAT_FAILED" case HOOK_CANNOT_GET_EXIT_STATUS: result += "HOOK_CANNOT_GET_EXIT_ST...
[ "func", "(", "hr", "*", "HookResult", ")", "String", "(", ")", "string", "{", "result", ":=", "\"", "\"", "\n", "switch", "hr", ".", "ExitStatus", "{", "case", "HOOK_SUCCESS", ":", "result", "+=", "\"", "\"", "\n", "case", "HOOK_DOES_NOT_EXIST", ":", "...
// String returns a printable version of the HookResult
[ "String", "returns", "a", "printable", "version", "of", "the", "HookResult" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/hook/hook.go#L261-L286
train
vitessio/vitess
go/vt/vttablet/tabletmanager/state_change.go
loadBlacklistRules
func (agent *ActionAgent) loadBlacklistRules(tablet *topodatapb.Tablet, blacklistedTables []string) (err error) { blacklistRules := rules.New() if len(blacklistedTables) > 0 { // tables, first resolve wildcards tables, err := mysqlctl.ResolveTables(agent.MysqlDaemon, topoproto.TabletDbName(tablet), blacklistedTab...
go
func (agent *ActionAgent) loadBlacklistRules(tablet *topodatapb.Tablet, blacklistedTables []string) (err error) { blacklistRules := rules.New() if len(blacklistedTables) > 0 { // tables, first resolve wildcards tables, err := mysqlctl.ResolveTables(agent.MysqlDaemon, topoproto.TabletDbName(tablet), blacklistedTab...
[ "func", "(", "agent", "*", "ActionAgent", ")", "loadBlacklistRules", "(", "tablet", "*", "topodatapb", ".", "Tablet", ",", "blacklistedTables", "[", "]", "string", ")", "(", "err", "error", ")", "{", "blacklistRules", ":=", "rules", ".", "New", "(", ")", ...
// loadBlacklistRules loads and builds the blacklist query rules
[ "loadBlacklistRules", "loads", "and", "builds", "the", "blacklist", "query", "rules" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/state_change.go#L60-L86
train
vitessio/vitess
go/vt/vttablet/tabletmanager/state_change.go
lameduck
func (agent *ActionAgent) lameduck(reason string) { log.Infof("Agent is entering lameduck, reason: %v", reason) agent.QueryServiceControl.EnterLameduck() agent.broadcastHealth() time.Sleep(*gracePeriod) log.Infof("Agent is leaving lameduck") }
go
func (agent *ActionAgent) lameduck(reason string) { log.Infof("Agent is entering lameduck, reason: %v", reason) agent.QueryServiceControl.EnterLameduck() agent.broadcastHealth() time.Sleep(*gracePeriod) log.Infof("Agent is leaving lameduck") }
[ "func", "(", "agent", "*", "ActionAgent", ")", "lameduck", "(", "reason", "string", ")", "{", "log", ".", "Infof", "(", "\"", "\"", ",", "reason", ")", "\n", "agent", ".", "QueryServiceControl", ".", "EnterLameduck", "(", ")", "\n", "agent", ".", "broa...
// lameduck changes the QueryServiceControl state to lameduck, // brodcasts the new health, then sleep for grace period, to give time // to clients to get the new status.
[ "lameduck", "changes", "the", "QueryServiceControl", "state", "to", "lameduck", "brodcasts", "the", "new", "health", "then", "sleep", "for", "grace", "period", "to", "give", "time", "to", "clients", "to", "get", "the", "new", "status", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/state_change.go#L91-L97
train
vitessio/vitess
go/vt/vttablet/tabletmanager/state_change.go
refreshTablet
func (agent *ActionAgent) refreshTablet(ctx context.Context, reason string) error { agent.checkLock() log.Infof("Executing post-action state refresh: %v", reason) span, ctx := trace.NewSpan(ctx, "ActionAgent.refreshTablet") span.Annotate("reason", reason) defer span.Finish() // Actions should have side effects ...
go
func (agent *ActionAgent) refreshTablet(ctx context.Context, reason string) error { agent.checkLock() log.Infof("Executing post-action state refresh: %v", reason) span, ctx := trace.NewSpan(ctx, "ActionAgent.refreshTablet") span.Annotate("reason", reason) defer span.Finish() // Actions should have side effects ...
[ "func", "(", "agent", "*", "ActionAgent", ")", "refreshTablet", "(", "ctx", "context", ".", "Context", ",", "reason", "string", ")", "error", "{", "agent", ".", "checkLock", "(", ")", "\n", "log", ".", "Infof", "(", "\"", "\"", ",", "reason", ")", "\...
// refreshTablet needs to be run after an action may have changed the current // state of the tablet.
[ "refreshTablet", "needs", "to", "be", "run", "after", "an", "action", "may", "have", "changed", "the", "current", "state", "of", "the", "tablet", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/state_change.go#L132-L160
train
vitessio/vitess
go/vt/vttablet/tabletmanager/state_change.go
updateState
func (agent *ActionAgent) updateState(ctx context.Context, newTablet *topodatapb.Tablet, reason string) { oldTablet := agent.Tablet() if oldTablet == nil { oldTablet = &topodatapb.Tablet{} } log.Infof("Running tablet callback because: %v", reason) agent.changeCallback(ctx, oldTablet, newTablet) agent.setTablet(...
go
func (agent *ActionAgent) updateState(ctx context.Context, newTablet *topodatapb.Tablet, reason string) { oldTablet := agent.Tablet() if oldTablet == nil { oldTablet = &topodatapb.Tablet{} } log.Infof("Running tablet callback because: %v", reason) agent.changeCallback(ctx, oldTablet, newTablet) agent.setTablet(...
[ "func", "(", "agent", "*", "ActionAgent", ")", "updateState", "(", "ctx", "context", ".", "Context", ",", "newTablet", "*", "topodatapb", ".", "Tablet", ",", "reason", "string", ")", "{", "oldTablet", ":=", "agent", ".", "Tablet", "(", ")", "\n", "if", ...
// updateState will use the provided tablet record as the new tablet state, // the current tablet as a base, run changeCallback, and dispatch the event.
[ "updateState", "will", "use", "the", "provided", "tablet", "record", "as", "the", "new", "tablet", "state", "the", "current", "tablet", "as", "a", "base", "run", "changeCallback", "and", "dispatch", "the", "event", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/state_change.go#L164-L177
train
vitessio/vitess
go/sqltypes/result.go
Repair
func (result *Result) Repair(fields []*querypb.Field) { // Usage of j is intentional. for j, f := range fields { for _, r := range result.Rows { if r[j].typ != Null { r[j].typ = f.Type } } } }
go
func (result *Result) Repair(fields []*querypb.Field) { // Usage of j is intentional. for j, f := range fields { for _, r := range result.Rows { if r[j].typ != Null { r[j].typ = f.Type } } } }
[ "func", "(", "result", "*", "Result", ")", "Repair", "(", "fields", "[", "]", "*", "querypb", ".", "Field", ")", "{", "// Usage of j is intentional.", "for", "j", ",", "f", ":=", "range", "fields", "{", "for", "_", ",", "r", ":=", "range", "result", ...
// Repair fixes the type info in the rows // to conform to the supplied field types.
[ "Repair", "fixes", "the", "type", "info", "in", "the", "rows", "to", "conform", "to", "the", "supplied", "field", "types", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/result.go#L45-L54
train
vitessio/vitess
go/sqltypes/result.go
Copy
func (result *Result) Copy() *Result { out := &Result{ InsertID: result.InsertID, RowsAffected: result.RowsAffected, } if result.Fields != nil { fieldsp := make([]*querypb.Field, len(result.Fields)) fields := make([]querypb.Field, len(result.Fields)) for i, f := range result.Fields { fields[i] = *f ...
go
func (result *Result) Copy() *Result { out := &Result{ InsertID: result.InsertID, RowsAffected: result.RowsAffected, } if result.Fields != nil { fieldsp := make([]*querypb.Field, len(result.Fields)) fields := make([]querypb.Field, len(result.Fields)) for i, f := range result.Fields { fields[i] = *f ...
[ "func", "(", "result", "*", "Result", ")", "Copy", "(", ")", "*", "Result", "{", "out", ":=", "&", "Result", "{", "InsertID", ":", "result", ".", "InsertID", ",", "RowsAffected", ":", "result", ".", "RowsAffected", ",", "}", "\n", "if", "result", "."...
// Copy creates a deep copy of Result.
[ "Copy", "creates", "a", "deep", "copy", "of", "Result", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/result.go#L57-L90
train
vitessio/vitess
go/sqltypes/result.go
CopyRow
func CopyRow(r []Value) []Value { // The raw bytes of the values are supposed to be treated as read-only. // So, there's no need to copy them. out := make([]Value, len(r)) copy(out, r) return out }
go
func CopyRow(r []Value) []Value { // The raw bytes of the values are supposed to be treated as read-only. // So, there's no need to copy them. out := make([]Value, len(r)) copy(out, r) return out }
[ "func", "CopyRow", "(", "r", "[", "]", "Value", ")", "[", "]", "Value", "{", "// The raw bytes of the values are supposed to be treated as read-only.", "// So, there's no need to copy them.", "out", ":=", "make", "(", "[", "]", "Value", ",", "len", "(", "r", ")", ...
// CopyRow makes a copy of the row.
[ "CopyRow", "makes", "a", "copy", "of", "the", "row", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/result.go#L93-L99
train
vitessio/vitess
go/sqltypes/result.go
Truncate
func (result *Result) Truncate(l int) *Result { if l == 0 { return result } out := &Result{ InsertID: result.InsertID, RowsAffected: result.RowsAffected, } if result.Fields != nil { out.Fields = result.Fields[:l] } if result.Rows != nil { out.Rows = make([][]Value, 0, len(result.Rows)) for _, r ...
go
func (result *Result) Truncate(l int) *Result { if l == 0 { return result } out := &Result{ InsertID: result.InsertID, RowsAffected: result.RowsAffected, } if result.Fields != nil { out.Fields = result.Fields[:l] } if result.Rows != nil { out.Rows = make([][]Value, 0, len(result.Rows)) for _, r ...
[ "func", "(", "result", "*", "Result", ")", "Truncate", "(", "l", "int", ")", "*", "Result", "{", "if", "l", "==", "0", "{", "return", "result", "\n", "}", "\n\n", "out", ":=", "&", "Result", "{", "InsertID", ":", "result", ".", "InsertID", ",", "...
// Truncate returns a new Result with all the rows truncated // to the specified number of columns.
[ "Truncate", "returns", "a", "new", "Result", "with", "all", "the", "rows", "truncated", "to", "the", "specified", "number", "of", "columns", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/result.go#L103-L134
train
vitessio/vitess
go/sqltypes/result.go
FieldsEqual
func FieldsEqual(f1, f2 []*querypb.Field) bool { if len(f1) != len(f2) { return false } for i, f := range f1 { if !proto.Equal(f, f2[i]) { return false } } return true }
go
func FieldsEqual(f1, f2 []*querypb.Field) bool { if len(f1) != len(f2) { return false } for i, f := range f1 { if !proto.Equal(f, f2[i]) { return false } } return true }
[ "func", "FieldsEqual", "(", "f1", ",", "f2", "[", "]", "*", "querypb", ".", "Field", ")", "bool", "{", "if", "len", "(", "f1", ")", "!=", "len", "(", "f2", ")", "{", "return", "false", "\n", "}", "\n", "for", "i", ",", "f", ":=", "range", "f1...
// FieldsEqual compares two arrays of fields. // reflect.DeepEqual shouldn't be used because of the protos.
[ "FieldsEqual", "compares", "two", "arrays", "of", "fields", ".", "reflect", ".", "DeepEqual", "shouldn", "t", "be", "used", "because", "of", "the", "protos", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/result.go#L138-L148
train
vitessio/vitess
go/sqltypes/result.go
Equal
func (result *Result) Equal(other *Result) bool { // Check for nil cases if result == nil { return other == nil } if other == nil { return false } // Compare Fields, RowsAffected, InsertID, Rows, Extras. return FieldsEqual(result.Fields, other.Fields) && result.RowsAffected == other.RowsAffected && resu...
go
func (result *Result) Equal(other *Result) bool { // Check for nil cases if result == nil { return other == nil } if other == nil { return false } // Compare Fields, RowsAffected, InsertID, Rows, Extras. return FieldsEqual(result.Fields, other.Fields) && result.RowsAffected == other.RowsAffected && resu...
[ "func", "(", "result", "*", "Result", ")", "Equal", "(", "other", "*", "Result", ")", "bool", "{", "// Check for nil cases", "if", "result", "==", "nil", "{", "return", "other", "==", "nil", "\n", "}", "\n", "if", "other", "==", "nil", "{", "return", ...
// Equal compares the Result with another one. // reflect.DeepEqual shouldn't be used because of the protos.
[ "Equal", "compares", "the", "Result", "with", "another", "one", ".", "reflect", ".", "DeepEqual", "shouldn", "t", "be", "used", "because", "of", "the", "protos", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/result.go#L152-L167
train
vitessio/vitess
go/sqltypes/result.go
ResultsEqual
func ResultsEqual(r1, r2 []Result) bool { if len(r1) != len(r2) { return false } for i, r := range r1 { if !r.Equal(&r2[i]) { return false } } return true }
go
func ResultsEqual(r1, r2 []Result) bool { if len(r1) != len(r2) { return false } for i, r := range r1 { if !r.Equal(&r2[i]) { return false } } return true }
[ "func", "ResultsEqual", "(", "r1", ",", "r2", "[", "]", "Result", ")", "bool", "{", "if", "len", "(", "r1", ")", "!=", "len", "(", "r2", ")", "{", "return", "false", "\n", "}", "\n", "for", "i", ",", "r", ":=", "range", "r1", "{", "if", "!", ...
// ResultsEqual compares two arrays of Result. // reflect.DeepEqual shouldn't be used because of the protos.
[ "ResultsEqual", "compares", "two", "arrays", "of", "Result", ".", "reflect", ".", "DeepEqual", "shouldn", "t", "be", "used", "because", "of", "the", "protos", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/result.go#L171-L181
train
vitessio/vitess
go/sqltypes/result.go
IncludeFieldsOrDefault
func IncludeFieldsOrDefault(options *querypb.ExecuteOptions) querypb.ExecuteOptions_IncludedFields { if options == nil { return querypb.ExecuteOptions_TYPE_AND_NAME } return options.IncludedFields }
go
func IncludeFieldsOrDefault(options *querypb.ExecuteOptions) querypb.ExecuteOptions_IncludedFields { if options == nil { return querypb.ExecuteOptions_TYPE_AND_NAME } return options.IncludedFields }
[ "func", "IncludeFieldsOrDefault", "(", "options", "*", "querypb", ".", "ExecuteOptions", ")", "querypb", ".", "ExecuteOptions_IncludedFields", "{", "if", "options", "==", "nil", "{", "return", "querypb", ".", "ExecuteOptions_TYPE_AND_NAME", "\n", "}", "\n\n", "retur...
// IncludeFieldsOrDefault normalizes the passed Execution Options. // It returns the default value if options is nil.
[ "IncludeFieldsOrDefault", "normalizes", "the", "passed", "Execution", "Options", ".", "It", "returns", "the", "default", "value", "if", "options", "is", "nil", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/result.go#L202-L208
train
vitessio/vitess
go/sqltypes/result.go
StripMetadata
func (result *Result) StripMetadata(incl querypb.ExecuteOptions_IncludedFields) *Result { if incl == querypb.ExecuteOptions_ALL || len(result.Fields) == 0 { return result } r := *result r.Fields = make([]*querypb.Field, len(result.Fields)) newFieldsArray := make([]querypb.Field, len(result.Fields)) for i, f := ...
go
func (result *Result) StripMetadata(incl querypb.ExecuteOptions_IncludedFields) *Result { if incl == querypb.ExecuteOptions_ALL || len(result.Fields) == 0 { return result } r := *result r.Fields = make([]*querypb.Field, len(result.Fields)) newFieldsArray := make([]querypb.Field, len(result.Fields)) for i, f := ...
[ "func", "(", "result", "*", "Result", ")", "StripMetadata", "(", "incl", "querypb", ".", "ExecuteOptions_IncludedFields", ")", "*", "Result", "{", "if", "incl", "==", "querypb", ".", "ExecuteOptions_ALL", "||", "len", "(", "result", ".", "Fields", ")", "==",...
// StripMetadata will return a new Result that has the same Rows, // but the Field objects will have their non-critical metadata emptied. Note we don't // proto.Copy each Field for performance reasons, but we only copy the // individual fields.
[ "StripMetadata", "will", "return", "a", "new", "Result", "that", "has", "the", "same", "Rows", "but", "the", "Field", "objects", "will", "have", "their", "non", "-", "critical", "metadata", "emptied", ".", "Note", "we", "don", "t", "proto", ".", "Copy", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/result.go#L214-L229
train
vitessio/vitess
go/sqltypes/result.go
AppendResult
func (result *Result) AppendResult(src *Result) { if src.RowsAffected == 0 && len(src.Fields) == 0 { return } if result.Fields == nil { result.Fields = src.Fields } result.RowsAffected += src.RowsAffected if src.InsertID != 0 { result.InsertID = src.InsertID } if len(result.Rows) == 0 { // we haven't go...
go
func (result *Result) AppendResult(src *Result) { if src.RowsAffected == 0 && len(src.Fields) == 0 { return } if result.Fields == nil { result.Fields = src.Fields } result.RowsAffected += src.RowsAffected if src.InsertID != 0 { result.InsertID = src.InsertID } if len(result.Rows) == 0 { // we haven't go...
[ "func", "(", "result", "*", "Result", ")", "AppendResult", "(", "src", "*", "Result", ")", "{", "if", "src", ".", "RowsAffected", "==", "0", "&&", "len", "(", "src", ".", "Fields", ")", "==", "0", "{", "return", "\n", "}", "\n", "if", "result", "...
// AppendResult will combine the Results Objects of one result // to another result.Note currently it doesn't handle cases like // if two results have different fields.We will enhance this function.
[ "AppendResult", "will", "combine", "the", "Results", "Objects", "of", "one", "result", "to", "another", "result", ".", "Note", "currently", "it", "doesn", "t", "handle", "cases", "like", "if", "two", "results", "have", "different", "fields", ".", "We", "will...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/result.go#L234-L271
train
vitessio/vitess
go/vt/topo/replication.go
NewShardReplicationInfo
func NewShardReplicationInfo(sr *topodatapb.ShardReplication, cell, keyspace, shard string) *ShardReplicationInfo { return &ShardReplicationInfo{ ShardReplication: sr, cell: cell, keyspace: keyspace, shard: shard, } }
go
func NewShardReplicationInfo(sr *topodatapb.ShardReplication, cell, keyspace, shard string) *ShardReplicationInfo { return &ShardReplicationInfo{ ShardReplication: sr, cell: cell, keyspace: keyspace, shard: shard, } }
[ "func", "NewShardReplicationInfo", "(", "sr", "*", "topodatapb", ".", "ShardReplication", ",", "cell", ",", "keyspace", ",", "shard", "string", ")", "*", "ShardReplicationInfo", "{", "return", "&", "ShardReplicationInfo", "{", "ShardReplication", ":", "sr", ",", ...
// NewShardReplicationInfo is for topo.Server implementations to // create the structure
[ "NewShardReplicationInfo", "is", "for", "topo", ".", "Server", "implementations", "to", "create", "the", "structure" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/replication.go#L44-L51
train
vitessio/vitess
go/vt/topo/replication.go
GetShardReplicationNode
func (sri *ShardReplicationInfo) GetShardReplicationNode(tabletAlias *topodatapb.TabletAlias) (*topodatapb.ShardReplication_Node, error) { for _, rl := range sri.Nodes { if proto.Equal(rl.TabletAlias, tabletAlias) { return rl, nil } } return nil, NewError(NoNode, tabletAlias.String()) }
go
func (sri *ShardReplicationInfo) GetShardReplicationNode(tabletAlias *topodatapb.TabletAlias) (*topodatapb.ShardReplication_Node, error) { for _, rl := range sri.Nodes { if proto.Equal(rl.TabletAlias, tabletAlias) { return rl, nil } } return nil, NewError(NoNode, tabletAlias.String()) }
[ "func", "(", "sri", "*", "ShardReplicationInfo", ")", "GetShardReplicationNode", "(", "tabletAlias", "*", "topodatapb", ".", "TabletAlias", ")", "(", "*", "topodatapb", ".", "ShardReplication_Node", ",", "error", ")", "{", "for", "_", ",", "rl", ":=", "range",...
// GetShardReplicationNode finds a node for a given tablet.
[ "GetShardReplicationNode", "finds", "a", "node", "for", "a", "given", "tablet", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/replication.go#L69-L76
train
vitessio/vitess
go/vt/topo/replication.go
RemoveShardReplicationRecord
func RemoveShardReplicationRecord(ctx context.Context, ts *Server, cell, keyspace, shard string, tabletAlias *topodatapb.TabletAlias) error { err := ts.UpdateShardReplicationFields(ctx, cell, keyspace, shard, func(sr *topodatapb.ShardReplication) error { nodes := make([]*topodatapb.ShardReplication_Node, 0, len(sr.N...
go
func RemoveShardReplicationRecord(ctx context.Context, ts *Server, cell, keyspace, shard string, tabletAlias *topodatapb.TabletAlias) error { err := ts.UpdateShardReplicationFields(ctx, cell, keyspace, shard, func(sr *topodatapb.ShardReplication) error { nodes := make([]*topodatapb.ShardReplication_Node, 0, len(sr.N...
[ "func", "RemoveShardReplicationRecord", "(", "ctx", "context", ".", "Context", ",", "ts", "*", "Server", ",", "cell", ",", "keyspace", ",", "shard", "string", ",", "tabletAlias", "*", "topodatapb", ".", "TabletAlias", ")", "error", "{", "err", ":=", "ts", ...
// RemoveShardReplicationRecord is a low level function to remove an // entry from the ShardReplication object.
[ "RemoveShardReplicationRecord", "is", "a", "low", "level", "function", "to", "remove", "an", "entry", "from", "the", "ShardReplication", "object", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/replication.go#L118-L130
train
vitessio/vitess
go/vt/topo/replication.go
FixShardReplication
func FixShardReplication(ctx context.Context, ts *Server, logger logutil.Logger, cell, keyspace, shard string) error { sri, err := ts.GetShardReplication(ctx, cell, keyspace, shard) if err != nil { return err } for _, node := range sri.Nodes { ti, err := ts.GetTablet(ctx, node.TabletAlias) if IsErrType(err, ...
go
func FixShardReplication(ctx context.Context, ts *Server, logger logutil.Logger, cell, keyspace, shard string) error { sri, err := ts.GetShardReplication(ctx, cell, keyspace, shard) if err != nil { return err } for _, node := range sri.Nodes { ti, err := ts.GetTablet(ctx, node.TabletAlias) if IsErrType(err, ...
[ "func", "FixShardReplication", "(", "ctx", "context", ".", "Context", ",", "ts", "*", "Server", ",", "logger", "logutil", ".", "Logger", ",", "cell", ",", "keyspace", ",", "shard", "string", ")", "error", "{", "sri", ",", "err", ":=", "ts", ".", "GetSh...
// FixShardReplication will fix the first problem it encounters within // a ShardReplication object.
[ "FixShardReplication", "will", "fix", "the", "first", "problem", "it", "encounters", "within", "a", "ShardReplication", "object", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/replication.go#L134-L161
train
vitessio/vitess
go/vt/topo/replication.go
UpdateShardReplicationFields
func (ts *Server) UpdateShardReplicationFields(ctx context.Context, cell, keyspace, shard string, update func(*topodatapb.ShardReplication) error) error { nodePath := path.Join(KeyspacesPath, keyspace, ShardsPath, shard, ShardReplicationFile) conn, err := ts.ConnForCell(ctx, cell) if err != nil { return err } ...
go
func (ts *Server) UpdateShardReplicationFields(ctx context.Context, cell, keyspace, shard string, update func(*topodatapb.ShardReplication) error) error { nodePath := path.Join(KeyspacesPath, keyspace, ShardsPath, shard, ShardReplicationFile) conn, err := ts.ConnForCell(ctx, cell) if err != nil { return err } ...
[ "func", "(", "ts", "*", "Server", ")", "UpdateShardReplicationFields", "(", "ctx", "context", ".", "Context", ",", "cell", ",", "keyspace", ",", "shard", "string", ",", "update", "func", "(", "*", "topodatapb", ".", "ShardReplication", ")", "error", ")", "...
// UpdateShardReplicationFields updates the fields inside a topo.ShardReplication object.
[ "UpdateShardReplicationFields", "updates", "the", "fields", "inside", "a", "topo", ".", "ShardReplication", "object", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/replication.go#L164-L221
train
vitessio/vitess
go/vt/topo/replication.go
GetShardReplication
func (ts *Server) GetShardReplication(ctx context.Context, cell, keyspace, shard string) (*ShardReplicationInfo, error) { conn, err := ts.ConnForCell(ctx, cell) if err != nil { return nil, err } nodePath := path.Join(KeyspacesPath, keyspace, ShardsPath, shard, ShardReplicationFile) data, _, err := conn.Get(ctx,...
go
func (ts *Server) GetShardReplication(ctx context.Context, cell, keyspace, shard string) (*ShardReplicationInfo, error) { conn, err := ts.ConnForCell(ctx, cell) if err != nil { return nil, err } nodePath := path.Join(KeyspacesPath, keyspace, ShardsPath, shard, ShardReplicationFile) data, _, err := conn.Get(ctx,...
[ "func", "(", "ts", "*", "Server", ")", "GetShardReplication", "(", "ctx", "context", ".", "Context", ",", "cell", ",", "keyspace", ",", "shard", "string", ")", "(", "*", "ShardReplicationInfo", ",", "error", ")", "{", "conn", ",", "err", ":=", "ts", "....
// GetShardReplication returns the ShardReplicationInfo object.
[ "GetShardReplication", "returns", "the", "ShardReplicationInfo", "object", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/replication.go#L224-L242
train
vitessio/vitess
go/vt/topo/replication.go
DeleteShardReplication
func (ts *Server) DeleteShardReplication(ctx context.Context, cell, keyspace, shard string) error { conn, err := ts.ConnForCell(ctx, cell) if err != nil { return err } nodePath := path.Join(KeyspacesPath, keyspace, ShardsPath, shard, ShardReplicationFile) return conn.Delete(ctx, nodePath, nil) }
go
func (ts *Server) DeleteShardReplication(ctx context.Context, cell, keyspace, shard string) error { conn, err := ts.ConnForCell(ctx, cell) if err != nil { return err } nodePath := path.Join(KeyspacesPath, keyspace, ShardsPath, shard, ShardReplicationFile) return conn.Delete(ctx, nodePath, nil) }
[ "func", "(", "ts", "*", "Server", ")", "DeleteShardReplication", "(", "ctx", "context", ".", "Context", ",", "cell", ",", "keyspace", ",", "shard", "string", ")", "error", "{", "conn", ",", "err", ":=", "ts", ".", "ConnForCell", "(", "ctx", ",", "cell"...
// DeleteShardReplication deletes a ShardReplication object.
[ "DeleteShardReplication", "deletes", "a", "ShardReplication", "object", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/replication.go#L245-L253
train
vitessio/vitess
go/vt/topo/workflow.go
CreateWorkflow
func (ts *Server) CreateWorkflow(ctx context.Context, w *workflowpb.Workflow) (*WorkflowInfo, error) { // Pack the content. contents, err := proto.Marshal(w) if err != nil { return nil, err } // Save it. filePath := pathForWorkflow(w.Uuid) version, err := ts.globalCell.Create(ctx, filePath, contents) if err ...
go
func (ts *Server) CreateWorkflow(ctx context.Context, w *workflowpb.Workflow) (*WorkflowInfo, error) { // Pack the content. contents, err := proto.Marshal(w) if err != nil { return nil, err } // Save it. filePath := pathForWorkflow(w.Uuid) version, err := ts.globalCell.Create(ctx, filePath, contents) if err ...
[ "func", "(", "ts", "*", "Server", ")", "CreateWorkflow", "(", "ctx", "context", ".", "Context", ",", "w", "*", "workflowpb", ".", "Workflow", ")", "(", "*", "WorkflowInfo", ",", "error", ")", "{", "// Pack the content.", "contents", ",", "err", ":=", "pr...
// CreateWorkflow creates the given workflow, and returns the initial // WorkflowInfo.
[ "CreateWorkflow", "creates", "the", "given", "workflow", "and", "returns", "the", "initial", "WorkflowInfo", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/workflow.go#L62-L79
train
vitessio/vitess
go/vt/topo/workflow.go
GetWorkflow
func (ts *Server) GetWorkflow(ctx context.Context, uuid string) (*WorkflowInfo, error) { // Read the file. filePath := pathForWorkflow(uuid) contents, version, err := ts.globalCell.Get(ctx, filePath) if err != nil { return nil, err } // Unpack the contents. w := &workflowpb.Workflow{} if err := proto.Unmarsh...
go
func (ts *Server) GetWorkflow(ctx context.Context, uuid string) (*WorkflowInfo, error) { // Read the file. filePath := pathForWorkflow(uuid) contents, version, err := ts.globalCell.Get(ctx, filePath) if err != nil { return nil, err } // Unpack the contents. w := &workflowpb.Workflow{} if err := proto.Unmarsh...
[ "func", "(", "ts", "*", "Server", ")", "GetWorkflow", "(", "ctx", "context", ".", "Context", ",", "uuid", "string", ")", "(", "*", "WorkflowInfo", ",", "error", ")", "{", "// Read the file.", "filePath", ":=", "pathForWorkflow", "(", "uuid", ")", "\n", "...
// GetWorkflow reads a workflow from the global cell.
[ "GetWorkflow", "reads", "a", "workflow", "from", "the", "global", "cell", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/workflow.go#L82-L100
train
vitessio/vitess
go/vt/topo/workflow.go
SaveWorkflow
func (ts *Server) SaveWorkflow(ctx context.Context, wi *WorkflowInfo) error { // Pack the content. contents, err := proto.Marshal(wi.Workflow) if err != nil { return err } // Save it. filePath := pathForWorkflow(wi.Uuid) version, err := ts.globalCell.Update(ctx, filePath, contents, wi.version) if err != nil ...
go
func (ts *Server) SaveWorkflow(ctx context.Context, wi *WorkflowInfo) error { // Pack the content. contents, err := proto.Marshal(wi.Workflow) if err != nil { return err } // Save it. filePath := pathForWorkflow(wi.Uuid) version, err := ts.globalCell.Update(ctx, filePath, contents, wi.version) if err != nil ...
[ "func", "(", "ts", "*", "Server", ")", "SaveWorkflow", "(", "ctx", "context", ".", "Context", ",", "wi", "*", "WorkflowInfo", ")", "error", "{", "// Pack the content.", "contents", ",", "err", ":=", "proto", ".", "Marshal", "(", "wi", ".", "Workflow", ")...
// SaveWorkflow saves the WorkflowInfo object. If the version is not // good any more, ErrBadVersion is returned.
[ "SaveWorkflow", "saves", "the", "WorkflowInfo", "object", ".", "If", "the", "version", "is", "not", "good", "any", "more", "ErrBadVersion", "is", "returned", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/workflow.go#L104-L121
train
vitessio/vitess
go/vt/topo/workflow.go
DeleteWorkflow
func (ts *Server) DeleteWorkflow(ctx context.Context, wi *WorkflowInfo) error { filePath := pathForWorkflow(wi.Uuid) return ts.globalCell.Delete(ctx, filePath, wi.version) }
go
func (ts *Server) DeleteWorkflow(ctx context.Context, wi *WorkflowInfo) error { filePath := pathForWorkflow(wi.Uuid) return ts.globalCell.Delete(ctx, filePath, wi.version) }
[ "func", "(", "ts", "*", "Server", ")", "DeleteWorkflow", "(", "ctx", "context", ".", "Context", ",", "wi", "*", "WorkflowInfo", ")", "error", "{", "filePath", ":=", "pathForWorkflow", "(", "wi", ".", "Uuid", ")", "\n", "return", "ts", ".", "globalCell", ...
// DeleteWorkflow deletes the specified workflow. After this, the // WorkflowInfo object should not be used any more.
[ "DeleteWorkflow", "deletes", "the", "specified", "workflow", ".", "After", "this", "the", "WorkflowInfo", "object", "should", "not", "be", "used", "any", "more", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/workflow.go#L125-L128
train
vitessio/vitess
go/vt/vtcombo/tablet_map.go
CreateTablet
func CreateTablet(ctx context.Context, ts *topo.Server, cell string, uid uint32, keyspace, shard, dbname string, tabletType topodatapb.TabletType, mysqld mysqlctl.MysqlDaemon, dbcfgs *dbconfigs.DBConfigs) error { alias := &topodatapb.TabletAlias{ Cell: cell, Uid: uid, } log.Infof("Creating %v tablet %v for %v/%...
go
func CreateTablet(ctx context.Context, ts *topo.Server, cell string, uid uint32, keyspace, shard, dbname string, tabletType topodatapb.TabletType, mysqld mysqlctl.MysqlDaemon, dbcfgs *dbconfigs.DBConfigs) error { alias := &topodatapb.TabletAlias{ Cell: cell, Uid: uid, } log.Infof("Creating %v tablet %v for %v/%...
[ "func", "CreateTablet", "(", "ctx", "context", ".", "Context", ",", "ts", "*", "topo", ".", "Server", ",", "cell", "string", ",", "uid", "uint32", ",", "keyspace", ",", "shard", ",", "dbname", "string", ",", "tabletType", "topodatapb", ".", "TabletType", ...
// CreateTablet creates an individual tablet, with its agent, and adds // it to the map. If it's a master tablet, it also issues a TER.
[ "CreateTablet", "creates", "an", "individual", "tablet", "with", "its", "agent", "and", "adds", "it", "to", "the", "map", ".", "If", "it", "s", "a", "master", "tablet", "it", "also", "issues", "a", "TER", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtcombo/tablet_map.go#L77-L106
train
vitessio/vitess
go/vt/vtcombo/tablet_map.go
dialer
func dialer(tablet *topodatapb.Tablet, failFast grpcclient.FailFast) (queryservice.QueryService, error) { t, ok := tabletMap[tablet.Alias.Uid] if !ok { return nil, vterrors.New(vtrpcpb.Code_UNAVAILABLE, "connection refused") } return &internalTabletConn{ tablet: t, topoTablet: tablet, }, nil }
go
func dialer(tablet *topodatapb.Tablet, failFast grpcclient.FailFast) (queryservice.QueryService, error) { t, ok := tabletMap[tablet.Alias.Uid] if !ok { return nil, vterrors.New(vtrpcpb.Code_UNAVAILABLE, "connection refused") } return &internalTabletConn{ tablet: t, topoTablet: tablet, }, nil }
[ "func", "dialer", "(", "tablet", "*", "topodatapb", ".", "Tablet", ",", "failFast", "grpcclient", ".", "FailFast", ")", "(", "queryservice", ".", "QueryService", ",", "error", ")", "{", "t", ",", "ok", ":=", "tabletMap", "[", "tablet", ".", "Alias", ".",...
// // TabletConn implementation // // dialer is our tabletconn.Dialer
[ "TabletConn", "implementation", "dialer", "is", "our", "tabletconn", ".", "Dialer" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtcombo/tablet_map.go#L274-L284
train
vitessio/vitess
go/vt/vtcombo/tablet_map.go
Execute
func (itc *internalTabletConn) Execute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]*querypb.BindVariable, transactionID int64, options *querypb.ExecuteOptions) (*sqltypes.Result, error) { bindVars = sqltypes.CopyBindVariables(bindVars) reply, err := itc.tablet.qsc.QueryService().Exe...
go
func (itc *internalTabletConn) Execute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]*querypb.BindVariable, transactionID int64, options *querypb.ExecuteOptions) (*sqltypes.Result, error) { bindVars = sqltypes.CopyBindVariables(bindVars) reply, err := itc.tablet.qsc.QueryService().Exe...
[ "func", "(", "itc", "*", "internalTabletConn", ")", "Execute", "(", "ctx", "context", ".", "Context", ",", "target", "*", "querypb", ".", "Target", ",", "query", "string", ",", "bindVars", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable", "...
// Execute is part of queryservice.QueryService // We need to copy the bind variables as tablet server will change them.
[ "Execute", "is", "part", "of", "queryservice", ".", "QueryService", "We", "need", "to", "copy", "the", "bind", "variables", "as", "tablet", "server", "will", "change", "them", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtcombo/tablet_map.go#L295-L302
train
vitessio/vitess
go/vt/vtcombo/tablet_map.go
ExecuteBatch
func (itc *internalTabletConn) ExecuteBatch(ctx context.Context, target *querypb.Target, queries []*querypb.BoundQuery, asTransaction bool, transactionID int64, options *querypb.ExecuteOptions) ([]sqltypes.Result, error) { q := make([]*querypb.BoundQuery, len(queries)) for i, query := range queries { q[i] = &queryp...
go
func (itc *internalTabletConn) ExecuteBatch(ctx context.Context, target *querypb.Target, queries []*querypb.BoundQuery, asTransaction bool, transactionID int64, options *querypb.ExecuteOptions) ([]sqltypes.Result, error) { q := make([]*querypb.BoundQuery, len(queries)) for i, query := range queries { q[i] = &queryp...
[ "func", "(", "itc", "*", "internalTabletConn", ")", "ExecuteBatch", "(", "ctx", "context", ".", "Context", ",", "target", "*", "querypb", ".", "Target", ",", "queries", "[", "]", "*", "querypb", ".", "BoundQuery", ",", "asTransaction", "bool", ",", "transa...
// ExecuteBatch is part of queryservice.QueryService // We need to copy the bind variables as tablet server will change them.
[ "ExecuteBatch", "is", "part", "of", "queryservice", ".", "QueryService", "We", "need", "to", "copy", "the", "bind", "variables", "as", "tablet", "server", "will", "change", "them", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtcombo/tablet_map.go#L306-L319
train
vitessio/vitess
go/vt/vtcombo/tablet_map.go
Begin
func (itc *internalTabletConn) Begin(ctx context.Context, target *querypb.Target, options *querypb.ExecuteOptions) (int64, error) { transactionID, err := itc.tablet.qsc.QueryService().Begin(ctx, target, options) if err != nil { return 0, tabletconn.ErrorFromGRPC(vterrors.ToGRPC(err)) } return transactionID, nil }
go
func (itc *internalTabletConn) Begin(ctx context.Context, target *querypb.Target, options *querypb.ExecuteOptions) (int64, error) { transactionID, err := itc.tablet.qsc.QueryService().Begin(ctx, target, options) if err != nil { return 0, tabletconn.ErrorFromGRPC(vterrors.ToGRPC(err)) } return transactionID, nil }
[ "func", "(", "itc", "*", "internalTabletConn", ")", "Begin", "(", "ctx", "context", ".", "Context", ",", "target", "*", "querypb", ".", "Target", ",", "options", "*", "querypb", ".", "ExecuteOptions", ")", "(", "int64", ",", "error", ")", "{", "transacti...
// Begin is part of queryservice.QueryService
[ "Begin", "is", "part", "of", "queryservice", ".", "QueryService" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtcombo/tablet_map.go#L330-L336
train
vitessio/vitess
go/vt/vtcombo/tablet_map.go
Commit
func (itc *internalTabletConn) Commit(ctx context.Context, target *querypb.Target, transactionID int64) error { err := itc.tablet.qsc.QueryService().Commit(ctx, target, transactionID) return tabletconn.ErrorFromGRPC(vterrors.ToGRPC(err)) }
go
func (itc *internalTabletConn) Commit(ctx context.Context, target *querypb.Target, transactionID int64) error { err := itc.tablet.qsc.QueryService().Commit(ctx, target, transactionID) return tabletconn.ErrorFromGRPC(vterrors.ToGRPC(err)) }
[ "func", "(", "itc", "*", "internalTabletConn", ")", "Commit", "(", "ctx", "context", ".", "Context", ",", "target", "*", "querypb", ".", "Target", ",", "transactionID", "int64", ")", "error", "{", "err", ":=", "itc", ".", "tablet", ".", "qsc", ".", "Qu...
// Commit is part of queryservice.QueryService
[ "Commit", "is", "part", "of", "queryservice", ".", "QueryService" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtcombo/tablet_map.go#L339-L342
train
vitessio/vitess
go/vt/vtcombo/tablet_map.go
BeginExecuteBatch
func (itc *internalTabletConn) BeginExecuteBatch(ctx context.Context, target *querypb.Target, queries []*querypb.BoundQuery, asTransaction bool, options *querypb.ExecuteOptions) ([]sqltypes.Result, int64, error) { transactionID, err := itc.Begin(ctx, target, options) if err != nil { return nil, 0, err } results, ...
go
func (itc *internalTabletConn) BeginExecuteBatch(ctx context.Context, target *querypb.Target, queries []*querypb.BoundQuery, asTransaction bool, options *querypb.ExecuteOptions) ([]sqltypes.Result, int64, error) { transactionID, err := itc.Begin(ctx, target, options) if err != nil { return nil, 0, err } results, ...
[ "func", "(", "itc", "*", "internalTabletConn", ")", "BeginExecuteBatch", "(", "ctx", "context", ".", "Context", ",", "target", "*", "querypb", ".", "Target", ",", "queries", "[", "]", "*", "querypb", ".", "BoundQuery", ",", "asTransaction", "bool", ",", "o...
// BeginExecuteBatch is part of queryservice.QueryService
[ "BeginExecuteBatch", "is", "part", "of", "queryservice", ".", "QueryService" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtcombo/tablet_map.go#L409-L416
train
vitessio/vitess
go/vt/vtcombo/tablet_map.go
MessageStream
func (itc *internalTabletConn) MessageStream(ctx context.Context, target *querypb.Target, name string, callback func(*sqltypes.Result) error) error { err := itc.tablet.qsc.QueryService().MessageStream(ctx, target, name, callback) return tabletconn.ErrorFromGRPC(vterrors.ToGRPC(err)) }
go
func (itc *internalTabletConn) MessageStream(ctx context.Context, target *querypb.Target, name string, callback func(*sqltypes.Result) error) error { err := itc.tablet.qsc.QueryService().MessageStream(ctx, target, name, callback) return tabletconn.ErrorFromGRPC(vterrors.ToGRPC(err)) }
[ "func", "(", "itc", "*", "internalTabletConn", ")", "MessageStream", "(", "ctx", "context", ".", "Context", ",", "target", "*", "querypb", ".", "Target", ",", "name", "string", ",", "callback", "func", "(", "*", "sqltypes", ".", "Result", ")", "error", "...
// MessageStream is part of queryservice.QueryService
[ "MessageStream", "is", "part", "of", "queryservice", ".", "QueryService" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtcombo/tablet_map.go#L419-L422
train
vitessio/vitess
go/vt/vtcombo/tablet_map.go
MessageAck
func (itc *internalTabletConn) MessageAck(ctx context.Context, target *querypb.Target, name string, ids []*querypb.Value) (int64, error) { count, err := itc.tablet.qsc.QueryService().MessageAck(ctx, target, name, ids) return count, tabletconn.ErrorFromGRPC(vterrors.ToGRPC(err)) }
go
func (itc *internalTabletConn) MessageAck(ctx context.Context, target *querypb.Target, name string, ids []*querypb.Value) (int64, error) { count, err := itc.tablet.qsc.QueryService().MessageAck(ctx, target, name, ids) return count, tabletconn.ErrorFromGRPC(vterrors.ToGRPC(err)) }
[ "func", "(", "itc", "*", "internalTabletConn", ")", "MessageAck", "(", "ctx", "context", ".", "Context", ",", "target", "*", "querypb", ".", "Target", ",", "name", "string", ",", "ids", "[", "]", "*", "querypb", ".", "Value", ")", "(", "int64", ",", ...
// MessageAck is part of queryservice.QueryService
[ "MessageAck", "is", "part", "of", "queryservice", ".", "QueryService" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtcombo/tablet_map.go#L425-L428
train
vitessio/vitess
go/vt/vtcombo/tablet_map.go
SplitQuery
func (itc *internalTabletConn) SplitQuery( ctx context.Context, target *querypb.Target, query *querypb.BoundQuery, splitColumns []string, splitCount int64, numRowsPerQueryPart int64, algorithm querypb.SplitQueryRequest_Algorithm) ([]*querypb.QuerySplit, error) { splits, err := itc.tablet.qsc.QueryService().Spl...
go
func (itc *internalTabletConn) SplitQuery( ctx context.Context, target *querypb.Target, query *querypb.BoundQuery, splitColumns []string, splitCount int64, numRowsPerQueryPart int64, algorithm querypb.SplitQueryRequest_Algorithm) ([]*querypb.QuerySplit, error) { splits, err := itc.tablet.qsc.QueryService().Spl...
[ "func", "(", "itc", "*", "internalTabletConn", ")", "SplitQuery", "(", "ctx", "context", ".", "Context", ",", "target", "*", "querypb", ".", "Target", ",", "query", "*", "querypb", ".", "BoundQuery", ",", "splitColumns", "[", "]", "string", ",", "splitCoun...
// SplitQuery is part of queryservice.QueryService
[ "SplitQuery", "is", "part", "of", "queryservice", ".", "QueryService" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtcombo/tablet_map.go#L445-L466
train
vitessio/vitess
go/vt/vtcombo/tablet_map.go
StreamHealth
func (itc *internalTabletConn) StreamHealth(ctx context.Context, callback func(*querypb.StreamHealthResponse) error) error { err := itc.tablet.qsc.QueryService().StreamHealth(ctx, callback) return tabletconn.ErrorFromGRPC(vterrors.ToGRPC(err)) }
go
func (itc *internalTabletConn) StreamHealth(ctx context.Context, callback func(*querypb.StreamHealthResponse) error) error { err := itc.tablet.qsc.QueryService().StreamHealth(ctx, callback) return tabletconn.ErrorFromGRPC(vterrors.ToGRPC(err)) }
[ "func", "(", "itc", "*", "internalTabletConn", ")", "StreamHealth", "(", "ctx", "context", ".", "Context", ",", "callback", "func", "(", "*", "querypb", ".", "StreamHealthResponse", ")", "error", ")", "error", "{", "err", ":=", "itc", ".", "tablet", ".", ...
// StreamHealth is part of queryservice.QueryService
[ "StreamHealth", "is", "part", "of", "queryservice", ".", "QueryService" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtcombo/tablet_map.go#L469-L472
train
vitessio/vitess
go/vt/vtcombo/tablet_map.go
UpdateStream
func (itc *internalTabletConn) UpdateStream(ctx context.Context, target *querypb.Target, position string, timestamp int64, callback func(*querypb.StreamEvent) error) error { err := itc.tablet.qsc.QueryService().UpdateStream(ctx, target, position, timestamp, callback) return tabletconn.ErrorFromGRPC(vterrors.ToGRPC(er...
go
func (itc *internalTabletConn) UpdateStream(ctx context.Context, target *querypb.Target, position string, timestamp int64, callback func(*querypb.StreamEvent) error) error { err := itc.tablet.qsc.QueryService().UpdateStream(ctx, target, position, timestamp, callback) return tabletconn.ErrorFromGRPC(vterrors.ToGRPC(er...
[ "func", "(", "itc", "*", "internalTabletConn", ")", "UpdateStream", "(", "ctx", "context", ".", "Context", ",", "target", "*", "querypb", ".", "Target", ",", "position", "string", ",", "timestamp", "int64", ",", "callback", "func", "(", "*", "querypb", "."...
// UpdateStream is part of queryservice.QueryService.
[ "UpdateStream", "is", "part", "of", "queryservice", ".", "QueryService", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtcombo/tablet_map.go#L475-L478
train
vitessio/vitess
go/vt/vtcombo/tablet_map.go
VStream
func (itc *internalTabletConn) VStream(ctx context.Context, target *querypb.Target, startPos string, filter *binlogdatapb.Filter, send func([]*binlogdatapb.VEvent) error) error { err := itc.tablet.qsc.QueryService().VStream(ctx, target, startPos, filter, send) return tabletconn.ErrorFromGRPC(vterrors.ToGRPC(err)) }
go
func (itc *internalTabletConn) VStream(ctx context.Context, target *querypb.Target, startPos string, filter *binlogdatapb.Filter, send func([]*binlogdatapb.VEvent) error) error { err := itc.tablet.qsc.QueryService().VStream(ctx, target, startPos, filter, send) return tabletconn.ErrorFromGRPC(vterrors.ToGRPC(err)) }
[ "func", "(", "itc", "*", "internalTabletConn", ")", "VStream", "(", "ctx", "context", ".", "Context", ",", "target", "*", "querypb", ".", "Target", ",", "startPos", "string", ",", "filter", "*", "binlogdatapb", ".", "Filter", ",", "send", "func", "(", "[...
// VStream is part of queryservice.QueryService.
[ "VStream", "is", "part", "of", "queryservice", ".", "QueryService", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtcombo/tablet_map.go#L481-L484
train
vitessio/vitess
go/vt/mysqlctl/schema.go
executeSchemaCommands
func (mysqld *Mysqld) executeSchemaCommands(sql string) error { params, err := dbconfigs.WithCredentials(mysqld.dbcfgs.Dba()) if err != nil { return err } return mysqld.executeMysqlScript(params, strings.NewReader(sql)) }
go
func (mysqld *Mysqld) executeSchemaCommands(sql string) error { params, err := dbconfigs.WithCredentials(mysqld.dbcfgs.Dba()) if err != nil { return err } return mysqld.executeMysqlScript(params, strings.NewReader(sql)) }
[ "func", "(", "mysqld", "*", "Mysqld", ")", "executeSchemaCommands", "(", "sql", "string", ")", "error", "{", "params", ",", "err", ":=", "dbconfigs", ".", "WithCredentials", "(", "mysqld", ".", "dbcfgs", ".", "Dba", "(", ")", ")", "\n", "if", "err", "!...
// executeSchemaCommands executes some SQL commands, using the mysql // command line tool. It uses the dba connection parameters, with credentials.
[ "executeSchemaCommands", "executes", "some", "SQL", "commands", "using", "the", "mysql", "command", "line", "tool", ".", "It", "uses", "the", "dba", "connection", "parameters", "with", "credentials", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/schema.go#L39-L46
train
vitessio/vitess
go/vt/mysqlctl/schema.go
ResolveTables
func ResolveTables(mysqld MysqlDaemon, dbName string, tables []string) ([]string, error) { sd, err := mysqld.GetSchema(dbName, tables, nil, true) if err != nil { return nil, err } result := make([]string, len(sd.TableDefinitions)) for i, td := range sd.TableDefinitions { result[i] = td.Name } return result, ...
go
func ResolveTables(mysqld MysqlDaemon, dbName string, tables []string) ([]string, error) { sd, err := mysqld.GetSchema(dbName, tables, nil, true) if err != nil { return nil, err } result := make([]string, len(sd.TableDefinitions)) for i, td := range sd.TableDefinitions { result[i] = td.Name } return result, ...
[ "func", "ResolveTables", "(", "mysqld", "MysqlDaemon", ",", "dbName", "string", ",", "tables", "[", "]", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "sd", ",", "err", ":=", "mysqld", ".", "GetSchema", "(", "dbName", ",", "tables", ...
// ResolveTables returns a list of actual tables+views matching a list // of regexps
[ "ResolveTables", "returns", "a", "list", "of", "actual", "tables", "+", "views", "matching", "a", "list", "of", "regexps" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/schema.go#L149-L159
train
vitessio/vitess
go/vt/mysqlctl/schema.go
GetColumns
func (mysqld *Mysqld) GetColumns(dbName, table string) ([]string, error) { conn, err := getPoolReconnect(context.TODO(), mysqld.dbaPool) if err != nil { return nil, err } defer conn.Recycle() qr, err := conn.ExecuteFetch(fmt.Sprintf("SELECT * FROM %s.%s WHERE 1=0", sqlescape.EscapeID(dbName), sqlescape.EscapeID(...
go
func (mysqld *Mysqld) GetColumns(dbName, table string) ([]string, error) { conn, err := getPoolReconnect(context.TODO(), mysqld.dbaPool) if err != nil { return nil, err } defer conn.Recycle() qr, err := conn.ExecuteFetch(fmt.Sprintf("SELECT * FROM %s.%s WHERE 1=0", sqlescape.EscapeID(dbName), sqlescape.EscapeID(...
[ "func", "(", "mysqld", "*", "Mysqld", ")", "GetColumns", "(", "dbName", ",", "table", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "conn", ",", "err", ":=", "getPoolReconnect", "(", "context", ".", "TODO", "(", ")", ",", "mysqld", ...
// GetColumns returns the columns of table.
[ "GetColumns", "returns", "the", "columns", "of", "table", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/schema.go#L162-L178
train
vitessio/vitess
go/vt/mysqlctl/schema.go
GetPrimaryKeyColumns
func (mysqld *Mysqld) GetPrimaryKeyColumns(dbName, table string) ([]string, error) { conn, err := getPoolReconnect(context.TODO(), mysqld.dbaPool) if err != nil { return nil, err } defer conn.Recycle() qr, err := conn.ExecuteFetch(fmt.Sprintf("SHOW INDEX FROM %s.%s", sqlescape.EscapeID(dbName), sqlescape.EscapeI...
go
func (mysqld *Mysqld) GetPrimaryKeyColumns(dbName, table string) ([]string, error) { conn, err := getPoolReconnect(context.TODO(), mysqld.dbaPool) if err != nil { return nil, err } defer conn.Recycle() qr, err := conn.ExecuteFetch(fmt.Sprintf("SHOW INDEX FROM %s.%s", sqlescape.EscapeID(dbName), sqlescape.EscapeI...
[ "func", "(", "mysqld", "*", "Mysqld", ")", "GetPrimaryKeyColumns", "(", "dbName", ",", "table", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "conn", ",", "err", ":=", "getPoolReconnect", "(", "context", ".", "TODO", "(", ")", ",", ...
// GetPrimaryKeyColumns returns the primary key columns of table.
[ "GetPrimaryKeyColumns", "returns", "the", "primary", "key", "columns", "of", "table", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/schema.go#L181-L229
train
vitessio/vitess
go/vt/mysqlctl/schema.go
PreflightSchemaChange
func (mysqld *Mysqld) PreflightSchemaChange(dbName string, changes []string) ([]*tabletmanagerdatapb.SchemaChangeResult, error) { results := make([]*tabletmanagerdatapb.SchemaChangeResult, len(changes)) // Get current schema from the real database. originalSchema, err := mysqld.GetSchema(dbName, nil, nil, true) if...
go
func (mysqld *Mysqld) PreflightSchemaChange(dbName string, changes []string) ([]*tabletmanagerdatapb.SchemaChangeResult, error) { results := make([]*tabletmanagerdatapb.SchemaChangeResult, len(changes)) // Get current schema from the real database. originalSchema, err := mysqld.GetSchema(dbName, nil, nil, true) if...
[ "func", "(", "mysqld", "*", "Mysqld", ")", "PreflightSchemaChange", "(", "dbName", "string", ",", "changes", "[", "]", "string", ")", "(", "[", "]", "*", "tabletmanagerdatapb", ".", "SchemaChangeResult", ",", "error", ")", "{", "results", ":=", "make", "("...
// PreflightSchemaChange checks the schema changes in "changes" by applying them // to an intermediate database that has the same schema as the target database.
[ "PreflightSchemaChange", "checks", "the", "schema", "changes", "in", "changes", "by", "applying", "them", "to", "an", "intermediate", "database", "that", "has", "the", "same", "schema", "as", "the", "target", "database", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/schema.go#L233-L296
train
vitessio/vitess
go/vt/mysqlctl/schema.go
ApplySchemaChange
func (mysqld *Mysqld) ApplySchemaChange(dbName string, change *tmutils.SchemaChange) (*tabletmanagerdatapb.SchemaChangeResult, error) { // check current schema matches beforeSchema, err := mysqld.GetSchema(dbName, nil, nil, true) if err != nil { return nil, err } if change.BeforeSchema != nil { schemaDiffs := ...
go
func (mysqld *Mysqld) ApplySchemaChange(dbName string, change *tmutils.SchemaChange) (*tabletmanagerdatapb.SchemaChangeResult, error) { // check current schema matches beforeSchema, err := mysqld.GetSchema(dbName, nil, nil, true) if err != nil { return nil, err } if change.BeforeSchema != nil { schemaDiffs := ...
[ "func", "(", "mysqld", "*", "Mysqld", ")", "ApplySchemaChange", "(", "dbName", "string", ",", "change", "*", "tmutils", ".", "SchemaChange", ")", "(", "*", "tabletmanagerdatapb", ".", "SchemaChangeResult", ",", "error", ")", "{", "// check current schema matches",...
// ApplySchemaChange will apply the schema change to the given database.
[ "ApplySchemaChange", "will", "apply", "the", "schema", "change", "to", "the", "given", "database", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/schema.go#L299-L369
train
vitessio/vitess
go/vt/logutil/proto3.go
ProtoToTime
func ProtoToTime(ts *logutilpb.Time) time.Time { if ts == nil { // treat nil like the empty Timestamp return time.Unix(0, 0).UTC() } return time.Unix(ts.Seconds, int64(ts.Nanoseconds)).UTC() }
go
func ProtoToTime(ts *logutilpb.Time) time.Time { if ts == nil { // treat nil like the empty Timestamp return time.Unix(0, 0).UTC() } return time.Unix(ts.Seconds, int64(ts.Nanoseconds)).UTC() }
[ "func", "ProtoToTime", "(", "ts", "*", "logutilpb", ".", "Time", ")", "time", ".", "Time", "{", "if", "ts", "==", "nil", "{", "// treat nil like the empty Timestamp", "return", "time", ".", "Unix", "(", "0", ",", "0", ")", ".", "UTC", "(", ")", "\n", ...
// This file contains a few functions to help with proto3. // ProtoToTime converts a logutilpb.Time to a time.Time. // proto3 will eventually support timestamps, at which point we'll retire // this. // // A nil pointer is like the empty timestamp.
[ "This", "file", "contains", "a", "few", "functions", "to", "help", "with", "proto3", ".", "ProtoToTime", "converts", "a", "logutilpb", ".", "Time", "to", "a", "time", ".", "Time", ".", "proto3", "will", "eventually", "support", "timestamps", "at", "which", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/logutil/proto3.go#L32-L38
train
vitessio/vitess
go/vt/logutil/proto3.go
TimeToProto
func TimeToProto(t time.Time) *logutilpb.Time { seconds := t.Unix() nanos := int64(t.Sub(time.Unix(seconds, 0))) return &logutilpb.Time{ Seconds: seconds, Nanoseconds: int32(nanos), } }
go
func TimeToProto(t time.Time) *logutilpb.Time { seconds := t.Unix() nanos := int64(t.Sub(time.Unix(seconds, 0))) return &logutilpb.Time{ Seconds: seconds, Nanoseconds: int32(nanos), } }
[ "func", "TimeToProto", "(", "t", "time", ".", "Time", ")", "*", "logutilpb", ".", "Time", "{", "seconds", ":=", "t", ".", "Unix", "(", ")", "\n", "nanos", ":=", "int64", "(", "t", ".", "Sub", "(", "time", ".", "Unix", "(", "seconds", ",", "0", ...
// TimeToProto converts the time.Time to a logutilpb.Time.
[ "TimeToProto", "converts", "the", "time", ".", "Time", "to", "a", "logutilpb", ".", "Time", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/logutil/proto3.go#L41-L48
train
vitessio/vitess
go/vt/worker/split_diff_cmd.go
shardsWithSources
func shardsWithSources(ctx context.Context, wr *wrangler.Wrangler) ([]map[string]string, error) { shortCtx, cancel := context.WithTimeout(ctx, *remoteActionsTimeout) keyspaces, err := wr.TopoServer().GetKeyspaces(shortCtx) cancel() if err != nil { return nil, vterrors.Wrap(err, "failed to get list of keyspaces") ...
go
func shardsWithSources(ctx context.Context, wr *wrangler.Wrangler) ([]map[string]string, error) { shortCtx, cancel := context.WithTimeout(ctx, *remoteActionsTimeout) keyspaces, err := wr.TopoServer().GetKeyspaces(shortCtx) cancel() if err != nil { return nil, vterrors.Wrap(err, "failed to get list of keyspaces") ...
[ "func", "shardsWithSources", "(", "ctx", "context", ".", "Context", ",", "wr", "*", "wrangler", ".", "Wrangler", ")", "(", "[", "]", "map", "[", "string", "]", "string", ",", "error", ")", "{", "shortCtx", ",", "cancel", ":=", "context", ".", "WithTime...
// shardsWithSources returns all the shards that have SourceShards set // with no Tables list.
[ "shardsWithSources", "returns", "all", "the", "shards", "that", "have", "SourceShards", "set", "with", "no", "Tables", "list", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/split_diff_cmd.go#L116-L172
train
vitessio/vitess
go/cmd/automation_client/automation_client.go
waitForClusterOp
func waitForClusterOp(client automationservicepb.AutomationClient, id string) (*automationpb.GetClusterOperationDetailsResponse, error) { for { req := &automationpb.GetClusterOperationDetailsRequest{ Id: id, } resp, err := client.GetClusterOperationDetails(context.Background(), req, grpc.FailFast(false)) i...
go
func waitForClusterOp(client automationservicepb.AutomationClient, id string) (*automationpb.GetClusterOperationDetailsResponse, error) { for { req := &automationpb.GetClusterOperationDetailsRequest{ Id: id, } resp, err := client.GetClusterOperationDetails(context.Background(), req, grpc.FailFast(false)) i...
[ "func", "waitForClusterOp", "(", "client", "automationservicepb", ".", "AutomationClient", ",", "id", "string", ")", "(", "*", "automationpb", ".", "GetClusterOperationDetailsResponse", ",", "error", ")", "{", "for", "{", "req", ":=", "&", "automationpb", ".", "...
// waitForClusterOp polls and blocks until the ClusterOperation invocation specified by "id" has finished. If an error occurred, it will be returned.
[ "waitForClusterOp", "polls", "and", "blocks", "until", "the", "ClusterOperation", "invocation", "specified", "by", "id", "has", "finished", ".", "If", "an", "error", "occurred", "it", "will", "be", "returned", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/cmd/automation_client/automation_client.go#L110-L133
train
vitessio/vitess
go/vt/topo/etcd2topo/server.go
NewServer
func NewServer(serverAddr, root string) (*Server, error) { cli, err := clientv3.New(clientv3.Config{ Endpoints: strings.Split(serverAddr, ","), DialTimeout: 5 * time.Second, }) if err != nil { return nil, err } return &Server{ cli: cli, root: root, }, nil }
go
func NewServer(serverAddr, root string) (*Server, error) { cli, err := clientv3.New(clientv3.Config{ Endpoints: strings.Split(serverAddr, ","), DialTimeout: 5 * time.Second, }) if err != nil { return nil, err } return &Server{ cli: cli, root: root, }, nil }
[ "func", "NewServer", "(", "serverAddr", ",", "root", "string", ")", "(", "*", "Server", ",", "error", ")", "{", "cli", ",", "err", ":=", "clientv3", ".", "New", "(", "clientv3", ".", "Config", "{", "Endpoints", ":", "strings", ".", "Split", "(", "ser...
// NewServer returns a new etcdtopo.Server.
[ "NewServer", "returns", "a", "new", "etcdtopo", ".", "Server", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/etcd2topo/server.go#L75-L88
train
vitessio/vitess
go/mysql/streaming_query.go
Fields
func (c *Conn) Fields() ([]*querypb.Field, error) { if c.fields == nil { return nil, NewSQLError(CRCommandsOutOfSync, SSUnknownSQLState, "no streaming query in progress") } if len(c.fields) == 0 { // The query returned an empty field list. return nil, nil } return c.fields, nil }
go
func (c *Conn) Fields() ([]*querypb.Field, error) { if c.fields == nil { return nil, NewSQLError(CRCommandsOutOfSync, SSUnknownSQLState, "no streaming query in progress") } if len(c.fields) == 0 { // The query returned an empty field list. return nil, nil } return c.fields, nil }
[ "func", "(", "c", "*", "Conn", ")", "Fields", "(", ")", "(", "[", "]", "*", "querypb", ".", "Field", ",", "error", ")", "{", "if", "c", ".", "fields", "==", "nil", "{", "return", "nil", ",", "NewSQLError", "(", "CRCommandsOutOfSync", ",", "SSUnknow...
// Fields returns the fields for an ongoing streaming query.
[ "Fields", "returns", "the", "fields", "for", "an", "ongoing", "streaming", "query", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/streaming_query.go#L97-L106
train
vitessio/vitess
go/mysql/streaming_query.go
CloseResult
func (c *Conn) CloseResult() { for c.fields != nil { rows, err := c.FetchNext() if err != nil || rows == nil { // We either got an error, or got the last result. c.fields = nil } } }
go
func (c *Conn) CloseResult() { for c.fields != nil { rows, err := c.FetchNext() if err != nil || rows == nil { // We either got an error, or got the last result. c.fields = nil } } }
[ "func", "(", "c", "*", "Conn", ")", "CloseResult", "(", ")", "{", "for", "c", ".", "fields", "!=", "nil", "{", "rows", ",", "err", ":=", "c", ".", "FetchNext", "(", ")", "\n", "if", "err", "!=", "nil", "||", "rows", "==", "nil", "{", "// We eit...
// CloseResult can be used to terminate a streaming query // early. It just drains the remaining values.
[ "CloseResult", "can", "be", "used", "to", "terminate", "a", "streaming", "query", "early", ".", "It", "just", "drains", "the", "remaining", "values", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/streaming_query.go#L141-L149
train
vitessio/vitess
go/vt/vtgate/planbuilder/subquery.go
newSubquery
func newSubquery(alias sqlparser.TableIdent, bldr builder) (*subquery, *symtab, error) { sq := &subquery{ order: bldr.Order() + 1, input: bldr, esubquery: &engine.Subquery{}, } // Create a 'table' that represents the subquery. t := &table{ alias: sqlparser.TableName{Name: alias}, origin: sq, } ...
go
func newSubquery(alias sqlparser.TableIdent, bldr builder) (*subquery, *symtab, error) { sq := &subquery{ order: bldr.Order() + 1, input: bldr, esubquery: &engine.Subquery{}, } // Create a 'table' that represents the subquery. t := &table{ alias: sqlparser.TableName{Name: alias}, origin: sq, } ...
[ "func", "newSubquery", "(", "alias", "sqlparser", ".", "TableIdent", ",", "bldr", "builder", ")", "(", "*", "subquery", ",", "*", "symtab", ",", "error", ")", "{", "sq", ":=", "&", "subquery", "{", "order", ":", "bldr", ".", "Order", "(", ")", "+", ...
// newSubquery builds a new subquery.
[ "newSubquery", "builds", "a", "new", "subquery", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/subquery.go#L46-L71
train
vitessio/vitess
go/vt/sqlannotation/sqlannotation.go
AnnotateIfDML
func AnnotateIfDML(sql string, keyspaceIDs [][]byte) string { if !sqlparser.IsDML(sql) { return sql } if len(keyspaceIDs) == 1 { return AddKeyspaceIDs(sql, keyspaceIDs, "") } filteredReplicationUnfriendlyStatementsCount.Add(1) return sql + filteredReplicationUnfriendlyAnnotation }
go
func AnnotateIfDML(sql string, keyspaceIDs [][]byte) string { if !sqlparser.IsDML(sql) { return sql } if len(keyspaceIDs) == 1 { return AddKeyspaceIDs(sql, keyspaceIDs, "") } filteredReplicationUnfriendlyStatementsCount.Add(1) return sql + filteredReplicationUnfriendlyAnnotation }
[ "func", "AnnotateIfDML", "(", "sql", "string", ",", "keyspaceIDs", "[", "]", "[", "]", "byte", ")", "string", "{", "if", "!", "sqlparser", ".", "IsDML", "(", "sql", ")", "{", "return", "sql", "\n", "}", "\n", "if", "len", "(", "keyspaceIDs", ")", "...
// AnnotateIfDML annotates 'sql' based on 'keyspaceIDs' // // If 'sql' is not a DML statement no annotation is added. // If 'sql' is a DML statement and contains exactly one keyspaceID // it is used to annotate 'sql' // Otherwise 'sql' is annotated as replication-unfriendly.
[ "AnnotateIfDML", "annotates", "sql", "based", "on", "keyspaceIDs", "If", "sql", "is", "not", "a", "DML", "statement", "no", "annotation", "is", "added", ".", "If", "sql", "is", "a", "DML", "statement", "and", "contains", "exactly", "one", "keyspaceID", "it",...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/sqlannotation/sqlannotation.go#L52-L61
train
vitessio/vitess
go/vt/sqlannotation/sqlannotation.go
AddKeyspaceIDs
func AddKeyspaceIDs(sql string, keyspaceIDs [][]byte, marginComments string) string { encodedIDs := make([][]byte, len(keyspaceIDs)) for i, src := range keyspaceIDs { encodedIDs[i] = make([]byte, hex.EncodedLen(len(src))) hex.Encode(encodedIDs[i], src) } return fmt.Sprintf("%s /* vtgate:: keyspace_id:%s */%s", ...
go
func AddKeyspaceIDs(sql string, keyspaceIDs [][]byte, marginComments string) string { encodedIDs := make([][]byte, len(keyspaceIDs)) for i, src := range keyspaceIDs { encodedIDs[i] = make([]byte, hex.EncodedLen(len(src))) hex.Encode(encodedIDs[i], src) } return fmt.Sprintf("%s /* vtgate:: keyspace_id:%s */%s", ...
[ "func", "AddKeyspaceIDs", "(", "sql", "string", ",", "keyspaceIDs", "[", "]", "[", "]", "byte", ",", "marginComments", "string", ")", "string", "{", "encodedIDs", ":=", "make", "(", "[", "]", "[", "]", "byte", ",", "len", "(", "keyspaceIDs", ")", ")", ...
// AddKeyspaceIDs returns a copy of 'sql' annotated // with the given keyspace id. It also appends the // additional marginComments, if any.
[ "AddKeyspaceIDs", "returns", "a", "copy", "of", "sql", "annotated", "with", "the", "given", "keyspace", "id", ".", "It", "also", "appends", "the", "additional", "marginComments", "if", "any", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/sqlannotation/sqlannotation.go#L66-L74
train
vitessio/vitess
go/vt/sqlannotation/sqlannotation.go
ExtractKeyspaceIDS
func ExtractKeyspaceIDS(sql string) (keyspaceIDs [][]byte, err error) { _, comments := sqlparser.SplitMarginComments(sql) keyspaceIDString, hasKeyspaceID := extractStringBetween(comments.Trailing, "/* vtgate:: keyspace_id:", " ") hasUnfriendlyAnnotation := strings.Contains(sql, filteredReplicationUnfriendlyAnnotatio...
go
func ExtractKeyspaceIDS(sql string) (keyspaceIDs [][]byte, err error) { _, comments := sqlparser.SplitMarginComments(sql) keyspaceIDString, hasKeyspaceID := extractStringBetween(comments.Trailing, "/* vtgate:: keyspace_id:", " ") hasUnfriendlyAnnotation := strings.Contains(sql, filteredReplicationUnfriendlyAnnotatio...
[ "func", "ExtractKeyspaceIDS", "(", "sql", "string", ")", "(", "keyspaceIDs", "[", "]", "[", "]", "byte", ",", "err", "error", ")", "{", "_", ",", "comments", ":=", "sqlparser", ".", "SplitMarginComments", "(", "sql", ")", "\n", "keyspaceIDString", ",", "...
// ExtractKeyspaceIDS parses the annotation of the given statement and tries // to extract the keyspace id. // If a keyspace-id comment exists 'keyspaceID' is set to the parsed keyspace id // and err is set to nil; otherwise, if a filtered-replication-unfriendly comment exists // or some other parsing error occured, ke...
[ "ExtractKeyspaceIDS", "parses", "the", "annotation", "of", "the", "given", "statement", "and", "tries", "to", "extract", "the", "keyspace", "id", ".", "If", "a", "keyspace", "-", "id", "comment", "exists", "keyspaceID", "is", "set", "to", "the", "parsed", "k...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/sqlannotation/sqlannotation.go#L82-L120
train
vitessio/vitess
go/vt/sqlannotation/sqlannotation.go
extractStringBetween
func extractStringBetween(source string, leftDelim string, rightDelim string) (match string, found bool) { leftDelimStart := strings.Index(source, leftDelim) if leftDelimStart == -1 { found = false match = "" return } found = true matchStart := leftDelimStart + len(leftDelim) matchEnd := strings.Index(sourc...
go
func extractStringBetween(source string, leftDelim string, rightDelim string) (match string, found bool) { leftDelimStart := strings.Index(source, leftDelim) if leftDelimStart == -1 { found = false match = "" return } found = true matchStart := leftDelimStart + len(leftDelim) matchEnd := strings.Index(sourc...
[ "func", "extractStringBetween", "(", "source", "string", ",", "leftDelim", "string", ",", "rightDelim", "string", ")", "(", "match", "string", ",", "found", "bool", ")", "{", "leftDelimStart", ":=", "strings", ".", "Index", "(", "source", ",", "leftDelim", "...
// Extracts the string from source contained between the leftmost instance of // 'leftDelim' and the next instance of 'rightDelim'. If there is no next instance // of 'rightDelim', returns the string contained between the end of the leftmost instance // of 'leftDelim' to the end of 'source'. If 'leftDelim' does not app...
[ "Extracts", "the", "string", "from", "source", "contained", "between", "the", "leftmost", "instance", "of", "leftDelim", "and", "the", "next", "instance", "of", "rightDelim", ".", "If", "there", "is", "no", "next", "instance", "of", "rightDelim", "returns", "t...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/sqlannotation/sqlannotation.go#L128-L144
train
vitessio/vitess
go/ratelimiter/ratelimiter.go
Allow
func (rl *RateLimiter) Allow() bool { rl.mu.Lock() defer rl.mu.Unlock() if time.Since(rl.lastTime) < rl.interval { if rl.curCount > 0 { rl.curCount-- return true } return false } rl.curCount = rl.maxCount - 1 rl.lastTime = time.Now() return true }
go
func (rl *RateLimiter) Allow() bool { rl.mu.Lock() defer rl.mu.Unlock() if time.Since(rl.lastTime) < rl.interval { if rl.curCount > 0 { rl.curCount-- return true } return false } rl.curCount = rl.maxCount - 1 rl.lastTime = time.Now() return true }
[ "func", "(", "rl", "*", "RateLimiter", ")", "Allow", "(", ")", "bool", "{", "rl", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "rl", ".", "mu", ".", "Unlock", "(", ")", "\n", "if", "time", ".", "Since", "(", "rl", ".", "lastTime", ")", "<...
// Allow returns true if a request is within the rate limit norms. // Otherwise, it returns false.
[ "Allow", "returns", "true", "if", "a", "request", "is", "within", "the", "rate", "limit", "norms", ".", "Otherwise", "it", "returns", "false", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/ratelimiter/ratelimiter.go#L53-L66
train
vitessio/vitess
go/cmd/zk/zkcmd.go
cmdWatch
func cmdWatch(ctx context.Context, subFlags *flag.FlagSet, args []string) error { subFlags.Parse(args) eventChan := make(chan zk.Event, 16) for _, arg := range subFlags.Args() { zkPath := fixZkPath(arg) _, _, watch, err := zconn.GetW(ctx, zkPath) if err != nil { return fmt.Errorf("watch error: %v", err) ...
go
func cmdWatch(ctx context.Context, subFlags *flag.FlagSet, args []string) error { subFlags.Parse(args) eventChan := make(chan zk.Event, 16) for _, arg := range subFlags.Args() { zkPath := fixZkPath(arg) _, _, watch, err := zconn.GetW(ctx, zkPath) if err != nil { return fmt.Errorf("watch error: %v", err) ...
[ "func", "cmdWatch", "(", "ctx", "context", ".", "Context", ",", "subFlags", "*", "flag", ".", "FlagSet", ",", "args", "[", "]", "string", ")", "error", "{", "subFlags", ".", "Parse", "(", "args", ")", "\n\n", "eventChan", ":=", "make", "(", "chan", "...
// Watch for changes to the node.
[ "Watch", "for", "changes", "to", "the", "node", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/cmd/zk/zkcmd.go#L227-L274
train
vitessio/vitess
go/cmd/zk/zkcmd.go
cmdZip
func cmdZip(ctx context.Context, subFlags *flag.FlagSet, args []string) error { subFlags.Parse(args) if subFlags.NArg() < 2 { return fmt.Errorf("zip: need to specify source and destination paths") } dstPath := subFlags.Arg(subFlags.NArg() - 1) paths := subFlags.Args()[:len(args)-1] if !strings.HasSuffix(dstPat...
go
func cmdZip(ctx context.Context, subFlags *flag.FlagSet, args []string) error { subFlags.Parse(args) if subFlags.NArg() < 2 { return fmt.Errorf("zip: need to specify source and destination paths") } dstPath := subFlags.Arg(subFlags.NArg() - 1) paths := subFlags.Args()[:len(args)-1] if !strings.HasSuffix(dstPat...
[ "func", "cmdZip", "(", "ctx", "context", ".", "Context", ",", "subFlags", "*", "flag", ".", "FlagSet", ",", "args", "[", "]", "string", ")", "error", "{", "subFlags", ".", "Parse", "(", "args", ")", "\n", "if", "subFlags", ".", "NArg", "(", ")", "<...
// Store a zk tree in a zip archive. This won't be immediately useful to // zip tools since even "directories" can contain data.
[ "Store", "a", "zk", "tree", "in", "a", "zip", "archive", ".", "This", "won", "t", "be", "immediately", "useful", "to", "zip", "tools", "since", "even", "directories", "can", "contain", "data", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/cmd/zk/zkcmd.go#L865-L931
train
vitessio/vitess
go/sqltypes/event_token.go
EventTokenMinimum
func EventTokenMinimum(ev1, ev2 *querypb.EventToken) *querypb.EventToken { if ev1 == nil || ev2 == nil { // One or the other is not set, we can't do anything. return nil } if ev1.Timestamp < ev2.Timestamp { return &querypb.EventToken{ Timestamp: ev1.Timestamp, } } return &querypb.EventToken{ Timestam...
go
func EventTokenMinimum(ev1, ev2 *querypb.EventToken) *querypb.EventToken { if ev1 == nil || ev2 == nil { // One or the other is not set, we can't do anything. return nil } if ev1.Timestamp < ev2.Timestamp { return &querypb.EventToken{ Timestamp: ev1.Timestamp, } } return &querypb.EventToken{ Timestam...
[ "func", "EventTokenMinimum", "(", "ev1", ",", "ev2", "*", "querypb", ".", "EventToken", ")", "*", "querypb", ".", "EventToken", "{", "if", "ev1", "==", "nil", "||", "ev2", "==", "nil", "{", "// One or the other is not set, we can't do anything.", "return", "nil"...
// EventTokenMinimum returns an event token that is guaranteed to // happen before both provided EventToken objects. Note it doesn't // parse the position, but rather only uses the timestamp. This is // meant to be used for EventToken objects coming from different // source shard.
[ "EventTokenMinimum", "returns", "an", "event", "token", "that", "is", "guaranteed", "to", "happen", "before", "both", "provided", "EventToken", "objects", ".", "Note", "it", "doesn", "t", "parse", "the", "position", "but", "rather", "only", "uses", "the", "tim...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/event_token.go#L28-L42
train
vitessio/vitess
go/vt/vtgate/planbuilder/from.go
processDMLTable
func (pb *primitiveBuilder) processDMLTable(tableExprs sqlparser.TableExprs) (*routeOption, error) { if err := pb.processTableExprs(tableExprs); err != nil { return nil, err } rb, ok := pb.bldr.(*route) if !ok { return nil, errors.New("unsupported: multi-shard or vindex write statement") } ro := rb.routeOptio...
go
func (pb *primitiveBuilder) processDMLTable(tableExprs sqlparser.TableExprs) (*routeOption, error) { if err := pb.processTableExprs(tableExprs); err != nil { return nil, err } rb, ok := pb.bldr.(*route) if !ok { return nil, errors.New("unsupported: multi-shard or vindex write statement") } ro := rb.routeOptio...
[ "func", "(", "pb", "*", "primitiveBuilder", ")", "processDMLTable", "(", "tableExprs", "sqlparser", ".", "TableExprs", ")", "(", "*", "routeOption", ",", "error", ")", "{", "if", "err", ":=", "pb", ".", "processTableExprs", "(", "tableExprs", ")", ";", "er...
// This file has functions to analyze the FROM clause. // processDMLTable analyzes the FROM clause for DMLs and returns a routeOption.
[ "This", "file", "has", "functions", "to", "analyze", "the", "FROM", "clause", ".", "processDMLTable", "analyzes", "the", "FROM", "clause", "for", "DMLs", "and", "returns", "a", "routeOption", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/from.go#L32-L45
train
vitessio/vitess
go/vt/vtgate/planbuilder/from.go
processTableExprs
func (pb *primitiveBuilder) processTableExprs(tableExprs sqlparser.TableExprs) error { if len(tableExprs) == 1 { return pb.processTableExpr(tableExprs[0]) } if err := pb.processTableExpr(tableExprs[0]); err != nil { return err } rpb := newPrimitiveBuilder(pb.vschema, pb.jt) if err := rpb.processTableExprs(ta...
go
func (pb *primitiveBuilder) processTableExprs(tableExprs sqlparser.TableExprs) error { if len(tableExprs) == 1 { return pb.processTableExpr(tableExprs[0]) } if err := pb.processTableExpr(tableExprs[0]); err != nil { return err } rpb := newPrimitiveBuilder(pb.vschema, pb.jt) if err := rpb.processTableExprs(ta...
[ "func", "(", "pb", "*", "primitiveBuilder", ")", "processTableExprs", "(", "tableExprs", "sqlparser", ".", "TableExprs", ")", "error", "{", "if", "len", "(", "tableExprs", ")", "==", "1", "{", "return", "pb", ".", "processTableExpr", "(", "tableExprs", "[", ...
// processTableExprs analyzes the FROM clause. It produces a builder // with all the routes identified.
[ "processTableExprs", "analyzes", "the", "FROM", "clause", ".", "It", "produces", "a", "builder", "with", "all", "the", "routes", "identified", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/from.go#L49-L62
train
vitessio/vitess
go/vt/vtgate/planbuilder/from.go
processTableExpr
func (pb *primitiveBuilder) processTableExpr(tableExpr sqlparser.TableExpr) error { switch tableExpr := tableExpr.(type) { case *sqlparser.AliasedTableExpr: return pb.processAliasedTable(tableExpr) case *sqlparser.ParenTableExpr: err := pb.processTableExprs(tableExpr.Exprs) // If it's a route, preserve the par...
go
func (pb *primitiveBuilder) processTableExpr(tableExpr sqlparser.TableExpr) error { switch tableExpr := tableExpr.(type) { case *sqlparser.AliasedTableExpr: return pb.processAliasedTable(tableExpr) case *sqlparser.ParenTableExpr: err := pb.processTableExprs(tableExpr.Exprs) // If it's a route, preserve the par...
[ "func", "(", "pb", "*", "primitiveBuilder", ")", "processTableExpr", "(", "tableExpr", "sqlparser", ".", "TableExpr", ")", "error", "{", "switch", "tableExpr", ":=", "tableExpr", ".", "(", "type", ")", "{", "case", "*", "sqlparser", ".", "AliasedTableExpr", ...
// processTableExpr produces a builder subtree for the given TableExpr.
[ "processTableExpr", "produces", "a", "builder", "subtree", "for", "the", "given", "TableExpr", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/from.go#L65-L83
train
vitessio/vitess
go/vt/vtgate/planbuilder/from.go
processAliasedTable
func (pb *primitiveBuilder) processAliasedTable(tableExpr *sqlparser.AliasedTableExpr) error { switch expr := tableExpr.Expr.(type) { case sqlparser.TableName: return pb.buildTablePrimitive(tableExpr, expr) case *sqlparser.Subquery: spb := newPrimitiveBuilder(pb.vschema, pb.jt) switch stmt := expr.Select.(type...
go
func (pb *primitiveBuilder) processAliasedTable(tableExpr *sqlparser.AliasedTableExpr) error { switch expr := tableExpr.Expr.(type) { case sqlparser.TableName: return pb.buildTablePrimitive(tableExpr, expr) case *sqlparser.Subquery: spb := newPrimitiveBuilder(pb.vschema, pb.jt) switch stmt := expr.Select.(type...
[ "func", "(", "pb", "*", "primitiveBuilder", ")", "processAliasedTable", "(", "tableExpr", "*", "sqlparser", ".", "AliasedTableExpr", ")", "error", "{", "switch", "expr", ":=", "tableExpr", ".", "Expr", ".", "(", "type", ")", "{", "case", "sqlparser", ".", ...
// processAliasedTable produces a builder subtree for the given AliasedTableExpr. // If the expression is a subquery, then the primitive will create a table // for it in the symtab. If the subquery is a route, then we build a route // primitive with the subquery in the From clause, because a route is more // versatile ...
[ "processAliasedTable", "produces", "a", "builder", "subtree", "for", "the", "given", "AliasedTableExpr", ".", "If", "the", "expression", "is", "a", "subquery", "then", "the", "primitive", "will", "create", "a", "table", "for", "it", "in", "the", "symtab", ".",...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/from.go#L92-L168
train
vitessio/vitess
go/vt/vtgate/planbuilder/from.go
processJoin
func (pb *primitiveBuilder) processJoin(ajoin *sqlparser.JoinTableExpr) error { switch ajoin.Join { case sqlparser.JoinStr, sqlparser.StraightJoinStr, sqlparser.LeftJoinStr: case sqlparser.RightJoinStr: convertToLeftJoin(ajoin) default: return fmt.Errorf("unsupported: %s", ajoin.Join) } if err := pb.processTa...
go
func (pb *primitiveBuilder) processJoin(ajoin *sqlparser.JoinTableExpr) error { switch ajoin.Join { case sqlparser.JoinStr, sqlparser.StraightJoinStr, sqlparser.LeftJoinStr: case sqlparser.RightJoinStr: convertToLeftJoin(ajoin) default: return fmt.Errorf("unsupported: %s", ajoin.Join) } if err := pb.processTa...
[ "func", "(", "pb", "*", "primitiveBuilder", ")", "processJoin", "(", "ajoin", "*", "sqlparser", ".", "JoinTableExpr", ")", "error", "{", "switch", "ajoin", ".", "Join", "{", "case", "sqlparser", ".", "JoinStr", ",", "sqlparser", ".", "StraightJoinStr", ",", ...
// processJoin produces a builder subtree for the given Join. // If the left and right nodes can be part of the same route, // then it's a route. Otherwise, it's a join.
[ "processJoin", "produces", "a", "builder", "subtree", "for", "the", "given", "Join", ".", "If", "the", "left", "and", "right", "nodes", "can", "be", "part", "of", "the", "same", "route", "then", "it", "s", "a", "route", ".", "Otherwise", "it", "s", "a"...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/from.go#L254-L270
train
vitessio/vitess
go/vt/vtgate/planbuilder/from.go
convertToLeftJoin
func convertToLeftJoin(ajoin *sqlparser.JoinTableExpr) { newRHS := ajoin.LeftExpr // If the LHS is a join, we have to parenthesize it. // Otherwise, it can be used as is. if _, ok := newRHS.(*sqlparser.JoinTableExpr); ok { newRHS = &sqlparser.ParenTableExpr{ Exprs: sqlparser.TableExprs{newRHS}, } } ajoin.L...
go
func convertToLeftJoin(ajoin *sqlparser.JoinTableExpr) { newRHS := ajoin.LeftExpr // If the LHS is a join, we have to parenthesize it. // Otherwise, it can be used as is. if _, ok := newRHS.(*sqlparser.JoinTableExpr); ok { newRHS = &sqlparser.ParenTableExpr{ Exprs: sqlparser.TableExprs{newRHS}, } } ajoin.L...
[ "func", "convertToLeftJoin", "(", "ajoin", "*", "sqlparser", ".", "JoinTableExpr", ")", "{", "newRHS", ":=", "ajoin", ".", "LeftExpr", "\n", "// If the LHS is a join, we have to parenthesize it.", "// Otherwise, it can be used as is.", "if", "_", ",", "ok", ":=", "newRH...
// convertToLeftJoin converts a right join into a left join.
[ "convertToLeftJoin", "converts", "a", "right", "join", "into", "a", "left", "join", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/from.go#L273-L284
train
vitessio/vitess
go/vt/vtgate/planbuilder/from.go
mergeRoutes
func (pb *primitiveBuilder) mergeRoutes(rpb *primitiveBuilder, routeOptions []*routeOption, ajoin *sqlparser.JoinTableExpr) error { lRoute := pb.bldr.(*route) rRoute := rpb.bldr.(*route) sel := lRoute.Select.(*sqlparser.Select) if ajoin == nil { rhsSel := rRoute.Select.(*sqlparser.Select) sel.From = append(sel...
go
func (pb *primitiveBuilder) mergeRoutes(rpb *primitiveBuilder, routeOptions []*routeOption, ajoin *sqlparser.JoinTableExpr) error { lRoute := pb.bldr.(*route) rRoute := rpb.bldr.(*route) sel := lRoute.Select.(*sqlparser.Select) if ajoin == nil { rhsSel := rRoute.Select.(*sqlparser.Select) sel.From = append(sel...
[ "func", "(", "pb", "*", "primitiveBuilder", ")", "mergeRoutes", "(", "rpb", "*", "primitiveBuilder", ",", "routeOptions", "[", "]", "*", "routeOption", ",", "ajoin", "*", "sqlparser", ".", "JoinTableExpr", ")", "error", "{", "lRoute", ":=", "pb", ".", "bld...
// mergeRoutes merges the two routes. The ON clause is also analyzed to // see if the primitive can be improved. The operation can fail if // the expression contains a non-pushable subquery. ajoin can be nil // if the join is on a ',' operator.
[ "mergeRoutes", "merges", "the", "two", "routes", ".", "The", "ON", "clause", "is", "also", "analyzed", "to", "see", "if", "the", "primitive", "can", "be", "improved", ".", "The", "operation", "can", "fail", "if", "the", "expression", "contains", "a", "non"...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/from.go#L326-L355
train
vitessio/vitess
go/vt/vttablet/sysloglogger/sysloglogger.go
run
func run() { log.Info("Logging queries to syslog") defer writer.Close() // ch will only be non-nil in a unit test context, when a mock has been populated if ch == nil { ch = tabletenv.StatsLogger.Subscribe("gwslog") defer tabletenv.StatsLogger.Unsubscribe(ch) } formatParams := map[string][]string{"full": {}...
go
func run() { log.Info("Logging queries to syslog") defer writer.Close() // ch will only be non-nil in a unit test context, when a mock has been populated if ch == nil { ch = tabletenv.StatsLogger.Subscribe("gwslog") defer tabletenv.StatsLogger.Unsubscribe(ch) } formatParams := map[string][]string{"full": {}...
[ "func", "run", "(", ")", "{", "log", ".", "Info", "(", "\"", "\"", ")", "\n", "defer", "writer", ".", "Close", "(", ")", "\n\n", "// ch will only be non-nil in a unit test context, when a mock has been populated", "if", "ch", "==", "nil", "{", "ch", "=", "tabl...
// Run logs queries to syslog, if the "log_queries" flag is set to true when starting vttablet.
[ "Run", "logs", "queries", "to", "syslog", "if", "the", "log_queries", "flag", "is", "set", "to", "true", "when", "starting", "vttablet", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/sysloglogger/sysloglogger.go#L60-L87
train
vitessio/vitess
go/vt/vttablet/tabletserver/query_list.go
NewQueryDetail
func NewQueryDetail(ctx context.Context, conn killable) *QueryDetail { return &QueryDetail{ctx: ctx, conn: conn, connID: conn.ID(), start: time.Now()} }
go
func NewQueryDetail(ctx context.Context, conn killable) *QueryDetail { return &QueryDetail{ctx: ctx, conn: conn, connID: conn.ID(), start: time.Now()} }
[ "func", "NewQueryDetail", "(", "ctx", "context", ".", "Context", ",", "conn", "killable", ")", "*", "QueryDetail", "{", "return", "&", "QueryDetail", "{", "ctx", ":", "ctx", ",", "conn", ":", "conn", ",", "connID", ":", "conn", ".", "ID", "(", ")", "...
// NewQueryDetail creates a new QueryDetail
[ "NewQueryDetail", "creates", "a", "new", "QueryDetail" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_list.go#L45-L47
train
vitessio/vitess
go/vt/vttablet/tabletserver/query_list.go
Add
func (ql *QueryList) Add(qd *QueryDetail) { ql.mu.Lock() defer ql.mu.Unlock() ql.queryDetails[qd.connID] = qd }
go
func (ql *QueryList) Add(qd *QueryDetail) { ql.mu.Lock() defer ql.mu.Unlock() ql.queryDetails[qd.connID] = qd }
[ "func", "(", "ql", "*", "QueryList", ")", "Add", "(", "qd", "*", "QueryDetail", ")", "{", "ql", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "ql", ".", "mu", ".", "Unlock", "(", ")", "\n", "ql", ".", "queryDetails", "[", "qd", ".", "connID"...
// Add adds a QueryDetail to QueryList
[ "Add", "adds", "a", "QueryDetail", "to", "QueryList" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_list.go#L61-L65
train
vitessio/vitess
go/vt/vttablet/tabletserver/query_list.go
Remove
func (ql *QueryList) Remove(qd *QueryDetail) { ql.mu.Lock() defer ql.mu.Unlock() delete(ql.queryDetails, qd.connID) }
go
func (ql *QueryList) Remove(qd *QueryDetail) { ql.mu.Lock() defer ql.mu.Unlock() delete(ql.queryDetails, qd.connID) }
[ "func", "(", "ql", "*", "QueryList", ")", "Remove", "(", "qd", "*", "QueryDetail", ")", "{", "ql", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "ql", ".", "mu", ".", "Unlock", "(", ")", "\n", "delete", "(", "ql", ".", "queryDetails", ",", "...
// Remove removes a QueryDetail from QueryList
[ "Remove", "removes", "a", "QueryDetail", "from", "QueryList" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_list.go#L68-L72
train
vitessio/vitess
go/vt/vttablet/tabletserver/query_list.go
Terminate
func (ql *QueryList) Terminate(connID int64) error { ql.mu.Lock() defer ql.mu.Unlock() qd := ql.queryDetails[connID] if qd == nil { return fmt.Errorf("query %v not found", connID) } qd.conn.Kill("QueryList.Terminate()", time.Since(qd.start)) return nil }
go
func (ql *QueryList) Terminate(connID int64) error { ql.mu.Lock() defer ql.mu.Unlock() qd := ql.queryDetails[connID] if qd == nil { return fmt.Errorf("query %v not found", connID) } qd.conn.Kill("QueryList.Terminate()", time.Since(qd.start)) return nil }
[ "func", "(", "ql", "*", "QueryList", ")", "Terminate", "(", "connID", "int64", ")", "error", "{", "ql", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "ql", ".", "mu", ".", "Unlock", "(", ")", "\n", "qd", ":=", "ql", ".", "queryDetails", "[", ...
// Terminate updates the query status and kills the connection
[ "Terminate", "updates", "the", "query", "status", "and", "kills", "the", "connection" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_list.go#L75-L84
train
vitessio/vitess
go/vt/vttablet/tabletserver/query_list.go
TerminateAll
func (ql *QueryList) TerminateAll() { ql.mu.Lock() defer ql.mu.Unlock() for _, qd := range ql.queryDetails { qd.conn.Kill("QueryList.TerminateAll()", time.Since(qd.start)) } }
go
func (ql *QueryList) TerminateAll() { ql.mu.Lock() defer ql.mu.Unlock() for _, qd := range ql.queryDetails { qd.conn.Kill("QueryList.TerminateAll()", time.Since(qd.start)) } }
[ "func", "(", "ql", "*", "QueryList", ")", "TerminateAll", "(", ")", "{", "ql", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "ql", ".", "mu", ".", "Unlock", "(", ")", "\n", "for", "_", ",", "qd", ":=", "range", "ql", ".", "queryDetails", "{"...
// TerminateAll terminates all queries and kills the MySQL connections
[ "TerminateAll", "terminates", "all", "queries", "and", "kills", "the", "MySQL", "connections" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_list.go#L87-L93
train
vitessio/vitess
go/vt/vttablet/tabletserver/query_list.go
GetQueryzRows
func (ql *QueryList) GetQueryzRows() []QueryDetailzRow { ql.mu.Lock() rows := []QueryDetailzRow{} for _, qd := range ql.queryDetails { row := QueryDetailzRow{ Query: qd.conn.Current(), ContextHTML: callinfo.HTMLFromContext(qd.ctx), Start: qd.start, Duration: time.Since(qd.start), Conn...
go
func (ql *QueryList) GetQueryzRows() []QueryDetailzRow { ql.mu.Lock() rows := []QueryDetailzRow{} for _, qd := range ql.queryDetails { row := QueryDetailzRow{ Query: qd.conn.Current(), ContextHTML: callinfo.HTMLFromContext(qd.ctx), Start: qd.start, Duration: time.Since(qd.start), Conn...
[ "func", "(", "ql", "*", "QueryList", ")", "GetQueryzRows", "(", ")", "[", "]", "QueryDetailzRow", "{", "ql", ".", "mu", ".", "Lock", "(", ")", "\n", "rows", ":=", "[", "]", "QueryDetailzRow", "{", "}", "\n", "for", "_", ",", "qd", ":=", "range", ...
// GetQueryzRows returns a list of QueryDetailzRow sorted by start time
[ "GetQueryzRows", "returns", "a", "list", "of", "QueryDetailzRow", "sorted", "by", "start", "time" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_list.go#L113-L129
train
vitessio/vitess
go/mysql/conn.go
newConn
func newConn(conn net.Conn) *Conn { return &Conn{ conn: conn, closed: sync2.NewAtomicBool(false), bufferedReader: bufio.NewReaderSize(conn, connBufferSize), } }
go
func newConn(conn net.Conn) *Conn { return &Conn{ conn: conn, closed: sync2.NewAtomicBool(false), bufferedReader: bufio.NewReaderSize(conn, connBufferSize), } }
[ "func", "newConn", "(", "conn", "net", ".", "Conn", ")", "*", "Conn", "{", "return", "&", "Conn", "{", "conn", ":", "conn", ",", "closed", ":", "sync2", ".", "NewAtomicBool", "(", "false", ")", ",", "bufferedReader", ":", "bufio", ".", "NewReaderSize",...
// newConn is an internal method to create a Conn. Used by client and server // side for common creation code.
[ "newConn", "is", "an", "internal", "method", "to", "create", "a", "Conn", ".", "Used", "by", "client", "and", "server", "side", "for", "common", "creation", "code", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/conn.go#L168-L174
train
vitessio/vitess
go/mysql/conn.go
newServerConn
func newServerConn(conn net.Conn, listener *Listener) *Conn { c := &Conn{ conn: conn, listener: listener, closed: sync2.NewAtomicBool(false), } if listener.connReadBufferSize > 0 { c.bufferedReader = bufio.NewReaderSize(conn, listener.connReadBufferSize) } return c }
go
func newServerConn(conn net.Conn, listener *Listener) *Conn { c := &Conn{ conn: conn, listener: listener, closed: sync2.NewAtomicBool(false), } if listener.connReadBufferSize > 0 { c.bufferedReader = bufio.NewReaderSize(conn, listener.connReadBufferSize) } return c }
[ "func", "newServerConn", "(", "conn", "net", ".", "Conn", ",", "listener", "*", "Listener", ")", "*", "Conn", "{", "c", ":=", "&", "Conn", "{", "conn", ":", "conn", ",", "listener", ":", "listener", ",", "closed", ":", "sync2", ".", "NewAtomicBool", ...
// newServerConn should be used to create server connections. // // It stashes a reference to the listener to be able to determine if // the server is shutting down, and has the ability to control buffer // size for reads.
[ "newServerConn", "should", "be", "used", "to", "create", "server", "connections", ".", "It", "stashes", "a", "reference", "to", "the", "listener", "to", "be", "able", "to", "determine", "if", "the", "server", "is", "shutting", "down", "and", "has", "the", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/conn.go#L181-L191
train
vitessio/vitess
go/mysql/conn.go
startWriterBuffering
func (c *Conn) startWriterBuffering() { c.bufferedWriter = writersPool.Get().(*bufio.Writer) c.bufferedWriter.Reset(c.conn) }
go
func (c *Conn) startWriterBuffering() { c.bufferedWriter = writersPool.Get().(*bufio.Writer) c.bufferedWriter.Reset(c.conn) }
[ "func", "(", "c", "*", "Conn", ")", "startWriterBuffering", "(", ")", "{", "c", ".", "bufferedWriter", "=", "writersPool", ".", "Get", "(", ")", ".", "(", "*", "bufio", ".", "Writer", ")", "\n", "c", ".", "bufferedWriter", ".", "Reset", "(", "c", "...
// startWriterBuffering starts using buffered writes. This should // be terminated by a call to flush.
[ "startWriterBuffering", "starts", "using", "buffered", "writes", ".", "This", "should", "be", "terminated", "by", "a", "call", "to", "flush", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/conn.go#L195-L198
train
vitessio/vitess
go/mysql/conn.go
flush
func (c *Conn) flush() error { if c.bufferedWriter == nil { return nil } defer func() { c.bufferedWriter.Reset(nil) writersPool.Put(c.bufferedWriter) c.bufferedWriter = nil }() return c.bufferedWriter.Flush() }
go
func (c *Conn) flush() error { if c.bufferedWriter == nil { return nil } defer func() { c.bufferedWriter.Reset(nil) writersPool.Put(c.bufferedWriter) c.bufferedWriter = nil }() return c.bufferedWriter.Flush() }
[ "func", "(", "c", "*", "Conn", ")", "flush", "(", ")", "error", "{", "if", "c", ".", "bufferedWriter", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "defer", "func", "(", ")", "{", "c", ".", "bufferedWriter", ".", "Reset", "(", "nil", ")"...
// flush flushes the written data to the socket. // This must be called to terminate startBuffering.
[ "flush", "flushes", "the", "written", "data", "to", "the", "socket", ".", "This", "must", "be", "called", "to", "terminate", "startBuffering", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/conn.go#L202-L214
train
vitessio/vitess
go/mysql/conn.go
getWriter
func (c *Conn) getWriter() io.Writer { if c.bufferedWriter != nil { return c.bufferedWriter } return c.conn }
go
func (c *Conn) getWriter() io.Writer { if c.bufferedWriter != nil { return c.bufferedWriter } return c.conn }
[ "func", "(", "c", "*", "Conn", ")", "getWriter", "(", ")", "io", ".", "Writer", "{", "if", "c", ".", "bufferedWriter", "!=", "nil", "{", "return", "c", ".", "bufferedWriter", "\n", "}", "\n", "return", "c", ".", "conn", "\n", "}" ]
// getWriter returns the current writer. It may be either // the original connection or a wrapper.
[ "getWriter", "returns", "the", "current", "writer", ".", "It", "may", "be", "either", "the", "original", "connection", "or", "a", "wrapper", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/conn.go#L218-L223
train
vitessio/vitess
go/mysql/conn.go
readEphemeralPacket
func (c *Conn) readEphemeralPacket() ([]byte, error) { if c.currentEphemeralPolicy != ephemeralUnused { panic(vterrors.Errorf(vtrpc.Code_INTERNAL, "readEphemeralPacket: unexpected currentEphemeralPolicy: %v", c.currentEphemeralPolicy)) } r := c.getReader() length, err := c.readHeaderFrom(r) if err != nil { r...
go
func (c *Conn) readEphemeralPacket() ([]byte, error) { if c.currentEphemeralPolicy != ephemeralUnused { panic(vterrors.Errorf(vtrpc.Code_INTERNAL, "readEphemeralPacket: unexpected currentEphemeralPolicy: %v", c.currentEphemeralPolicy)) } r := c.getReader() length, err := c.readHeaderFrom(r) if err != nil { r...
[ "func", "(", "c", "*", "Conn", ")", "readEphemeralPacket", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "if", "c", ".", "currentEphemeralPolicy", "!=", "ephemeralUnused", "{", "panic", "(", "vterrors", ".", "Errorf", "(", "vtrpc", ".", "Cod...
// readEphemeralPacket attempts to read a packet into buffer from sync.Pool. Do // not use this method if the contents of the packet needs to be kept // after the next readEphemeralPacket. // // Note if the connection is closed already, an error will be // returned, and it may not be io.EOF. If the connection closes w...
[ "readEphemeralPacket", "attempts", "to", "read", "a", "packet", "into", "buffer", "from", "sync", ".", "Pool", ".", "Do", "not", "use", "this", "method", "if", "the", "contents", "of", "the", "packet", "needs", "to", "be", "kept", "after", "the", "next", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/conn.go#L273-L326
train
vitessio/vitess
go/mysql/conn.go
readEphemeralPacketDirect
func (c *Conn) readEphemeralPacketDirect() ([]byte, error) { if c.currentEphemeralPolicy != ephemeralUnused { panic(vterrors.Errorf(vtrpc.Code_INTERNAL, "readEphemeralPacketDirect: unexpected currentEphemeralPolicy: %v", c.currentEphemeralPolicy)) } var r io.Reader = c.conn length, err := c.readHeaderFrom(r) i...
go
func (c *Conn) readEphemeralPacketDirect() ([]byte, error) { if c.currentEphemeralPolicy != ephemeralUnused { panic(vterrors.Errorf(vtrpc.Code_INTERNAL, "readEphemeralPacketDirect: unexpected currentEphemeralPolicy: %v", c.currentEphemeralPolicy)) } var r io.Reader = c.conn length, err := c.readHeaderFrom(r) i...
[ "func", "(", "c", "*", "Conn", ")", "readEphemeralPacketDirect", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "if", "c", ".", "currentEphemeralPolicy", "!=", "ephemeralUnused", "{", "panic", "(", "vterrors", ".", "Errorf", "(", "vtrpc", ".", ...
// readEphemeralPacketDirect attempts to read a packet from the socket directly. // It needs to be used for the first handshake packet the server receives, // so we do't buffer the SSL negotiation packet. As a shortcut, only // packets smaller than MaxPacketSize can be read here. // This function usually shouldn't be u...
[ "readEphemeralPacketDirect", "attempts", "to", "read", "a", "packet", "from", "the", "socket", "directly", ".", "It", "needs", "to", "be", "used", "for", "the", "first", "handshake", "packet", "the", "server", "receives", "so", "we", "do", "t", "buffer", "th...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/conn.go#L333-L361
train
vitessio/vitess
go/mysql/conn.go
recycleReadPacket
func (c *Conn) recycleReadPacket() { if c.currentEphemeralPolicy != ephemeralRead { // Programming error. panic(vterrors.Errorf(vtrpc.Code_INTERNAL, "trying to call recycleReadPacket while currentEphemeralPolicy is %d", c.currentEphemeralPolicy)) } if c.currentEphemeralBuffer != nil { // We are using the pool,...
go
func (c *Conn) recycleReadPacket() { if c.currentEphemeralPolicy != ephemeralRead { // Programming error. panic(vterrors.Errorf(vtrpc.Code_INTERNAL, "trying to call recycleReadPacket while currentEphemeralPolicy is %d", c.currentEphemeralPolicy)) } if c.currentEphemeralBuffer != nil { // We are using the pool,...
[ "func", "(", "c", "*", "Conn", ")", "recycleReadPacket", "(", ")", "{", "if", "c", ".", "currentEphemeralPolicy", "!=", "ephemeralRead", "{", "// Programming error.", "panic", "(", "vterrors", ".", "Errorf", "(", "vtrpc", ".", "Code_INTERNAL", ",", "\"", "\"...
// recycleReadPacket recycles the read packet. It needs to be called // after readEphemeralPacket was called.
[ "recycleReadPacket", "recycles", "the", "read", "packet", ".", "It", "needs", "to", "be", "called", "after", "readEphemeralPacket", "was", "called", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/conn.go#L365-L376
train
vitessio/vitess
go/mysql/conn.go
readOnePacket
func (c *Conn) readOnePacket() ([]byte, error) { r := c.getReader() length, err := c.readHeaderFrom(r) if err != nil { return nil, err } if length == 0 { // This can be caused by the packet after a packet of // exactly size MaxPacketSize. return nil, nil } data := make([]byte, length) if _, err := io.R...
go
func (c *Conn) readOnePacket() ([]byte, error) { r := c.getReader() length, err := c.readHeaderFrom(r) if err != nil { return nil, err } if length == 0 { // This can be caused by the packet after a packet of // exactly size MaxPacketSize. return nil, nil } data := make([]byte, length) if _, err := io.R...
[ "func", "(", "c", "*", "Conn", ")", "readOnePacket", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "r", ":=", "c", ".", "getReader", "(", ")", "\n", "length", ",", "err", ":=", "c", ".", "readHeaderFrom", "(", "r", ")", "\n", "if", ...
// readOnePacket reads a single packet into a newly allocated buffer.
[ "readOnePacket", "reads", "a", "single", "packet", "into", "a", "newly", "allocated", "buffer", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/conn.go#L379-L396
train
vitessio/vitess
go/mysql/conn.go
readPacket
func (c *Conn) readPacket() ([]byte, error) { // Optimize for a single packet case. data, err := c.readOnePacket() if err != nil { return nil, err } // This is a single packet. if len(data) < MaxPacketSize { return data, nil } // There is more than one packet, read them all. for { next, err := c.readOn...
go
func (c *Conn) readPacket() ([]byte, error) { // Optimize for a single packet case. data, err := c.readOnePacket() if err != nil { return nil, err } // This is a single packet. if len(data) < MaxPacketSize { return data, nil } // There is more than one packet, read them all. for { next, err := c.readOn...
[ "func", "(", "c", "*", "Conn", ")", "readPacket", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "// Optimize for a single packet case.", "data", ",", "err", ":=", "c", ".", "readOnePacket", "(", ")", "\n", "if", "err", "!=", "nil", "{", "r...
// readPacket reads a packet from the underlying connection. // It re-assembles packets that span more than one message. // This method returns a generic error, not a SQLError.
[ "readPacket", "reads", "a", "packet", "from", "the", "underlying", "connection", ".", "It", "re", "-", "assembles", "packets", "that", "span", "more", "than", "one", "message", ".", "This", "method", "returns", "a", "generic", "error", "not", "a", "SQLError"...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/conn.go#L401-L432
train
vitessio/vitess
go/mysql/conn.go
ReadPacket
func (c *Conn) ReadPacket() ([]byte, error) { result, err := c.readPacket() if err != nil { return nil, NewSQLError(CRServerLost, SSUnknownSQLState, "%v", err) } return result, err }
go
func (c *Conn) ReadPacket() ([]byte, error) { result, err := c.readPacket() if err != nil { return nil, NewSQLError(CRServerLost, SSUnknownSQLState, "%v", err) } return result, err }
[ "func", "(", "c", "*", "Conn", ")", "ReadPacket", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "result", ",", "err", ":=", "c", ".", "readPacket", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "NewSQLError", "...
// ReadPacket reads a packet from the underlying connection. // it is the public API version, that returns a SQLError. // The memory for the packet is always allocated, and it is owned by the caller // after this function returns.
[ "ReadPacket", "reads", "a", "packet", "from", "the", "underlying", "connection", ".", "it", "is", "the", "public", "API", "version", "that", "returns", "a", "SQLError", ".", "The", "memory", "for", "the", "packet", "is", "always", "allocated", "and", "it", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/conn.go#L438-L444
train
vitessio/vitess
go/mysql/conn.go
writeEphemeralPacket
func (c *Conn) writeEphemeralPacket() error { defer c.recycleWritePacket() switch c.currentEphemeralPolicy { case ephemeralWrite: if err := c.writePacket(*c.currentEphemeralBuffer); err != nil { return vterrors.Wrapf(err, "conn %v", c.ID()) } case ephemeralUnused, ephemeralRead: // Programming error. pa...
go
func (c *Conn) writeEphemeralPacket() error { defer c.recycleWritePacket() switch c.currentEphemeralPolicy { case ephemeralWrite: if err := c.writePacket(*c.currentEphemeralBuffer); err != nil { return vterrors.Wrapf(err, "conn %v", c.ID()) } case ephemeralUnused, ephemeralRead: // Programming error. pa...
[ "func", "(", "c", "*", "Conn", ")", "writeEphemeralPacket", "(", ")", "error", "{", "defer", "c", ".", "recycleWritePacket", "(", ")", "\n\n", "switch", "c", ".", "currentEphemeralPolicy", "{", "case", "ephemeralWrite", ":", "if", "err", ":=", "c", ".", ...
// writeEphemeralPacket writes the packet that was allocated by // startEphemeralPacket.
[ "writeEphemeralPacket", "writes", "the", "packet", "that", "was", "allocated", "by", "startEphemeralPacket", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/conn.go#L522-L536
train
vitessio/vitess
go/mysql/conn.go
recycleWritePacket
func (c *Conn) recycleWritePacket() { if c.currentEphemeralPolicy != ephemeralWrite { // Programming error. panic(vterrors.Errorf(vtrpc.Code_INTERNAL, "trying to call recycleWritePacket while currentEphemeralPolicy is %d", c.currentEphemeralPolicy)) } // Release our reference so the buffer can be gced bufPool.P...
go
func (c *Conn) recycleWritePacket() { if c.currentEphemeralPolicy != ephemeralWrite { // Programming error. panic(vterrors.Errorf(vtrpc.Code_INTERNAL, "trying to call recycleWritePacket while currentEphemeralPolicy is %d", c.currentEphemeralPolicy)) } // Release our reference so the buffer can be gced bufPool.P...
[ "func", "(", "c", "*", "Conn", ")", "recycleWritePacket", "(", ")", "{", "if", "c", ".", "currentEphemeralPolicy", "!=", "ephemeralWrite", "{", "// Programming error.", "panic", "(", "vterrors", ".", "Errorf", "(", "vtrpc", ".", "Code_INTERNAL", ",", "\"", "...
// recycleWritePacket recycles the write packet. It needs to be called // after writeEphemeralPacket was called.
[ "recycleWritePacket", "recycles", "the", "write", "packet", ".", "It", "needs", "to", "be", "called", "after", "writeEphemeralPacket", "was", "called", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/conn.go#L540-L549
train
vitessio/vitess
go/mysql/conn.go
String
func (c *Conn) String() string { return fmt.Sprintf("client %v (%s)", c.ConnectionID, c.RemoteAddr().String()) }
go
func (c *Conn) String() string { return fmt.Sprintf("client %v (%s)", c.ConnectionID, c.RemoteAddr().String()) }
[ "func", "(", "c", "*", "Conn", ")", "String", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "c", ".", "ConnectionID", ",", "c", ".", "RemoteAddr", "(", ")", ".", "String", "(", ")", ")", "\n", "}" ]
// Ident returns a useful identification string for error logging
[ "Ident", "returns", "a", "useful", "identification", "string", "for", "error", "logging" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/conn.go#L578-L580
train
vitessio/vitess
go/mysql/conn.go
Close
func (c *Conn) Close() { if c.closed.CompareAndSwap(false, true) { c.conn.Close() } }
go
func (c *Conn) Close() { if c.closed.CompareAndSwap(false, true) { c.conn.Close() } }
[ "func", "(", "c", "*", "Conn", ")", "Close", "(", ")", "{", "if", "c", ".", "closed", ".", "CompareAndSwap", "(", "false", ",", "true", ")", "{", "c", ".", "conn", ".", "Close", "(", ")", "\n", "}", "\n", "}" ]
// Close closes the connection. It can be called from a different go // routine to interrupt the current connection.
[ "Close", "closes", "the", "connection", ".", "It", "can", "be", "called", "from", "a", "different", "go", "routine", "to", "interrupt", "the", "current", "connection", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/conn.go#L584-L588
train
vitessio/vitess
go/mysql/conn.go
writeOKPacket
func (c *Conn) writeOKPacket(affectedRows, lastInsertID uint64, flags uint16, warnings uint16) error { length := 1 + // OKPacket lenEncIntSize(affectedRows) + lenEncIntSize(lastInsertID) + 2 + // flags 2 // warnings data := c.startEphemeralPacket(length) pos := 0 pos = writeByte(data, pos, OKPacket) pos = ...
go
func (c *Conn) writeOKPacket(affectedRows, lastInsertID uint64, flags uint16, warnings uint16) error { length := 1 + // OKPacket lenEncIntSize(affectedRows) + lenEncIntSize(lastInsertID) + 2 + // flags 2 // warnings data := c.startEphemeralPacket(length) pos := 0 pos = writeByte(data, pos, OKPacket) pos = ...
[ "func", "(", "c", "*", "Conn", ")", "writeOKPacket", "(", "affectedRows", ",", "lastInsertID", "uint64", ",", "flags", "uint16", ",", "warnings", "uint16", ")", "error", "{", "length", ":=", "1", "+", "// OKPacket", "lenEncIntSize", "(", "affectedRows", ")",...
// // Packet writing methods, for generic packets. // // writeOKPacket writes an OK packet. // Server -> Client. // This method returns a generic error, not a SQLError.
[ "Packet", "writing", "methods", "for", "generic", "packets", ".", "writeOKPacket", "writes", "an", "OK", "packet", ".", "Server", "-", ">", "Client", ".", "This", "method", "returns", "a", "generic", "error", "not", "a", "SQLError", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/conn.go#L604-L619
train
vitessio/vitess
go/mysql/conn.go
writeErrorPacket
func (c *Conn) writeErrorPacket(errorCode uint16, sqlState string, format string, args ...interface{}) error { errorMessage := fmt.Sprintf(format, args...) length := 1 + 2 + 1 + 5 + len(errorMessage) data := c.startEphemeralPacket(length) pos := 0 pos = writeByte(data, pos, ErrPacket) pos = writeUint16(data, pos,...
go
func (c *Conn) writeErrorPacket(errorCode uint16, sqlState string, format string, args ...interface{}) error { errorMessage := fmt.Sprintf(format, args...) length := 1 + 2 + 1 + 5 + len(errorMessage) data := c.startEphemeralPacket(length) pos := 0 pos = writeByte(data, pos, ErrPacket) pos = writeUint16(data, pos,...
[ "func", "(", "c", "*", "Conn", ")", "writeErrorPacket", "(", "errorCode", "uint16", ",", "sqlState", "string", ",", "format", "string", ",", "args", "...", "interface", "{", "}", ")", "error", "{", "errorMessage", ":=", "fmt", ".", "Sprintf", "(", "forma...
// writeErrorPacket writes an error packet. // Server -> Client. // This method returns a generic error, not a SQLError.
[ "writeErrorPacket", "writes", "an", "error", "packet", ".", "Server", "-", ">", "Client", ".", "This", "method", "returns", "a", "generic", "error", "not", "a", "SQLError", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/conn.go#L646-L664
train