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/discovery/tablet_stats_cache_wait.go
WaitForAnyTablet
func (tc *TabletStatsCache) WaitForAnyTablet(ctx context.Context, cell, keyspace, shard string, tabletTypes []topodatapb.TabletType) error { return tc.waitForAnyTablet(ctx, keyspace, shard, tabletTypes) }
go
func (tc *TabletStatsCache) WaitForAnyTablet(ctx context.Context, cell, keyspace, shard string, tabletTypes []topodatapb.TabletType) error { return tc.waitForAnyTablet(ctx, keyspace, shard, tabletTypes) }
[ "func", "(", "tc", "*", "TabletStatsCache", ")", "WaitForAnyTablet", "(", "ctx", "context", ".", "Context", ",", "cell", ",", "keyspace", ",", "shard", "string", ",", "tabletTypes", "[", "]", "topodatapb", ".", "TabletType", ")", "error", "{", "return", "t...
// WaitForAnyTablet waits for a single tablet of any of the types. // It doesn't have to be serving.
[ "WaitForAnyTablet", "waits", "for", "a", "single", "tablet", "of", "any", "of", "the", "types", ".", "It", "doesn", "t", "have", "to", "be", "serving", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/tablet_stats_cache_wait.go#L49-L51
train
vitessio/vitess
go/vt/discovery/tablet_stats_cache_wait.go
waitForTablets
func (tc *TabletStatsCache) waitForTablets(ctx context.Context, targets []*querypb.Target, requireServing bool) error { for { // We nil targets as we find them. allPresent := true for i, target := range targets { if target == nil { continue } var stats []TabletStats if requireServing { stats...
go
func (tc *TabletStatsCache) waitForTablets(ctx context.Context, targets []*querypb.Target, requireServing bool) error { for { // We nil targets as we find them. allPresent := true for i, target := range targets { if target == nil { continue } var stats []TabletStats if requireServing { stats...
[ "func", "(", "tc", "*", "TabletStatsCache", ")", "waitForTablets", "(", "ctx", "context", ".", "Context", ",", "targets", "[", "]", "*", "querypb", ".", "Target", ",", "requireServing", "bool", ")", "error", "{", "for", "{", "// We nil targets as we find them....
// waitForTablets is the internal method that polls for tablets.
[ "waitForTablets", "is", "the", "internal", "method", "that", "polls", "for", "tablets", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/tablet_stats_cache_wait.go#L62-L98
train
vitessio/vitess
go/vt/discovery/tablet_stats_cache_wait.go
waitForAnyTablet
func (tc *TabletStatsCache) waitForAnyTablet(ctx context.Context, keyspace, shard string, types []topodatapb.TabletType) error { for { for _, tt := range types { stats := tc.GetTabletStats(keyspace, shard, tt) if len(stats) > 0 { return nil } } // Unblock after the sleep or when the context has exp...
go
func (tc *TabletStatsCache) waitForAnyTablet(ctx context.Context, keyspace, shard string, types []topodatapb.TabletType) error { for { for _, tt := range types { stats := tc.GetTabletStats(keyspace, shard, tt) if len(stats) > 0 { return nil } } // Unblock after the sleep or when the context has exp...
[ "func", "(", "tc", "*", "TabletStatsCache", ")", "waitForAnyTablet", "(", "ctx", "context", ".", "Context", ",", "keyspace", ",", "shard", "string", ",", "types", "[", "]", "topodatapb", ".", "TabletType", ")", "error", "{", "for", "{", "for", "_", ",", ...
// waitForAnyTablet is the internal method that polls for any tablet of required type
[ "waitForAnyTablet", "is", "the", "internal", "method", "that", "polls", "for", "any", "tablet", "of", "required", "type" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/tablet_stats_cache_wait.go#L101-L119
train
vitessio/vitess
go/vt/topotools/events/reparent_syslog.go
Syslog
func (r *Reparent) Syslog() (syslog.Priority, string) { return syslog.LOG_INFO, fmt.Sprintf("%s/%s [reparent %v -> %v] %s (%s)", r.ShardInfo.Keyspace(), r.ShardInfo.ShardName(), topoproto.TabletAliasString(r.OldMaster.Alias), topoproto.TabletAliasString(r.NewMaster.Alias), r.Status, r.ExternalID) }
go
func (r *Reparent) Syslog() (syslog.Priority, string) { return syslog.LOG_INFO, fmt.Sprintf("%s/%s [reparent %v -> %v] %s (%s)", r.ShardInfo.Keyspace(), r.ShardInfo.ShardName(), topoproto.TabletAliasString(r.OldMaster.Alias), topoproto.TabletAliasString(r.NewMaster.Alias), r.Status, r.ExternalID) }
[ "func", "(", "r", "*", "Reparent", ")", "Syslog", "(", ")", "(", "syslog", ".", "Priority", ",", "string", ")", "{", "return", "syslog", ".", "LOG_INFO", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "r", ".", "ShardInfo", ".", "Keyspace", "(",...
// Syslog writes a Reparent event to syslog.
[ "Syslog", "writes", "a", "Reparent", "event", "to", "syslog", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topotools/events/reparent_syslog.go#L28-L34
train
vitessio/vitess
go/sqltypes/arithmetic.go
Min
func Min(v1, v2 Value) (Value, error) { return minmax(v1, v2, true) }
go
func Min(v1, v2 Value) (Value, error) { return minmax(v1, v2, true) }
[ "func", "Min", "(", "v1", ",", "v2", "Value", ")", "(", "Value", ",", "error", ")", "{", "return", "minmax", "(", "v1", ",", "v2", ",", "true", ")", "\n", "}" ]
// Min returns the minimum of v1 and v2. If one of the // values is NULL, it returns the other value. If both // are NULL, it returns NULL.
[ "Min", "returns", "the", "minimum", "of", "v1", "and", "v2", ".", "If", "one", "of", "the", "values", "is", "NULL", "it", "returns", "the", "other", "value", ".", "If", "both", "are", "NULL", "it", "returns", "NULL", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/arithmetic.go#L123-L125
train
vitessio/vitess
go/sqltypes/arithmetic.go
Max
func Max(v1, v2 Value) (Value, error) { return minmax(v1, v2, false) }
go
func Max(v1, v2 Value) (Value, error) { return minmax(v1, v2, false) }
[ "func", "Max", "(", "v1", ",", "v2", "Value", ")", "(", "Value", ",", "error", ")", "{", "return", "minmax", "(", "v1", ",", "v2", ",", "false", ")", "\n", "}" ]
// Max returns the maximum of v1 and v2. If one of the // values is NULL, it returns the other value. If both // are NULL, it returns NULL.
[ "Max", "returns", "the", "maximum", "of", "v1", "and", "v2", ".", "If", "one", "of", "the", "values", "is", "NULL", "it", "returns", "the", "other", "value", ".", "If", "both", "are", "NULL", "it", "returns", "NULL", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/arithmetic.go#L130-L132
train
vitessio/vitess
go/sqltypes/arithmetic.go
Cast
func Cast(v Value, typ querypb.Type) (Value, error) { if v.Type() == typ || v.IsNull() { return v, nil } if IsSigned(typ) && v.IsSigned() { return MakeTrusted(typ, v.ToBytes()), nil } if IsUnsigned(typ) && v.IsUnsigned() { return MakeTrusted(typ, v.ToBytes()), nil } if (IsFloat(typ) || typ == Decimal) && (...
go
func Cast(v Value, typ querypb.Type) (Value, error) { if v.Type() == typ || v.IsNull() { return v, nil } if IsSigned(typ) && v.IsSigned() { return MakeTrusted(typ, v.ToBytes()), nil } if IsUnsigned(typ) && v.IsUnsigned() { return MakeTrusted(typ, v.ToBytes()), nil } if (IsFloat(typ) || typ == Decimal) && (...
[ "func", "Cast", "(", "v", "Value", ",", "typ", "querypb", ".", "Type", ")", "(", "Value", ",", "error", ")", "{", "if", "v", ".", "Type", "(", ")", "==", "typ", "||", "v", ".", "IsNull", "(", ")", "{", "return", "v", ",", "nil", "\n", "}", ...
// Cast converts a Value to the target type.
[ "Cast", "converts", "a", "Value", "to", "the", "target", "type", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/arithmetic.go#L156-L181
train
vitessio/vitess
go/sqltypes/arithmetic.go
ToUint64
func ToUint64(v Value) (uint64, error) { num, err := newIntegralNumeric(v) if err != nil { return 0, err } switch num.typ { case Int64: if num.ival < 0 { return 0, vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "negative number cannot be converted to unsigned: %d", num.ival) } return uint64(num.ival), n...
go
func ToUint64(v Value) (uint64, error) { num, err := newIntegralNumeric(v) if err != nil { return 0, err } switch num.typ { case Int64: if num.ival < 0 { return 0, vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "negative number cannot be converted to unsigned: %d", num.ival) } return uint64(num.ival), n...
[ "func", "ToUint64", "(", "v", "Value", ")", "(", "uint64", ",", "error", ")", "{", "num", ",", "err", ":=", "newIntegralNumeric", "(", "v", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n", "switch", "num", "."...
// ToUint64 converts Value to uint64.
[ "ToUint64", "converts", "Value", "to", "uint64", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/arithmetic.go#L184-L199
train
vitessio/vitess
go/sqltypes/arithmetic.go
ToFloat64
func ToFloat64(v Value) (float64, error) { num, err := newNumeric(v) if err != nil { return 0, err } switch num.typ { case Int64: return float64(num.ival), nil case Uint64: return float64(num.uval), nil case Float64: return num.fval, nil } panic("unreachable") }
go
func ToFloat64(v Value) (float64, error) { num, err := newNumeric(v) if err != nil { return 0, err } switch num.typ { case Int64: return float64(num.ival), nil case Uint64: return float64(num.uval), nil case Float64: return num.fval, nil } panic("unreachable") }
[ "func", "ToFloat64", "(", "v", "Value", ")", "(", "float64", ",", "error", ")", "{", "num", ",", "err", ":=", "newNumeric", "(", "v", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n", "switch", "num", ".", "t...
// ToFloat64 converts Value to float64.
[ "ToFloat64", "converts", "Value", "to", "float64", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/arithmetic.go#L221-L235
train
vitessio/vitess
go/sqltypes/arithmetic.go
newNumeric
func newNumeric(v Value) (numeric, error) { str := v.ToString() switch { case v.IsSigned(): ival, err := strconv.ParseInt(str, 10, 64) if err != nil { return numeric{}, vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "%v", err) } return numeric{ival: ival, typ: Int64}, nil case v.IsUnsigned(): uval, err...
go
func newNumeric(v Value) (numeric, error) { str := v.ToString() switch { case v.IsSigned(): ival, err := strconv.ParseInt(str, 10, 64) if err != nil { return numeric{}, vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "%v", err) } return numeric{ival: ival, typ: Int64}, nil case v.IsUnsigned(): uval, err...
[ "func", "newNumeric", "(", "v", "Value", ")", "(", "numeric", ",", "error", ")", "{", "str", ":=", "v", ".", "ToString", "(", ")", "\n", "switch", "{", "case", "v", ".", "IsSigned", "(", ")", ":", "ival", ",", "err", ":=", "strconv", ".", "ParseI...
// newNumeric parses a value and produces an Int64, Uint64 or Float64.
[ "newNumeric", "parses", "a", "value", "and", "produces", "an", "Int64", "Uint64", "or", "Float64", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/arithmetic.go#L260-L291
train
vitessio/vitess
go/sqltypes/arithmetic.go
newIntegralNumeric
func newIntegralNumeric(v Value) (numeric, error) { str := v.ToString() switch { case v.IsSigned(): ival, err := strconv.ParseInt(str, 10, 64) if err != nil { return numeric{}, vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "%v", err) } return numeric{ival: ival, typ: Int64}, nil case v.IsUnsigned(): u...
go
func newIntegralNumeric(v Value) (numeric, error) { str := v.ToString() switch { case v.IsSigned(): ival, err := strconv.ParseInt(str, 10, 64) if err != nil { return numeric{}, vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "%v", err) } return numeric{ival: ival, typ: Int64}, nil case v.IsUnsigned(): u...
[ "func", "newIntegralNumeric", "(", "v", "Value", ")", "(", "numeric", ",", "error", ")", "{", "str", ":=", "v", ".", "ToString", "(", ")", "\n", "switch", "{", "case", "v", ".", "IsSigned", "(", ")", ":", "ival", ",", "err", ":=", "strconv", ".", ...
// newIntegralNumeric parses a value and produces an Int64 or Uint64.
[ "newIntegralNumeric", "parses", "a", "value", "and", "produces", "an", "Int64", "or", "Uint64", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/arithmetic.go#L294-L319
train
vitessio/vitess
go/sqltypes/arithmetic.go
prioritize
func prioritize(v1, v2 numeric) (altv1, altv2 numeric) { switch v1.typ { case Int64: if v2.typ == Uint64 || v2.typ == Float64 { return v2, v1 } case Uint64: if v2.typ == Float64 { return v2, v1 } } return v1, v2 }
go
func prioritize(v1, v2 numeric) (altv1, altv2 numeric) { switch v1.typ { case Int64: if v2.typ == Uint64 || v2.typ == Float64 { return v2, v1 } case Uint64: if v2.typ == Float64 { return v2, v1 } } return v1, v2 }
[ "func", "prioritize", "(", "v1", ",", "v2", "numeric", ")", "(", "altv1", ",", "altv2", "numeric", ")", "{", "switch", "v1", ".", "typ", "{", "case", "Int64", ":", "if", "v2", ".", "typ", "==", "Uint64", "||", "v2", ".", "typ", "==", "Float64", "...
// prioritize reorders the input parameters // to be Float64, Uint64, Int64.
[ "prioritize", "reorders", "the", "input", "parameters", "to", "be", "Float64", "Uint64", "Int64", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/arithmetic.go#L341-L353
train
vitessio/vitess
go/vt/vtgate/logstats.go
RemoteAddrUsername
func (stats *LogStats) RemoteAddrUsername() (string, string) { ci, ok := callinfo.FromContext(stats.Ctx) if !ok { return "", "" } return ci.RemoteAddr(), ci.Username() }
go
func (stats *LogStats) RemoteAddrUsername() (string, string) { ci, ok := callinfo.FromContext(stats.Ctx) if !ok { return "", "" } return ci.RemoteAddr(), ci.Username() }
[ "func", "(", "stats", "*", "LogStats", ")", "RemoteAddrUsername", "(", ")", "(", "string", ",", "string", ")", "{", "ci", ",", "ok", ":=", "callinfo", ".", "FromContext", "(", "stats", ".", "Ctx", ")", "\n", "if", "!", "ok", "{", "return", "\"", "\...
// RemoteAddrUsername returns some parts of CallInfo if set
[ "RemoteAddrUsername", "returns", "some", "parts", "of", "CallInfo", "if", "set" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/logstats.go#L113-L119
train
vitessio/vitess
go/vt/vtgate/vschemaacl/vschemaacl.go
Authorized
func Authorized(caller *querypb.VTGateCallerID) bool { if allowAll { return true } user := caller.GetUsername() _, ok := acl[user] return ok }
go
func Authorized(caller *querypb.VTGateCallerID) bool { if allowAll { return true } user := caller.GetUsername() _, ok := acl[user] return ok }
[ "func", "Authorized", "(", "caller", "*", "querypb", ".", "VTGateCallerID", ")", "bool", "{", "if", "allowAll", "{", "return", "true", "\n", "}", "\n\n", "user", ":=", "caller", ".", "GetUsername", "(", ")", "\n", "_", ",", "ok", ":=", "acl", "[", "u...
// Authorized returns true if the given caller is allowed to execute vschema operations
[ "Authorized", "returns", "true", "if", "the", "given", "caller", "is", "allowed", "to", "execute", "vschema", "operations" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vschemaacl/vschemaacl.go#L56-L64
train
vitessio/vitess
go/vt/worker/status_worker.go
SetState
func (w *StatusWorker) SetState(state StatusWorkerState) { w.mu.Lock() defer w.mu.Unlock() w.state = state statsState.Set(string(state)) }
go
func (w *StatusWorker) SetState(state StatusWorkerState) { w.mu.Lock() defer w.mu.Unlock() w.state = state statsState.Set(string(state)) }
[ "func", "(", "w", "*", "StatusWorker", ")", "SetState", "(", "state", "StatusWorkerState", ")", "{", "w", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "w", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "w", ".", "state", "=", "state", "\n", "st...
// SetState is a convenience function for workers.
[ "SetState", "is", "a", "convenience", "function", "for", "workers", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/status_worker.go#L88-L94
train
vitessio/vitess
go/vt/worker/status_worker.go
State
func (w *StatusWorker) State() StatusWorkerState { w.mu.Lock() defer w.mu.Unlock() return w.state }
go
func (w *StatusWorker) State() StatusWorkerState { w.mu.Lock() defer w.mu.Unlock() return w.state }
[ "func", "(", "w", "*", "StatusWorker", ")", "State", "(", ")", "StatusWorkerState", "{", "w", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "w", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "return", "w", ".", "state", "\n", "}" ]
// State is part of the Worker interface.
[ "State", "is", "part", "of", "the", "Worker", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/status_worker.go#L97-L102
train
vitessio/vitess
go/vt/automation/id_generator.go
GetNextID
func (ig *IDGenerator) GetNextID() string { return strconv.FormatInt(atomic.AddInt64(&ig.counter, 1), 10) }
go
func (ig *IDGenerator) GetNextID() string { return strconv.FormatInt(atomic.AddInt64(&ig.counter, 1), 10) }
[ "func", "(", "ig", "*", "IDGenerator", ")", "GetNextID", "(", ")", "string", "{", "return", "strconv", ".", "FormatInt", "(", "atomic", ".", "AddInt64", "(", "&", "ig", ".", "counter", ",", "1", ")", ",", "10", ")", "\n", "}" ]
// GetNextID returns an ID which wasn't returned before.
[ "GetNextID", "returns", "an", "ID", "which", "wasn", "t", "returned", "before", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/automation/id_generator.go#L30-L32
train
vitessio/vitess
go/pools/id_pool.go
Get
func (pool *IDPool) Get() (id uint32) { pool.Lock() defer pool.Unlock() // Pick a value that's been returned, if any. for key := range pool.used { delete(pool.used, key) return key } // No recycled IDs are available, so increase the pool size. pool.maxUsed += 1 return pool.maxUsed }
go
func (pool *IDPool) Get() (id uint32) { pool.Lock() defer pool.Unlock() // Pick a value that's been returned, if any. for key := range pool.used { delete(pool.used, key) return key } // No recycled IDs are available, so increase the pool size. pool.maxUsed += 1 return pool.maxUsed }
[ "func", "(", "pool", "*", "IDPool", ")", "Get", "(", ")", "(", "id", "uint32", ")", "{", "pool", ".", "Lock", "(", ")", "\n", "defer", "pool", ".", "Unlock", "(", ")", "\n\n", "// Pick a value that's been returned, if any.", "for", "key", ":=", "range", ...
// Get returns an ID that is unique among currently active users of this pool.
[ "Get", "returns", "an", "ID", "that", "is", "unique", "among", "currently", "active", "users", "of", "this", "pool", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/pools/id_pool.go#L46-L59
train
vitessio/vitess
go/pools/id_pool.go
Put
func (pool *IDPool) Put(id uint32) { pool.Lock() defer pool.Unlock() if id < 1 || id > pool.maxUsed { panic(fmt.Errorf("IDPool.Put(%v): invalid value, must be in the range [1,%v]", id, pool.maxUsed)) } if pool.used[id] { panic(fmt.Errorf("IDPool.Put(%v): can't put value that was already recycled", id)) } ...
go
func (pool *IDPool) Put(id uint32) { pool.Lock() defer pool.Unlock() if id < 1 || id > pool.maxUsed { panic(fmt.Errorf("IDPool.Put(%v): invalid value, must be in the range [1,%v]", id, pool.maxUsed)) } if pool.used[id] { panic(fmt.Errorf("IDPool.Put(%v): can't put value that was already recycled", id)) } ...
[ "func", "(", "pool", "*", "IDPool", ")", "Put", "(", "id", "uint32", ")", "{", "pool", ".", "Lock", "(", ")", "\n", "defer", "pool", ".", "Unlock", "(", ")", "\n\n", "if", "id", "<", "1", "||", "id", ">", "pool", ".", "maxUsed", "{", "panic", ...
// Put recycles an ID back into the pool for others to use. Putting back a value // or 0, or a value that is not currently "checked out", will result in a panic // because that should never happen except in the case of a programming error.
[ "Put", "recycles", "an", "ID", "back", "into", "the", "pool", "for", "others", "to", "use", ".", "Putting", "back", "a", "value", "or", "0", "or", "a", "value", "that", "is", "not", "currently", "checked", "out", "will", "result", "in", "a", "panic", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/pools/id_pool.go#L64-L84
train
vitessio/vitess
go/vt/mysqlctl/backup.go
removeExistingFiles
func removeExistingFiles(cnf *Mycnf) error { paths := map[string]string{ "BinLogPath.*": cnf.BinLogPath, "DataDir": cnf.DataDir, "InnodbDataHomeDir": cnf.InnodbDataHomeDir, "InnodbLogGroupHomeDir": cnf.InnodbLogGroupHomeDir, "RelayLogPath.*": cnf.RelayLogPath, "RelayLogInd...
go
func removeExistingFiles(cnf *Mycnf) error { paths := map[string]string{ "BinLogPath.*": cnf.BinLogPath, "DataDir": cnf.DataDir, "InnodbDataHomeDir": cnf.InnodbDataHomeDir, "InnodbLogGroupHomeDir": cnf.InnodbLogGroupHomeDir, "RelayLogPath.*": cnf.RelayLogPath, "RelayLogInd...
[ "func", "removeExistingFiles", "(", "cnf", "*", "Mycnf", ")", "error", "{", "paths", ":=", "map", "[", "string", "]", "string", "{", "\"", "\"", ":", "cnf", ".", "BinLogPath", ",", "\"", "\"", ":", "cnf", ".", "DataDir", ",", "\"", "\"", ":", "cnf"...
// removeExistingFiles will delete existing files in the data dir to prevent // conflicts with the restored archive. In particular, binlogs can be created // even during initial bootstrap, and these can interfere with configuring // replication if kept around after the restore.
[ "removeExistingFiles", "will", "delete", "existing", "files", "in", "the", "data", "dir", "to", "prevent", "conflicts", "with", "the", "restored", "archive", ".", "In", "particular", "binlogs", "can", "be", "created", "even", "during", "initial", "bootstrap", "a...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/backup.go#L163-L206
train
vitessio/vitess
go/vt/workflow/node.go
BroadcastChanges
func (n *Node) BroadcastChanges(updateChildren bool) error { n.nodeManager.mu.Lock() defer n.nodeManager.mu.Unlock() return n.nodeManager.updateNodeAndBroadcastLocked(n, updateChildren) }
go
func (n *Node) BroadcastChanges(updateChildren bool) error { n.nodeManager.mu.Lock() defer n.nodeManager.mu.Unlock() return n.nodeManager.updateNodeAndBroadcastLocked(n, updateChildren) }
[ "func", "(", "n", "*", "Node", ")", "BroadcastChanges", "(", "updateChildren", "bool", ")", "error", "{", "n", ".", "nodeManager", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "n", ".", "nodeManager", ".", "mu", ".", "Unlock", "(", ")", "\n", "...
// BroadcastChanges sends the new contents of the node to the watchers.
[ "BroadcastChanges", "sends", "the", "new", "contents", "of", "the", "node", "to", "the", "watchers", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/node.go#L193-L197
train
vitessio/vitess
go/vt/workflow/node.go
deepCopyFrom
func (n *Node) deepCopyFrom(otherNode *Node, copyChildren bool) error { oldChildren := n.Children *n = *otherNode n.Children = oldChildren n.Actions = []*Action{} for _, otherAction := range otherNode.Actions { action := &Action{} *action = *otherAction n.Actions = append(n.Actions, action) } if !copyChi...
go
func (n *Node) deepCopyFrom(otherNode *Node, copyChildren bool) error { oldChildren := n.Children *n = *otherNode n.Children = oldChildren n.Actions = []*Action{} for _, otherAction := range otherNode.Actions { action := &Action{} *action = *otherAction n.Actions = append(n.Actions, action) } if !copyChi...
[ "func", "(", "n", "*", "Node", ")", "deepCopyFrom", "(", "otherNode", "*", "Node", ",", "copyChildren", "bool", ")", "error", "{", "oldChildren", ":=", "n", ".", "Children", "\n", "*", "n", "=", "*", "otherNode", "\n", "n", ".", "Children", "=", "old...
// deepCopyFrom copies contents of otherNode into this node. Contents of Actions // is copied into new Action objects, so that changes in otherNode are not // immediately visible in this node. When copyChildren is false the contents of // Children in this node is preserved fully even if it doesn't match the contents //...
[ "deepCopyFrom", "copies", "contents", "of", "otherNode", "into", "this", "node", ".", "Contents", "of", "Actions", "is", "copied", "into", "new", "Action", "objects", "so", "that", "changes", "in", "otherNode", "are", "not", "immediately", "visible", "in", "th...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/node.go#L207-L239
train
vitessio/vitess
go/vt/workflow/node.go
GetChildByPath
func (n *Node) GetChildByPath(subPath string) (*Node, error) { // Find the subnode if needed. parts := strings.Split(subPath, "/") currentNode := n for i := 0; i < len(parts); i++ { childPathName := parts[i] found := false for _, child := range currentNode.Children { if child.PathName == childPathName { ...
go
func (n *Node) GetChildByPath(subPath string) (*Node, error) { // Find the subnode if needed. parts := strings.Split(subPath, "/") currentNode := n for i := 0; i < len(parts); i++ { childPathName := parts[i] found := false for _, child := range currentNode.Children { if child.PathName == childPathName { ...
[ "func", "(", "n", "*", "Node", ")", "GetChildByPath", "(", "subPath", "string", ")", "(", "*", "Node", ",", "error", ")", "{", "// Find the subnode if needed.", "parts", ":=", "strings", ".", "Split", "(", "subPath", ",", "\"", "\"", ")", "\n\n", "curren...
// GetChildByPath returns the child node given the relative path to this node. // The caller must ensure that the node tree is not modified during the call.
[ "GetChildByPath", "returns", "the", "child", "node", "given", "the", "relative", "path", "to", "this", "node", ".", "The", "caller", "must", "ensure", "that", "the", "node", "tree", "is", "not", "modified", "during", "the", "call", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/node.go#L243-L263
train
vitessio/vitess
go/vt/workflow/node.go
NewNodeManager
func NewNodeManager() *NodeManager { return &NodeManager{ roots: make(map[string]*Node), watchers: make(map[int]chan []byte), nextWatcherIndex: 1, } }
go
func NewNodeManager() *NodeManager { return &NodeManager{ roots: make(map[string]*Node), watchers: make(map[int]chan []byte), nextWatcherIndex: 1, } }
[ "func", "NewNodeManager", "(", ")", "*", "NodeManager", "{", "return", "&", "NodeManager", "{", "roots", ":", "make", "(", "map", "[", "string", "]", "*", "Node", ")", ",", "watchers", ":", "make", "(", "map", "[", "int", "]", "chan", "[", "]", "by...
// NewNodeManager returns a new NodeManager.
[ "NewNodeManager", "returns", "a", "new", "NodeManager", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/node.go#L291-L297
train
vitessio/vitess
go/vt/workflow/node.go
AddRootNode
func (m *NodeManager) AddRootNode(n *Node) error { m.mu.Lock() defer m.mu.Unlock() if _, ok := m.roots[n.PathName]; ok { return fmt.Errorf("toplevel node %v (with name %v) already exists", n.Path, n.Name) } n.Path = "/" + n.PathName n.nodeManager = m savedNode := NewNode() m.roots[n.PathName] = savedNode r...
go
func (m *NodeManager) AddRootNode(n *Node) error { m.mu.Lock() defer m.mu.Unlock() if _, ok := m.roots[n.PathName]; ok { return fmt.Errorf("toplevel node %v (with name %v) already exists", n.Path, n.Name) } n.Path = "/" + n.PathName n.nodeManager = m savedNode := NewNode() m.roots[n.PathName] = savedNode r...
[ "func", "(", "m", "*", "NodeManager", ")", "AddRootNode", "(", "n", "*", "Node", ")", "error", "{", "m", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "if", "_", ",", "ok", ":=", "m", ".", ...
// AddRootNode adds a toplevel Node to the NodeManager, // and broadcasts the Node to the listeners.
[ "AddRootNode", "adds", "a", "toplevel", "Node", "to", "the", "NodeManager", "and", "broadcasts", "the", "Node", "to", "the", "listeners", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/node.go#L301-L314
train
vitessio/vitess
go/vt/workflow/node.go
RemoveRootNode
func (m *NodeManager) RemoveRootNode(n *Node) { m.mu.Lock() defer m.mu.Unlock() delete(m.roots, n.PathName) u := &Update{ Deletes: []string{n.Path}, } m.broadcastUpdateLocked(u) }
go
func (m *NodeManager) RemoveRootNode(n *Node) { m.mu.Lock() defer m.mu.Unlock() delete(m.roots, n.PathName) u := &Update{ Deletes: []string{n.Path}, } m.broadcastUpdateLocked(u) }
[ "func", "(", "m", "*", "NodeManager", ")", "RemoveRootNode", "(", "n", "*", "Node", ")", "{", "m", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "delete", "(", "m", ".", "roots", ",", "n", "...
// RemoveRootNode removes a toplevel Node from the NodeManager, // and broadcasts the change to the listeners.
[ "RemoveRootNode", "removes", "a", "toplevel", "Node", "from", "the", "NodeManager", "and", "broadcasts", "the", "change", "to", "the", "listeners", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/node.go#L318-L328
train
vitessio/vitess
go/vt/workflow/node.go
GetFullTree
func (m *NodeManager) GetFullTree() ([]byte, error) { m.mu.Lock() defer m.mu.Unlock() return m.toJSON(0) }
go
func (m *NodeManager) GetFullTree() ([]byte, error) { m.mu.Lock() defer m.mu.Unlock() return m.toJSON(0) }
[ "func", "(", "m", "*", "NodeManager", ")", "GetFullTree", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "m", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "mu", ".", "Unlock", "(", ")", "\n", "return", "m", ".", "toJSO...
// GetFullTree returns the JSON representation of the entire Node tree.
[ "GetFullTree", "returns", "the", "JSON", "representation", "of", "the", "entire", "Node", "tree", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/node.go#L345-L349
train
vitessio/vitess
go/vt/workflow/node.go
GetAndWatchFullTree
func (m *NodeManager) GetAndWatchFullTree(notifications chan []byte) ([]byte, int, error) { m.mu.Lock() defer m.mu.Unlock() i := m.nextWatcherIndex m.nextWatcherIndex++ result, err := m.toJSON(i) if err != nil { return nil, 0, err } // It worked, register the watcher. m.watchers[i] = notifications return...
go
func (m *NodeManager) GetAndWatchFullTree(notifications chan []byte) ([]byte, int, error) { m.mu.Lock() defer m.mu.Unlock() i := m.nextWatcherIndex m.nextWatcherIndex++ result, err := m.toJSON(i) if err != nil { return nil, 0, err } // It worked, register the watcher. m.watchers[i] = notifications return...
[ "func", "(", "m", "*", "NodeManager", ")", "GetAndWatchFullTree", "(", "notifications", "chan", "[", "]", "byte", ")", "(", "[", "]", "byte", ",", "int", ",", "error", ")", "{", "m", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "mu"...
// GetAndWatchFullTree returns the JSON representation of the entire Node tree, // and registers a watcher to monitor changes to the tree.
[ "GetAndWatchFullTree", "returns", "the", "JSON", "representation", "of", "the", "entire", "Node", "tree", "and", "registers", "a", "watcher", "to", "monitor", "changes", "to", "the", "tree", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/node.go#L353-L368
train
vitessio/vitess
go/vt/workflow/node.go
broadcastUpdateLocked
func (m *NodeManager) broadcastUpdateLocked(u *Update) { data, err := json.Marshal(u) if err != nil { log.Errorf("Cannot JSON encode update: %v", err) return } // If we can't write on the channel, we close it and remove it // from the list. It probably means the web browser on the // other side is not there ...
go
func (m *NodeManager) broadcastUpdateLocked(u *Update) { data, err := json.Marshal(u) if err != nil { log.Errorf("Cannot JSON encode update: %v", err) return } // If we can't write on the channel, we close it and remove it // from the list. It probably means the web browser on the // other side is not there ...
[ "func", "(", "m", "*", "NodeManager", ")", "broadcastUpdateLocked", "(", "u", "*", "Update", ")", "{", "data", ",", "err", ":=", "json", ".", "Marshal", "(", "u", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Errorf", "(", "\"", "\"", ",...
// broadcastUpdateLocked sends the provided update to all watchers. // Has to be called with the lock.
[ "broadcastUpdateLocked", "sends", "the", "provided", "update", "to", "all", "watchers", ".", "Has", "to", "be", "called", "with", "the", "lock", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/node.go#L372-L391
train
vitessio/vitess
go/vt/workflow/node.go
CloseWatcher
func (m *NodeManager) CloseWatcher(i int) { m.mu.Lock() defer m.mu.Unlock() delete(m.watchers, i) }
go
func (m *NodeManager) CloseWatcher(i int) { m.mu.Lock() defer m.mu.Unlock() delete(m.watchers, i) }
[ "func", "(", "m", "*", "NodeManager", ")", "CloseWatcher", "(", "i", "int", ")", "{", "m", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "delete", "(", "m", ".", "watchers", ",", "i", ")", "...
// CloseWatcher unregisters the watcher from this Manager.
[ "CloseWatcher", "unregisters", "the", "watcher", "from", "this", "Manager", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/node.go#L426-L431
train
vitessio/vitess
go/vt/workflow/node.go
Action
func (m *NodeManager) Action(ctx context.Context, ap *ActionParameters) error { n, err := m.getNodeByPath(ap.Path) if err != nil { return err } m.mu.Lock() if n.Listener == nil { m.mu.Unlock() return fmt.Errorf("Action %v is invoked on a node without listener (node path is %v)", ap.Name, ap.Path) } nodeL...
go
func (m *NodeManager) Action(ctx context.Context, ap *ActionParameters) error { n, err := m.getNodeByPath(ap.Path) if err != nil { return err } m.mu.Lock() if n.Listener == nil { m.mu.Unlock() return fmt.Errorf("Action %v is invoked on a node without listener (node path is %v)", ap.Name, ap.Path) } nodeL...
[ "func", "(", "m", "*", "NodeManager", ")", "Action", "(", "ctx", "context", ".", "Context", ",", "ap", "*", "ActionParameters", ")", "error", "{", "n", ",", "err", ":=", "m", ".", "getNodeByPath", "(", "ap", ".", "Path", ")", "\n", "if", "err", "!=...
// Action is called by the UI agents to trigger actions.
[ "Action", "is", "called", "by", "the", "UI", "agents", "to", "trigger", "actions", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/node.go#L434-L450
train
vitessio/vitess
go/mysql/mysql56_gtid.go
parseMysql56GTID
func parseMysql56GTID(s string) (GTID, error) { // Split into parts. parts := strings.Split(s, ":") if len(parts) != 2 { return nil, vterrors.Errorf(vtrpc.Code_INTERNAL, "invalid MySQL 5.6 GTID (%v): expecting UUID:Sequence", s) } // Parse Server ID. sid, err := ParseSID(parts[0]) if err != nil { return nil...
go
func parseMysql56GTID(s string) (GTID, error) { // Split into parts. parts := strings.Split(s, ":") if len(parts) != 2 { return nil, vterrors.Errorf(vtrpc.Code_INTERNAL, "invalid MySQL 5.6 GTID (%v): expecting UUID:Sequence", s) } // Parse Server ID. sid, err := ParseSID(parts[0]) if err != nil { return nil...
[ "func", "parseMysql56GTID", "(", "s", "string", ")", "(", "GTID", ",", "error", ")", "{", "// Split into parts.", "parts", ":=", "strings", ".", "Split", "(", "s", ",", "\"", "\"", ")", "\n", "if", "len", "(", "parts", ")", "!=", "2", "{", "return", ...
// parseMysql56GTID is registered as a GTID parser.
[ "parseMysql56GTID", "is", "registered", "as", "a", "GTID", "parser", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/mysql56_gtid.go#L32-L52
train
vitessio/vitess
go/mysql/mysql56_gtid.go
String
func (sid SID) String() string { dst := []byte("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx") hex.Encode(dst, sid[:4]) hex.Encode(dst[9:], sid[4:6]) hex.Encode(dst[14:], sid[6:8]) hex.Encode(dst[19:], sid[8:10]) hex.Encode(dst[24:], sid[10:16]) return string(dst) }
go
func (sid SID) String() string { dst := []byte("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx") hex.Encode(dst, sid[:4]) hex.Encode(dst[9:], sid[4:6]) hex.Encode(dst[14:], sid[6:8]) hex.Encode(dst[19:], sid[8:10]) hex.Encode(dst[24:], sid[10:16]) return string(dst) }
[ "func", "(", "sid", "SID", ")", "String", "(", ")", "string", "{", "dst", ":=", "[", "]", "byte", "(", "\"", "\"", ")", "\n", "hex", ".", "Encode", "(", "dst", ",", "sid", "[", ":", "4", "]", ")", "\n", "hex", ".", "Encode", "(", "dst", "["...
// String prints an SID in the form used by MySQL 5.6.
[ "String", "prints", "an", "SID", "in", "the", "form", "used", "by", "MySQL", "5", ".", "6", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/mysql56_gtid.go#L58-L66
train
vitessio/vitess
go/mysql/mysql56_gtid.go
ParseSID
func ParseSID(s string) (sid SID, err error) { if len(s) != 36 || s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-' { return sid, vterrors.Errorf(vtrpc.Code_INTERNAL, "invalid MySQL 5.6 SID %q", s) } // Drop the dashes so we can just check the error of Decode once. b := make([]byte, 0, 32) b = append(...
go
func ParseSID(s string) (sid SID, err error) { if len(s) != 36 || s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-' { return sid, vterrors.Errorf(vtrpc.Code_INTERNAL, "invalid MySQL 5.6 SID %q", s) } // Drop the dashes so we can just check the error of Decode once. b := make([]byte, 0, 32) b = append(...
[ "func", "ParseSID", "(", "s", "string", ")", "(", "sid", "SID", ",", "err", "error", ")", "{", "if", "len", "(", "s", ")", "!=", "36", "||", "s", "[", "8", "]", "!=", "'-'", "||", "s", "[", "13", "]", "!=", "'-'", "||", "s", "[", "18", "]...
// ParseSID parses an SID in the form used by MySQL 5.6.
[ "ParseSID", "parses", "an", "SID", "in", "the", "form", "used", "by", "MySQL", "5", ".", "6", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/mysql56_gtid.go#L69-L86
train
vitessio/vitess
go/vt/vttablet/tabletserver/twopc.go
Open
func (tpc *TwoPC) Open(dbconfigs *dbconfigs.DBConfigs) { tpc.readPool.Open(dbconfigs.AppWithDB(), dbconfigs.DbaWithDB(), dbconfigs.DbaWithDB()) }
go
func (tpc *TwoPC) Open(dbconfigs *dbconfigs.DBConfigs) { tpc.readPool.Open(dbconfigs.AppWithDB(), dbconfigs.DbaWithDB(), dbconfigs.DbaWithDB()) }
[ "func", "(", "tpc", "*", "TwoPC", ")", "Open", "(", "dbconfigs", "*", "dbconfigs", ".", "DBConfigs", ")", "{", "tpc", ".", "readPool", ".", "Open", "(", "dbconfigs", ".", "AppWithDB", "(", ")", ",", "dbconfigs", ".", "DbaWithDB", "(", ")", ",", "dbco...
// Open starts the TwoPC service.
[ "Open", "starts", "the", "TwoPC", "service", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/twopc.go#L203-L205
train
vitessio/vitess
go/vt/vttablet/tabletserver/twopc.go
SaveRedo
func (tpc *TwoPC) SaveRedo(ctx context.Context, conn *TxConnection, dtid string, queries []string) error { bindVars := map[string]*querypb.BindVariable{ "dtid": sqltypes.StringBindVariable(dtid), "state": sqltypes.Int64BindVariable(RedoStatePrepared), "time_created": sqltypes.Int64BindVariable(tim...
go
func (tpc *TwoPC) SaveRedo(ctx context.Context, conn *TxConnection, dtid string, queries []string) error { bindVars := map[string]*querypb.BindVariable{ "dtid": sqltypes.StringBindVariable(dtid), "state": sqltypes.Int64BindVariable(RedoStatePrepared), "time_created": sqltypes.Int64BindVariable(tim...
[ "func", "(", "tpc", "*", "TwoPC", ")", "SaveRedo", "(", "ctx", "context", ".", "Context", ",", "conn", "*", "TxConnection", ",", "dtid", "string", ",", "queries", "[", "]", "string", ")", "error", "{", "bindVars", ":=", "map", "[", "string", "]", "*"...
// SaveRedo saves the statements in the redo log using the supplied connection.
[ "SaveRedo", "saves", "the", "statements", "in", "the", "redo", "log", "using", "the", "supplied", "connection", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/twopc.go#L213-L241
train
vitessio/vitess
go/vt/vttablet/tabletserver/twopc.go
UpdateRedo
func (tpc *TwoPC) UpdateRedo(ctx context.Context, conn *TxConnection, dtid string, state int) error { bindVars := map[string]*querypb.BindVariable{ "dtid": sqltypes.StringBindVariable(dtid), "state": sqltypes.Int64BindVariable(int64(state)), } _, err := tpc.exec(ctx, conn, tpc.updateRedoTx, bindVars) return er...
go
func (tpc *TwoPC) UpdateRedo(ctx context.Context, conn *TxConnection, dtid string, state int) error { bindVars := map[string]*querypb.BindVariable{ "dtid": sqltypes.StringBindVariable(dtid), "state": sqltypes.Int64BindVariable(int64(state)), } _, err := tpc.exec(ctx, conn, tpc.updateRedoTx, bindVars) return er...
[ "func", "(", "tpc", "*", "TwoPC", ")", "UpdateRedo", "(", "ctx", "context", ".", "Context", ",", "conn", "*", "TxConnection", ",", "dtid", "string", ",", "state", "int", ")", "error", "{", "bindVars", ":=", "map", "[", "string", "]", "*", "querypb", ...
// UpdateRedo changes the state of the redo log for the dtid.
[ "UpdateRedo", "changes", "the", "state", "of", "the", "redo", "log", "for", "the", "dtid", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/twopc.go#L244-L251
train
vitessio/vitess
go/vt/vttablet/tabletserver/twopc.go
DeleteRedo
func (tpc *TwoPC) DeleteRedo(ctx context.Context, conn *TxConnection, dtid string) error { bindVars := map[string]*querypb.BindVariable{ "dtid": sqltypes.StringBindVariable(dtid), } _, err := tpc.exec(ctx, conn, tpc.deleteRedoTx, bindVars) if err != nil { return err } _, err = tpc.exec(ctx, conn, tpc.deleteRe...
go
func (tpc *TwoPC) DeleteRedo(ctx context.Context, conn *TxConnection, dtid string) error { bindVars := map[string]*querypb.BindVariable{ "dtid": sqltypes.StringBindVariable(dtid), } _, err := tpc.exec(ctx, conn, tpc.deleteRedoTx, bindVars) if err != nil { return err } _, err = tpc.exec(ctx, conn, tpc.deleteRe...
[ "func", "(", "tpc", "*", "TwoPC", ")", "DeleteRedo", "(", "ctx", "context", ".", "Context", ",", "conn", "*", "TxConnection", ",", "dtid", "string", ")", "error", "{", "bindVars", ":=", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable", "{...
// DeleteRedo deletes the redo log for the dtid.
[ "DeleteRedo", "deletes", "the", "redo", "log", "for", "the", "dtid", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/twopc.go#L254-L264
train
vitessio/vitess
go/vt/vttablet/tabletserver/twopc.go
ReadAllRedo
func (tpc *TwoPC) ReadAllRedo(ctx context.Context) (prepared, failed []*PreparedTx, err error) { conn, err := tpc.readPool.Get(ctx) if err != nil { return nil, nil, err } defer conn.Recycle() qr, err := conn.Exec(ctx, tpc.readAllRedo, 10000, false) if err != nil { return nil, nil, err } var curTx *Prepare...
go
func (tpc *TwoPC) ReadAllRedo(ctx context.Context) (prepared, failed []*PreparedTx, err error) { conn, err := tpc.readPool.Get(ctx) if err != nil { return nil, nil, err } defer conn.Recycle() qr, err := conn.Exec(ctx, tpc.readAllRedo, 10000, false) if err != nil { return nil, nil, err } var curTx *Prepare...
[ "func", "(", "tpc", "*", "TwoPC", ")", "ReadAllRedo", "(", "ctx", "context", ".", "Context", ")", "(", "prepared", ",", "failed", "[", "]", "*", "PreparedTx", ",", "err", "error", ")", "{", "conn", ",", "err", ":=", "tpc", ".", "readPool", ".", "Ge...
// ReadAllRedo returns all the prepared transactions from the redo logs.
[ "ReadAllRedo", "returns", "all", "the", "prepared", "transactions", "from", "the", "redo", "logs", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/twopc.go#L274-L315
train
vitessio/vitess
go/vt/vttablet/tabletserver/twopc.go
CountUnresolvedRedo
func (tpc *TwoPC) CountUnresolvedRedo(ctx context.Context, unresolvedTime time.Time) (int64, error) { conn, err := tpc.readPool.Get(ctx) if err != nil { return 0, err } defer conn.Recycle() bindVars := map[string]*querypb.BindVariable{ "time_created": sqltypes.Int64BindVariable(unresolvedTime.UnixNano()), } ...
go
func (tpc *TwoPC) CountUnresolvedRedo(ctx context.Context, unresolvedTime time.Time) (int64, error) { conn, err := tpc.readPool.Get(ctx) if err != nil { return 0, err } defer conn.Recycle() bindVars := map[string]*querypb.BindVariable{ "time_created": sqltypes.Int64BindVariable(unresolvedTime.UnixNano()), } ...
[ "func", "(", "tpc", "*", "TwoPC", ")", "CountUnresolvedRedo", "(", "ctx", "context", ".", "Context", ",", "unresolvedTime", "time", ".", "Time", ")", "(", "int64", ",", "error", ")", "{", "conn", ",", "err", ":=", "tpc", ".", "readPool", ".", "Get", ...
// CountUnresolvedRedo returns the number of prepared transactions that are still unresolved.
[ "CountUnresolvedRedo", "returns", "the", "number", "of", "prepared", "transactions", "that", "are", "still", "unresolved", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/twopc.go#L318-L337
train
vitessio/vitess
go/vt/vttablet/tabletserver/twopc.go
CreateTransaction
func (tpc *TwoPC) CreateTransaction(ctx context.Context, conn *TxConnection, dtid string, participants []*querypb.Target) error { bindVars := map[string]*querypb.BindVariable{ "dtid": sqltypes.StringBindVariable(dtid), "state": sqltypes.Int64BindVariable(int64(DTStatePrepare)), "cur_time": sqltypes.Int64B...
go
func (tpc *TwoPC) CreateTransaction(ctx context.Context, conn *TxConnection, dtid string, participants []*querypb.Target) error { bindVars := map[string]*querypb.BindVariable{ "dtid": sqltypes.StringBindVariable(dtid), "state": sqltypes.Int64BindVariable(int64(DTStatePrepare)), "cur_time": sqltypes.Int64B...
[ "func", "(", "tpc", "*", "TwoPC", ")", "CreateTransaction", "(", "ctx", "context", ".", "Context", ",", "conn", "*", "TxConnection", ",", "dtid", "string", ",", "participants", "[", "]", "*", "querypb", ".", "Target", ")", "error", "{", "bindVars", ":=",...
// CreateTransaction saves the metadata of a 2pc transaction as Prepared.
[ "CreateTransaction", "saves", "the", "metadata", "of", "a", "2pc", "transaction", "as", "Prepared", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/twopc.go#L340-L369
train
vitessio/vitess
go/vt/vttablet/tabletserver/twopc.go
Transition
func (tpc *TwoPC) Transition(ctx context.Context, conn *TxConnection, dtid string, state querypb.TransactionState) error { bindVars := map[string]*querypb.BindVariable{ "dtid": sqltypes.StringBindVariable(dtid), "state": sqltypes.Int64BindVariable(int64(state)), "prepare": sqltypes.Int64BindVariable(int64(q...
go
func (tpc *TwoPC) Transition(ctx context.Context, conn *TxConnection, dtid string, state querypb.TransactionState) error { bindVars := map[string]*querypb.BindVariable{ "dtid": sqltypes.StringBindVariable(dtid), "state": sqltypes.Int64BindVariable(int64(state)), "prepare": sqltypes.Int64BindVariable(int64(q...
[ "func", "(", "tpc", "*", "TwoPC", ")", "Transition", "(", "ctx", "context", ".", "Context", ",", "conn", "*", "TxConnection", ",", "dtid", "string", ",", "state", "querypb", ".", "TransactionState", ")", "error", "{", "bindVars", ":=", "map", "[", "strin...
// Transition performs a transition from Prepare to the specified state. // If the transaction is not a in the Prepare state, an error is returned.
[ "Transition", "performs", "a", "transition", "from", "Prepare", "to", "the", "specified", "state", ".", "If", "the", "transaction", "is", "not", "a", "in", "the", "Prepare", "state", "an", "error", "is", "returned", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/twopc.go#L373-L387
train
vitessio/vitess
go/vt/vttablet/tabletserver/twopc.go
DeleteTransaction
func (tpc *TwoPC) DeleteTransaction(ctx context.Context, conn *TxConnection, dtid string) error { bindVars := map[string]*querypb.BindVariable{ "dtid": sqltypes.StringBindVariable(dtid), } _, err := tpc.exec(ctx, conn, tpc.deleteTransaction, bindVars) if err != nil { return err } _, err = tpc.exec(ctx, conn, ...
go
func (tpc *TwoPC) DeleteTransaction(ctx context.Context, conn *TxConnection, dtid string) error { bindVars := map[string]*querypb.BindVariable{ "dtid": sqltypes.StringBindVariable(dtid), } _, err := tpc.exec(ctx, conn, tpc.deleteTransaction, bindVars) if err != nil { return err } _, err = tpc.exec(ctx, conn, ...
[ "func", "(", "tpc", "*", "TwoPC", ")", "DeleteTransaction", "(", "ctx", "context", ".", "Context", ",", "conn", "*", "TxConnection", ",", "dtid", "string", ")", "error", "{", "bindVars", ":=", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable...
// DeleteTransaction deletes the metadata for the specified transaction.
[ "DeleteTransaction", "deletes", "the", "metadata", "for", "the", "specified", "transaction", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/twopc.go#L390-L400
train
vitessio/vitess
go/vt/vttablet/tabletserver/twopc.go
ReadTransaction
func (tpc *TwoPC) ReadTransaction(ctx context.Context, dtid string) (*querypb.TransactionMetadata, error) { conn, err := tpc.readPool.Get(ctx) if err != nil { return nil, err } defer conn.Recycle() result := &querypb.TransactionMetadata{} bindVars := map[string]*querypb.BindVariable{ "dtid": sqltypes.StringB...
go
func (tpc *TwoPC) ReadTransaction(ctx context.Context, dtid string) (*querypb.TransactionMetadata, error) { conn, err := tpc.readPool.Get(ctx) if err != nil { return nil, err } defer conn.Recycle() result := &querypb.TransactionMetadata{} bindVars := map[string]*querypb.BindVariable{ "dtid": sqltypes.StringB...
[ "func", "(", "tpc", "*", "TwoPC", ")", "ReadTransaction", "(", "ctx", "context", ".", "Context", ",", "dtid", "string", ")", "(", "*", "querypb", ".", "TransactionMetadata", ",", "error", ")", "{", "conn", ",", "err", ":=", "tpc", ".", "readPool", ".",...
// ReadTransaction returns the metadata for the transaction.
[ "ReadTransaction", "returns", "the", "metadata", "for", "the", "transaction", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/twopc.go#L403-L449
train
vitessio/vitess
go/vt/vttablet/tabletserver/twopc.go
ReadAbandoned
func (tpc *TwoPC) ReadAbandoned(ctx context.Context, abandonTime time.Time) (map[string]time.Time, error) { conn, err := tpc.readPool.Get(ctx) if err != nil { return nil, err } defer conn.Recycle() bindVars := map[string]*querypb.BindVariable{ "time_created": sqltypes.Int64BindVariable(abandonTime.UnixNano())...
go
func (tpc *TwoPC) ReadAbandoned(ctx context.Context, abandonTime time.Time) (map[string]time.Time, error) { conn, err := tpc.readPool.Get(ctx) if err != nil { return nil, err } defer conn.Recycle() bindVars := map[string]*querypb.BindVariable{ "time_created": sqltypes.Int64BindVariable(abandonTime.UnixNano())...
[ "func", "(", "tpc", "*", "TwoPC", ")", "ReadAbandoned", "(", "ctx", "context", ".", "Context", ",", "abandonTime", "time", ".", "Time", ")", "(", "map", "[", "string", "]", "time", ".", "Time", ",", "error", ")", "{", "conn", ",", "err", ":=", "tpc...
// ReadAbandoned returns the list of abandoned transactions // and their associated start time.
[ "ReadAbandoned", "returns", "the", "list", "of", "abandoned", "transactions", "and", "their", "associated", "start", "time", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/twopc.go#L453-L476
train
vitessio/vitess
go/vt/vttablet/tabletserver/twopc.go
ReadAllTransactions
func (tpc *TwoPC) ReadAllTransactions(ctx context.Context) ([]*DistributedTx, error) { conn, err := tpc.readPool.Get(ctx) if err != nil { return nil, err } defer conn.Recycle() qr, err := conn.Exec(ctx, tpc.readAllTransactions, 10000, false) if err != nil { return nil, err } var curTx *DistributedTx var ...
go
func (tpc *TwoPC) ReadAllTransactions(ctx context.Context) ([]*DistributedTx, error) { conn, err := tpc.readPool.Get(ctx) if err != nil { return nil, err } defer conn.Recycle() qr, err := conn.Exec(ctx, tpc.readAllTransactions, 10000, false) if err != nil { return nil, err } var curTx *DistributedTx var ...
[ "func", "(", "tpc", "*", "TwoPC", ")", "ReadAllTransactions", "(", "ctx", "context", ".", "Context", ")", "(", "[", "]", "*", "DistributedTx", ",", "error", ")", "{", "conn", ",", "err", ":=", "tpc", ".", "readPool", ".", "Get", "(", "ctx", ")", "\...
// ReadAllTransactions returns info about all distributed transactions.
[ "ReadAllTransactions", "returns", "info", "about", "all", "distributed", "transactions", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/twopc.go#L488-L532
train
vitessio/vitess
go/vt/servenv/run.go
Run
func Run(port int) { populateListeningURL(int32(port)) createGRPCServer() onRunHooks.Fire() serveGRPC() serveSocketFile() l, err := proc.Listen(fmt.Sprintf("%v", port)) if err != nil { log.Exit(err) } go http.Serve(l, nil) proc.Wait() l.Close() startTime := time.Now() log.Infof("Entering lameduck mode...
go
func Run(port int) { populateListeningURL(int32(port)) createGRPCServer() onRunHooks.Fire() serveGRPC() serveSocketFile() l, err := proc.Listen(fmt.Sprintf("%v", port)) if err != nil { log.Exit(err) } go http.Serve(l, nil) proc.Wait() l.Close() startTime := time.Now() log.Infof("Entering lameduck mode...
[ "func", "Run", "(", "port", "int", ")", "{", "populateListeningURL", "(", "int32", "(", "port", ")", ")", "\n", "createGRPCServer", "(", ")", "\n", "onRunHooks", ".", "Fire", "(", ")", "\n", "serveGRPC", "(", ")", "\n", "serveSocketFile", "(", ")", "\n...
// Run starts listening for RPC and HTTP requests, // and blocks until it the process gets a signal.
[ "Run", "starts", "listening", "for", "RPC", "and", "HTTP", "requests", "and", "blocks", "until", "it", "the", "process", "gets", "a", "signal", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/servenv/run.go#L36-L65
train
vitessio/vitess
go/vt/workflow/resharding/tasks.go
GetTasks
func (hw *horizontalReshardingWorkflow) GetTasks(phase workflow.PhaseType) []*workflowpb.Task { var shards []string switch phase { case phaseCopySchema, phaseWaitForFilteredReplication, phaseDiff: shards = strings.Split(hw.checkpoint.Settings["destination_shards"], ",") case phaseClone, phaseMigrateRdonly, phaseM...
go
func (hw *horizontalReshardingWorkflow) GetTasks(phase workflow.PhaseType) []*workflowpb.Task { var shards []string switch phase { case phaseCopySchema, phaseWaitForFilteredReplication, phaseDiff: shards = strings.Split(hw.checkpoint.Settings["destination_shards"], ",") case phaseClone, phaseMigrateRdonly, phaseM...
[ "func", "(", "hw", "*", "horizontalReshardingWorkflow", ")", "GetTasks", "(", "phase", "workflow", ".", "PhaseType", ")", "[", "]", "*", "workflowpb", ".", "Task", "{", "var", "shards", "[", "]", "string", "\n", "switch", "phase", "{", "case", "phaseCopySc...
// GetTasks returns selected tasks for a phase from the checkpoint // with expected execution order.
[ "GetTasks", "returns", "selected", "tasks", "for", "a", "phase", "from", "the", "checkpoint", "with", "expected", "execution", "order", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/resharding/tasks.go#L41-L58
train
vitessio/vitess
go/vt/worker/split_clone.go
newSplitCloneWorker
func newSplitCloneWorker(wr *wrangler.Wrangler, cell, keyspace, shard string, online, offline bool, excludeTables []string, chunkCount, minRowsPerChunk, sourceReaderCount, writeQueryMaxRows, writeQueryMaxSize, destinationWriterCount, minHealthyTablets int, tabletType topodatapb.TabletType, maxTPS, maxReplicationLag int...
go
func newSplitCloneWorker(wr *wrangler.Wrangler, cell, keyspace, shard string, online, offline bool, excludeTables []string, chunkCount, minRowsPerChunk, sourceReaderCount, writeQueryMaxRows, writeQueryMaxSize, destinationWriterCount, minHealthyTablets int, tabletType topodatapb.TabletType, maxTPS, maxReplicationLag int...
[ "func", "newSplitCloneWorker", "(", "wr", "*", "wrangler", ".", "Wrangler", ",", "cell", ",", "keyspace", ",", "shard", "string", ",", "online", ",", "offline", "bool", ",", "excludeTables", "[", "]", "string", ",", "chunkCount", ",", "minRowsPerChunk", ",",...
// newSplitCloneWorker returns a new worker object for the SplitClone command.
[ "newSplitCloneWorker", "returns", "a", "new", "worker", "object", "for", "the", "SplitClone", "command", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/split_clone.go#L147-L149
train
vitessio/vitess
go/vt/worker/split_clone.go
FormattedOfflineSources
func (scw *SplitCloneWorker) FormattedOfflineSources() string { scw.formattedOfflineSourcesMu.Lock() defer scw.formattedOfflineSourcesMu.Unlock() if scw.formattedOfflineSources == "" { return "no offline source tablets currently in use" } return scw.formattedOfflineSources }
go
func (scw *SplitCloneWorker) FormattedOfflineSources() string { scw.formattedOfflineSourcesMu.Lock() defer scw.formattedOfflineSourcesMu.Unlock() if scw.formattedOfflineSources == "" { return "no offline source tablets currently in use" } return scw.formattedOfflineSources }
[ "func", "(", "scw", "*", "SplitCloneWorker", ")", "FormattedOfflineSources", "(", ")", "string", "{", "scw", ".", "formattedOfflineSourcesMu", ".", "Lock", "(", ")", "\n", "defer", "scw", ".", "formattedOfflineSourcesMu", ".", "Unlock", "(", ")", "\n\n", "if",...
// FormattedOfflineSources returns a space separated list of tablets which // are in use during the offline clone phase.
[ "FormattedOfflineSources", "returns", "a", "space", "separated", "list", "of", "tablets", "which", "are", "in", "use", "during", "the", "offline", "clone", "phase", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/split_clone.go#L290-L298
train
vitessio/vitess
go/vt/worker/split_clone.go
findDestinationMasters
func (scw *SplitCloneWorker) findDestinationMasters(ctx context.Context) error { scw.setState(WorkerStateFindTargets) // Make sure we find a master for each destination shard and log it. scw.wr.Logger().Infof("Finding a MASTER tablet for each destination shard...") for _, si := range scw.destinationShards { wait...
go
func (scw *SplitCloneWorker) findDestinationMasters(ctx context.Context) error { scw.setState(WorkerStateFindTargets) // Make sure we find a master for each destination shard and log it. scw.wr.Logger().Infof("Finding a MASTER tablet for each destination shard...") for _, si := range scw.destinationShards { wait...
[ "func", "(", "scw", "*", "SplitCloneWorker", ")", "findDestinationMasters", "(", "ctx", "context", ".", "Context", ")", "error", "{", "scw", ".", "setState", "(", "WorkerStateFindTargets", ")", "\n\n", "// Make sure we find a master for each destination shard and log it."...
// findDestinationMasters finds for each destination shard the current master.
[ "findDestinationMasters", "finds", "for", "each", "destination", "shard", "the", "current", "master", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/split_clone.go#L840-L867
train
vitessio/vitess
go/vt/worker/split_clone.go
createKeyResolver
func (scw *SplitCloneWorker) createKeyResolver(td *tabletmanagerdatapb.TableDefinition) (keyspaceIDResolver, error) { if scw.cloneType == verticalSplit { // VerticalSplitClone currently always has exactly one destination shard // and therefore does not require routing between multiple shards. return nil, nil } ...
go
func (scw *SplitCloneWorker) createKeyResolver(td *tabletmanagerdatapb.TableDefinition) (keyspaceIDResolver, error) { if scw.cloneType == verticalSplit { // VerticalSplitClone currently always has exactly one destination shard // and therefore does not require routing between multiple shards. return nil, nil } ...
[ "func", "(", "scw", "*", "SplitCloneWorker", ")", "createKeyResolver", "(", "td", "*", "tabletmanagerdatapb", ".", "TableDefinition", ")", "(", "keyspaceIDResolver", ",", "error", ")", "{", "if", "scw", ".", "cloneType", "==", "verticalSplit", "{", "// VerticalS...
// createKeyResolver is called at the start of each chunk pipeline. // It creates a keyspaceIDResolver which translates a given row to a // keyspace ID. This is necessary to route the to be copied rows to the // different destination shards.
[ "createKeyResolver", "is", "called", "at", "the", "start", "of", "each", "chunk", "pipeline", ".", "It", "creates", "a", "keyspaceIDResolver", "which", "translates", "a", "given", "row", "to", "a", "keyspace", "ID", ".", "This", "is", "necessary", "to", "rou...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/split_clone.go#L1343-L1354
train
vitessio/vitess
go/vt/worker/split_clone.go
StatsUpdate
func (scw *SplitCloneWorker) StatsUpdate(ts *discovery.TabletStats) { scw.tsc.StatsUpdate(ts) // Ignore unless REPLICA or RDONLY. if ts.Target.TabletType != topodatapb.TabletType_REPLICA && ts.Target.TabletType != topodatapb.TabletType_RDONLY { return } // Lock throttlers mutex to avoid that this method (and t...
go
func (scw *SplitCloneWorker) StatsUpdate(ts *discovery.TabletStats) { scw.tsc.StatsUpdate(ts) // Ignore unless REPLICA or RDONLY. if ts.Target.TabletType != topodatapb.TabletType_REPLICA && ts.Target.TabletType != topodatapb.TabletType_RDONLY { return } // Lock throttlers mutex to avoid that this method (and t...
[ "func", "(", "scw", "*", "SplitCloneWorker", ")", "StatsUpdate", "(", "ts", "*", "discovery", ".", "TabletStats", ")", "{", "scw", ".", "tsc", ".", "StatsUpdate", "(", "ts", ")", "\n\n", "// Ignore unless REPLICA or RDONLY.", "if", "ts", ".", "Target", ".", ...
// StatsUpdate receives replication lag updates for each destination master // and forwards them to the respective throttler instance. // It also forwards any update to the TabletStatsCache to keep it up to date. // It is part of the discovery.HealthCheckStatsListener interface.
[ "StatsUpdate", "receives", "replication", "lag", "updates", "for", "each", "destination", "master", "and", "forwards", "them", "to", "the", "respective", "throttler", "instance", ".", "It", "also", "forwards", "any", "update", "to", "the", "TabletStatsCache", "to"...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/split_clone.go#L1360-L1378
train
vitessio/vitess
go/vt/worker/tablet_tracker.go
Track
func (t *TabletTracker) Track(stats []discovery.TabletStats) *topodatapb.Tablet { if len(stats) == 0 { panic("stats must not be empty") } t.mu.Lock() defer t.mu.Unlock() // Try to find a tablet which is not in use yet. for _, stat := range stats { key := topoproto.TabletAliasString(stat.Tablet.Alias) if _,...
go
func (t *TabletTracker) Track(stats []discovery.TabletStats) *topodatapb.Tablet { if len(stats) == 0 { panic("stats must not be empty") } t.mu.Lock() defer t.mu.Unlock() // Try to find a tablet which is not in use yet. for _, stat := range stats { key := topoproto.TabletAliasString(stat.Tablet.Alias) if _,...
[ "func", "(", "t", "*", "TabletTracker", ")", "Track", "(", "stats", "[", "]", "discovery", ".", "TabletStats", ")", "*", "topodatapb", ".", "Tablet", "{", "if", "len", "(", "stats", ")", "==", "0", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "...
// Track will pick the least used tablet from "stats", increment its usage by 1 // and return it. // "stats" must not be empty.
[ "Track", "will", "pick", "the", "least", "used", "tablet", "from", "stats", "increment", "its", "usage", "by", "1", "and", "return", "it", ".", "stats", "must", "not", "be", "empty", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/tablet_tracker.go#L53-L81
train
vitessio/vitess
go/vt/worker/tablet_tracker.go
Untrack
func (t *TabletTracker) Untrack(alias *topodatapb.TabletAlias) { t.mu.Lock() defer t.mu.Unlock() key := topoproto.TabletAliasString(alias) count, ok := t.usedTablets[key] if !ok { panic(fmt.Sprintf("tablet: %v was never tracked", key)) } count-- if count == 0 { delete(t.usedTablets, key) } else { t.used...
go
func (t *TabletTracker) Untrack(alias *topodatapb.TabletAlias) { t.mu.Lock() defer t.mu.Unlock() key := topoproto.TabletAliasString(alias) count, ok := t.usedTablets[key] if !ok { panic(fmt.Sprintf("tablet: %v was never tracked", key)) } count-- if count == 0 { delete(t.usedTablets, key) } else { t.used...
[ "func", "(", "t", "*", "TabletTracker", ")", "Untrack", "(", "alias", "*", "topodatapb", ".", "TabletAlias", ")", "{", "t", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "t", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "key", ":=", "topoproto", ...
// Untrack decrements the usage of "alias" by 1.
[ "Untrack", "decrements", "the", "usage", "of", "alias", "by", "1", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/tablet_tracker.go#L84-L99
train
vitessio/vitess
go/vt/worker/tablet_tracker.go
TabletsInUse
func (t *TabletTracker) TabletsInUse() string { t.mu.Lock() defer t.mu.Unlock() var aliases []string for alias := range t.usedTablets { aliases = append(aliases, alias) } sort.Strings(aliases) return strings.Join(aliases, " ") }
go
func (t *TabletTracker) TabletsInUse() string { t.mu.Lock() defer t.mu.Unlock() var aliases []string for alias := range t.usedTablets { aliases = append(aliases, alias) } sort.Strings(aliases) return strings.Join(aliases, " ") }
[ "func", "(", "t", "*", "TabletTracker", ")", "TabletsInUse", "(", ")", "string", "{", "t", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "t", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "var", "aliases", "[", "]", "string", "\n", "for", "alias...
// TabletsInUse returns a string of all tablet aliases currently in use. // The tablets are separated by a space.
[ "TabletsInUse", "returns", "a", "string", "of", "all", "tablet", "aliases", "currently", "in", "use", ".", "The", "tablets", "are", "separated", "by", "a", "space", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/tablet_tracker.go#L103-L113
train
vitessio/vitess
go/vt/vttablet/endtoend/framework/client.go
NewClient
func NewClient() *QueryClient { return &QueryClient{ ctx: callerid.NewContext( context.Background(), &vtrpcpb.CallerID{}, &querypb.VTGateCallerID{Username: "dev"}, ), target: Target, server: Server, } }
go
func NewClient() *QueryClient { return &QueryClient{ ctx: callerid.NewContext( context.Background(), &vtrpcpb.CallerID{}, &querypb.VTGateCallerID{Username: "dev"}, ), target: Target, server: Server, } }
[ "func", "NewClient", "(", ")", "*", "QueryClient", "{", "return", "&", "QueryClient", "{", "ctx", ":", "callerid", ".", "NewContext", "(", "context", ".", "Background", "(", ")", ",", "&", "vtrpcpb", ".", "CallerID", "{", "}", ",", "&", "querypb", ".",...
// NewClient creates a new client for Server.
[ "NewClient", "creates", "a", "new", "client", "for", "Server", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/endtoend/framework/client.go#L43-L53
train
vitessio/vitess
go/vt/vttablet/endtoend/framework/client.go
NewClientWithContext
func NewClientWithContext(ctx context.Context) *QueryClient { return &QueryClient{ ctx: ctx, target: Target, server: Server, } }
go
func NewClientWithContext(ctx context.Context) *QueryClient { return &QueryClient{ ctx: ctx, target: Target, server: Server, } }
[ "func", "NewClientWithContext", "(", "ctx", "context", ".", "Context", ")", "*", "QueryClient", "{", "return", "&", "QueryClient", "{", "ctx", ":", "ctx", ",", "target", ":", "Target", ",", "server", ":", "Server", ",", "}", "\n", "}" ]
// NewClientWithContext creates a new client for Server with the provided context.
[ "NewClientWithContext", "creates", "a", "new", "client", "for", "Server", "with", "the", "provided", "context", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/endtoend/framework/client.go#L56-L62
train
vitessio/vitess
go/vt/vttablet/endtoend/framework/client.go
Begin
func (client *QueryClient) Begin(clientFoundRows bool) error { if client.transactionID != 0 { return errors.New("already in transaction") } var options *querypb.ExecuteOptions if clientFoundRows { options = &querypb.ExecuteOptions{ClientFoundRows: clientFoundRows} } transactionID, err := client.server.Begin(c...
go
func (client *QueryClient) Begin(clientFoundRows bool) error { if client.transactionID != 0 { return errors.New("already in transaction") } var options *querypb.ExecuteOptions if clientFoundRows { options = &querypb.ExecuteOptions{ClientFoundRows: clientFoundRows} } transactionID, err := client.server.Begin(c...
[ "func", "(", "client", "*", "QueryClient", ")", "Begin", "(", "clientFoundRows", "bool", ")", "error", "{", "if", "client", ".", "transactionID", "!=", "0", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "var", "options", ...
// Begin begins a transaction.
[ "Begin", "begins", "a", "transaction", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/endtoend/framework/client.go#L65-L79
train
vitessio/vitess
go/vt/vttablet/endtoend/framework/client.go
Prepare
func (client *QueryClient) Prepare(dtid string) error { defer func() { client.transactionID = 0 }() return client.server.Prepare(client.ctx, &client.target, client.transactionID, dtid) }
go
func (client *QueryClient) Prepare(dtid string) error { defer func() { client.transactionID = 0 }() return client.server.Prepare(client.ctx, &client.target, client.transactionID, dtid) }
[ "func", "(", "client", "*", "QueryClient", ")", "Prepare", "(", "dtid", "string", ")", "error", "{", "defer", "func", "(", ")", "{", "client", ".", "transactionID", "=", "0", "}", "(", ")", "\n", "return", "client", ".", "server", ".", "Prepare", "("...
// Prepare executes a prepare on the current transaction.
[ "Prepare", "executes", "a", "prepare", "on", "the", "current", "transaction", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/endtoend/framework/client.go#L94-L97
train
vitessio/vitess
go/vt/vttablet/endtoend/framework/client.go
RollbackPrepared
func (client *QueryClient) RollbackPrepared(dtid string, originalID int64) error { return client.server.RollbackPrepared(client.ctx, &client.target, dtid, originalID) }
go
func (client *QueryClient) RollbackPrepared(dtid string, originalID int64) error { return client.server.RollbackPrepared(client.ctx, &client.target, dtid, originalID) }
[ "func", "(", "client", "*", "QueryClient", ")", "RollbackPrepared", "(", "dtid", "string", ",", "originalID", "int64", ")", "error", "{", "return", "client", ".", "server", ".", "RollbackPrepared", "(", "client", ".", "ctx", ",", "&", "client", ".", "targe...
// RollbackPrepared rollsback a prepared transaction.
[ "RollbackPrepared", "rollsback", "a", "prepared", "transaction", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/endtoend/framework/client.go#L105-L107
train
vitessio/vitess
go/vt/vttablet/endtoend/framework/client.go
CreateTransaction
func (client *QueryClient) CreateTransaction(dtid string, participants []*querypb.Target) error { return client.server.CreateTransaction(client.ctx, &client.target, dtid, participants) }
go
func (client *QueryClient) CreateTransaction(dtid string, participants []*querypb.Target) error { return client.server.CreateTransaction(client.ctx, &client.target, dtid, participants) }
[ "func", "(", "client", "*", "QueryClient", ")", "CreateTransaction", "(", "dtid", "string", ",", "participants", "[", "]", "*", "querypb", ".", "Target", ")", "error", "{", "return", "client", ".", "server", ".", "CreateTransaction", "(", "client", ".", "c...
// CreateTransaction issues a CreateTransaction to TabletServer.
[ "CreateTransaction", "issues", "a", "CreateTransaction", "to", "TabletServer", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/endtoend/framework/client.go#L110-L112
train
vitessio/vitess
go/vt/vttablet/endtoend/framework/client.go
SetRollback
func (client *QueryClient) SetRollback(dtid string, transactionID int64) error { return client.server.SetRollback(client.ctx, &client.target, dtid, client.transactionID) }
go
func (client *QueryClient) SetRollback(dtid string, transactionID int64) error { return client.server.SetRollback(client.ctx, &client.target, dtid, client.transactionID) }
[ "func", "(", "client", "*", "QueryClient", ")", "SetRollback", "(", "dtid", "string", ",", "transactionID", "int64", ")", "error", "{", "return", "client", ".", "server", ".", "SetRollback", "(", "client", ".", "ctx", ",", "&", "client", ".", "target", "...
// SetRollback issues a SetRollback to TabletServer.
[ "SetRollback", "issues", "a", "SetRollback", "to", "TabletServer", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/endtoend/framework/client.go#L121-L123
train
vitessio/vitess
go/vt/vttablet/endtoend/framework/client.go
ConcludeTransaction
func (client *QueryClient) ConcludeTransaction(dtid string) error { return client.server.ConcludeTransaction(client.ctx, &client.target, dtid) }
go
func (client *QueryClient) ConcludeTransaction(dtid string) error { return client.server.ConcludeTransaction(client.ctx, &client.target, dtid) }
[ "func", "(", "client", "*", "QueryClient", ")", "ConcludeTransaction", "(", "dtid", "string", ")", "error", "{", "return", "client", ".", "server", ".", "ConcludeTransaction", "(", "client", ".", "ctx", ",", "&", "client", ".", "target", ",", "dtid", ")", ...
// ConcludeTransaction issues a ConcludeTransaction to TabletServer.
[ "ConcludeTransaction", "issues", "a", "ConcludeTransaction", "to", "TabletServer", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/endtoend/framework/client.go#L126-L128
train
vitessio/vitess
go/vt/vttablet/endtoend/framework/client.go
ReadTransaction
func (client *QueryClient) ReadTransaction(dtid string) (*querypb.TransactionMetadata, error) { return client.server.ReadTransaction(client.ctx, &client.target, dtid) }
go
func (client *QueryClient) ReadTransaction(dtid string) (*querypb.TransactionMetadata, error) { return client.server.ReadTransaction(client.ctx, &client.target, dtid) }
[ "func", "(", "client", "*", "QueryClient", ")", "ReadTransaction", "(", "dtid", "string", ")", "(", "*", "querypb", ".", "TransactionMetadata", ",", "error", ")", "{", "return", "client", ".", "server", ".", "ReadTransaction", "(", "client", ".", "ctx", ",...
// ReadTransaction returns the transaction metadata.
[ "ReadTransaction", "returns", "the", "transaction", "metadata", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/endtoend/framework/client.go#L131-L133
train
vitessio/vitess
go/vt/vttablet/endtoend/framework/client.go
SetServingType
func (client *QueryClient) SetServingType(tabletType topodatapb.TabletType) error { _, err := client.server.SetServingType(tabletType, true, nil) return err }
go
func (client *QueryClient) SetServingType(tabletType topodatapb.TabletType) error { _, err := client.server.SetServingType(tabletType, true, nil) return err }
[ "func", "(", "client", "*", "QueryClient", ")", "SetServingType", "(", "tabletType", "topodatapb", ".", "TabletType", ")", "error", "{", "_", ",", "err", ":=", "client", ".", "server", ".", "SetServingType", "(", "tabletType", ",", "true", ",", "nil", ")",...
// SetServingType is for testing transitions. // It currently supports only master->replica and back.
[ "SetServingType", "is", "for", "testing", "transitions", ".", "It", "currently", "supports", "only", "master", "-", ">", "replica", "and", "back", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/endtoend/framework/client.go#L137-L140
train
vitessio/vitess
go/vt/vttablet/endtoend/framework/client.go
Execute
func (client *QueryClient) Execute(query string, bindvars map[string]*querypb.BindVariable) (*sqltypes.Result, error) { return client.ExecuteWithOptions(query, bindvars, &querypb.ExecuteOptions{IncludedFields: querypb.ExecuteOptions_ALL}) }
go
func (client *QueryClient) Execute(query string, bindvars map[string]*querypb.BindVariable) (*sqltypes.Result, error) { return client.ExecuteWithOptions(query, bindvars, &querypb.ExecuteOptions{IncludedFields: querypb.ExecuteOptions_ALL}) }
[ "func", "(", "client", "*", "QueryClient", ")", "Execute", "(", "query", "string", ",", "bindvars", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable", ")", "(", "*", "sqltypes", ".", "Result", ",", "error", ")", "{", "return", "client", "....
// Execute executes a query.
[ "Execute", "executes", "a", "query", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/endtoend/framework/client.go#L143-L145
train
vitessio/vitess
go/vt/vttablet/endtoend/framework/client.go
BeginExecute
func (client *QueryClient) BeginExecute(query string, bindvars map[string]*querypb.BindVariable) (*sqltypes.Result, error) { if client.transactionID != 0 { return nil, errors.New("already in transaction") } qr, transactionID, err := client.server.BeginExecute( client.ctx, &client.target, query, bindvars, ...
go
func (client *QueryClient) BeginExecute(query string, bindvars map[string]*querypb.BindVariable) (*sqltypes.Result, error) { if client.transactionID != 0 { return nil, errors.New("already in transaction") } qr, transactionID, err := client.server.BeginExecute( client.ctx, &client.target, query, bindvars, ...
[ "func", "(", "client", "*", "QueryClient", ")", "BeginExecute", "(", "query", "string", ",", "bindvars", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable", ")", "(", "*", "sqltypes", ".", "Result", ",", "error", ")", "{", "if", "client", "...
// BeginExecute performs a BeginExecute.
[ "BeginExecute", "performs", "a", "BeginExecute", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/endtoend/framework/client.go#L148-L164
train
vitessio/vitess
go/vt/vttablet/endtoend/framework/client.go
ExecuteWithOptions
func (client *QueryClient) ExecuteWithOptions(query string, bindvars map[string]*querypb.BindVariable, options *querypb.ExecuteOptions) (*sqltypes.Result, error) { return client.server.Execute( client.ctx, &client.target, query, bindvars, client.transactionID, options, ) }
go
func (client *QueryClient) ExecuteWithOptions(query string, bindvars map[string]*querypb.BindVariable, options *querypb.ExecuteOptions) (*sqltypes.Result, error) { return client.server.Execute( client.ctx, &client.target, query, bindvars, client.transactionID, options, ) }
[ "func", "(", "client", "*", "QueryClient", ")", "ExecuteWithOptions", "(", "query", "string", ",", "bindvars", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable", ",", "options", "*", "querypb", ".", "ExecuteOptions", ")", "(", "*", "sqltypes", ...
// ExecuteWithOptions executes a query using 'options'.
[ "ExecuteWithOptions", "executes", "a", "query", "using", "options", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/endtoend/framework/client.go#L167-L176
train
vitessio/vitess
go/vt/vttablet/endtoend/framework/client.go
StreamExecute
func (client *QueryClient) StreamExecute(query string, bindvars map[string]*querypb.BindVariable) (*sqltypes.Result, error) { return client.StreamExecuteWithOptions(query, bindvars, &querypb.ExecuteOptions{IncludedFields: querypb.ExecuteOptions_ALL}) }
go
func (client *QueryClient) StreamExecute(query string, bindvars map[string]*querypb.BindVariable) (*sqltypes.Result, error) { return client.StreamExecuteWithOptions(query, bindvars, &querypb.ExecuteOptions{IncludedFields: querypb.ExecuteOptions_ALL}) }
[ "func", "(", "client", "*", "QueryClient", ")", "StreamExecute", "(", "query", "string", ",", "bindvars", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable", ")", "(", "*", "sqltypes", ".", "Result", ",", "error", ")", "{", "return", "client"...
// StreamExecute executes a query & returns the results.
[ "StreamExecute", "executes", "a", "query", "&", "returns", "the", "results", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/endtoend/framework/client.go#L179-L181
train
vitessio/vitess
go/vt/vttablet/endtoend/framework/client.go
StreamExecuteWithOptions
func (client *QueryClient) StreamExecuteWithOptions(query string, bindvars map[string]*querypb.BindVariable, options *querypb.ExecuteOptions) (*sqltypes.Result, error) { result := &sqltypes.Result{} err := client.server.StreamExecute( client.ctx, &client.target, query, bindvars, 0, options, func(res *sq...
go
func (client *QueryClient) StreamExecuteWithOptions(query string, bindvars map[string]*querypb.BindVariable, options *querypb.ExecuteOptions) (*sqltypes.Result, error) { result := &sqltypes.Result{} err := client.server.StreamExecute( client.ctx, &client.target, query, bindvars, 0, options, func(res *sq...
[ "func", "(", "client", "*", "QueryClient", ")", "StreamExecuteWithOptions", "(", "query", "string", ",", "bindvars", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable", ",", "options", "*", "querypb", ".", "ExecuteOptions", ")", "(", "*", "sqltyp...
// StreamExecuteWithOptions executes a query & returns the results using 'options'.
[ "StreamExecuteWithOptions", "executes", "a", "query", "&", "returns", "the", "results", "using", "options", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/endtoend/framework/client.go#L184-L206
train
vitessio/vitess
go/vt/vttablet/endtoend/framework/client.go
Stream
func (client *QueryClient) Stream(query string, bindvars map[string]*querypb.BindVariable, sendFunc func(*sqltypes.Result) error) error { return client.server.StreamExecute( client.ctx, &client.target, query, bindvars, 0, &querypb.ExecuteOptions{IncludedFields: querypb.ExecuteOptions_ALL}, sendFunc, ) }
go
func (client *QueryClient) Stream(query string, bindvars map[string]*querypb.BindVariable, sendFunc func(*sqltypes.Result) error) error { return client.server.StreamExecute( client.ctx, &client.target, query, bindvars, 0, &querypb.ExecuteOptions{IncludedFields: querypb.ExecuteOptions_ALL}, sendFunc, ) }
[ "func", "(", "client", "*", "QueryClient", ")", "Stream", "(", "query", "string", ",", "bindvars", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable", ",", "sendFunc", "func", "(", "*", "sqltypes", ".", "Result", ")", "error", ")", "error", ...
// Stream streams the results of a query.
[ "Stream", "streams", "the", "results", "of", "a", "query", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/endtoend/framework/client.go#L209-L219
train
vitessio/vitess
go/vt/vttablet/endtoend/framework/client.go
ExecuteBatch
func (client *QueryClient) ExecuteBatch(queries []*querypb.BoundQuery, asTransaction bool) ([]sqltypes.Result, error) { return client.server.ExecuteBatch( client.ctx, &client.target, queries, asTransaction, client.transactionID, &querypb.ExecuteOptions{IncludedFields: querypb.ExecuteOptions_ALL}, ) }
go
func (client *QueryClient) ExecuteBatch(queries []*querypb.BoundQuery, asTransaction bool) ([]sqltypes.Result, error) { return client.server.ExecuteBatch( client.ctx, &client.target, queries, asTransaction, client.transactionID, &querypb.ExecuteOptions{IncludedFields: querypb.ExecuteOptions_ALL}, ) }
[ "func", "(", "client", "*", "QueryClient", ")", "ExecuteBatch", "(", "queries", "[", "]", "*", "querypb", ".", "BoundQuery", ",", "asTransaction", "bool", ")", "(", "[", "]", "sqltypes", ".", "Result", ",", "error", ")", "{", "return", "client", ".", "...
// ExecuteBatch executes a batch of queries.
[ "ExecuteBatch", "executes", "a", "batch", "of", "queries", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/endtoend/framework/client.go#L222-L231
train
vitessio/vitess
go/vt/vttablet/endtoend/framework/client.go
MessageStream
func (client *QueryClient) MessageStream(name string, callback func(*sqltypes.Result) error) (err error) { return client.server.MessageStream(client.ctx, &client.target, name, callback) }
go
func (client *QueryClient) MessageStream(name string, callback func(*sqltypes.Result) error) (err error) { return client.server.MessageStream(client.ctx, &client.target, name, callback) }
[ "func", "(", "client", "*", "QueryClient", ")", "MessageStream", "(", "name", "string", ",", "callback", "func", "(", "*", "sqltypes", ".", "Result", ")", "error", ")", "(", "err", "error", ")", "{", "return", "client", ".", "server", ".", "MessageStream...
// MessageStream streams messages from the message table.
[ "MessageStream", "streams", "messages", "from", "the", "message", "table", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/endtoend/framework/client.go#L234-L236
train
vitessio/vitess
go/vt/vttablet/endtoend/framework/client.go
MessageAck
func (client *QueryClient) MessageAck(name string, ids []string) (int64, error) { bids := make([]*querypb.Value, 0, len(ids)) for _, id := range ids { bids = append(bids, &querypb.Value{ Type: sqltypes.VarChar, Value: []byte(id), }) } return client.server.MessageAck(client.ctx, &client.target, name, bids...
go
func (client *QueryClient) MessageAck(name string, ids []string) (int64, error) { bids := make([]*querypb.Value, 0, len(ids)) for _, id := range ids { bids = append(bids, &querypb.Value{ Type: sqltypes.VarChar, Value: []byte(id), }) } return client.server.MessageAck(client.ctx, &client.target, name, bids...
[ "func", "(", "client", "*", "QueryClient", ")", "MessageAck", "(", "name", "string", ",", "ids", "[", "]", "string", ")", "(", "int64", ",", "error", ")", "{", "bids", ":=", "make", "(", "[", "]", "*", "querypb", ".", "Value", ",", "0", ",", "len...
// MessageAck acks messages
[ "MessageAck", "acks", "messages" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/endtoend/framework/client.go#L239-L248
train
vitessio/vitess
go/vt/worker/command.go
AddCommand
func AddCommand(groupName string, c Command) { for i, group := range commands { if group.Name == groupName { commands[i].Commands = append(commands[i].Commands, c) return } } panic(vterrors.Errorf(vtrpc.Code_INVALID_ARGUMENT, "trying to add to missing group %v", groupName)) }
go
func AddCommand(groupName string, c Command) { for i, group := range commands { if group.Name == groupName { commands[i].Commands = append(commands[i].Commands, c) return } } panic(vterrors.Errorf(vtrpc.Code_INVALID_ARGUMENT, "trying to add to missing group %v", groupName)) }
[ "func", "AddCommand", "(", "groupName", "string", ",", "c", "Command", ")", "{", "for", "i", ",", "group", ":=", "range", "commands", "{", "if", "group", ".", "Name", "==", "groupName", "{", "commands", "[", "i", "]", ".", "Commands", "=", "append", ...
// AddCommand registers a command and makes it available.
[ "AddCommand", "registers", "a", "command", "and", "makes", "it", "available", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/command.go#L73-L81
train
vitessio/vitess
go/vt/worker/command.go
WaitForCommand
func (wi *Instance) WaitForCommand(wrk Worker, done chan struct{}) error { // display the status every second timer := time.NewTicker(wi.commandDisplayInterval) defer timer.Stop() for { select { case <-done: log.Info(wrk.StatusAsText()) wi.currentWorkerMutex.Lock() err := wi.lastRunError wi.currentW...
go
func (wi *Instance) WaitForCommand(wrk Worker, done chan struct{}) error { // display the status every second timer := time.NewTicker(wi.commandDisplayInterval) defer timer.Stop() for { select { case <-done: log.Info(wrk.StatusAsText()) wi.currentWorkerMutex.Lock() err := wi.lastRunError wi.currentW...
[ "func", "(", "wi", "*", "Instance", ")", "WaitForCommand", "(", "wrk", "Worker", ",", "done", "chan", "struct", "{", "}", ")", "error", "{", "// display the status every second", "timer", ":=", "time", ".", "NewTicker", "(", "wi", ".", "commandDisplayInterval"...
// WaitForCommand blocks until "done" is closed. In the meantime, it logs the status of "wrk".
[ "WaitForCommand", "blocks", "until", "done", "is", "closed", ".", "In", "the", "meantime", "it", "logs", "the", "status", "of", "wrk", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/command.go#L146-L165
train
vitessio/vitess
go/vt/worker/command.go
PrintAllCommands
func PrintAllCommands(logger logutil.Logger) { for _, group := range commands { if group.Name == "Debugging" { continue } logger.Printf("%v: %v\n", group.Name, group.Description) for _, cmd := range group.Commands { logger.Printf(" %v %v\n", cmd.Name, cmd.Params) } logger.Printf("\n") } }
go
func PrintAllCommands(logger logutil.Logger) { for _, group := range commands { if group.Name == "Debugging" { continue } logger.Printf("%v: %v\n", group.Name, group.Description) for _, cmd := range group.Commands { logger.Printf(" %v %v\n", cmd.Name, cmd.Params) } logger.Printf("\n") } }
[ "func", "PrintAllCommands", "(", "logger", "logutil", ".", "Logger", ")", "{", "for", "_", ",", "group", ":=", "range", "commands", "{", "if", "group", ".", "Name", "==", "\"", "\"", "{", "continue", "\n", "}", "\n", "logger", ".", "Printf", "(", "\"...
// PrintAllCommands prints a help text for all registered commands to the given Logger.
[ "PrintAllCommands", "prints", "a", "help", "text", "for", "all", "registered", "commands", "to", "the", "given", "Logger", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/command.go#L168-L179
train
vitessio/vitess
go/vt/binlog/binlog_streamer.go
NewStreamer
func NewStreamer(cp *mysql.ConnParams, se *schema.Engine, clientCharset *binlogdatapb.Charset, startPos mysql.Position, timestamp int64, sendTransaction sendTransactionFunc) *Streamer { return &Streamer{ cp: cp, se: se, clientCharset: clientCharset, startPos: startPos, time...
go
func NewStreamer(cp *mysql.ConnParams, se *schema.Engine, clientCharset *binlogdatapb.Charset, startPos mysql.Position, timestamp int64, sendTransaction sendTransactionFunc) *Streamer { return &Streamer{ cp: cp, se: se, clientCharset: clientCharset, startPos: startPos, time...
[ "func", "NewStreamer", "(", "cp", "*", "mysql", ".", "ConnParams", ",", "se", "*", "schema", ".", "Engine", ",", "clientCharset", "*", "binlogdatapb", ".", "Charset", ",", "startPos", "mysql", ".", "Position", ",", "timestamp", "int64", ",", "sendTransaction...
// NewStreamer creates a binlog Streamer. // // dbname specifes the database to stream events for. // mysqld is the local instance of mysqlctl.Mysqld. // charset is the default character set on the BinlogPlayer side. // startPos is the position to start streaming at. Incompatible with timestamp. // timestamp is the tim...
[ "NewStreamer", "creates", "a", "binlog", "Streamer", ".", "dbname", "specifes", "the", "database", "to", "stream", "events", "for", ".", "mysqld", "is", "the", "local", "instance", "of", "mysqlctl", ".", "Mysqld", ".", "charset", "is", "the", "default", "cha...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/binlog/binlog_streamer.go#L158-L167
train
vitessio/vitess
go/vt/binlog/binlog_streamer.go
writeValuesAsSQL
func writeValuesAsSQL(sql *sqlparser.TrackedBuffer, tce *tableCacheEntry, rs *mysql.Rows, rowIndex int, getPK bool) (sqltypes.Value, []sqltypes.Value, error) { valueIndex := 0 data := rs.Rows[rowIndex].Data pos := 0 var keyspaceIDCell sqltypes.Value var pkValues []sqltypes.Value if getPK { pkValues = make([]sql...
go
func writeValuesAsSQL(sql *sqlparser.TrackedBuffer, tce *tableCacheEntry, rs *mysql.Rows, rowIndex int, getPK bool) (sqltypes.Value, []sqltypes.Value, error) { valueIndex := 0 data := rs.Rows[rowIndex].Data pos := 0 var keyspaceIDCell sqltypes.Value var pkValues []sqltypes.Value if getPK { pkValues = make([]sql...
[ "func", "writeValuesAsSQL", "(", "sql", "*", "sqlparser", ".", "TrackedBuffer", ",", "tce", "*", "tableCacheEntry", ",", "rs", "*", "mysql", ".", "Rows", ",", "rowIndex", "int", ",", "getPK", "bool", ")", "(", "sqltypes", ".", "Value", ",", "[", "]", "...
// writeValuesAsSQL is a helper method to print the values as SQL in the // provided bytes.Buffer. It also returns the value for the keyspaceIDColumn, // and the array of values for the PK, if necessary.
[ "writeValuesAsSQL", "is", "a", "helper", "method", "to", "print", "the", "values", "as", "SQL", "in", "the", "provided", "bytes", ".", "Buffer", ".", "It", "also", "returns", "the", "value", "for", "the", "keyspaceIDColumn", "and", "the", "array", "of", "v...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/binlog/binlog_streamer.go#L723-L779
train
vitessio/vitess
go/mysql/flavor_mariadb.go
setSlavePositionCommands
func (mariadbFlavor) setSlavePositionCommands(pos Position) []string { return []string{ // RESET MASTER will clear out gtid_binlog_pos, // which then guarantees that gtid_current_pos = gtid_slave_pos, // since gtid_current_pos = MAX(gtid_binlog_pos,gtid_slave_pos). // This also emptys the binlogs, which allows...
go
func (mariadbFlavor) setSlavePositionCommands(pos Position) []string { return []string{ // RESET MASTER will clear out gtid_binlog_pos, // which then guarantees that gtid_current_pos = gtid_slave_pos, // since gtid_current_pos = MAX(gtid_binlog_pos,gtid_slave_pos). // This also emptys the binlogs, which allows...
[ "func", "(", "mariadbFlavor", ")", "setSlavePositionCommands", "(", "pos", "Position", ")", "[", "]", "string", "{", "return", "[", "]", "string", "{", "// RESET MASTER will clear out gtid_binlog_pos,", "// which then guarantees that gtid_current_pos = gtid_slave_pos,", "// s...
// setSlavePositionCommands is part of the Flavor interface.
[ "setSlavePositionCommands", "is", "part", "of", "the", "Flavor", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/flavor_mariadb.go#L97-L117
train
vitessio/vitess
go/vt/wrangler/version.go
GetVersion
func (wr *Wrangler) GetVersion(ctx context.Context, tabletAlias *topodatapb.TabletAlias) (string, error) { tablet, err := wr.ts.GetTablet(ctx, tabletAlias) if err != nil { return "", err } version, err := getVersionFromTablet(tablet.Addr()) if err != nil { return "", err } log.Infof("Tablet %v is running ve...
go
func (wr *Wrangler) GetVersion(ctx context.Context, tabletAlias *topodatapb.TabletAlias) (string, error) { tablet, err := wr.ts.GetTablet(ctx, tabletAlias) if err != nil { return "", err } version, err := getVersionFromTablet(tablet.Addr()) if err != nil { return "", err } log.Infof("Tablet %v is running ve...
[ "func", "(", "wr", "*", "Wrangler", ")", "GetVersion", "(", "ctx", "context", ".", "Context", ",", "tabletAlias", "*", "topodatapb", ".", "TabletAlias", ")", "(", "string", ",", "error", ")", "{", "tablet", ",", "err", ":=", "wr", ".", "ts", ".", "Ge...
// GetVersion returns the version string from a tablet
[ "GetVersion", "returns", "the", "version", "string", "from", "a", "tablet" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/version.go#L72-L84
train
vitessio/vitess
go/vt/wrangler/version.go
diffVersion
func (wr *Wrangler) diffVersion(ctx context.Context, masterVersion string, masterAlias *topodatapb.TabletAlias, alias *topodatapb.TabletAlias, wg *sync.WaitGroup, er concurrency.ErrorRecorder) { defer wg.Done() log.Infof("Gathering version for %v", topoproto.TabletAliasString(alias)) slaveVersion, err := wr.GetVersi...
go
func (wr *Wrangler) diffVersion(ctx context.Context, masterVersion string, masterAlias *topodatapb.TabletAlias, alias *topodatapb.TabletAlias, wg *sync.WaitGroup, er concurrency.ErrorRecorder) { defer wg.Done() log.Infof("Gathering version for %v", topoproto.TabletAliasString(alias)) slaveVersion, err := wr.GetVersi...
[ "func", "(", "wr", "*", "Wrangler", ")", "diffVersion", "(", "ctx", "context", ".", "Context", ",", "masterVersion", "string", ",", "masterAlias", "*", "topodatapb", ".", "TabletAlias", ",", "alias", "*", "topodatapb", ".", "TabletAlias", ",", "wg", "*", "...
// helper method to asynchronously get and diff a version
[ "helper", "method", "to", "asynchronously", "get", "and", "diff", "a", "version" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/version.go#L87-L99
train
vitessio/vitess
go/vt/wrangler/version.go
ValidateVersionShard
func (wr *Wrangler) ValidateVersionShard(ctx context.Context, keyspace, shard string) error { si, err := wr.ts.GetShard(ctx, keyspace, shard) if err != nil { return err } // get version from the master, or error if !si.HasMaster() { return fmt.Errorf("no master in shard %v/%v", keyspace, shard) } log.Infof(...
go
func (wr *Wrangler) ValidateVersionShard(ctx context.Context, keyspace, shard string) error { si, err := wr.ts.GetShard(ctx, keyspace, shard) if err != nil { return err } // get version from the master, or error if !si.HasMaster() { return fmt.Errorf("no master in shard %v/%v", keyspace, shard) } log.Infof(...
[ "func", "(", "wr", "*", "Wrangler", ")", "ValidateVersionShard", "(", "ctx", "context", ".", "Context", ",", "keyspace", ",", "shard", "string", ")", "error", "{", "si", ",", "err", ":=", "wr", ".", "ts", ".", "GetShard", "(", "ctx", ",", "keyspace", ...
// ValidateVersionShard validates all versions are the same in all // tablets in a shard
[ "ValidateVersionShard", "validates", "all", "versions", "are", "the", "same", "in", "all", "tablets", "in", "a", "shard" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/version.go#L103-L142
train
vitessio/vitess
go/vt/wrangler/version.go
ValidateVersionKeyspace
func (wr *Wrangler) ValidateVersionKeyspace(ctx context.Context, keyspace string) error { // find all the shards shards, err := wr.ts.GetShardNames(ctx, keyspace) if err != nil { return err } // corner cases if len(shards) == 0 { return fmt.Errorf("no shards in keyspace %v", keyspace) } sort.Strings(shards...
go
func (wr *Wrangler) ValidateVersionKeyspace(ctx context.Context, keyspace string) error { // find all the shards shards, err := wr.ts.GetShardNames(ctx, keyspace) if err != nil { return err } // corner cases if len(shards) == 0 { return fmt.Errorf("no shards in keyspace %v", keyspace) } sort.Strings(shards...
[ "func", "(", "wr", "*", "Wrangler", ")", "ValidateVersionKeyspace", "(", "ctx", "context", ".", "Context", ",", "keyspace", "string", ")", "error", "{", "// find all the shards", "shards", ",", "err", ":=", "wr", ".", "ts", ".", "GetShardNames", "(", "ctx", ...
// ValidateVersionKeyspace validates all versions are the same in all // tablets in a keyspace
[ "ValidateVersionKeyspace", "validates", "all", "versions", "are", "the", "same", "in", "all", "tablets", "in", "a", "keyspace" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/version.go#L146-L201
train
vitessio/vitess
go/vt/vtgate/vtgate.go
Execute
func (vtg *VTGate) Execute(ctx context.Context, session *vtgatepb.Session, sql string, bindVariables map[string]*querypb.BindVariable) (newSession *vtgatepb.Session, qr *sqltypes.Result, err error) { // In this context, we don't care if we can't fully parse destination destKeyspace, destTabletType, _, _ := vtg.execut...
go
func (vtg *VTGate) Execute(ctx context.Context, session *vtgatepb.Session, sql string, bindVariables map[string]*querypb.BindVariable) (newSession *vtgatepb.Session, qr *sqltypes.Result, err error) { // In this context, we don't care if we can't fully parse destination destKeyspace, destTabletType, _, _ := vtg.execut...
[ "func", "(", "vtg", "*", "VTGate", ")", "Execute", "(", "ctx", "context", ".", "Context", ",", "session", "*", "vtgatepb", ".", "Session", ",", "sql", "string", ",", "bindVariables", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable", ")", ...
// Execute executes a non-streaming query. This is a V3 function.
[ "Execute", "executes", "a", "non", "-", "streaming", "query", ".", "This", "is", "a", "V3", "function", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vtgate.go#L276-L301
train
vitessio/vitess
go/vt/vtgate/vtgate.go
ExecuteBatch
func (vtg *VTGate) ExecuteBatch(ctx context.Context, session *vtgatepb.Session, sqlList []string, bindVariablesList []map[string]*querypb.BindVariable) (*vtgatepb.Session, []sqltypes.QueryResponse, error) { // In this context, we don't care if we can't fully parse destination destKeyspace, destTabletType, _, _ := vtg...
go
func (vtg *VTGate) ExecuteBatch(ctx context.Context, session *vtgatepb.Session, sqlList []string, bindVariablesList []map[string]*querypb.BindVariable) (*vtgatepb.Session, []sqltypes.QueryResponse, error) { // In this context, we don't care if we can't fully parse destination destKeyspace, destTabletType, _, _ := vtg...
[ "func", "(", "vtg", "*", "VTGate", ")", "ExecuteBatch", "(", "ctx", "context", ".", "Context", ",", "session", "*", "vtgatepb", ".", "Session", ",", "sqlList", "[", "]", "string", ",", "bindVariablesList", "[", "]", "map", "[", "string", "]", "*", "que...
// ExecuteBatch executes a batch of queries. This is a V3 function.
[ "ExecuteBatch", "executes", "a", "batch", "of", "queries", ".", "This", "is", "a", "V3", "function", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vtgate.go#L304-L328
train
vitessio/vitess
go/vt/vtgate/vtgate.go
StreamExecute
func (vtg *VTGate) StreamExecute(ctx context.Context, session *vtgatepb.Session, sql string, bindVariables map[string]*querypb.BindVariable, callback func(*sqltypes.Result) error) error { // In this context, we don't care if we can't fully parse destination destKeyspace, destTabletType, dest, _ := vtg.executor.ParseD...
go
func (vtg *VTGate) StreamExecute(ctx context.Context, session *vtgatepb.Session, sql string, bindVariables map[string]*querypb.BindVariable, callback func(*sqltypes.Result) error) error { // In this context, we don't care if we can't fully parse destination destKeyspace, destTabletType, dest, _ := vtg.executor.ParseD...
[ "func", "(", "vtg", "*", "VTGate", ")", "StreamExecute", "(", "ctx", "context", ".", "Context", ",", "session", "*", "vtgatepb", ".", "Session", ",", "sql", "string", ",", "bindVariables", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable", "...
// StreamExecute executes a streaming query. This is a V3 function. // Note we guarantee the callback will not be called concurrently // by mutiple go routines.
[ "StreamExecute", "executes", "a", "streaming", "query", ".", "This", "is", "a", "V3", "function", ".", "Note", "we", "guarantee", "the", "callback", "will", "not", "be", "called", "concurrently", "by", "mutiple", "go", "routines", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vtgate.go#L333-L388
train
vitessio/vitess
go/vt/vtgate/vtgate.go
ExecuteKeyRanges
func (vtg *VTGate) ExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]*querypb.BindVariable, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) { startT...
go
func (vtg *VTGate) ExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]*querypb.BindVariable, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) { startT...
[ "func", "(", "vtg", "*", "VTGate", ")", "ExecuteKeyRanges", "(", "ctx", "context", ".", "Context", ",", "sql", "string", ",", "bindVariables", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable", ",", "keyspace", "string", ",", "keyRanges", "[",...
// ExecuteKeyRanges executes a non-streaming query based on the specified keyranges. This is a legacy function.
[ "ExecuteKeyRanges", "executes", "a", "non", "-", "streaming", "query", "based", "on", "the", "specified", "keyranges", ".", "This", "is", "a", "legacy", "function", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vtgate.go#L483-L518
train
vitessio/vitess
go/vt/vtgate/vtgate.go
ExecuteBatchShards
func (vtg *VTGate) ExecuteBatchShards(ctx context.Context, queries []*vtgatepb.BoundShardQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session, options *querypb.ExecuteOptions) ([]sqltypes.Result, error) { startTime := time.Now() ltt := topoproto.TabletTypeLString(tabletType) statsKe...
go
func (vtg *VTGate) ExecuteBatchShards(ctx context.Context, queries []*vtgatepb.BoundShardQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session, options *querypb.ExecuteOptions) ([]sqltypes.Result, error) { startTime := time.Now() ltt := topoproto.TabletTypeLString(tabletType) statsKe...
[ "func", "(", "vtg", "*", "VTGate", ")", "ExecuteBatchShards", "(", "ctx", "context", ".", "Context", ",", "queries", "[", "]", "*", "vtgatepb", ".", "BoundShardQuery", ",", "tabletType", "topodatapb", ".", "TabletType", ",", "asTransaction", "bool", ",", "se...
// ExecuteBatchShards executes a group of queries on the specified shards. This is a legacy function.
[ "ExecuteBatchShards", "executes", "a", "group", "of", "queries", "on", "the", "specified", "shards", ".", "This", "is", "a", "legacy", "function", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vtgate.go#L560-L606
train
vitessio/vitess
go/vt/vtgate/vtgate.go
StreamExecuteKeyspaceIds
func (vtg *VTGate) StreamExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]*querypb.BindVariable, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, callback func(*sqltypes.Result) error) error { startTime := time.Now() ltt := topoproto...
go
func (vtg *VTGate) StreamExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]*querypb.BindVariable, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, callback func(*sqltypes.Result) error) error { startTime := time.Now() ltt := topoproto...
[ "func", "(", "vtg", "*", "VTGate", ")", "StreamExecuteKeyspaceIds", "(", "ctx", "context", ".", "Context", ",", "sql", "string", ",", "bindVariables", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable", ",", "keyspace", "string", ",", "keyspaceId...
// StreamExecuteKeyspaceIds executes a streaming query on the specified KeyspaceIds. // The KeyspaceIds are resolved to shards using the serving graph. // This function currently temporarily enforces the restriction of executing on // one shard since it cannot merge-sort the results to guarantee ordering of // response...
[ "StreamExecuteKeyspaceIds", "executes", "a", "streaming", "query", "on", "the", "specified", "KeyspaceIds", ".", "The", "KeyspaceIds", "are", "resolved", "to", "shards", "using", "the", "serving", "graph", ".", "This", "function", "currently", "temporarily", "enforc...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vtgate.go#L665-L704
train
vitessio/vitess
go/vt/vtgate/vtgate.go
Begin
func (vtg *VTGate) Begin(ctx context.Context, singledb bool) (*vtgatepb.Session, error) { if !singledb && vtg.txConn.mode == vtgatepb.TransactionMode_SINGLE { return nil, vterrors.New(vtrpcpb.Code_INVALID_ARGUMENT, "multi-db transaction disallowed") } return &vtgatepb.Session{ InTransaction: true, SingleDb: ...
go
func (vtg *VTGate) Begin(ctx context.Context, singledb bool) (*vtgatepb.Session, error) { if !singledb && vtg.txConn.mode == vtgatepb.TransactionMode_SINGLE { return nil, vterrors.New(vtrpcpb.Code_INVALID_ARGUMENT, "multi-db transaction disallowed") } return &vtgatepb.Session{ InTransaction: true, SingleDb: ...
[ "func", "(", "vtg", "*", "VTGate", ")", "Begin", "(", "ctx", "context", ".", "Context", ",", "singledb", "bool", ")", "(", "*", "vtgatepb", ".", "Session", ",", "error", ")", "{", "if", "!", "singledb", "&&", "vtg", ".", "txConn", ".", "mode", "=="...
// Begin begins a transaction. This is a legacy function.
[ "Begin", "begins", "a", "transaction", ".", "This", "is", "a", "legacy", "function", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vtgate.go#L800-L808
train
vitessio/vitess
go/vt/vtgate/vtgate.go
Commit
func (vtg *VTGate) Commit(ctx context.Context, twopc bool, session *vtgatepb.Session) error { if session == nil { return formatError(vterrors.New(vtrpcpb.Code_INVALID_ARGUMENT, "cannot commit: empty session")) } if !session.InTransaction { return formatError(vterrors.New(vtrpcpb.Code_ABORTED, "cannot commit: not...
go
func (vtg *VTGate) Commit(ctx context.Context, twopc bool, session *vtgatepb.Session) error { if session == nil { return formatError(vterrors.New(vtrpcpb.Code_INVALID_ARGUMENT, "cannot commit: empty session")) } if !session.InTransaction { return formatError(vterrors.New(vtrpcpb.Code_ABORTED, "cannot commit: not...
[ "func", "(", "vtg", "*", "VTGate", ")", "Commit", "(", "ctx", "context", ".", "Context", ",", "twopc", "bool", ",", "session", "*", "vtgatepb", ".", "Session", ")", "error", "{", "if", "session", "==", "nil", "{", "return", "formatError", "(", "vterror...
// Commit commits a transaction. This is a legacy function.
[ "Commit", "commits", "a", "transaction", ".", "This", "is", "a", "legacy", "function", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vtgate.go#L811-L822
train
vitessio/vitess
go/vt/vtgate/vtgate.go
Rollback
func (vtg *VTGate) Rollback(ctx context.Context, session *vtgatepb.Session) error { return formatError(vtg.txConn.Rollback(ctx, NewSafeSession(session))) }
go
func (vtg *VTGate) Rollback(ctx context.Context, session *vtgatepb.Session) error { return formatError(vtg.txConn.Rollback(ctx, NewSafeSession(session))) }
[ "func", "(", "vtg", "*", "VTGate", ")", "Rollback", "(", "ctx", "context", ".", "Context", ",", "session", "*", "vtgatepb", ".", "Session", ")", "error", "{", "return", "formatError", "(", "vtg", ".", "txConn", ".", "Rollback", "(", "ctx", ",", "NewSaf...
// Rollback rolls back a transaction. This is a legacy function.
[ "Rollback", "rolls", "back", "a", "transaction", ".", "This", "is", "a", "legacy", "function", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vtgate.go#L825-L827
train
vitessio/vitess
go/vt/vtgate/vtgate.go
ResolveTransaction
func (vtg *VTGate) ResolveTransaction(ctx context.Context, dtid string) error { return formatError(vtg.txConn.Resolve(ctx, dtid)) }
go
func (vtg *VTGate) ResolveTransaction(ctx context.Context, dtid string) error { return formatError(vtg.txConn.Resolve(ctx, dtid)) }
[ "func", "(", "vtg", "*", "VTGate", ")", "ResolveTransaction", "(", "ctx", "context", ".", "Context", ",", "dtid", "string", ")", "error", "{", "return", "formatError", "(", "vtg", ".", "txConn", ".", "Resolve", "(", "ctx", ",", "dtid", ")", ")", "\n", ...
// ResolveTransaction resolves the specified 2PC transaction.
[ "ResolveTransaction", "resolves", "the", "specified", "2PC", "transaction", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vtgate.go#L830-L832
train
vitessio/vitess
go/vt/vtgate/vtgate.go
GetSrvKeyspace
func (vtg *VTGate) GetSrvKeyspace(ctx context.Context, keyspace string) (*topodatapb.SrvKeyspace, error) { return vtg.resolver.toposerv.GetSrvKeyspace(ctx, vtg.resolver.cell, keyspace) }
go
func (vtg *VTGate) GetSrvKeyspace(ctx context.Context, keyspace string) (*topodatapb.SrvKeyspace, error) { return vtg.resolver.toposerv.GetSrvKeyspace(ctx, vtg.resolver.cell, keyspace) }
[ "func", "(", "vtg", "*", "VTGate", ")", "GetSrvKeyspace", "(", "ctx", "context", ".", "Context", ",", "keyspace", "string", ")", "(", "*", "topodatapb", ".", "SrvKeyspace", ",", "error", ")", "{", "return", "vtg", ".", "resolver", ".", "toposerv", ".", ...
// GetSrvKeyspace is part of the vtgate service API.
[ "GetSrvKeyspace", "is", "part", "of", "the", "vtgate", "service", "API", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vtgate.go#L939-L941
train
vitessio/vitess
go/vt/vtgate/vtgate.go
MessageStream
func (vtg *VTGate) MessageStream(ctx context.Context, keyspace string, shard string, keyRange *topodatapb.KeyRange, name string, callback func(*sqltypes.Result) error) error { startTime := time.Now() ltt := topoproto.TabletTypeLString(topodatapb.TabletType_MASTER) statsKey := []string{"MessageStream", keyspace, ltt}...
go
func (vtg *VTGate) MessageStream(ctx context.Context, keyspace string, shard string, keyRange *topodatapb.KeyRange, name string, callback func(*sqltypes.Result) error) error { startTime := time.Now() ltt := topoproto.TabletTypeLString(topodatapb.TabletType_MASTER) statsKey := []string{"MessageStream", keyspace, ltt}...
[ "func", "(", "vtg", "*", "VTGate", ")", "MessageStream", "(", "ctx", "context", ".", "Context", ",", "keyspace", "string", ",", "shard", "string", ",", "keyRange", "*", "topodatapb", ".", "KeyRange", ",", "name", "string", ",", "callback", "func", "(", "...
// MessageStream is part of the vtgate service API. This is a V2 level API // that's sent to the Resolver. // Note we guarantee the callback will not be called concurrently // by mutiple go routines.
[ "MessageStream", "is", "part", "of", "the", "vtgate", "service", "API", ".", "This", "is", "a", "V2", "level", "API", "that", "s", "sent", "to", "the", "Resolver", ".", "Note", "we", "guarantee", "the", "callback", "will", "not", "be", "called", "concurr...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vtgate.go#L947-L972
train
vitessio/vitess
go/vt/vtgate/vtgate.go
UpdateStream
func (vtg *VTGate) UpdateStream(ctx context.Context, keyspace string, shard string, keyRange *topodatapb.KeyRange, tabletType topodatapb.TabletType, timestamp int64, event *querypb.EventToken, callback func(*querypb.StreamEvent, int64) error) error { startTime := time.Now() ltt := topoproto.TabletTypeLString(tabletTy...
go
func (vtg *VTGate) UpdateStream(ctx context.Context, keyspace string, shard string, keyRange *topodatapb.KeyRange, tabletType topodatapb.TabletType, timestamp int64, event *querypb.EventToken, callback func(*querypb.StreamEvent, int64) error) error { startTime := time.Now() ltt := topoproto.TabletTypeLString(tabletTy...
[ "func", "(", "vtg", "*", "VTGate", ")", "UpdateStream", "(", "ctx", "context", ".", "Context", ",", "keyspace", "string", ",", "shard", "string", ",", "keyRange", "*", "topodatapb", ".", "KeyRange", ",", "tabletType", "topodatapb", ".", "TabletType", ",", ...
// UpdateStream is part of the vtgate service API. // Note we guarantee the callback will not be called concurrently // by mutiple go routines, as the current implementation can only target // one shard.
[ "UpdateStream", "is", "part", "of", "the", "vtgate", "service", "API", ".", "Note", "we", "guarantee", "the", "callback", "will", "not", "be", "called", "concurrently", "by", "mutiple", "go", "routines", "as", "the", "current", "implementation", "can", "only",...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vtgate.go#L1016-L1043
train
vitessio/vitess
go/vt/vtgate/vtgate.go
annotateBoundKeyspaceIDQueries
func annotateBoundKeyspaceIDQueries(queries []*vtgatepb.BoundKeyspaceIdQuery) { for i, q := range queries { queries[i].Query.Sql = sqlannotation.AnnotateIfDML(q.Query.Sql, q.KeyspaceIds) } }
go
func annotateBoundKeyspaceIDQueries(queries []*vtgatepb.BoundKeyspaceIdQuery) { for i, q := range queries { queries[i].Query.Sql = sqlannotation.AnnotateIfDML(q.Query.Sql, q.KeyspaceIds) } }
[ "func", "annotateBoundKeyspaceIDQueries", "(", "queries", "[", "]", "*", "vtgatepb", ".", "BoundKeyspaceIdQuery", ")", "{", "for", "i", ",", "q", ":=", "range", "queries", "{", "queries", "[", "i", "]", ".", "Query", ".", "Sql", "=", "sqlannotation", ".", ...
// Helper function used in ExecuteBatchKeyspaceIds
[ "Helper", "function", "used", "in", "ExecuteBatchKeyspaceIds" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vtgate.go#L1114-L1118
train
vitessio/vitess
go/vt/vtgate/vtgate.go
annotateBoundShardQueriesAsUnfriendly
func annotateBoundShardQueriesAsUnfriendly(queries []*vtgatepb.BoundShardQuery) { for i, q := range queries { queries[i].Query.Sql = sqlannotation.AnnotateIfDML(q.Query.Sql, nil) } }
go
func annotateBoundShardQueriesAsUnfriendly(queries []*vtgatepb.BoundShardQuery) { for i, q := range queries { queries[i].Query.Sql = sqlannotation.AnnotateIfDML(q.Query.Sql, nil) } }
[ "func", "annotateBoundShardQueriesAsUnfriendly", "(", "queries", "[", "]", "*", "vtgatepb", ".", "BoundShardQuery", ")", "{", "for", "i", ",", "q", ":=", "range", "queries", "{", "queries", "[", "i", "]", ".", "Query", ".", "Sql", "=", "sqlannotation", "."...
// Helper function used in ExecuteBatchShards
[ "Helper", "function", "used", "in", "ExecuteBatchShards" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vtgate.go#L1121-L1125
train