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/vttablet/tabletmanager/rpc_server.go
HandleRPCPanic
func (agent *ActionAgent) HandleRPCPanic(ctx context.Context, name string, args, reply interface{}, verbose bool, err *error) { // panic handling if x := recover(); x != nil { log.Errorf("TabletManager.%v(%v) on %v panic: %v\n%s", name, args, topoproto.TabletAliasString(agent.TabletAlias), x, tb.Stack(4)) *err = ...
go
func (agent *ActionAgent) HandleRPCPanic(ctx context.Context, name string, args, reply interface{}, verbose bool, err *error) { // panic handling if x := recover(); x != nil { log.Errorf("TabletManager.%v(%v) on %v panic: %v\n%s", name, args, topoproto.TabletAliasString(agent.TabletAlias), x, tb.Stack(4)) *err = ...
[ "func", "(", "agent", "*", "ActionAgent", ")", "HandleRPCPanic", "(", "ctx", "context", ".", "Context", ",", "name", "string", ",", "args", ",", "reply", "interface", "{", "}", ",", "verbose", "bool", ",", "err", "*", "error", ")", "{", "// panic handlin...
// HandleRPCPanic is part of the RPCAgent interface.
[ "HandleRPCPanic", "is", "part", "of", "the", "RPCAgent", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/rpc_server.go#L69-L97
train
vitessio/vitess
go/vt/discovery/tablet_stats_cache.go
NewTabletStatsCache
func NewTabletStatsCache(hc HealthCheck, ts *topo.Server, cell string) *TabletStatsCache { return newTabletStatsCache(hc, ts, cell, true /* setListener */) }
go
func NewTabletStatsCache(hc HealthCheck, ts *topo.Server, cell string) *TabletStatsCache { return newTabletStatsCache(hc, ts, cell, true /* setListener */) }
[ "func", "NewTabletStatsCache", "(", "hc", "HealthCheck", ",", "ts", "*", "topo", ".", "Server", ",", "cell", "string", ")", "*", "TabletStatsCache", "{", "return", "newTabletStatsCache", "(", "hc", ",", "ts", ",", "cell", ",", "true", "/* setListener */", ")...
// NewTabletStatsCache creates a TabletStatsCache, and registers // it as HealthCheckStatsListener of the provided healthcheck. // Note we do the registration in this code to guarantee we call // SetListener with sendDownEvents=true, as we need these events // to maintain the integrity of our cache.
[ "NewTabletStatsCache", "creates", "a", "TabletStatsCache", "and", "registers", "it", "as", "HealthCheckStatsListener", "of", "the", "provided", "healthcheck", ".", "Note", "we", "do", "the", "registration", "in", "this", "code", "to", "guarantee", "we", "call", "S...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/tablet_stats_cache.go#L117-L119
train
vitessio/vitess
go/vt/discovery/tablet_stats_cache.go
getEntry
func (tc *TabletStatsCache) getEntry(keyspace, shard string, tabletType topodatapb.TabletType) *tabletStatsCacheEntry { tc.mu.RLock() defer tc.mu.RUnlock() if s, ok := tc.entries[keyspace]; ok { if t, ok := s[shard]; ok { if e, ok := t[tabletType]; ok { return e } } } return nil }
go
func (tc *TabletStatsCache) getEntry(keyspace, shard string, tabletType topodatapb.TabletType) *tabletStatsCacheEntry { tc.mu.RLock() defer tc.mu.RUnlock() if s, ok := tc.entries[keyspace]; ok { if t, ok := s[shard]; ok { if e, ok := t[tabletType]; ok { return e } } } return nil }
[ "func", "(", "tc", "*", "TabletStatsCache", ")", "getEntry", "(", "keyspace", ",", "shard", "string", ",", "tabletType", "topodatapb", ".", "TabletType", ")", "*", "tabletStatsCacheEntry", "{", "tc", ".", "mu", ".", "RLock", "(", ")", "\n", "defer", "tc", ...
// getEntry returns an existing tabletStatsCacheEntry in the cache, or nil // if the entry does not exist. It only takes a Read lock on mu.
[ "getEntry", "returns", "an", "existing", "tabletStatsCacheEntry", "in", "the", "cache", "or", "nil", "if", "the", "entry", "does", "not", "exist", ".", "It", "only", "takes", "a", "Read", "lock", "on", "mu", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/tablet_stats_cache.go#L152-L164
train
vitessio/vitess
go/vt/discovery/tablet_stats_cache.go
getOrCreateEntry
func (tc *TabletStatsCache) getOrCreateEntry(target *querypb.Target) *tabletStatsCacheEntry { // Fast path (most common path too): Read-lock, return the entry. if e := tc.getEntry(target.Keyspace, target.Shard, target.TabletType); e != nil { return e } // Slow path: Lock, will probably have to add the entry at s...
go
func (tc *TabletStatsCache) getOrCreateEntry(target *querypb.Target) *tabletStatsCacheEntry { // Fast path (most common path too): Read-lock, return the entry. if e := tc.getEntry(target.Keyspace, target.Shard, target.TabletType); e != nil { return e } // Slow path: Lock, will probably have to add the entry at s...
[ "func", "(", "tc", "*", "TabletStatsCache", ")", "getOrCreateEntry", "(", "target", "*", "querypb", ".", "Target", ")", "*", "tabletStatsCacheEntry", "{", "// Fast path (most common path too): Read-lock, return the entry.", "if", "e", ":=", "tc", ".", "getEntry", "(",...
// getOrCreateEntry returns an existing tabletStatsCacheEntry from the cache, // or creates it if it doesn't exist.
[ "getOrCreateEntry", "returns", "an", "existing", "tabletStatsCacheEntry", "from", "the", "cache", "or", "creates", "it", "if", "it", "doesn", "t", "exist", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/tablet_stats_cache.go#L168-L197
train
vitessio/vitess
go/vt/discovery/tablet_stats_cache.go
makeAggregateMap
func (tc *TabletStatsCache) makeAggregateMap(stats []*TabletStats) map[string]*querypb.AggregateStats { result := make(map[string]*querypb.AggregateStats) for _, ts := range stats { alias := tc.getAliasByCell(ts.Tablet.Alias.Cell) agg, ok := result[alias] if !ok { agg = &querypb.AggregateStats{ SecondsBe...
go
func (tc *TabletStatsCache) makeAggregateMap(stats []*TabletStats) map[string]*querypb.AggregateStats { result := make(map[string]*querypb.AggregateStats) for _, ts := range stats { alias := tc.getAliasByCell(ts.Tablet.Alias.Cell) agg, ok := result[alias] if !ok { agg = &querypb.AggregateStats{ SecondsBe...
[ "func", "(", "tc", "*", "TabletStatsCache", ")", "makeAggregateMap", "(", "stats", "[", "]", "*", "TabletStats", ")", "map", "[", "string", "]", "*", "querypb", ".", "AggregateStats", "{", "result", ":=", "make", "(", "map", "[", "string", "]", "*", "q...
// makeAggregateMap takes a list of TabletStats and builds a per-alias // AggregateStats map.
[ "makeAggregateMap", "takes", "a", "list", "of", "TabletStats", "and", "builds", "a", "per", "-", "alias", "AggregateStats", "map", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/tablet_stats_cache.go#L285-L310
train
vitessio/vitess
go/vt/discovery/tablet_stats_cache.go
updateAggregateMap
func (tc *TabletStatsCache) updateAggregateMap(keyspace, shard string, tabletType topodatapb.TabletType, e *tabletStatsCacheEntry, stats []*TabletStats) { // Save the new value e.aggregates = tc.makeAggregateMap(stats) }
go
func (tc *TabletStatsCache) updateAggregateMap(keyspace, shard string, tabletType topodatapb.TabletType, e *tabletStatsCacheEntry, stats []*TabletStats) { // Save the new value e.aggregates = tc.makeAggregateMap(stats) }
[ "func", "(", "tc", "*", "TabletStatsCache", ")", "updateAggregateMap", "(", "keyspace", ",", "shard", "string", ",", "tabletType", "topodatapb", ".", "TabletType", ",", "e", "*", "tabletStatsCacheEntry", ",", "stats", "[", "]", "*", "TabletStats", ")", "{", ...
// updateAggregateMap will update the aggregate map for the // tabletStatsCacheEntry. It may broadcast the changes too if we have listeners. // e.mu needs to be locked.
[ "updateAggregateMap", "will", "update", "the", "aggregate", "map", "for", "the", "tabletStatsCacheEntry", ".", "It", "may", "broadcast", "the", "changes", "too", "if", "we", "have", "listeners", ".", "e", ".", "mu", "needs", "to", "be", "locked", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/tablet_stats_cache.go#L315-L318
train
vitessio/vitess
go/vt/discovery/tablet_stats_cache.go
GetTabletStats
func (tc *TabletStatsCache) GetTabletStats(keyspace, shard string, tabletType topodatapb.TabletType) []TabletStats { e := tc.getEntry(keyspace, shard, tabletType) if e == nil { return nil } e.mu.RLock() defer e.mu.RUnlock() result := make([]TabletStats, 0, len(e.all)) for _, s := range e.all { result = appe...
go
func (tc *TabletStatsCache) GetTabletStats(keyspace, shard string, tabletType topodatapb.TabletType) []TabletStats { e := tc.getEntry(keyspace, shard, tabletType) if e == nil { return nil } e.mu.RLock() defer e.mu.RUnlock() result := make([]TabletStats, 0, len(e.all)) for _, s := range e.all { result = appe...
[ "func", "(", "tc", "*", "TabletStatsCache", ")", "GetTabletStats", "(", "keyspace", ",", "shard", "string", ",", "tabletType", "topodatapb", ".", "TabletType", ")", "[", "]", "TabletStats", "{", "e", ":=", "tc", ".", "getEntry", "(", "keyspace", ",", "shar...
// GetTabletStats returns the full list of available targets. // The returned array is owned by the caller.
[ "GetTabletStats", "returns", "the", "full", "list", "of", "available", "targets", ".", "The", "returned", "array", "is", "owned", "by", "the", "caller", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/tablet_stats_cache.go#L322-L335
train
vitessio/vitess
go/vt/discovery/tablet_stats_cache.go
GetHealthyTabletStats
func (tc *TabletStatsCache) GetHealthyTabletStats(keyspace, shard string, tabletType topodatapb.TabletType) []TabletStats { e := tc.getEntry(keyspace, shard, tabletType) if e == nil { return nil } e.mu.RLock() defer e.mu.RUnlock() result := make([]TabletStats, len(e.healthy)) for i, ts := range e.healthy { ...
go
func (tc *TabletStatsCache) GetHealthyTabletStats(keyspace, shard string, tabletType topodatapb.TabletType) []TabletStats { e := tc.getEntry(keyspace, shard, tabletType) if e == nil { return nil } e.mu.RLock() defer e.mu.RUnlock() result := make([]TabletStats, len(e.healthy)) for i, ts := range e.healthy { ...
[ "func", "(", "tc", "*", "TabletStatsCache", ")", "GetHealthyTabletStats", "(", "keyspace", ",", "shard", "string", ",", "tabletType", "topodatapb", ".", "TabletType", ")", "[", "]", "TabletStats", "{", "e", ":=", "tc", ".", "getEntry", "(", "keyspace", ",", ...
// GetHealthyTabletStats returns only the healthy targets. // The returned array is owned by the caller. // For TabletType_MASTER, this will only return at most one entry, // the most recent tablet of type master.
[ "GetHealthyTabletStats", "returns", "only", "the", "healthy", "targets", ".", "The", "returned", "array", "is", "owned", "by", "the", "caller", ".", "For", "TabletType_MASTER", "this", "will", "only", "return", "at", "most", "one", "entry", "the", "most", "rec...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/tablet_stats_cache.go#L341-L354
train
vitessio/vitess
go/vt/discovery/tablet_stats_cache.go
GetAggregateStats
func (tc *TabletStatsCache) GetAggregateStats(target *querypb.Target) (*querypb.AggregateStats, error) { e := tc.getEntry(target.Keyspace, target.Shard, target.TabletType) if e == nil { return nil, topo.NewError(topo.NoNode, topotools.TargetIdent(target)) } e.mu.RLock() defer e.mu.RUnlock() if target.TabletTyp...
go
func (tc *TabletStatsCache) GetAggregateStats(target *querypb.Target) (*querypb.AggregateStats, error) { e := tc.getEntry(target.Keyspace, target.Shard, target.TabletType) if e == nil { return nil, topo.NewError(topo.NoNode, topotools.TargetIdent(target)) } e.mu.RLock() defer e.mu.RUnlock() if target.TabletTyp...
[ "func", "(", "tc", "*", "TabletStatsCache", ")", "GetAggregateStats", "(", "target", "*", "querypb", ".", "Target", ")", "(", "*", "querypb", ".", "AggregateStats", ",", "error", ")", "{", "e", ":=", "tc", ".", "getEntry", "(", "target", ".", "Keyspace",...
// GetAggregateStats is part of the TargetStatsListener interface.
[ "GetAggregateStats", "is", "part", "of", "the", "TargetStatsListener", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/tablet_stats_cache.go#L365-L387
train
vitessio/vitess
go/vt/discovery/tablet_stats_cache.go
GetMasterCell
func (tc *TabletStatsCache) GetMasterCell(keyspace, shard string) (cell string, err error) { e := tc.getEntry(keyspace, shard, topodatapb.TabletType_MASTER) if e == nil { return "", topo.NewError(topo.NoNode, topotools.TargetIdent(&querypb.Target{ Keyspace: keyspace, Shard: shard, TabletType: topoda...
go
func (tc *TabletStatsCache) GetMasterCell(keyspace, shard string) (cell string, err error) { e := tc.getEntry(keyspace, shard, topodatapb.TabletType_MASTER) if e == nil { return "", topo.NewError(topo.NoNode, topotools.TargetIdent(&querypb.Target{ Keyspace: keyspace, Shard: shard, TabletType: topoda...
[ "func", "(", "tc", "*", "TabletStatsCache", ")", "GetMasterCell", "(", "keyspace", ",", "shard", "string", ")", "(", "cell", "string", ",", "err", "error", ")", "{", "e", ":=", "tc", ".", "getEntry", "(", "keyspace", ",", "shard", ",", "topodatapb", "....
// GetMasterCell is part of the TargetStatsListener interface.
[ "GetMasterCell", "is", "part", "of", "the", "TargetStatsListener", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/tablet_stats_cache.go#L390-L410
train
vitessio/vitess
go/vt/key/destination.go
DestinationsString
func DestinationsString(destinations []Destination) string { var buffer bytes.Buffer buffer.WriteString("Destinations:") for i, d := range destinations { if i > 0 { buffer.WriteByte(',') } buffer.WriteString(d.String()) } return buffer.String() }
go
func DestinationsString(destinations []Destination) string { var buffer bytes.Buffer buffer.WriteString("Destinations:") for i, d := range destinations { if i > 0 { buffer.WriteByte(',') } buffer.WriteString(d.String()) } return buffer.String() }
[ "func", "DestinationsString", "(", "destinations", "[", "]", "Destination", ")", "string", "{", "var", "buffer", "bytes", ".", "Buffer", "\n", "buffer", ".", "WriteString", "(", "\"", "\"", ")", "\n", "for", "i", ",", "d", ":=", "range", "destinations", ...
// DestinationsString returns a printed version of the destination array.
[ "DestinationsString", "returns", "a", "printed", "version", "of", "the", "destination", "array", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/key/destination.go#L57-L67
train
vitessio/vitess
go/vt/key/destination.go
GetShardForKeyspaceID
func GetShardForKeyspaceID(allShards []*topodatapb.ShardReference, keyspaceID []byte) (string, error) { if len(allShards) == 0 { return "", vterrors.Errorf(vtrpcpb.Code_UNAVAILABLE, "no shard in keyspace") } for _, shardReference := range allShards { if KeyRangeContains(shardReference.KeyRange, keyspaceID) { ...
go
func GetShardForKeyspaceID(allShards []*topodatapb.ShardReference, keyspaceID []byte) (string, error) { if len(allShards) == 0 { return "", vterrors.Errorf(vtrpcpb.Code_UNAVAILABLE, "no shard in keyspace") } for _, shardReference := range allShards { if KeyRangeContains(shardReference.KeyRange, keyspaceID) { ...
[ "func", "GetShardForKeyspaceID", "(", "allShards", "[", "]", "*", "topodatapb", ".", "ShardReference", ",", "keyspaceID", "[", "]", "byte", ")", "(", "string", ",", "error", ")", "{", "if", "len", "(", "allShards", ")", "==", "0", "{", "return", "\"", ...
// GetShardForKeyspaceID finds the right shard for a keyspace id.
[ "GetShardForKeyspaceID", "finds", "the", "right", "shard", "for", "a", "keyspace", "id", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/key/destination.go#L322-L333
train
vitessio/vitess
go/memcache/memcache.go
Connect
func Connect(address string, timeout time.Duration) (conn *Connection, err error) { var network string if strings.Contains(address, "/") { network = "unix" } else { network = "tcp" } var nc net.Conn nc, err = net.DialTimeout(network, address, timeout) if err != nil { return nil, err } return &Connection{...
go
func Connect(address string, timeout time.Duration) (conn *Connection, err error) { var network string if strings.Contains(address, "/") { network = "unix" } else { network = "tcp" } var nc net.Conn nc, err = net.DialTimeout(network, address, timeout) if err != nil { return nil, err } return &Connection{...
[ "func", "Connect", "(", "address", "string", ",", "timeout", "time", ".", "Duration", ")", "(", "conn", "*", "Connection", ",", "err", "error", ")", "{", "var", "network", "string", "\n", "if", "strings", ".", "Contains", "(", "address", ",", "\"", "\"...
// Connect connects a memcache process.
[ "Connect", "connects", "a", "memcache", "process", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/memcache/memcache.go#L40-L60
train
vitessio/vitess
go/memcache/memcache.go
Get
func (mc *Connection) Get(keys ...string) (results []cacheservice.Result, err error) { defer handleError(&err) results = mc.get("get", keys) return }
go
func (mc *Connection) Get(keys ...string) (results []cacheservice.Result, err error) { defer handleError(&err) results = mc.get("get", keys) return }
[ "func", "(", "mc", "*", "Connection", ")", "Get", "(", "keys", "...", "string", ")", "(", "results", "[", "]", "cacheservice", ".", "Result", ",", "err", "error", ")", "{", "defer", "handleError", "(", "&", "err", ")", "\n", "results", "=", "mc", "...
// Get returns cached data for given keys.
[ "Get", "returns", "cached", "data", "for", "given", "keys", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/memcache/memcache.go#L68-L72
train
vitessio/vitess
go/memcache/memcache.go
Set
func (mc *Connection) Set(key string, flags uint16, timeout uint64, value []byte) (stored bool, err error) { defer handleError(&err) return mc.store("set", key, flags, timeout, value, 0), nil }
go
func (mc *Connection) Set(key string, flags uint16, timeout uint64, value []byte) (stored bool, err error) { defer handleError(&err) return mc.store("set", key, flags, timeout, value, 0), nil }
[ "func", "(", "mc", "*", "Connection", ")", "Set", "(", "key", "string", ",", "flags", "uint16", ",", "timeout", "uint64", ",", "value", "[", "]", "byte", ")", "(", "stored", "bool", ",", "err", "error", ")", "{", "defer", "handleError", "(", "&", "...
// Set sets the value with specified cache key.
[ "Set", "sets", "the", "value", "with", "specified", "cache", "key", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/memcache/memcache.go#L84-L87
train
vitessio/vitess
go/memcache/memcache.go
Delete
func (mc *Connection) Delete(key string) (deleted bool, err error) { defer handleError(&err) mc.setDeadline() // delete <key> [<time>] [noreply]\r\n mc.writestrings("delete ", key, "\r\n") reply := mc.readline() if strings.Contains(reply, "ERROR") { panic(NewError("Server error")) } return strings.HasPrefix(r...
go
func (mc *Connection) Delete(key string) (deleted bool, err error) { defer handleError(&err) mc.setDeadline() // delete <key> [<time>] [noreply]\r\n mc.writestrings("delete ", key, "\r\n") reply := mc.readline() if strings.Contains(reply, "ERROR") { panic(NewError("Server error")) } return strings.HasPrefix(r...
[ "func", "(", "mc", "*", "Connection", ")", "Delete", "(", "key", "string", ")", "(", "deleted", "bool", ",", "err", "error", ")", "{", "defer", "handleError", "(", "&", "err", ")", "\n", "mc", ".", "setDeadline", "(", ")", "\n", "// delete <key> [<time...
// Delete deletes the value for the specified cache key.
[ "Delete", "deletes", "the", "value", "for", "the", "specified", "cache", "key", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/memcache/memcache.go#L121-L131
train
vitessio/vitess
go/memcache/memcache.go
FlushAll
func (mc *Connection) FlushAll() (err error) { defer handleError(&err) mc.setDeadline() // flush_all [delay] [noreply]\r\n mc.writestrings("flush_all\r\n") response := mc.readline() if !strings.Contains(response, "OK") { panic(NewError(fmt.Sprintf("Error in FlushAll %v", response))) } return nil }
go
func (mc *Connection) FlushAll() (err error) { defer handleError(&err) mc.setDeadline() // flush_all [delay] [noreply]\r\n mc.writestrings("flush_all\r\n") response := mc.readline() if !strings.Contains(response, "OK") { panic(NewError(fmt.Sprintf("Error in FlushAll %v", response))) } return nil }
[ "func", "(", "mc", "*", "Connection", ")", "FlushAll", "(", ")", "(", "err", "error", ")", "{", "defer", "handleError", "(", "&", "err", ")", "\n", "mc", ".", "setDeadline", "(", ")", "\n", "// flush_all [delay] [noreply]\\r\\n", "mc", ".", "writestrings",...
// FlushAll purges the entire cache.
[ "FlushAll", "purges", "the", "entire", "cache", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/memcache/memcache.go#L134-L144
train
vitessio/vitess
go/memcache/memcache.go
Stats
func (mc *Connection) Stats(argument string) (result []byte, err error) { defer handleError(&err) mc.setDeadline() if argument == "" { mc.writestrings("stats\r\n") } else { mc.writestrings("stats ", argument, "\r\n") } mc.flush() for { l := mc.readline() if strings.HasPrefix(l, "END") { break } if...
go
func (mc *Connection) Stats(argument string) (result []byte, err error) { defer handleError(&err) mc.setDeadline() if argument == "" { mc.writestrings("stats\r\n") } else { mc.writestrings("stats ", argument, "\r\n") } mc.flush() for { l := mc.readline() if strings.HasPrefix(l, "END") { break } if...
[ "func", "(", "mc", "*", "Connection", ")", "Stats", "(", "argument", "string", ")", "(", "result", "[", "]", "byte", ",", "err", "error", ")", "{", "defer", "handleError", "(", "&", "err", ")", "\n", "mc", ".", "setDeadline", "(", ")", "\n", "if", ...
// Stats returns a list of basic stats.
[ "Stats", "returns", "a", "list", "of", "basic", "stats", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/memcache/memcache.go#L147-L168
train
vitessio/vitess
go/vt/topo/etcd2topo/lock.go
newUniqueEphemeralKV
func (s *Server) newUniqueEphemeralKV(ctx context.Context, cli *clientv3.Client, leaseID clientv3.LeaseID, nodePath string, contents string) (string, int64, error) { // Use the lease ID as the file name, so it's guaranteed unique. newKey := fmt.Sprintf("%v/%v", nodePath, leaseID) // Only create a new file if it doe...
go
func (s *Server) newUniqueEphemeralKV(ctx context.Context, cli *clientv3.Client, leaseID clientv3.LeaseID, nodePath string, contents string) (string, int64, error) { // Use the lease ID as the file name, so it's guaranteed unique. newKey := fmt.Sprintf("%v/%v", nodePath, leaseID) // Only create a new file if it doe...
[ "func", "(", "s", "*", "Server", ")", "newUniqueEphemeralKV", "(", "ctx", "context", ".", "Context", ",", "cli", "*", "clientv3", ".", "Client", ",", "leaseID", "clientv3", ".", "LeaseID", ",", "nodePath", "string", ",", "contents", "string", ")", "(", "...
// newUniqueEphemeralKV creates a new file in the provided directory. // It is linked to the Lease. // Errors returned are converted to topo errors.
[ "newUniqueEphemeralKV", "creates", "a", "new", "file", "in", "the", "provided", "directory", ".", "It", "is", "linked", "to", "the", "Lease", ".", "Errors", "returned", "are", "converted", "to", "topo", "errors", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/etcd2topo/lock.go#L41-L69
train
vitessio/vitess
go/vt/topo/etcd2topo/lock.go
waitOnLastRev
func (s *Server) waitOnLastRev(ctx context.Context, cli *clientv3.Client, nodePath string, revision int64) (bool, error) { // Get the keys that are blocking us, if any. opts := append(clientv3.WithLastRev(), clientv3.WithMaxModRev(revision-1)) lastKey, err := cli.Get(ctx, nodePath+"/", opts...) if err != nil { re...
go
func (s *Server) waitOnLastRev(ctx context.Context, cli *clientv3.Client, nodePath string, revision int64) (bool, error) { // Get the keys that are blocking us, if any. opts := append(clientv3.WithLastRev(), clientv3.WithMaxModRev(revision-1)) lastKey, err := cli.Get(ctx, nodePath+"/", opts...) if err != nil { re...
[ "func", "(", "s", "*", "Server", ")", "waitOnLastRev", "(", "ctx", "context", ".", "Context", ",", "cli", "*", "clientv3", ".", "Client", ",", "nodePath", "string", ",", "revision", "int64", ")", "(", "bool", ",", "error", ")", "{", "// Get the keys that...
// waitOnLastRev waits on all revisions of the files in the provided // directory that have revisions smaller than the provided revision. // It returns true only if there is no more other older files.
[ "waitOnLastRev", "waits", "on", "all", "revisions", "of", "the", "files", "in", "the", "provided", "directory", "that", "have", "revisions", "smaller", "than", "the", "provided", "revision", ".", "It", "returns", "true", "only", "if", "there", "is", "no", "m...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/etcd2topo/lock.go#L74-L111
train
vitessio/vitess
go/vt/topo/etcd2topo/lock.go
Check
func (ld *etcdLockDescriptor) Check(ctx context.Context) error { _, err := ld.s.cli.KeepAliveOnce(ctx, ld.leaseID) if err != nil { return convertError(err, "lease") } return nil }
go
func (ld *etcdLockDescriptor) Check(ctx context.Context) error { _, err := ld.s.cli.KeepAliveOnce(ctx, ld.leaseID) if err != nil { return convertError(err, "lease") } return nil }
[ "func", "(", "ld", "*", "etcdLockDescriptor", ")", "Check", "(", "ctx", "context", ".", "Context", ")", "error", "{", "_", ",", "err", ":=", "ld", ".", "s", ".", "cli", ".", "KeepAliveOnce", "(", "ctx", ",", "ld", ".", "leaseID", ")", "\n", "if", ...
// Check is part of the topo.LockDescriptor interface. // We use KeepAliveOnce to make sure the lease is still active and well.
[ "Check", "is", "part", "of", "the", "topo", ".", "LockDescriptor", "interface", ".", "We", "use", "KeepAliveOnce", "to", "make", "sure", "the", "lease", "is", "still", "active", "and", "well", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/etcd2topo/lock.go#L183-L189
train
vitessio/vitess
go/vt/grpcclient/client_auth_static.go
GetRequestMetadata
func (c *StaticAuthClientCreds) GetRequestMetadata(context.Context, ...string) (map[string]string, error) { return map[string]string{ "username": c.Username, "password": c.Password, }, nil }
go
func (c *StaticAuthClientCreds) GetRequestMetadata(context.Context, ...string) (map[string]string, error) { return map[string]string{ "username": c.Username, "password": c.Password, }, nil }
[ "func", "(", "c", "*", "StaticAuthClientCreds", ")", "GetRequestMetadata", "(", "context", ".", "Context", ",", "...", "string", ")", "(", "map", "[", "string", "]", "string", ",", "error", ")", "{", "return", "map", "[", "string", "]", "string", "{", ...
// GetRequestMetadata gets the request metadata as a map from StaticAuthClientCreds
[ "GetRequestMetadata", "gets", "the", "request", "metadata", "as", "a", "map", "from", "StaticAuthClientCreds" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/grpcclient/client_auth_static.go#L43-L48
train
vitessio/vitess
go/vt/grpcclient/client_auth_static.go
AppendStaticAuth
func AppendStaticAuth(opts []grpc.DialOption) ([]grpc.DialOption, error) { if *credsFile == "" { return opts, nil } data, err := ioutil.ReadFile(*credsFile) if err != nil { return nil, err } clientCreds := &StaticAuthClientCreds{} err = json.Unmarshal(data, clientCreds) if err != nil { return nil, err } ...
go
func AppendStaticAuth(opts []grpc.DialOption) ([]grpc.DialOption, error) { if *credsFile == "" { return opts, nil } data, err := ioutil.ReadFile(*credsFile) if err != nil { return nil, err } clientCreds := &StaticAuthClientCreds{} err = json.Unmarshal(data, clientCreds) if err != nil { return nil, err } ...
[ "func", "AppendStaticAuth", "(", "opts", "[", "]", "grpc", ".", "DialOption", ")", "(", "[", "]", "grpc", ".", "DialOption", ",", "error", ")", "{", "if", "*", "credsFile", "==", "\"", "\"", "{", "return", "opts", ",", "nil", "\n", "}", "\n", "data...
// AppendStaticAuth optionally appends static auth credentials if provided.
[ "AppendStaticAuth", "optionally", "appends", "static", "auth", "credentials", "if", "provided", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/grpcclient/client_auth_static.go#L58-L74
train
vitessio/vitess
go/vt/throttler/aggregated_interval_history.go
average
func (h *aggregatedIntervalHistory) average(from, to time.Time) float64 { sum := 0.0 for i := 0; i < h.threadCount; i++ { sum += h.historyPerThread[i].average(from, to) } return sum }
go
func (h *aggregatedIntervalHistory) average(from, to time.Time) float64 { sum := 0.0 for i := 0; i < h.threadCount; i++ { sum += h.historyPerThread[i].average(from, to) } return sum }
[ "func", "(", "h", "*", "aggregatedIntervalHistory", ")", "average", "(", "from", ",", "to", "time", ".", "Time", ")", "float64", "{", "sum", ":=", "0.0", "\n", "for", "i", ":=", "0", ";", "i", "<", "h", ".", "threadCount", ";", "i", "++", "{", "s...
// average aggregates the average of all intervalHistory instances.
[ "average", "aggregates", "the", "average", "of", "all", "intervalHistory", "instances", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/aggregated_interval_history.go#L47-L53
train
vitessio/vitess
go/vt/wrangler/shard.go
updateShardMaster
func (wr *Wrangler) updateShardMaster(ctx context.Context, si *topo.ShardInfo, tabletAlias *topodatapb.TabletAlias, tabletType topodatapb.TabletType, allowMasterOverride bool) error { // See if we need to update the Shard: // - add the tablet's cell to the shard's Cells if needed // - change the master if needed sh...
go
func (wr *Wrangler) updateShardMaster(ctx context.Context, si *topo.ShardInfo, tabletAlias *topodatapb.TabletAlias, tabletType topodatapb.TabletType, allowMasterOverride bool) error { // See if we need to update the Shard: // - add the tablet's cell to the shard's Cells if needed // - change the master if needed sh...
[ "func", "(", "wr", "*", "Wrangler", ")", "updateShardMaster", "(", "ctx", "context", ".", "Context", ",", "si", "*", "topo", ".", "ShardInfo", ",", "tabletAlias", "*", "topodatapb", ".", "TabletAlias", ",", "tabletType", "topodatapb", ".", "TabletType", ",",...
// shard related methods for Wrangler // updateShardCellsAndMaster will update the 'Cells' and possibly // MasterAlias records for the shard, if needed.
[ "shard", "related", "methods", "for", "Wrangler", "updateShardCellsAndMaster", "will", "update", "the", "Cells", "and", "possibly", "MasterAlias", "records", "for", "the", "shard", "if", "needed", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/shard.go#L33-L63
train
vitessio/vitess
go/vt/wrangler/shard.go
SetShardIsMasterServing
func (wr *Wrangler) SetShardIsMasterServing(ctx context.Context, keyspace, shard string, isMasterServing bool) (err error) { // lock the keyspace to not conflict with resharding operations ctx, unlock, lockErr := wr.ts.LockKeyspace(ctx, keyspace, fmt.Sprintf("SetShardIsMasterServing(%v,%v,%v)", keyspace, shard, isMas...
go
func (wr *Wrangler) SetShardIsMasterServing(ctx context.Context, keyspace, shard string, isMasterServing bool) (err error) { // lock the keyspace to not conflict with resharding operations ctx, unlock, lockErr := wr.ts.LockKeyspace(ctx, keyspace, fmt.Sprintf("SetShardIsMasterServing(%v,%v,%v)", keyspace, shard, isMas...
[ "func", "(", "wr", "*", "Wrangler", ")", "SetShardIsMasterServing", "(", "ctx", "context", ".", "Context", ",", "keyspace", ",", "shard", "string", ",", "isMasterServing", "bool", ")", "(", "err", "error", ")", "{", "// lock the keyspace to not conflict with resha...
// SetShardIsMasterServing changes the IsMasterServing parameter of a shard. // It does not rebuild any serving graph or do any consistency check. // This is an emergency manual operation.
[ "SetShardIsMasterServing", "changes", "the", "IsMasterServing", "parameter", "of", "a", "shard", ".", "It", "does", "not", "rebuild", "any", "serving", "graph", "or", "do", "any", "consistency", "check", ".", "This", "is", "an", "emergency", "manual", "operation...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/shard.go#L68-L82
train
vitessio/vitess
go/vt/wrangler/shard.go
SetShardTabletControl
func (wr *Wrangler) SetShardTabletControl(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, cells []string, remove bool, blacklistedTables []string) (err error) { // lock the keyspace ctx, unlock, lockErr := wr.ts.LockKeyspace(ctx, keyspace, "SetShardTabletControl") if lockErr != nil { ...
go
func (wr *Wrangler) SetShardTabletControl(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, cells []string, remove bool, blacklistedTables []string) (err error) { // lock the keyspace ctx, unlock, lockErr := wr.ts.LockKeyspace(ctx, keyspace, "SetShardTabletControl") if lockErr != nil { ...
[ "func", "(", "wr", "*", "Wrangler", ")", "SetShardTabletControl", "(", "ctx", "context", ".", "Context", ",", "keyspace", ",", "shard", "string", ",", "tabletType", "topodatapb", ".", "TabletType", ",", "cells", "[", "]", "string", ",", "remove", "bool", "...
// SetShardTabletControl changes the TabletControl records // for a shard. It does not rebuild any serving graph or do // cross-shard consistency check. // - sets black listed tables in tablet control record // // This takes the keyspace lock as to not interfere with resharding operations.
[ "SetShardTabletControl", "changes", "the", "TabletControl", "records", "for", "a", "shard", ".", "It", "does", "not", "rebuild", "any", "serving", "graph", "or", "do", "cross", "-", "shard", "consistency", "check", ".", "-", "sets", "black", "listed", "tables"...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/shard.go#L90-L104
train
vitessio/vitess
go/vt/wrangler/shard.go
UpdateSrvKeyspacePartitions
func (wr *Wrangler) UpdateSrvKeyspacePartitions(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, cells []string, remove bool) (err error) { // lock the keyspace ctx, unlock, lockErr := wr.ts.LockKeyspace(ctx, keyspace, "UpdateSrvKeyspacePartitions") if lockErr != nil { return lockErr ...
go
func (wr *Wrangler) UpdateSrvKeyspacePartitions(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, cells []string, remove bool) (err error) { // lock the keyspace ctx, unlock, lockErr := wr.ts.LockKeyspace(ctx, keyspace, "UpdateSrvKeyspacePartitions") if lockErr != nil { return lockErr ...
[ "func", "(", "wr", "*", "Wrangler", ")", "UpdateSrvKeyspacePartitions", "(", "ctx", "context", ".", "Context", ",", "keyspace", ",", "shard", "string", ",", "tabletType", "topodatapb", ".", "TabletType", ",", "cells", "[", "]", "string", ",", "remove", "bool...
// UpdateSrvKeyspacePartitions changes the SrvKeyspaceGraph // for a shard. It updates serving graph // // This takes the keyspace lock as to not interfere with resharding operations.
[ "UpdateSrvKeyspacePartitions", "changes", "the", "SrvKeyspaceGraph", "for", "a", "shard", ".", "It", "updates", "serving", "graph", "This", "takes", "the", "keyspace", "lock", "as", "to", "not", "interfere", "with", "resharding", "operations", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/shard.go#L130-L147
train
vitessio/vitess
go/vt/wrangler/shard.go
SourceShardDelete
func (wr *Wrangler) SourceShardDelete(ctx context.Context, keyspace, shard string, uid uint32) (err error) { // lock the keyspace ctx, unlock, lockErr := wr.ts.LockKeyspace(ctx, keyspace, fmt.Sprintf("SourceShardDelete(%v)", uid)) if lockErr != nil { return lockErr } defer unlock(&err) // remove the source sha...
go
func (wr *Wrangler) SourceShardDelete(ctx context.Context, keyspace, shard string, uid uint32) (err error) { // lock the keyspace ctx, unlock, lockErr := wr.ts.LockKeyspace(ctx, keyspace, fmt.Sprintf("SourceShardDelete(%v)", uid)) if lockErr != nil { return lockErr } defer unlock(&err) // remove the source sha...
[ "func", "(", "wr", "*", "Wrangler", ")", "SourceShardDelete", "(", "ctx", "context", ".", "Context", ",", "keyspace", ",", "shard", "string", ",", "uid", "uint32", ")", "(", "err", "error", ")", "{", "// lock the keyspace", "ctx", ",", "unlock", ",", "lo...
// SourceShardDelete will delete a SourceShard inside a shard, by index. // // This takes the keyspace lock as not to interfere with resharding operations.
[ "SourceShardDelete", "will", "delete", "a", "SourceShard", "inside", "a", "shard", "by", "index", ".", "This", "takes", "the", "keyspace", "lock", "as", "not", "to", "interfere", "with", "resharding", "operations", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/shard.go#L346-L369
train
vitessio/vitess
go/vt/wrangler/shard.go
SourceShardAdd
func (wr *Wrangler) SourceShardAdd(ctx context.Context, keyspace, shard string, uid uint32, skeyspace, sshard string, keyRange *topodatapb.KeyRange, tables []string) (err error) { // lock the keyspace ctx, unlock, lockErr := wr.ts.LockKeyspace(ctx, keyspace, fmt.Sprintf("SourceShardAdd(%v)", uid)) if lockErr != nil ...
go
func (wr *Wrangler) SourceShardAdd(ctx context.Context, keyspace, shard string, uid uint32, skeyspace, sshard string, keyRange *topodatapb.KeyRange, tables []string) (err error) { // lock the keyspace ctx, unlock, lockErr := wr.ts.LockKeyspace(ctx, keyspace, fmt.Sprintf("SourceShardAdd(%v)", uid)) if lockErr != nil ...
[ "func", "(", "wr", "*", "Wrangler", ")", "SourceShardAdd", "(", "ctx", "context", ".", "Context", ",", "keyspace", ",", "shard", "string", ",", "uid", "uint32", ",", "skeyspace", ",", "sshard", "string", ",", "keyRange", "*", "topodatapb", ".", "KeyRange",...
// SourceShardAdd will add a new SourceShard inside a shard.
[ "SourceShardAdd", "will", "add", "a", "new", "SourceShard", "inside", "a", "shard", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/shard.go#L372-L399
train
vitessio/vitess
go/vt/schemamanager/schemamanager.go
Run
func Run(ctx context.Context, controller Controller, executor Executor) error { if err := controller.Open(ctx); err != nil { log.Errorf("failed to open data sourcer: %v", err) return err } defer controller.Close() sqls, err := controller.Read(ctx) if err != nil { log.Errorf("failed to read data from data sou...
go
func Run(ctx context.Context, controller Controller, executor Executor) error { if err := controller.Open(ctx); err != nil { log.Errorf("failed to open data sourcer: %v", err) return err } defer controller.Close() sqls, err := controller.Read(ctx) if err != nil { log.Errorf("failed to read data from data sou...
[ "func", "Run", "(", "ctx", "context", ".", "Context", ",", "controller", "Controller", ",", "executor", "Executor", ")", "error", "{", "if", "err", ":=", "controller", ".", "Open", "(", "ctx", ")", ";", "err", "!=", "nil", "{", "log", ".", "Errorf", ...
// Run applies schema changes on Vitess through VtGate.
[ "Run", "applies", "schema", "changes", "on", "Vitess", "through", "VtGate", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemamanager.go#L96-L138
train
vitessio/vitess
go/vt/schemamanager/schemamanager.go
RegisterControllerFactory
func RegisterControllerFactory(name string, factory ControllerFactory) { if _, ok := controllerFactories[name]; ok { panic(fmt.Sprintf("register a registered key: %s", name)) } controllerFactories[name] = factory }
go
func RegisterControllerFactory(name string, factory ControllerFactory) { if _, ok := controllerFactories[name]; ok { panic(fmt.Sprintf("register a registered key: %s", name)) } controllerFactories[name] = factory }
[ "func", "RegisterControllerFactory", "(", "name", "string", ",", "factory", "ControllerFactory", ")", "{", "if", "_", ",", "ok", ":=", "controllerFactories", "[", "name", "]", ";", "ok", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "na...
// RegisterControllerFactory register a control factory.
[ "RegisterControllerFactory", "register", "a", "control", "factory", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemamanager.go#L141-L146
train
vitessio/vitess
go/vt/schemamanager/schemamanager.go
GetControllerFactory
func GetControllerFactory(name string) (ControllerFactory, error) { factory, ok := controllerFactories[name] if !ok { return nil, fmt.Errorf("there is no data sourcer factory with name: %s", name) } return factory, nil }
go
func GetControllerFactory(name string) (ControllerFactory, error) { factory, ok := controllerFactories[name] if !ok { return nil, fmt.Errorf("there is no data sourcer factory with name: %s", name) } return factory, nil }
[ "func", "GetControllerFactory", "(", "name", "string", ")", "(", "ControllerFactory", ",", "error", ")", "{", "factory", ",", "ok", ":=", "controllerFactories", "[", "name", "]", "\n", "if", "!", "ok", "{", "return", "nil", ",", "fmt", ".", "Errorf", "("...
// GetControllerFactory gets a ControllerFactory.
[ "GetControllerFactory", "gets", "a", "ControllerFactory", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemamanager.go#L149-L155
train
vitessio/vitess
go/vt/vttablet/queryservice/wrapped.go
canRetry
func canRetry(ctx context.Context, err error) bool { if err == nil { return false } select { case <-ctx.Done(): return false default: } switch vterrors.Code(err) { case vtrpcpb.Code_UNAVAILABLE, vtrpcpb.Code_FAILED_PRECONDITION: return true } return false }
go
func canRetry(ctx context.Context, err error) bool { if err == nil { return false } select { case <-ctx.Done(): return false default: } switch vterrors.Code(err) { case vtrpcpb.Code_UNAVAILABLE, vtrpcpb.Code_FAILED_PRECONDITION: return true } return false }
[ "func", "canRetry", "(", "ctx", "context", ".", "Context", ",", "err", "error", ")", "bool", "{", "if", "err", "==", "nil", "{", "return", "false", "\n", "}", "\n\n", "select", "{", "case", "<-", "ctx", ".", "Done", "(", ")", ":", "return", "false"...
// canRetry returns true if the error is retryable on a different vttablet. // Nil error or a canceled context make it return // false. Otherwise, the error code determines the outcome.
[ "canRetry", "returns", "true", "if", "the", "error", "is", "retryable", "on", "a", "different", "vttablet", ".", "Nil", "error", "or", "a", "canceled", "context", "make", "it", "return", "false", ".", "Otherwise", "the", "error", "code", "determines", "the",...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/queryservice/wrapped.go#L61-L77
train
vitessio/vitess
go/vt/vtgate/resolver.go
StreamExecute
func (res *Resolver) StreamExecute( ctx context.Context, sql string, bindVars map[string]*querypb.BindVariable, keyspace string, tabletType topodatapb.TabletType, destination key.Destination, options *querypb.ExecuteOptions, callback func(*sqltypes.Result) error, ) error { rss, err := res.resolver.ResolveDesti...
go
func (res *Resolver) StreamExecute( ctx context.Context, sql string, bindVars map[string]*querypb.BindVariable, keyspace string, tabletType topodatapb.TabletType, destination key.Destination, options *querypb.ExecuteOptions, callback func(*sqltypes.Result) error, ) error { rss, err := res.resolver.ResolveDesti...
[ "func", "(", "res", "*", "Resolver", ")", "StreamExecute", "(", "ctx", "context", ".", "Context", ",", "sql", "string", ",", "bindVars", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable", ",", "keyspace", "string", ",", "tabletType", "topodata...
// StreamExecute executes a streaming query on shards resolved by given func. // This function currently temporarily enforces the restriction of executing on // one shard since it cannot merge-sort the results to guarantee ordering of // response which is needed for checkpointing. // Note we guarantee the callback will...
[ "StreamExecute", "executes", "a", "streaming", "query", "on", "shards", "resolved", "by", "given", "func", ".", "This", "function", "currently", "temporarily", "enforces", "the", "restriction", "of", "executing", "on", "one", "shard", "since", "it", "cannot", "m...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/resolver.go#L241-L264
train
vitessio/vitess
go/vt/vtgate/resolver.go
MessageAckKeyspaceIds
func (res *Resolver) MessageAckKeyspaceIds(ctx context.Context, keyspace, name string, idKeyspaceIDs []*vtgatepb.IdKeyspaceId) (int64, error) { ids := make([]*querypb.Value, len(idKeyspaceIDs)) ksids := make([]key.Destination, len(idKeyspaceIDs)) for i, iki := range idKeyspaceIDs { ids[i] = iki.Id ksids[i] = key...
go
func (res *Resolver) MessageAckKeyspaceIds(ctx context.Context, keyspace, name string, idKeyspaceIDs []*vtgatepb.IdKeyspaceId) (int64, error) { ids := make([]*querypb.Value, len(idKeyspaceIDs)) ksids := make([]key.Destination, len(idKeyspaceIDs)) for i, iki := range idKeyspaceIDs { ids[i] = iki.Id ksids[i] = key...
[ "func", "(", "res", "*", "Resolver", ")", "MessageAckKeyspaceIds", "(", "ctx", "context", ".", "Context", ",", "keyspace", ",", "name", "string", ",", "idKeyspaceIDs", "[", "]", "*", "vtgatepb", ".", "IdKeyspaceId", ")", "(", "int64", ",", "error", ")", ...
// MessageAckKeyspaceIds routes message acks based on the associated keyspace ids.
[ "MessageAckKeyspaceIds", "routes", "message", "acks", "based", "on", "the", "associated", "keyspace", "ids", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/resolver.go#L287-L301
train
vitessio/vitess
go/vt/vtgate/resolver.go
StrsEquals
func StrsEquals(a, b []string) bool { if len(a) != len(b) { return false } sort.Strings(a) sort.Strings(b) for i, v := range a { if v != b[i] { return false } } return true }
go
func StrsEquals(a, b []string) bool { if len(a) != len(b) { return false } sort.Strings(a) sort.Strings(b) for i, v := range a { if v != b[i] { return false } } return true }
[ "func", "StrsEquals", "(", "a", ",", "b", "[", "]", "string", ")", "bool", "{", "if", "len", "(", "a", ")", "!=", "len", "(", "b", ")", "{", "return", "false", "\n", "}", "\n", "sort", ".", "Strings", "(", "a", ")", "\n", "sort", ".", "String...
// StrsEquals compares contents of two string slices.
[ "StrsEquals", "compares", "contents", "of", "two", "string", "slices", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/resolver.go#L348-L360
train
vitessio/vitess
go/vt/vtgate/resolver.go
buildEntityIds
func buildEntityIds(values [][]*querypb.Value, qSQL, entityColName string, qBindVars map[string]*querypb.BindVariable) ([]string, []map[string]*querypb.BindVariable) { sqls := make([]string, len(values)) bindVars := make([]map[string]*querypb.BindVariable, len(values)) for i, val := range values { var b bytes.Buff...
go
func buildEntityIds(values [][]*querypb.Value, qSQL, entityColName string, qBindVars map[string]*querypb.BindVariable) ([]string, []map[string]*querypb.BindVariable) { sqls := make([]string, len(values)) bindVars := make([]map[string]*querypb.BindVariable, len(values)) for i, val := range values { var b bytes.Buff...
[ "func", "buildEntityIds", "(", "values", "[", "]", "[", "]", "*", "querypb", ".", "Value", ",", "qSQL", ",", "entityColName", "string", ",", "qBindVars", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable", ")", "(", "[", "]", "string", ",",...
// buildEntityIds populates SQL and BindVariables.
[ "buildEntityIds", "populates", "SQL", "and", "BindVariables", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/resolver.go#L363-L385
train
vitessio/vitess
go/vt/vtgate/vindexes/lookup_internal.go
Lookup
func (lkp *lookupInternal) Lookup(vcursor VCursor, ids []sqltypes.Value) ([]*sqltypes.Result, error) { results := make([]*sqltypes.Result, 0, len(ids)) for _, id := range ids { bindVars := map[string]*querypb.BindVariable{ lkp.FromColumns[0]: sqltypes.ValueBindVariable(id), } var err error var result *sqlt...
go
func (lkp *lookupInternal) Lookup(vcursor VCursor, ids []sqltypes.Value) ([]*sqltypes.Result, error) { results := make([]*sqltypes.Result, 0, len(ids)) for _, id := range ids { bindVars := map[string]*querypb.BindVariable{ lkp.FromColumns[0]: sqltypes.ValueBindVariable(id), } var err error var result *sqlt...
[ "func", "(", "lkp", "*", "lookupInternal", ")", "Lookup", "(", "vcursor", "VCursor", ",", "ids", "[", "]", "sqltypes", ".", "Value", ")", "(", "[", "]", "*", "sqltypes", ".", "Result", ",", "error", ")", "{", "results", ":=", "make", "(", "[", "]",...
// Lookup performs a lookup for the ids.
[ "Lookup", "performs", "a", "lookup", "for", "the", "ids", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vindexes/lookup_internal.go#L62-L81
train
vitessio/vitess
go/vt/vtgate/vindexes/lookup_internal.go
Verify
func (lkp *lookupInternal) Verify(vcursor VCursor, ids, values []sqltypes.Value) ([]bool, error) { out := make([]bool, len(ids)) for i, id := range ids { bindVars := map[string]*querypb.BindVariable{ lkp.FromColumns[0]: sqltypes.ValueBindVariable(id), lkp.To: sqltypes.ValueBindVariable(values[i]),...
go
func (lkp *lookupInternal) Verify(vcursor VCursor, ids, values []sqltypes.Value) ([]bool, error) { out := make([]bool, len(ids)) for i, id := range ids { bindVars := map[string]*querypb.BindVariable{ lkp.FromColumns[0]: sqltypes.ValueBindVariable(id), lkp.To: sqltypes.ValueBindVariable(values[i]),...
[ "func", "(", "lkp", "*", "lookupInternal", ")", "Verify", "(", "vcursor", "VCursor", ",", "ids", ",", "values", "[", "]", "sqltypes", ".", "Value", ")", "(", "[", "]", "bool", ",", "error", ")", "{", "out", ":=", "make", "(", "[", "]", "bool", ",...
// Verify returns true if ids map to values.
[ "Verify", "returns", "true", "if", "ids", "map", "to", "values", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vindexes/lookup_internal.go#L84-L104
train
vitessio/vitess
go/vt/vtgate/vindexes/lookup_internal.go
Update
func (lkp *lookupInternal) Update(vcursor VCursor, oldValues []sqltypes.Value, ksid sqltypes.Value, newValues []sqltypes.Value) error { if err := lkp.Delete(vcursor, [][]sqltypes.Value{oldValues}, ksid); err != nil { return err } return lkp.Create(vcursor, [][]sqltypes.Value{newValues}, []sqltypes.Value{ksid}, fal...
go
func (lkp *lookupInternal) Update(vcursor VCursor, oldValues []sqltypes.Value, ksid sqltypes.Value, newValues []sqltypes.Value) error { if err := lkp.Delete(vcursor, [][]sqltypes.Value{oldValues}, ksid); err != nil { return err } return lkp.Create(vcursor, [][]sqltypes.Value{newValues}, []sqltypes.Value{ksid}, fal...
[ "func", "(", "lkp", "*", "lookupInternal", ")", "Update", "(", "vcursor", "VCursor", ",", "oldValues", "[", "]", "sqltypes", ".", "Value", ",", "ksid", "sqltypes", ".", "Value", ",", "newValues", "[", "]", "sqltypes", ".", "Value", ")", "error", "{", "...
// Update implements the update functionality.
[ "Update", "implements", "the", "update", "functionality", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vindexes/lookup_internal.go#L217-L222
train
vitessio/vitess
go/vt/health/health.go
Report
func (fc FunctionReporter) Report(isSlaveType, shouldQueryServiceBeRunning bool) (time.Duration, error) { return fc(isSlaveType, shouldQueryServiceBeRunning) }
go
func (fc FunctionReporter) Report(isSlaveType, shouldQueryServiceBeRunning bool) (time.Duration, error) { return fc(isSlaveType, shouldQueryServiceBeRunning) }
[ "func", "(", "fc", "FunctionReporter", ")", "Report", "(", "isSlaveType", ",", "shouldQueryServiceBeRunning", "bool", ")", "(", "time", ".", "Duration", ",", "error", ")", "{", "return", "fc", "(", "isSlaveType", ",", "shouldQueryServiceBeRunning", ")", "\n", ...
// Report implements Reporter.Report
[ "Report", "implements", "Reporter", ".", "Report" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/health/health.go#L64-L66
train
vitessio/vitess
go/vt/health/health.go
Register
func (ag *Aggregator) Register(name string, rep Reporter) { ag.mu.Lock() defer ag.mu.Unlock() if _, ok := ag.reporters[name]; ok { panic("reporter named " + name + " is already registered") } ag.reporters[name] = rep }
go
func (ag *Aggregator) Register(name string, rep Reporter) { ag.mu.Lock() defer ag.mu.Unlock() if _, ok := ag.reporters[name]; ok { panic("reporter named " + name + " is already registered") } ag.reporters[name] = rep }
[ "func", "(", "ag", "*", "Aggregator", ")", "Register", "(", "name", "string", ",", "rep", "Reporter", ")", "{", "ag", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "ag", ".", "mu", ".", "Unlock", "(", ")", "\n", "if", "_", ",", "ok", ":=", ...
// Register registers rep with ag.
[ "Register", "registers", "rep", "with", "ag", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/health/health.go#L138-L145
train
vitessio/vitess
go/vt/health/health.go
RegisterSimpleCheck
func (ag *Aggregator) RegisterSimpleCheck(name string, check func() error) { ag.Register(name, simpleReporter{html: template.HTML(name), check: check}) }
go
func (ag *Aggregator) RegisterSimpleCheck(name string, check func() error) { ag.Register(name, simpleReporter{html: template.HTML(name), check: check}) }
[ "func", "(", "ag", "*", "Aggregator", ")", "RegisterSimpleCheck", "(", "name", "string", ",", "check", "func", "(", ")", "error", ")", "{", "ag", ".", "Register", "(", "name", ",", "simpleReporter", "{", "html", ":", "template", ".", "HTML", "(", "name...
// RegisterSimpleCheck registers a simple health check function.
[ "RegisterSimpleCheck", "registers", "a", "simple", "health", "check", "function", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/health/health.go#L148-L150
train
vitessio/vitess
go/vt/health/health.go
HTMLName
func (ag *Aggregator) HTMLName() template.HTML { ag.mu.Lock() defer ag.mu.Unlock() result := make([]string, 0, len(ag.reporters)) for _, rep := range ag.reporters { result = append(result, string(rep.HTMLName())) } sort.Strings(result) return template.HTML(strings.Join(result, "&nbsp; + &nbsp;")) }
go
func (ag *Aggregator) HTMLName() template.HTML { ag.mu.Lock() defer ag.mu.Unlock() result := make([]string, 0, len(ag.reporters)) for _, rep := range ag.reporters { result = append(result, string(rep.HTMLName())) } sort.Strings(result) return template.HTML(strings.Join(result, "&nbsp; + &nbsp;")) }
[ "func", "(", "ag", "*", "Aggregator", ")", "HTMLName", "(", ")", "template", ".", "HTML", "{", "ag", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "ag", ".", "mu", ".", "Unlock", "(", ")", "\n", "result", ":=", "make", "(", "[", "]", "string...
// HTMLName returns an aggregate name for all the reporters
[ "HTMLName", "returns", "an", "aggregate", "name", "for", "all", "the", "reporters" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/health/health.go#L153-L162
train
vitessio/vitess
go/vt/schemamanager/local_controller.go
Open
func (controller *LocalController) Open(ctx context.Context) error { // find all keyspace directories. fileInfos, err := ioutil.ReadDir(controller.schemaChangeDir) if err != nil { return err } for _, fileinfo := range fileInfos { if !fileinfo.IsDir() { continue } dirpath := path.Join(controller.schemaCh...
go
func (controller *LocalController) Open(ctx context.Context) error { // find all keyspace directories. fileInfos, err := ioutil.ReadDir(controller.schemaChangeDir) if err != nil { return err } for _, fileinfo := range fileInfos { if !fileinfo.IsDir() { continue } dirpath := path.Join(controller.schemaCh...
[ "func", "(", "controller", "*", "LocalController", ")", "Open", "(", "ctx", "context", ".", "Context", ")", "error", "{", "// find all keyspace directories.", "fileInfos", ",", "err", ":=", "ioutil", ".", "ReadDir", "(", "controller", ".", "schemaChangeDir", ")"...
// Open goes through the schema change dir and find a keyspace with a pending // schema change.
[ "Open", "goes", "through", "the", "schema", "change", "dir", "and", "find", "a", "keyspace", "with", "a", "pending", "schema", "change", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/local_controller.go#L77-L114
train
vitessio/vitess
go/vt/schemamanager/local_controller.go
Read
func (controller *LocalController) Read(ctx context.Context) ([]string, error) { if controller.keyspace == "" || controller.sqlPath == "" { return []string{}, nil } data, err := ioutil.ReadFile(controller.sqlPath) if err != nil { return nil, err } return strings.Split(string(data), ";"), nil }
go
func (controller *LocalController) Read(ctx context.Context) ([]string, error) { if controller.keyspace == "" || controller.sqlPath == "" { return []string{}, nil } data, err := ioutil.ReadFile(controller.sqlPath) if err != nil { return nil, err } return strings.Split(string(data), ";"), nil }
[ "func", "(", "controller", "*", "LocalController", ")", "Read", "(", "ctx", "context", ".", "Context", ")", "(", "[", "]", "string", ",", "error", ")", "{", "if", "controller", ".", "keyspace", "==", "\"", "\"", "||", "controller", ".", "sqlPath", "=="...
// Read reads schema changes.
[ "Read", "reads", "schema", "changes", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/local_controller.go#L117-L126
train
vitessio/vitess
go/vt/schemamanager/local_controller.go
Close
func (controller *LocalController) Close() { controller.keyspace = "" controller.sqlPath = "" controller.sqlFilename = "" controller.errorDir = "" controller.logDir = "" controller.completeDir = "" }
go
func (controller *LocalController) Close() { controller.keyspace = "" controller.sqlPath = "" controller.sqlFilename = "" controller.errorDir = "" controller.logDir = "" controller.completeDir = "" }
[ "func", "(", "controller", "*", "LocalController", ")", "Close", "(", ")", "{", "controller", ".", "keyspace", "=", "\"", "\"", "\n", "controller", ".", "sqlPath", "=", "\"", "\"", "\n", "controller", ".", "sqlFilename", "=", "\"", "\"", "\n", "controlle...
// Close reset keyspace, sqlPath, errorDir, logDir and completeDir.
[ "Close", "reset", "keyspace", "sqlPath", "errorDir", "logDir", "and", "completeDir", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/local_controller.go#L134-L141
train
vitessio/vitess
go/vt/schemamanager/local_controller.go
OnValidationFail
func (controller *LocalController) OnValidationFail(ctx context.Context, err error) error { return controller.moveToErrorDir(ctx) }
go
func (controller *LocalController) OnValidationFail(ctx context.Context, err error) error { return controller.moveToErrorDir(ctx) }
[ "func", "(", "controller", "*", "LocalController", ")", "OnValidationFail", "(", "ctx", "context", ".", "Context", ",", "err", "error", ")", "error", "{", "return", "controller", ".", "moveToErrorDir", "(", "ctx", ")", "\n", "}" ]
// OnValidationFail is no-op
[ "OnValidationFail", "is", "no", "-", "op" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/local_controller.go#L160-L162
train
vitessio/vitess
go/vt/topo/topoproto/flag.go
TabletTypeVar
func TabletTypeVar(p *topodatapb.TabletType, name string, defaultValue topodatapb.TabletType, usage string) { *p = defaultValue flag.Var((*TabletTypeFlag)(p), name, usage) }
go
func TabletTypeVar(p *topodatapb.TabletType, name string, defaultValue topodatapb.TabletType, usage string) { *p = defaultValue flag.Var((*TabletTypeFlag)(p), name, usage) }
[ "func", "TabletTypeVar", "(", "p", "*", "topodatapb", ".", "TabletType", ",", "name", "string", ",", "defaultValue", "topodatapb", ".", "TabletType", ",", "usage", "string", ")", "{", "*", "p", "=", "defaultValue", "\n", "flag", ".", "Var", "(", "(", "*"...
// TabletTypeVar defines a TabletType flag with the specified name, default value and usage // string. The argument 'p' points to a tabletType in which to store the value of the flag.
[ "TabletTypeVar", "defines", "a", "TabletType", "flag", "with", "the", "specified", "name", "default", "value", "and", "usage", "string", ".", "The", "argument", "p", "points", "to", "a", "tabletType", "in", "which", "to", "store", "the", "value", "of", "the"...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/topoproto/flag.go#L18-L21
train
vitessio/vitess
go/vt/topo/topoproto/tablet.go
TabletAliasIsZero
func TabletAliasIsZero(ta *topodatapb.TabletAlias) bool { return ta == nil || (ta.Cell == "" && ta.Uid == 0) }
go
func TabletAliasIsZero(ta *topodatapb.TabletAlias) bool { return ta == nil || (ta.Cell == "" && ta.Uid == 0) }
[ "func", "TabletAliasIsZero", "(", "ta", "*", "topodatapb", ".", "TabletAlias", ")", "bool", "{", "return", "ta", "==", "nil", "||", "(", "ta", ".", "Cell", "==", "\"", "\"", "&&", "ta", ".", "Uid", "==", "0", ")", "\n", "}" ]
// TabletAliasIsZero returns true iff cell and uid are empty
[ "TabletAliasIsZero", "returns", "true", "iff", "cell", "and", "uid", "are", "empty" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/topoproto/tablet.go#L52-L54
train
vitessio/vitess
go/vt/topo/topoproto/tablet.go
TabletAliasEqual
func TabletAliasEqual(left, right *topodatapb.TabletAlias) bool { return proto.Equal(left, right) }
go
func TabletAliasEqual(left, right *topodatapb.TabletAlias) bool { return proto.Equal(left, right) }
[ "func", "TabletAliasEqual", "(", "left", ",", "right", "*", "topodatapb", ".", "TabletAlias", ")", "bool", "{", "return", "proto", ".", "Equal", "(", "left", ",", "right", ")", "\n", "}" ]
// TabletAliasEqual returns true if two TabletAlias match
[ "TabletAliasEqual", "returns", "true", "if", "two", "TabletAlias", "match" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/topoproto/tablet.go#L57-L59
train
vitessio/vitess
go/vt/topo/topoproto/tablet.go
TabletAliasString
func TabletAliasString(ta *topodatapb.TabletAlias) string { if ta == nil { return "<nil>" } return fmt.Sprintf("%v-%010d", ta.Cell, ta.Uid) }
go
func TabletAliasString(ta *topodatapb.TabletAlias) string { if ta == nil { return "<nil>" } return fmt.Sprintf("%v-%010d", ta.Cell, ta.Uid) }
[ "func", "TabletAliasString", "(", "ta", "*", "topodatapb", ".", "TabletAlias", ")", "string", "{", "if", "ta", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "ta", ".", "Cell", ",", "...
// TabletAliasString formats a TabletAlias
[ "TabletAliasString", "formats", "a", "TabletAlias" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/topoproto/tablet.go#L62-L67
train
vitessio/vitess
go/vt/topo/topoproto/tablet.go
ParseTabletType
func ParseTabletType(param string) (topodatapb.TabletType, error) { value, ok := topodatapb.TabletType_value[strings.ToUpper(param)] if !ok { return topodatapb.TabletType_UNKNOWN, fmt.Errorf("unknown TabletType %v", param) } return topodatapb.TabletType(value), nil }
go
func ParseTabletType(param string) (topodatapb.TabletType, error) { value, ok := topodatapb.TabletType_value[strings.ToUpper(param)] if !ok { return topodatapb.TabletType_UNKNOWN, fmt.Errorf("unknown TabletType %v", param) } return topodatapb.TabletType(value), nil }
[ "func", "ParseTabletType", "(", "param", "string", ")", "(", "topodatapb", ".", "TabletType", ",", "error", ")", "{", "value", ",", "ok", ":=", "topodatapb", ".", "TabletType_value", "[", "strings", ".", "ToUpper", "(", "param", ")", "]", "\n", "if", "!"...
// ParseTabletType parses the tablet type into the enum.
[ "ParseTabletType", "parses", "the", "tablet", "type", "into", "the", "enum", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/topoproto/tablet.go#L150-L156
train
vitessio/vitess
go/vt/topo/topoproto/tablet.go
ParseTabletTypes
func ParseTabletTypes(param string) ([]topodatapb.TabletType, error) { var tabletTypes []topodatapb.TabletType for _, typeStr := range strings.Split(param, ",") { t, err := ParseTabletType(typeStr) if err != nil { return nil, err } tabletTypes = append(tabletTypes, t) } return tabletTypes, nil }
go
func ParseTabletTypes(param string) ([]topodatapb.TabletType, error) { var tabletTypes []topodatapb.TabletType for _, typeStr := range strings.Split(param, ",") { t, err := ParseTabletType(typeStr) if err != nil { return nil, err } tabletTypes = append(tabletTypes, t) } return tabletTypes, nil }
[ "func", "ParseTabletTypes", "(", "param", "string", ")", "(", "[", "]", "topodatapb", ".", "TabletType", ",", "error", ")", "{", "var", "tabletTypes", "[", "]", "topodatapb", ".", "TabletType", "\n", "for", "_", ",", "typeStr", ":=", "range", "strings", ...
// ParseTabletTypes parses a comma separated list of tablet types and returns a slice with the respective enums.
[ "ParseTabletTypes", "parses", "a", "comma", "separated", "list", "of", "tablet", "types", "and", "returns", "a", "slice", "with", "the", "respective", "enums", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/topoproto/tablet.go#L159-L169
train
vitessio/vitess
go/vt/topo/topoproto/tablet.go
TabletTypeLString
func TabletTypeLString(tabletType topodatapb.TabletType) string { value, ok := tabletTypeLowerName[int32(tabletType)] if !ok { return "unknown" } return value }
go
func TabletTypeLString(tabletType topodatapb.TabletType) string { value, ok := tabletTypeLowerName[int32(tabletType)] if !ok { return "unknown" } return value }
[ "func", "TabletTypeLString", "(", "tabletType", "topodatapb", ".", "TabletType", ")", "string", "{", "value", ",", "ok", ":=", "tabletTypeLowerName", "[", "int32", "(", "tabletType", ")", "]", "\n", "if", "!", "ok", "{", "return", "\"", "\"", "\n", "}", ...
// TabletTypeLString returns a lower case version of the tablet type, // or "unknown" if not known.
[ "TabletTypeLString", "returns", "a", "lower", "case", "version", "of", "the", "tablet", "type", "or", "unknown", "if", "not", "known", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/topoproto/tablet.go#L173-L179
train
vitessio/vitess
go/vt/topo/topoproto/tablet.go
IsTypeInList
func IsTypeInList(tabletType topodatapb.TabletType, types []topodatapb.TabletType) bool { for _, t := range types { if tabletType == t { return true } } return false }
go
func IsTypeInList(tabletType topodatapb.TabletType, types []topodatapb.TabletType) bool { for _, t := range types { if tabletType == t { return true } } return false }
[ "func", "IsTypeInList", "(", "tabletType", "topodatapb", ".", "TabletType", ",", "types", "[", "]", "topodatapb", ".", "TabletType", ")", "bool", "{", "for", "_", ",", "t", ":=", "range", "types", "{", "if", "tabletType", "==", "t", "{", "return", "true"...
// IsTypeInList returns true if the given type is in the list. // Use it with AllTabletType and SlaveTabletType for instance.
[ "IsTypeInList", "returns", "true", "if", "the", "given", "type", "is", "in", "the", "list", ".", "Use", "it", "with", "AllTabletType", "and", "SlaveTabletType", "for", "instance", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/topoproto/tablet.go#L183-L190
train
vitessio/vitess
go/vt/topo/topoproto/tablet.go
MakeStringTypeList
func MakeStringTypeList(types []topodatapb.TabletType) []string { strs := make([]string, len(types)) for i, t := range types { strs[i] = strings.ToLower(t.String()) } sort.Strings(strs) return strs }
go
func MakeStringTypeList(types []topodatapb.TabletType) []string { strs := make([]string, len(types)) for i, t := range types { strs[i] = strings.ToLower(t.String()) } sort.Strings(strs) return strs }
[ "func", "MakeStringTypeList", "(", "types", "[", "]", "topodatapb", ".", "TabletType", ")", "[", "]", "string", "{", "strs", ":=", "make", "(", "[", "]", "string", ",", "len", "(", "types", ")", ")", "\n", "for", "i", ",", "t", ":=", "range", "type...
// MakeStringTypeList returns a list of strings that match the input list.
[ "MakeStringTypeList", "returns", "a", "list", "of", "strings", "that", "match", "the", "input", "list", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/topoproto/tablet.go#L193-L200
train
vitessio/vitess
go/vt/topo/topoproto/tablet.go
MySQLIP
func MySQLIP(tablet *topodatapb.Tablet) (string, error) { ipAddrs, err := net.LookupHost(MysqlHostname(tablet)) if err != nil { return "", err } return ipAddrs[0], nil }
go
func MySQLIP(tablet *topodatapb.Tablet) (string, error) { ipAddrs, err := net.LookupHost(MysqlHostname(tablet)) if err != nil { return "", err } return ipAddrs[0], nil }
[ "func", "MySQLIP", "(", "tablet", "*", "topodatapb", ".", "Tablet", ")", "(", "string", ",", "error", ")", "{", "ipAddrs", ",", "err", ":=", "net", ".", "LookupHost", "(", "MysqlHostname", "(", "tablet", ")", ")", "\n", "if", "err", "!=", "nil", "{",...
// MySQLIP returns the MySQL server's IP by resolvign the host name.
[ "MySQLIP", "returns", "the", "MySQL", "server", "s", "IP", "by", "resolvign", "the", "host", "name", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/topoproto/tablet.go#L244-L250
train
vitessio/vitess
go/vt/topo/topoproto/tablet.go
TabletDbName
func TabletDbName(tablet *topodatapb.Tablet) string { if tablet.DbNameOverride != "" { return tablet.DbNameOverride } if tablet.Keyspace == "" { return "" } return vtDbPrefix + tablet.Keyspace }
go
func TabletDbName(tablet *topodatapb.Tablet) string { if tablet.DbNameOverride != "" { return tablet.DbNameOverride } if tablet.Keyspace == "" { return "" } return vtDbPrefix + tablet.Keyspace }
[ "func", "TabletDbName", "(", "tablet", "*", "topodatapb", ".", "Tablet", ")", "string", "{", "if", "tablet", ".", "DbNameOverride", "!=", "\"", "\"", "{", "return", "tablet", ".", "DbNameOverride", "\n", "}", "\n", "if", "tablet", ".", "Keyspace", "==", ...
// TabletDbName is usually implied by keyspace. Having the shard // information in the database name complicates mysql replication.
[ "TabletDbName", "is", "usually", "implied", "by", "keyspace", ".", "Having", "the", "shard", "information", "in", "the", "database", "name", "complicates", "mysql", "replication", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/topoproto/tablet.go#L254-L262
train
vitessio/vitess
go/vt/topo/topoproto/tablet.go
TabletIsAssigned
func TabletIsAssigned(tablet *topodatapb.Tablet) bool { return tablet != nil && tablet.Keyspace != "" && tablet.Shard != "" }
go
func TabletIsAssigned(tablet *topodatapb.Tablet) bool { return tablet != nil && tablet.Keyspace != "" && tablet.Shard != "" }
[ "func", "TabletIsAssigned", "(", "tablet", "*", "topodatapb", ".", "Tablet", ")", "bool", "{", "return", "tablet", "!=", "nil", "&&", "tablet", ".", "Keyspace", "!=", "\"", "\"", "&&", "tablet", ".", "Shard", "!=", "\"", "\"", "\n", "}" ]
// TabletIsAssigned returns if this tablet is assigned to a keyspace and shard. // A "scrap" node will show up as assigned even though its data cannot be used // for serving.
[ "TabletIsAssigned", "returns", "if", "this", "tablet", "is", "assigned", "to", "a", "keyspace", "and", "shard", ".", "A", "scrap", "node", "will", "show", "up", "as", "assigned", "even", "though", "its", "data", "cannot", "be", "used", "for", "serving", "....
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/topoproto/tablet.go#L267-L269
train
vitessio/vitess
go/mysql/binlog_event_rbr.go
metadataLength
func metadataLength(typ byte) int { switch typ { case TypeDecimal, TypeTiny, TypeShort, TypeLong, TypeNull, TypeTimestamp, TypeLongLong, TypeInt24, TypeDate, TypeTime, TypeDateTime, TypeYear, TypeNewDate: // No data here. return 0 case TypeFloat, TypeDouble, TypeTimestamp2, TypeDateTime2, TypeTime2, TypeJSON, T...
go
func metadataLength(typ byte) int { switch typ { case TypeDecimal, TypeTiny, TypeShort, TypeLong, TypeNull, TypeTimestamp, TypeLongLong, TypeInt24, TypeDate, TypeTime, TypeDateTime, TypeYear, TypeNewDate: // No data here. return 0 case TypeFloat, TypeDouble, TypeTimestamp2, TypeDateTime2, TypeTime2, TypeJSON, T...
[ "func", "metadataLength", "(", "typ", "byte", ")", "int", "{", "switch", "typ", "{", "case", "TypeDecimal", ",", "TypeTiny", ",", "TypeShort", ",", "TypeLong", ",", "TypeNull", ",", "TypeTimestamp", ",", "TypeLongLong", ",", "TypeInt24", ",", "TypeDate", ","...
// metadataLength returns how many bytes are used for metadata, based on a type.
[ "metadataLength", "returns", "how", "many", "bytes", "are", "used", "for", "metadata", "based", "on", "a", "type", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/binlog_event_rbr.go#L104-L126
train
vitessio/vitess
go/mysql/binlog_event_rbr.go
metadataTotalLength
func metadataTotalLength(types []byte) int { sum := 0 for _, t := range types { sum += metadataLength(t) } return sum }
go
func metadataTotalLength(types []byte) int { sum := 0 for _, t := range types { sum += metadataLength(t) } return sum }
[ "func", "metadataTotalLength", "(", "types", "[", "]", "byte", ")", "int", "{", "sum", ":=", "0", "\n", "for", "_", ",", "t", ":=", "range", "types", "{", "sum", "+=", "metadataLength", "(", "t", ")", "\n", "}", "\n", "return", "sum", "\n", "}" ]
// metadataTotalLength returns the total size of the metadata for an // array of types.
[ "metadataTotalLength", "returns", "the", "total", "size", "of", "the", "metadata", "for", "an", "array", "of", "types", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/binlog_event_rbr.go#L130-L136
train
vitessio/vitess
go/mysql/binlog_event_rbr.go
metadataRead
func metadataRead(data []byte, pos int, typ byte) (uint16, int, error) { switch typ { case TypeDecimal, TypeTiny, TypeShort, TypeLong, TypeNull, TypeTimestamp, TypeLongLong, TypeInt24, TypeDate, TypeTime, TypeDateTime, TypeYear, TypeNewDate: // No data here. return 0, pos, nil case TypeFloat, TypeDouble, TypeT...
go
func metadataRead(data []byte, pos int, typ byte) (uint16, int, error) { switch typ { case TypeDecimal, TypeTiny, TypeShort, TypeLong, TypeNull, TypeTimestamp, TypeLongLong, TypeInt24, TypeDate, TypeTime, TypeDateTime, TypeYear, TypeNewDate: // No data here. return 0, pos, nil case TypeFloat, TypeDouble, TypeT...
[ "func", "metadataRead", "(", "data", "[", "]", "byte", ",", "pos", "int", ",", "typ", "byte", ")", "(", "uint16", ",", "int", ",", "error", ")", "{", "switch", "typ", "{", "case", "TypeDecimal", ",", "TypeTiny", ",", "TypeShort", ",", "TypeLong", ","...
// metadataRead reads a single value from the metadata string.
[ "metadataRead", "reads", "a", "single", "value", "from", "the", "metadata", "string", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/binlog_event_rbr.go#L139-L162
train
vitessio/vitess
go/mysql/binlog_event_rbr.go
printTimestamp
func printTimestamp(v uint32) *bytes.Buffer { if v == 0 { return bytes.NewBuffer(ZeroTimestamp) } t := time.Unix(int64(v), 0).UTC() year, month, day := t.Date() hour, minute, second := t.Clock() result := &bytes.Buffer{} fmt.Fprintf(result, "%04d-%02d-%02d %02d:%02d:%02d", year, int(month), day, hour, minute...
go
func printTimestamp(v uint32) *bytes.Buffer { if v == 0 { return bytes.NewBuffer(ZeroTimestamp) } t := time.Unix(int64(v), 0).UTC() year, month, day := t.Date() hour, minute, second := t.Clock() result := &bytes.Buffer{} fmt.Fprintf(result, "%04d-%02d-%02d %02d:%02d:%02d", year, int(month), day, hour, minute...
[ "func", "printTimestamp", "(", "v", "uint32", ")", "*", "bytes", ".", "Buffer", "{", "if", "v", "==", "0", "{", "return", "bytes", ".", "NewBuffer", "(", "ZeroTimestamp", ")", "\n", "}", "\n\n", "t", ":=", "time", ".", "Unix", "(", "int64", "(", "v...
// printTimestamp is a helper method to append a timestamp into a bytes.Buffer, // and return the Buffer.
[ "printTimestamp", "is", "a", "helper", "method", "to", "append", "a", "timestamp", "into", "a", "bytes", ".", "Buffer", "and", "return", "the", "Buffer", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/binlog_event_rbr.go#L318-L330
train
vitessio/vitess
go/vt/vttablet/tabletserver/vstreamer/vstreamer.go
SetKSchema
func (vs *vstreamer) SetKSchema(kschema *vindexes.KeyspaceSchema) { // Since vs.Stream is a single-threaded loop. We just send an event to // that thread, which helps us avoid mutexes to update the plans. select { case vs.kevents <- kschema: case <-vs.ctx.Done(): } }
go
func (vs *vstreamer) SetKSchema(kschema *vindexes.KeyspaceSchema) { // Since vs.Stream is a single-threaded loop. We just send an event to // that thread, which helps us avoid mutexes to update the plans. select { case vs.kevents <- kschema: case <-vs.ctx.Done(): } }
[ "func", "(", "vs", "*", "vstreamer", ")", "SetKSchema", "(", "kschema", "*", "vindexes", ".", "KeyspaceSchema", ")", "{", "// Since vs.Stream is a single-threaded loop. We just send an event to", "// that thread, which helps us avoid mutexes to update the plans.", "select", "{", ...
// SetKSchema updates all existing against the new kschema.
[ "SetKSchema", "updates", "all", "existing", "against", "the", "new", "kschema", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/vstreamer/vstreamer.go#L88-L95
train
vitessio/vitess
go/vt/vttablet/tabletserver/vstreamer/vstreamer.go
Stream
func (vs *vstreamer) Stream() error { defer vs.cancel() pos, err := mysql.DecodePosition(vs.startPos) if err != nil { return err } vs.pos = pos // Ensure se is Open. If vttablet came up in a non_serving role, // the schema engine may not have been initialized. if err := vs.se.Open(); err != nil { return w...
go
func (vs *vstreamer) Stream() error { defer vs.cancel() pos, err := mysql.DecodePosition(vs.startPos) if err != nil { return err } vs.pos = pos // Ensure se is Open. If vttablet came up in a non_serving role, // the schema engine may not have been initialized. if err := vs.se.Open(); err != nil { return w...
[ "func", "(", "vs", "*", "vstreamer", ")", "Stream", "(", ")", "error", "{", "defer", "vs", ".", "cancel", "(", ")", "\n\n", "pos", ",", "err", ":=", "mysql", ".", "DecodePosition", "(", "vs", ".", "startPos", ")", "\n", "if", "err", "!=", "nil", ...
// Stream runs a single-threaded loop.
[ "Stream", "runs", "a", "single", "-", "threaded", "loop", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/vstreamer/vstreamer.go#L102-L129
train
vitessio/vitess
go/vt/vttablet/tabletserver/query_engine.go
AddStats
func (ep *TabletPlan) AddStats(queryCount int64, duration, mysqlTime time.Duration, rowCount, errorCount int64) { ep.mu.Lock() ep.QueryCount += queryCount ep.Time += duration ep.MysqlTime += mysqlTime ep.RowCount += rowCount ep.ErrorCount += errorCount ep.mu.Unlock() }
go
func (ep *TabletPlan) AddStats(queryCount int64, duration, mysqlTime time.Duration, rowCount, errorCount int64) { ep.mu.Lock() ep.QueryCount += queryCount ep.Time += duration ep.MysqlTime += mysqlTime ep.RowCount += rowCount ep.ErrorCount += errorCount ep.mu.Unlock() }
[ "func", "(", "ep", "*", "TabletPlan", ")", "AddStats", "(", "queryCount", "int64", ",", "duration", ",", "mysqlTime", "time", ".", "Duration", ",", "rowCount", ",", "errorCount", "int64", ")", "{", "ep", ".", "mu", ".", "Lock", "(", ")", "\n", "ep", ...
// AddStats updates the stats for the current TabletPlan.
[ "AddStats", "updates", "the", "stats", "for", "the", "current", "TabletPlan", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_engine.go#L79-L87
train
vitessio/vitess
go/vt/vttablet/tabletserver/query_engine.go
buildAuthorized
func (ep *TabletPlan) buildAuthorized() { ep.Authorized = make([]*tableacl.ACLResult, len(ep.Permissions)) for i, perm := range ep.Permissions { ep.Authorized[i] = tableacl.Authorized(perm.TableName, perm.Role) } }
go
func (ep *TabletPlan) buildAuthorized() { ep.Authorized = make([]*tableacl.ACLResult, len(ep.Permissions)) for i, perm := range ep.Permissions { ep.Authorized[i] = tableacl.Authorized(perm.TableName, perm.Role) } }
[ "func", "(", "ep", "*", "TabletPlan", ")", "buildAuthorized", "(", ")", "{", "ep", ".", "Authorized", "=", "make", "(", "[", "]", "*", "tableacl", ".", "ACLResult", ",", "len", "(", "ep", ".", "Permissions", ")", ")", "\n", "for", "i", ",", "perm",...
// buildAuthorized builds 'Authorized', which is the runtime part for 'Permissions'.
[ "buildAuthorized", "builds", "Authorized", "which", "is", "the", "runtime", "part", "for", "Permissions", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_engine.go#L102-L107
train
vitessio/vitess
go/vt/vttablet/tabletserver/query_engine.go
Open
func (qe *QueryEngine) Open() error { qe.conns.Open(qe.dbconfigs.AppWithDB(), qe.dbconfigs.DbaWithDB(), qe.dbconfigs.AppDebugWithDB()) conn, err := qe.conns.Get(tabletenv.LocalContext()) if err != nil { qe.conns.Close() return err } qe.binlogFormat, err = conn.VerifyMode(qe.strictTransTables) conn.Recycle() ...
go
func (qe *QueryEngine) Open() error { qe.conns.Open(qe.dbconfigs.AppWithDB(), qe.dbconfigs.DbaWithDB(), qe.dbconfigs.AppDebugWithDB()) conn, err := qe.conns.Get(tabletenv.LocalContext()) if err != nil { qe.conns.Close() return err } qe.binlogFormat, err = conn.VerifyMode(qe.strictTransTables) conn.Recycle() ...
[ "func", "(", "qe", "*", "QueryEngine", ")", "Open", "(", ")", "error", "{", "qe", ".", "conns", ".", "Open", "(", "qe", ".", "dbconfigs", ".", "AppWithDB", "(", ")", ",", "qe", ".", "dbconfigs", ".", "DbaWithDB", "(", ")", ",", "qe", ".", "dbconf...
// Open must be called before sending requests to QueryEngine.
[ "Open", "must", "be", "called", "before", "sending", "requests", "to", "QueryEngine", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_engine.go#L285-L304
train
vitessio/vitess
go/vt/vttablet/tabletserver/query_engine.go
Close
func (qe *QueryEngine) Close() { // Close in reverse order of Open. qe.se.UnregisterNotifier("qe") qe.plans.Clear() qe.tables = make(map[string]*schema.Table) qe.streamConns.Close() qe.conns.Close() }
go
func (qe *QueryEngine) Close() { // Close in reverse order of Open. qe.se.UnregisterNotifier("qe") qe.plans.Clear() qe.tables = make(map[string]*schema.Table) qe.streamConns.Close() qe.conns.Close() }
[ "func", "(", "qe", "*", "QueryEngine", ")", "Close", "(", ")", "{", "// Close in reverse order of Open.", "qe", ".", "se", ".", "UnregisterNotifier", "(", "\"", "\"", ")", "\n", "qe", ".", "plans", ".", "Clear", "(", ")", "\n", "qe", ".", "tables", "="...
// Close must be called to shut down QueryEngine. // You must ensure that no more queries will be sent // before calling Close.
[ "Close", "must", "be", "called", "to", "shut", "down", "QueryEngine", ".", "You", "must", "ensure", "that", "no", "more", "queries", "will", "be", "sent", "before", "calling", "Close", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_engine.go#L309-L316
train
vitessio/vitess
go/vt/vttablet/tabletserver/query_engine.go
GetPlan
func (qe *QueryEngine) GetPlan(ctx context.Context, logStats *tabletenv.LogStats, sql string, skipQueryPlanCache bool) (*TabletPlan, error) { span, ctx := trace.NewSpan(ctx, "QueryEngine.GetPlan") defer span.Finish() if plan := qe.getQuery(sql); plan != nil { return plan, nil } // Obtain read lock to prevent s...
go
func (qe *QueryEngine) GetPlan(ctx context.Context, logStats *tabletenv.LogStats, sql string, skipQueryPlanCache bool) (*TabletPlan, error) { span, ctx := trace.NewSpan(ctx, "QueryEngine.GetPlan") defer span.Finish() if plan := qe.getQuery(sql); plan != nil { return plan, nil } // Obtain read lock to prevent s...
[ "func", "(", "qe", "*", "QueryEngine", ")", "GetPlan", "(", "ctx", "context", ".", "Context", ",", "logStats", "*", "tabletenv", ".", "LogStats", ",", "sql", "string", ",", "skipQueryPlanCache", "bool", ")", "(", "*", "TabletPlan", ",", "error", ")", "{"...
// GetPlan returns the TabletPlan that for the query. Plans are cached in a cache.LRUCache.
[ "GetPlan", "returns", "the", "TabletPlan", "that", "for", "the", "query", ".", "Plans", "are", "cached", "in", "a", "cache", ".", "LRUCache", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_engine.go#L319-L370
train
vitessio/vitess
go/vt/vttablet/tabletserver/query_engine.go
getQueryConn
func (qe *QueryEngine) getQueryConn(ctx context.Context) (*connpool.DBConn, error) { waiterCount := qe.queryPoolWaiters.Add(1) defer qe.queryPoolWaiters.Add(-1) if waiterCount > qe.queryPoolWaiterCap.Get() { return nil, vterrors.New(vtrpcpb.Code_RESOURCE_EXHAUSTED, "query pool waiter count exceeded") } timeout...
go
func (qe *QueryEngine) getQueryConn(ctx context.Context) (*connpool.DBConn, error) { waiterCount := qe.queryPoolWaiters.Add(1) defer qe.queryPoolWaiters.Add(-1) if waiterCount > qe.queryPoolWaiterCap.Get() { return nil, vterrors.New(vtrpcpb.Code_RESOURCE_EXHAUSTED, "query pool waiter count exceeded") } timeout...
[ "func", "(", "qe", "*", "QueryEngine", ")", "getQueryConn", "(", "ctx", "context", ".", "Context", ")", "(", "*", "connpool", ".", "DBConn", ",", "error", ")", "{", "waiterCount", ":=", "qe", ".", "queryPoolWaiters", ".", "Add", "(", "1", ")", "\n", ...
// getQueryConn returns a connection from the query pool using either // the conn pool timeout if configured, or the original context query timeout
[ "getQueryConn", "returns", "a", "connection", "from", "the", "query", "pool", "using", "either", "the", "conn", "pool", "timeout", "if", "configured", "or", "the", "original", "context", "query", "timeout" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_engine.go#L374-L393
train
vitessio/vitess
go/vt/vttablet/tabletserver/query_engine.go
GetStreamPlan
func (qe *QueryEngine) GetStreamPlan(sql string) (*TabletPlan, error) { qe.mu.RLock() defer qe.mu.RUnlock() splan, err := planbuilder.BuildStreaming(sql, qe.tables) if err != nil { return nil, err } plan := &TabletPlan{Plan: splan} plan.Rules = qe.queryRuleSources.FilterByPlan(sql, plan.PlanID, plan.TableName(...
go
func (qe *QueryEngine) GetStreamPlan(sql string) (*TabletPlan, error) { qe.mu.RLock() defer qe.mu.RUnlock() splan, err := planbuilder.BuildStreaming(sql, qe.tables) if err != nil { return nil, err } plan := &TabletPlan{Plan: splan} plan.Rules = qe.queryRuleSources.FilterByPlan(sql, plan.PlanID, plan.TableName(...
[ "func", "(", "qe", "*", "QueryEngine", ")", "GetStreamPlan", "(", "sql", "string", ")", "(", "*", "TabletPlan", ",", "error", ")", "{", "qe", ".", "mu", ".", "RLock", "(", ")", "\n", "defer", "qe", ".", "mu", ".", "RUnlock", "(", ")", "\n", "spla...
// GetStreamPlan is similar to GetPlan, but doesn't use the cache // and doesn't enforce a limit. It just returns the parsed query.
[ "GetStreamPlan", "is", "similar", "to", "GetPlan", "but", "doesn", "t", "use", "the", "cache", "and", "doesn", "t", "enforce", "a", "limit", ".", "It", "just", "returns", "the", "parsed", "query", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_engine.go#L397-L408
train
vitessio/vitess
go/vt/vttablet/tabletserver/query_engine.go
GetMessageStreamPlan
func (qe *QueryEngine) GetMessageStreamPlan(name string) (*TabletPlan, error) { qe.mu.RLock() defer qe.mu.RUnlock() splan, err := planbuilder.BuildMessageStreaming(name, qe.tables) if err != nil { return nil, err } plan := &TabletPlan{Plan: splan} plan.Rules = qe.queryRuleSources.FilterByPlan("stream from "+na...
go
func (qe *QueryEngine) GetMessageStreamPlan(name string) (*TabletPlan, error) { qe.mu.RLock() defer qe.mu.RUnlock() splan, err := planbuilder.BuildMessageStreaming(name, qe.tables) if err != nil { return nil, err } plan := &TabletPlan{Plan: splan} plan.Rules = qe.queryRuleSources.FilterByPlan("stream from "+na...
[ "func", "(", "qe", "*", "QueryEngine", ")", "GetMessageStreamPlan", "(", "name", "string", ")", "(", "*", "TabletPlan", ",", "error", ")", "{", "qe", ".", "mu", ".", "RLock", "(", ")", "\n", "defer", "qe", ".", "mu", ".", "RUnlock", "(", ")", "\n",...
// GetMessageStreamPlan builds a plan for Message streaming.
[ "GetMessageStreamPlan", "builds", "a", "plan", "for", "Message", "streaming", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_engine.go#L411-L422
train
vitessio/vitess
go/vt/vttablet/tabletserver/query_engine.go
IsMySQLReachable
func (qe *QueryEngine) IsMySQLReachable() bool { conn, err := dbconnpool.NewDBConnection(qe.dbconfigs.AppWithDB(), tabletenv.MySQLStats) if err != nil { if mysql.IsConnErr(err) { return false } log.Warningf("checking MySQL, unexpected error: %v", err) return true } conn.Close() return true }
go
func (qe *QueryEngine) IsMySQLReachable() bool { conn, err := dbconnpool.NewDBConnection(qe.dbconfigs.AppWithDB(), tabletenv.MySQLStats) if err != nil { if mysql.IsConnErr(err) { return false } log.Warningf("checking MySQL, unexpected error: %v", err) return true } conn.Close() return true }
[ "func", "(", "qe", "*", "QueryEngine", ")", "IsMySQLReachable", "(", ")", "bool", "{", "conn", ",", "err", ":=", "dbconnpool", ".", "NewDBConnection", "(", "qe", ".", "dbconfigs", ".", "AppWithDB", "(", ")", ",", "tabletenv", ".", "MySQLStats", ")", "\n"...
// IsMySQLReachable returns true if we can connect to MySQL.
[ "IsMySQLReachable", "returns", "true", "if", "we", "can", "connect", "to", "MySQL", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_engine.go#L430-L441
train
vitessio/vitess
go/vt/vttablet/tabletserver/query_engine.go
getQuery
func (qe *QueryEngine) getQuery(sql string) *TabletPlan { if cacheResult, ok := qe.plans.Get(sql); ok { return cacheResult.(*TabletPlan) } return nil }
go
func (qe *QueryEngine) getQuery(sql string) *TabletPlan { if cacheResult, ok := qe.plans.Get(sql); ok { return cacheResult.(*TabletPlan) } return nil }
[ "func", "(", "qe", "*", "QueryEngine", ")", "getQuery", "(", "sql", "string", ")", "*", "TabletPlan", "{", "if", "cacheResult", ",", "ok", ":=", "qe", ".", "plans", ".", "Get", "(", "sql", ")", ";", "ok", "{", "return", "cacheResult", ".", "(", "*"...
// getQuery fetches the plan and makes it the most recent.
[ "getQuery", "fetches", "the", "plan", "and", "makes", "it", "the", "most", "recent", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_engine.go#L453-L458
train
vitessio/vitess
go/vt/vttablet/tabletserver/query_engine.go
peekQuery
func (qe *QueryEngine) peekQuery(sql string) *TabletPlan { if cacheResult, ok := qe.plans.Peek(sql); ok { return cacheResult.(*TabletPlan) } return nil }
go
func (qe *QueryEngine) peekQuery(sql string) *TabletPlan { if cacheResult, ok := qe.plans.Peek(sql); ok { return cacheResult.(*TabletPlan) } return nil }
[ "func", "(", "qe", "*", "QueryEngine", ")", "peekQuery", "(", "sql", "string", ")", "*", "TabletPlan", "{", "if", "cacheResult", ",", "ok", ":=", "qe", ".", "plans", ".", "Peek", "(", "sql", ")", ";", "ok", "{", "return", "cacheResult", ".", "(", "...
// peekQuery fetches the plan without changing the LRU order.
[ "peekQuery", "fetches", "the", "plan", "without", "changing", "the", "LRU", "order", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_engine.go#L461-L466
train
vitessio/vitess
go/vt/vttablet/tabletserver/query_engine.go
SetQueryPlanCacheCap
func (qe *QueryEngine) SetQueryPlanCacheCap(size int) { if size <= 0 { size = 1 } qe.plans.SetCapacity(int64(size)) }
go
func (qe *QueryEngine) SetQueryPlanCacheCap(size int) { if size <= 0 { size = 1 } qe.plans.SetCapacity(int64(size)) }
[ "func", "(", "qe", "*", "QueryEngine", ")", "SetQueryPlanCacheCap", "(", "size", "int", ")", "{", "if", "size", "<=", "0", "{", "size", "=", "1", "\n", "}", "\n", "qe", ".", "plans", ".", "SetCapacity", "(", "int64", "(", "size", ")", ")", "\n", ...
// SetQueryPlanCacheCap sets the query plan cache capacity.
[ "SetQueryPlanCacheCap", "sets", "the", "query", "plan", "cache", "capacity", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_engine.go#L469-L474
train
vitessio/vitess
go/vt/vttablet/tabletserver/query_engine.go
AddStats
func (qe *QueryEngine) AddStats(planName, tableName string, queryCount int64, duration, mysqlTime time.Duration, rowCount, errorCount int64) { key := tableName + "." + planName qe.queryStatsMu.RLock() stats, ok := qe.queryStats[key] qe.queryStatsMu.RUnlock() if !ok { // Check again with the write lock held and...
go
func (qe *QueryEngine) AddStats(planName, tableName string, queryCount int64, duration, mysqlTime time.Duration, rowCount, errorCount int64) { key := tableName + "." + planName qe.queryStatsMu.RLock() stats, ok := qe.queryStats[key] qe.queryStatsMu.RUnlock() if !ok { // Check again with the write lock held and...
[ "func", "(", "qe", "*", "QueryEngine", ")", "AddStats", "(", "planName", ",", "tableName", "string", ",", "queryCount", "int64", ",", "duration", ",", "mysqlTime", "time", ".", "Duration", ",", "rowCount", ",", "errorCount", "int64", ")", "{", "key", ":=",...
// AddStats adds the given stats for the planName.tableName
[ "AddStats", "adds", "the", "given", "stats", "for", "the", "planName", ".", "tableName" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_engine.go#L492-L517
train
vitessio/vitess
go/vt/mysqlctl/s3backupstorage/s3.go
AddFile
func (bh *S3BackupHandle) AddFile(ctx context.Context, filename string, filesize int64) (io.WriteCloser, error) { if bh.readOnly { return nil, fmt.Errorf("AddFile cannot be called on read-only backup") } // Calculate s3 upload part size using the source filesize partSizeBytes := s3manager.DefaultUploadPartSize ...
go
func (bh *S3BackupHandle) AddFile(ctx context.Context, filename string, filesize int64) (io.WriteCloser, error) { if bh.readOnly { return nil, fmt.Errorf("AddFile cannot be called on read-only backup") } // Calculate s3 upload part size using the source filesize partSizeBytes := s3manager.DefaultUploadPartSize ...
[ "func", "(", "bh", "*", "S3BackupHandle", ")", "AddFile", "(", "ctx", "context", ".", "Context", ",", "filename", "string", ",", "filesize", "int64", ")", "(", "io", ".", "WriteCloser", ",", "error", ")", "{", "if", "bh", ".", "readOnly", "{", "return"...
// AddFile is part of the backupstorage.BackupHandle interface.
[ "AddFile", "is", "part", "of", "the", "backupstorage", ".", "BackupHandle", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/s3backupstorage/s3.go#L103-L146
train
vitessio/vitess
go/vt/mysqlctl/s3backupstorage/s3.go
EndBackup
func (bh *S3BackupHandle) EndBackup(ctx context.Context) error { if bh.readOnly { return fmt.Errorf("EndBackup cannot be called on read-only backup") } bh.waitGroup.Wait() return bh.errors.Error() }
go
func (bh *S3BackupHandle) EndBackup(ctx context.Context) error { if bh.readOnly { return fmt.Errorf("EndBackup cannot be called on read-only backup") } bh.waitGroup.Wait() return bh.errors.Error() }
[ "func", "(", "bh", "*", "S3BackupHandle", ")", "EndBackup", "(", "ctx", "context", ".", "Context", ")", "error", "{", "if", "bh", ".", "readOnly", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "bh", ".", "waitGroup", "...
// EndBackup is part of the backupstorage.BackupHandle interface.
[ "EndBackup", "is", "part", "of", "the", "backupstorage", ".", "BackupHandle", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/s3backupstorage/s3.go#L149-L155
train
vitessio/vitess
go/vt/mysqlctl/s3backupstorage/s3.go
ReadFile
func (bh *S3BackupHandle) ReadFile(ctx context.Context, filename string) (io.ReadCloser, error) { if !bh.readOnly { return nil, fmt.Errorf("ReadFile cannot be called on read-write backup") } object := objName(bh.dir, bh.name, filename) out, err := bh.client.GetObject(&s3.GetObjectInput{ Bucket: bucket, Key: ...
go
func (bh *S3BackupHandle) ReadFile(ctx context.Context, filename string) (io.ReadCloser, error) { if !bh.readOnly { return nil, fmt.Errorf("ReadFile cannot be called on read-write backup") } object := objName(bh.dir, bh.name, filename) out, err := bh.client.GetObject(&s3.GetObjectInput{ Bucket: bucket, Key: ...
[ "func", "(", "bh", "*", "S3BackupHandle", ")", "ReadFile", "(", "ctx", "context", ".", "Context", ",", "filename", "string", ")", "(", "io", ".", "ReadCloser", ",", "error", ")", "{", "if", "!", "bh", ".", "readOnly", "{", "return", "nil", ",", "fmt"...
// ReadFile is part of the backupstorage.BackupHandle interface.
[ "ReadFile", "is", "part", "of", "the", "backupstorage", ".", "BackupHandle", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/s3backupstorage/s3.go#L166-L179
train
vitessio/vitess
go/vt/mysqlctl/s3backupstorage/s3.go
ListBackups
func (bs *S3BackupStorage) ListBackups(ctx context.Context, dir string) ([]backupstorage.BackupHandle, error) { log.Infof("ListBackups: [s3] dir: %v, bucket: %v", dir, *bucket) c, err := bs.client() if err != nil { return nil, err } searchPrefix := objName(dir, "") query := &s3.ListObjectsV2Input{ Bucket: ...
go
func (bs *S3BackupStorage) ListBackups(ctx context.Context, dir string) ([]backupstorage.BackupHandle, error) { log.Infof("ListBackups: [s3] dir: %v, bucket: %v", dir, *bucket) c, err := bs.client() if err != nil { return nil, err } searchPrefix := objName(dir, "") query := &s3.ListObjectsV2Input{ Bucket: ...
[ "func", "(", "bs", "*", "S3BackupStorage", ")", "ListBackups", "(", "ctx", "context", ".", "Context", ",", "dir", "string", ")", "(", "[", "]", "backupstorage", ".", "BackupHandle", ",", "error", ")", "{", "log", ".", "Infof", "(", "\"", "\"", ",", "...
// ListBackups is part of the backupstorage.BackupStorage interface.
[ "ListBackups", "is", "part", "of", "the", "backupstorage", ".", "BackupStorage", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/s3backupstorage/s3.go#L190-L236
train
vitessio/vitess
go/vt/mysqlctl/s3backupstorage/s3.go
StartBackup
func (bs *S3BackupStorage) StartBackup(ctx context.Context, dir, name string) (backupstorage.BackupHandle, error) { log.Infof("StartBackup: [s3] dir: %v, name: %v, bucket: %v", dir, name, *bucket) c, err := bs.client() if err != nil { return nil, err } return &S3BackupHandle{ client: c, bs: bs, di...
go
func (bs *S3BackupStorage) StartBackup(ctx context.Context, dir, name string) (backupstorage.BackupHandle, error) { log.Infof("StartBackup: [s3] dir: %v, name: %v, bucket: %v", dir, name, *bucket) c, err := bs.client() if err != nil { return nil, err } return &S3BackupHandle{ client: c, bs: bs, di...
[ "func", "(", "bs", "*", "S3BackupStorage", ")", "StartBackup", "(", "ctx", "context", ".", "Context", ",", "dir", ",", "name", "string", ")", "(", "backupstorage", ".", "BackupHandle", ",", "error", ")", "{", "log", ".", "Infof", "(", "\"", "\"", ",", ...
// StartBackup is part of the backupstorage.BackupStorage interface.
[ "StartBackup", "is", "part", "of", "the", "backupstorage", ".", "BackupStorage", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/s3backupstorage/s3.go#L239-L253
train
vitessio/vitess
go/vt/mysqlctl/s3backupstorage/s3.go
RemoveBackup
func (bs *S3BackupStorage) RemoveBackup(ctx context.Context, dir, name string) error { log.Infof("RemoveBackup: [s3] dir: %v, name: %v, bucket: %v", dir, name, *bucket) c, err := bs.client() if err != nil { return err } query := &s3.ListObjectsV2Input{ Bucket: bucket, Prefix: objName(dir, name), } for {...
go
func (bs *S3BackupStorage) RemoveBackup(ctx context.Context, dir, name string) error { log.Infof("RemoveBackup: [s3] dir: %v, name: %v, bucket: %v", dir, name, *bucket) c, err := bs.client() if err != nil { return err } query := &s3.ListObjectsV2Input{ Bucket: bucket, Prefix: objName(dir, name), } for {...
[ "func", "(", "bs", "*", "S3BackupStorage", ")", "RemoveBackup", "(", "ctx", "context", ".", "Context", ",", "dir", ",", "name", "string", ")", "error", "{", "log", ".", "Infof", "(", "\"", "\"", ",", "dir", ",", "name", ",", "*", "bucket", ")", "\n...
// RemoveBackup is part of the backupstorage.BackupStorage interface.
[ "RemoveBackup", "is", "part", "of", "the", "backupstorage", ".", "BackupStorage", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/s3backupstorage/s3.go#L256-L307
train
vitessio/vitess
go/vt/mysqlctl/s3backupstorage/s3.go
getLogLevel
func getLogLevel() *aws.LogLevelType { l := new(aws.LogLevelType) *l = aws.LogOff // default setting if level, found := logNameMap[*requiredLogLevel]; found { *l = level // adjust as required } return l }
go
func getLogLevel() *aws.LogLevelType { l := new(aws.LogLevelType) *l = aws.LogOff // default setting if level, found := logNameMap[*requiredLogLevel]; found { *l = level // adjust as required } return l }
[ "func", "getLogLevel", "(", ")", "*", "aws", ".", "LogLevelType", "{", "l", ":=", "new", "(", "aws", ".", "LogLevelType", ")", "\n", "*", "l", "=", "aws", ".", "LogOff", "// default setting", "\n", "if", "level", ",", "found", ":=", "logNameMap", "[", ...
// getLogLevel converts the string loglevel to an aws.LogLevelType
[ "getLogLevel", "converts", "the", "string", "loglevel", "to", "an", "aws", ".", "LogLevelType" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/s3backupstorage/s3.go#L320-L327
train
vitessio/vitess
go/vt/worker/executor.go
fetchLoop
func (e *executor) fetchLoop(ctx context.Context, insertChannel chan string) error { for { select { case cmd, ok := <-insertChannel: if !ok { // no more to read, we're done return nil } if err := e.fetchWithRetries(ctx, func(ctx context.Context, tablet *topodatapb.Tablet) error { _, err := e.w...
go
func (e *executor) fetchLoop(ctx context.Context, insertChannel chan string) error { for { select { case cmd, ok := <-insertChannel: if !ok { // no more to read, we're done return nil } if err := e.fetchWithRetries(ctx, func(ctx context.Context, tablet *topodatapb.Tablet) error { _, err := e.w...
[ "func", "(", "e", "*", "executor", ")", "fetchLoop", "(", "ctx", "context", ".", "Context", ",", "insertChannel", "chan", "string", ")", "error", "{", "for", "{", "select", "{", "case", "cmd", ",", "ok", ":=", "<-", "insertChannel", ":", "if", "!", "...
// fetchLoop loops over the provided insertChannel and sends the commands to the // current master.
[ "fetchLoop", "loops", "over", "the", "provided", "insertChannel", "and", "sends", "the", "commands", "to", "the", "current", "master", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/executor.go#L68-L89
train
vitessio/vitess
go/vt/worker/executor.go
checkError
func (e *executor) checkError(ctx context.Context, err error, isRetry bool, master *discovery.TabletStats) (bool, error) { tabletString := fmt.Sprintf("%v (%v/%v)", topoproto.TabletAliasString(master.Tablet.Alias), e.keyspace, e.shard) // first see if it was a context timeout. select { case <-ctx.Done(): if ctx....
go
func (e *executor) checkError(ctx context.Context, err error, isRetry bool, master *discovery.TabletStats) (bool, error) { tabletString := fmt.Sprintf("%v (%v/%v)", topoproto.TabletAliasString(master.Tablet.Alias), e.keyspace, e.shard) // first see if it was a context timeout. select { case <-ctx.Done(): if ctx....
[ "func", "(", "e", "*", "executor", ")", "checkError", "(", "ctx", "context", ".", "Context", ",", "err", "error", ",", "isRetry", "bool", ",", "master", "*", "discovery", ".", "TabletStats", ")", "(", "bool", ",", "error", ")", "{", "tabletString", ":=...
// checkError returns true if the error can be ignored and the command // succeeded, false if the error is retryable and a non-nil error if the // command must not be retried.
[ "checkError", "returns", "true", "if", "the", "error", "can", "be", "ignored", "and", "the", "command", "succeeded", "false", "if", "the", "error", "is", "retryable", "and", "a", "non", "-", "nil", "error", "if", "the", "command", "must", "not", "be", "r...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/executor.go#L197-L248
train
vitessio/vitess
go/vt/status/status.go
MakeVtctldRedirect
func MakeVtctldRedirect(text string, q map[string]string) template.HTML { query := url.Values{} for k, v := range q { query.Set(k, v) } url := "explorers/redirect" + "?" + query.Encode() return VtctldLink(text, url) }
go
func MakeVtctldRedirect(text string, q map[string]string) template.HTML { query := url.Values{} for k, v := range q { query.Set(k, v) } url := "explorers/redirect" + "?" + query.Encode() return VtctldLink(text, url) }
[ "func", "MakeVtctldRedirect", "(", "text", "string", ",", "q", "map", "[", "string", "]", "string", ")", "template", ".", "HTML", "{", "query", ":=", "url", ".", "Values", "{", "}", "\n", "for", "k", ",", "v", ":=", "range", "q", "{", "query", ".",...
// MakeVtctldRedirect returns an absolute vtctld url that will // redirect to the page for the topology object specified in q.
[ "MakeVtctldRedirect", "returns", "an", "absolute", "vtctld", "url", "that", "will", "redirect", "to", "the", "page", "for", "the", "topology", "object", "specified", "in", "q", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/status/status.go#L37-L44
train
vitessio/vitess
go/vt/status/status.go
VtctldLink
func VtctldLink(text, urlPath string) template.HTML { if *vtctldAddr == "" { return template.HTML(text) } var fullURL string if strings.HasSuffix(*vtctldAddr, "/") { fullURL = *vtctldAddr + urlPath } else { fullURL = *vtctldAddr + "/" + urlPath } return template.HTML(fmt.Sprintf(`<a href="%v">%v</a>`, ful...
go
func VtctldLink(text, urlPath string) template.HTML { if *vtctldAddr == "" { return template.HTML(text) } var fullURL string if strings.HasSuffix(*vtctldAddr, "/") { fullURL = *vtctldAddr + urlPath } else { fullURL = *vtctldAddr + "/" + urlPath } return template.HTML(fmt.Sprintf(`<a href="%v">%v</a>`, ful...
[ "func", "VtctldLink", "(", "text", ",", "urlPath", "string", ")", "template", ".", "HTML", "{", "if", "*", "vtctldAddr", "==", "\"", "\"", "{", "return", "template", ".", "HTML", "(", "text", ")", "\n", "}", "\n", "var", "fullURL", "string", "\n", "i...
// VtctldLink returns the HTML to display a link to the fully // qualified vtctld url whose path is given as parameter. // If no vtctld_addr flag was passed in, we just return the text with no link.
[ "VtctldLink", "returns", "the", "HTML", "to", "display", "a", "link", "to", "the", "fully", "qualified", "vtctld", "url", "whose", "path", "is", "given", "as", "parameter", ".", "If", "no", "vtctld_addr", "flag", "was", "passed", "in", "we", "just", "retur...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/status/status.go#L49-L61
train
vitessio/vitess
go/vt/status/status.go
VtctldKeyspace
func VtctldKeyspace(keyspace string) template.HTML { return MakeVtctldRedirect(keyspace, map[string]string{ "type": "keyspace", "keyspace": keyspace, }) }
go
func VtctldKeyspace(keyspace string) template.HTML { return MakeVtctldRedirect(keyspace, map[string]string{ "type": "keyspace", "keyspace": keyspace, }) }
[ "func", "VtctldKeyspace", "(", "keyspace", "string", ")", "template", ".", "HTML", "{", "return", "MakeVtctldRedirect", "(", "keyspace", ",", "map", "[", "string", "]", "string", "{", "\"", "\"", ":", "\"", "\"", ",", "\"", "\"", ":", "keyspace", ",", ...
// VtctldKeyspace returns the keyspace name, possibly linked to the // keyspace page in vtctld.
[ "VtctldKeyspace", "returns", "the", "keyspace", "name", "possibly", "linked", "to", "the", "keyspace", "page", "in", "vtctld", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/status/status.go#L65-L71
train
vitessio/vitess
go/vt/status/status.go
VtctldShard
func VtctldShard(keyspace, shard string) template.HTML { return MakeVtctldRedirect(shard, map[string]string{ "type": "shard", "keyspace": keyspace, "shard": shard, }) }
go
func VtctldShard(keyspace, shard string) template.HTML { return MakeVtctldRedirect(shard, map[string]string{ "type": "shard", "keyspace": keyspace, "shard": shard, }) }
[ "func", "VtctldShard", "(", "keyspace", ",", "shard", "string", ")", "template", ".", "HTML", "{", "return", "MakeVtctldRedirect", "(", "shard", ",", "map", "[", "string", "]", "string", "{", "\"", "\"", ":", "\"", "\"", ",", "\"", "\"", ":", "keyspace...
// VtctldShard returns the shard name, possibly linked to the shard // page in vtctld.
[ "VtctldShard", "returns", "the", "shard", "name", "possibly", "linked", "to", "the", "shard", "page", "in", "vtctld", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/status/status.go#L75-L81
train
vitessio/vitess
go/vt/status/status.go
VtctldSrvKeyspace
func VtctldSrvKeyspace(cell, keyspace string) template.HTML { return MakeVtctldRedirect(keyspace, map[string]string{ "type": "srv_keyspace", "cell": cell, "keyspace": keyspace, }) }
go
func VtctldSrvKeyspace(cell, keyspace string) template.HTML { return MakeVtctldRedirect(keyspace, map[string]string{ "type": "srv_keyspace", "cell": cell, "keyspace": keyspace, }) }
[ "func", "VtctldSrvKeyspace", "(", "cell", ",", "keyspace", "string", ")", "template", ".", "HTML", "{", "return", "MakeVtctldRedirect", "(", "keyspace", ",", "map", "[", "string", "]", "string", "{", "\"", "\"", ":", "\"", "\"", ",", "\"", "\"", ":", "...
// VtctldSrvKeyspace returns the keyspace name, possibly linked to the // SrvKeyspace page in vtctld.
[ "VtctldSrvKeyspace", "returns", "the", "keyspace", "name", "possibly", "linked", "to", "the", "SrvKeyspace", "page", "in", "vtctld", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/status/status.go#L91-L97
train
vitessio/vitess
go/vt/status/status.go
VtctldTablet
func VtctldTablet(aliasName string) template.HTML { return MakeVtctldRedirect(aliasName, map[string]string{ "type": "tablet", "alias": aliasName, }) }
go
func VtctldTablet(aliasName string) template.HTML { return MakeVtctldRedirect(aliasName, map[string]string{ "type": "tablet", "alias": aliasName, }) }
[ "func", "VtctldTablet", "(", "aliasName", "string", ")", "template", ".", "HTML", "{", "return", "MakeVtctldRedirect", "(", "aliasName", ",", "map", "[", "string", "]", "string", "{", "\"", "\"", ":", "\"", "\"", ",", "\"", "\"", ":", "aliasName", ",", ...
// VtctldTablet returns the tablet alias, possibly linked to the // Tablet page in vtctld.
[ "VtctldTablet", "returns", "the", "tablet", "alias", "possibly", "linked", "to", "the", "Tablet", "page", "in", "vtctld", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/status/status.go#L113-L118
train
vitessio/vitess
go/stats/opentsdb/opentsdb.go
sendDataPoints
func sendDataPoints(data []dataPoint) error { json, err := json.Marshal(data) if err != nil { return err } resp, err := http.Post(*openTsdbURI, "application/json", bytes.NewReader(json)) if err != nil { return err } resp.Body.Close() return nil }
go
func sendDataPoints(data []dataPoint) error { json, err := json.Marshal(data) if err != nil { return err } resp, err := http.Post(*openTsdbURI, "application/json", bytes.NewReader(json)) if err != nil { return err } resp.Body.Close() return nil }
[ "func", "sendDataPoints", "(", "data", "[", "]", "dataPoint", ")", "error", "{", "json", ",", "err", ":=", "json", ".", "Marshal", "(", "data", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "resp", ",", "err", ":=", ...
// sendDataPoints pushes a list of data points to openTSDB. // All other code in this file is just to support getting this function called // with all stats represented as data points.
[ "sendDataPoints", "pushes", "a", "list", "of", "data", "points", "to", "openTSDB", ".", "All", "other", "code", "in", "this", "file", "is", "just", "to", "support", "getting", "this", "function", "called", "with", "all", "stats", "represented", "as", "data",...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/opentsdb/opentsdb.go#L36-L48
train
vitessio/vitess
go/stats/opentsdb/opentsdb.go
Init
func Init(prefix string) { // Needs to happen in servenv.OnRun() instead of init because it requires flag parsing and logging servenv.OnRun(func() { if *openTsdbURI == "" { return } backend := &openTSDBBackend{ prefix: prefix, // If you want to global service values like host, service name, git revisi...
go
func Init(prefix string) { // Needs to happen in servenv.OnRun() instead of init because it requires flag parsing and logging servenv.OnRun(func() { if *openTsdbURI == "" { return } backend := &openTSDBBackend{ prefix: prefix, // If you want to global service values like host, service name, git revisi...
[ "func", "Init", "(", "prefix", "string", ")", "{", "// Needs to happen in servenv.OnRun() instead of init because it requires flag parsing and logging", "servenv", ".", "OnRun", "(", "func", "(", ")", "{", "if", "*", "openTsdbURI", "==", "\"", "\"", "{", "return", "\n...
// Init attempts to create a singleton openTSDBBackend and register it as a PushBackend. // If it fails to create one, this is a noop. The prefix argument is an optional string // to prepend to the name of every data point reported.
[ "Init", "attempts", "to", "create", "a", "singleton", "openTSDBBackend", "and", "register", "it", "as", "a", "PushBackend", ".", "If", "it", "fails", "to", "create", "one", "this", "is", "a", "noop", ".", "The", "prefix", "argument", "is", "an", "optional"...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/opentsdb/opentsdb.go#L71-L99
train
vitessio/vitess
go/stats/opentsdb/opentsdb.go
makeLabel
func makeLabel(labelName string, labelVal string) map[string]string { return map[string]string{labelName: labelVal} }
go
func makeLabel(labelName string, labelVal string) map[string]string { return map[string]string{labelName: labelVal} }
[ "func", "makeLabel", "(", "labelName", "string", ",", "labelVal", "string", ")", "map", "[", "string", "]", "string", "{", "return", "map", "[", "string", "]", "string", "{", "labelName", ":", "labelVal", "}", "\n", "}" ]
// makeLabel builds a tag list with a single label + value.
[ "makeLabel", "builds", "a", "tag", "list", "with", "a", "single", "label", "+", "value", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/opentsdb/opentsdb.go#L242-L244
train
vitessio/vitess
go/stats/opentsdb/opentsdb.go
addUnrecognizedExpvars
func (dc *dataCollector) addUnrecognizedExpvars(prefix string, obj map[string]interface{}) { for k, v := range obj { prefix := combineMetricName(prefix, k) switch v := v.(type) { case map[string]interface{}: dc.addUnrecognizedExpvars(prefix, v) case float64: dc.addFloat(prefix, v, nil) } } }
go
func (dc *dataCollector) addUnrecognizedExpvars(prefix string, obj map[string]interface{}) { for k, v := range obj { prefix := combineMetricName(prefix, k) switch v := v.(type) { case map[string]interface{}: dc.addUnrecognizedExpvars(prefix, v) case float64: dc.addFloat(prefix, v, nil) } } }
[ "func", "(", "dc", "*", "dataCollector", ")", "addUnrecognizedExpvars", "(", "prefix", "string", ",", "obj", "map", "[", "string", "]", "interface", "{", "}", ")", "{", "for", "k", ",", "v", ":=", "range", "obj", "{", "prefix", ":=", "combineMetricName",...
// addUnrecognizedExpvars recurses into a json object to pull out float64 variables to report.
[ "addUnrecognizedExpvars", "recurses", "into", "a", "json", "object", "to", "pull", "out", "float64", "variables", "to", "report", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/opentsdb/opentsdb.go#L258-L268
train
vitessio/vitess
go/stats/opentsdb/opentsdb.go
addTimings
func (dc *dataCollector) addTimings(labels []string, timings *stats.Timings, prefix string) { histograms := timings.Histograms() for labelValsCombined, histogram := range histograms { // If you prefer millisecond timings over nanoseconds you can pass 1000000 here instead of 1. dc.addHistogram(histogram, 1, prefix...
go
func (dc *dataCollector) addTimings(labels []string, timings *stats.Timings, prefix string) { histograms := timings.Histograms() for labelValsCombined, histogram := range histograms { // If you prefer millisecond timings over nanoseconds you can pass 1000000 here instead of 1. dc.addHistogram(histogram, 1, prefix...
[ "func", "(", "dc", "*", "dataCollector", ")", "addTimings", "(", "labels", "[", "]", "string", ",", "timings", "*", "stats", ".", "Timings", ",", "prefix", "string", ")", "{", "histograms", ":=", "timings", ".", "Histograms", "(", ")", "\n", "for", "la...
// addTimings converts a vitess Timings stat to something opentsdb can deal with.
[ "addTimings", "converts", "a", "vitess", "Timings", "stat", "to", "something", "opentsdb", "can", "deal", "with", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/opentsdb/opentsdb.go#L271-L277
train