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/tabletserver/replication_watcher.go
EventToken
func (rpw *ReplicationWatcher) EventToken() *querypb.EventToken { rpw.mu.Lock() defer rpw.mu.Unlock() return rpw.eventToken }
go
func (rpw *ReplicationWatcher) EventToken() *querypb.EventToken { rpw.mu.Lock() defer rpw.mu.Unlock() return rpw.eventToken }
[ "func", "(", "rpw", "*", "ReplicationWatcher", ")", "EventToken", "(", ")", "*", "querypb", ".", "EventToken", "{", "rpw", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "rpw", ".", "mu", ".", "Unlock", "(", ")", "\n", "return", "rpw", ".", "even...
// EventToken returns the current event token.
[ "EventToken", "returns", "the", "current", "event", "token", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/replication_watcher.go#L194-L198
train
vitessio/vitess
go/vt/vttablet/tabletserver/vstreamer/planbuilder.go
fields
func (plan *Plan) fields() []*querypb.Field { fields := make([]*querypb.Field, len(plan.ColExprs)) for i, ce := range plan.ColExprs { fields[i] = &querypb.Field{ Name: ce.Alias.String(), Type: ce.Type, } } return fields }
go
func (plan *Plan) fields() []*querypb.Field { fields := make([]*querypb.Field, len(plan.ColExprs)) for i, ce := range plan.ColExprs { fields[i] = &querypb.Field{ Name: ce.Alias.String(), Type: ce.Type, } } return fields }
[ "func", "(", "plan", "*", "Plan", ")", "fields", "(", ")", "[", "]", "*", "querypb", ".", "Field", "{", "fields", ":=", "make", "(", "[", "]", "*", "querypb", ".", "Field", ",", "len", "(", "plan", ".", "ColExprs", ")", ")", "\n", "for", "i", ...
// fields returns the fields for the plan.
[ "fields", "returns", "the", "fields", "for", "the", "plan", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/vstreamer/planbuilder.go#L59-L68
train
vitessio/vitess
go/vt/vttablet/tabletserver/vstreamer/planbuilder.go
filter
func (plan *Plan) filter(values []sqltypes.Value) (bool, []sqltypes.Value, error) { result := make([]sqltypes.Value, len(plan.ColExprs)) for i, colExpr := range plan.ColExprs { result[i] = values[colExpr.ColNum] } if plan.Vindex == nil { return true, result, nil } // Filter by Vindex. destinations, err := p...
go
func (plan *Plan) filter(values []sqltypes.Value) (bool, []sqltypes.Value, error) { result := make([]sqltypes.Value, len(plan.ColExprs)) for i, colExpr := range plan.ColExprs { result[i] = values[colExpr.ColNum] } if plan.Vindex == nil { return true, result, nil } // Filter by Vindex. destinations, err := p...
[ "func", "(", "plan", "*", "Plan", ")", "filter", "(", "values", "[", "]", "sqltypes", ".", "Value", ")", "(", "bool", ",", "[", "]", "sqltypes", ".", "Value", ",", "error", ")", "{", "result", ":=", "make", "(", "[", "]", "sqltypes", ".", "Value"...
// filter filters the row against the plan. It returns false if the row did not match. // If the row matched, it returns the columns to be sent.
[ "filter", "filters", "the", "row", "against", "the", "plan", ".", "It", "returns", "false", "if", "the", "row", "did", "not", "match", ".", "If", "the", "row", "matched", "it", "returns", "the", "columns", "to", "be", "sent", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/vstreamer/planbuilder.go#L72-L97
train
vitessio/vitess
go/sync2/consolidator.go
Create
func (co *Consolidator) Create(query string) (r *Result, created bool) { co.mu.Lock() defer co.mu.Unlock() if r, ok := co.queries[query]; ok { return r, false } r = &Result{consolidator: co, query: query} r.executing.Lock() co.queries[query] = r return r, true }
go
func (co *Consolidator) Create(query string) (r *Result, created bool) { co.mu.Lock() defer co.mu.Unlock() if r, ok := co.queries[query]; ok { return r, false } r = &Result{consolidator: co, query: query} r.executing.Lock() co.queries[query] = r return r, true }
[ "func", "(", "co", "*", "Consolidator", ")", "Create", "(", "query", "string", ")", "(", "r", "*", "Result", ",", "created", "bool", ")", "{", "co", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "co", ".", "mu", ".", "Unlock", "(", ")", "\n"...
// Create adds a query to currently executing queries and acquires a // lock on its Result if it is not already present. If the query is // a duplicate, Create returns false.
[ "Create", "adds", "a", "query", "to", "currently", "executing", "queries", "and", "acquires", "a", "lock", "on", "its", "Result", "if", "it", "is", "not", "already", "present", ".", "If", "the", "query", "is", "a", "duplicate", "Create", "returns", "false"...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sync2/consolidator.go#L58-L68
train
vitessio/vitess
go/sync2/consolidator.go
Broadcast
func (rs *Result) Broadcast() { rs.consolidator.mu.Lock() defer rs.consolidator.mu.Unlock() delete(rs.consolidator.queries, rs.query) rs.executing.Unlock() }
go
func (rs *Result) Broadcast() { rs.consolidator.mu.Lock() defer rs.consolidator.mu.Unlock() delete(rs.consolidator.queries, rs.query) rs.executing.Unlock() }
[ "func", "(", "rs", "*", "Result", ")", "Broadcast", "(", ")", "{", "rs", ".", "consolidator", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "rs", ".", "consolidator", ".", "mu", ".", "Unlock", "(", ")", "\n", "delete", "(", "rs", ".", "consoli...
// Broadcast removes the entry from current queries and releases the // lock on its Result. Broadcast should be invoked when original // query completes execution.
[ "Broadcast", "removes", "the", "entry", "from", "current", "queries", "and", "releases", "the", "lock", "on", "its", "Result", ".", "Broadcast", "should", "be", "invoked", "when", "original", "query", "completes", "execution", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sync2/consolidator.go#L73-L78
train
vitessio/vitess
go/sync2/consolidator.go
Wait
func (rs *Result) Wait() { rs.consolidator.Record(rs.query) rs.executing.RLock() }
go
func (rs *Result) Wait() { rs.consolidator.Record(rs.query) rs.executing.RLock() }
[ "func", "(", "rs", "*", "Result", ")", "Wait", "(", ")", "{", "rs", ".", "consolidator", ".", "Record", "(", "rs", ".", "query", ")", "\n", "rs", ".", "executing", ".", "RLock", "(", ")", "\n", "}" ]
// Wait waits for the original query to complete execution. Wait should // be invoked for duplicate queries.
[ "Wait", "waits", "for", "the", "original", "query", "to", "complete", "execution", ".", "Wait", "should", "be", "invoked", "for", "duplicate", "queries", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sync2/consolidator.go#L82-L85
train
vitessio/vitess
go/sync2/consolidator.go
Record
func (cc *ConsolidatorCache) Record(query string) { if v, ok := cc.Get(query); ok { v.(*ccount).add(1) } else { c := ccount(1) cc.Set(query, &c) } }
go
func (cc *ConsolidatorCache) Record(query string) { if v, ok := cc.Get(query); ok { v.(*ccount).add(1) } else { c := ccount(1) cc.Set(query, &c) } }
[ "func", "(", "cc", "*", "ConsolidatorCache", ")", "Record", "(", "query", "string", ")", "{", "if", "v", ",", "ok", ":=", "cc", ".", "Get", "(", "query", ")", ";", "ok", "{", "v", ".", "(", "*", "ccount", ")", ".", "add", "(", "1", ")", "\n",...
// Record increments the count for "query" by 1. // If it's not in the cache yet, it will be added.
[ "Record", "increments", "the", "count", "for", "query", "by", "1", ".", "If", "it", "s", "not", "in", "the", "cache", "yet", "it", "will", "be", "added", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sync2/consolidator.go#L102-L109
train
vitessio/vitess
go/sync2/consolidator.go
Items
func (cc *ConsolidatorCache) Items() []ConsolidatorCacheItem { items := cc.LRUCache.Items() ret := make([]ConsolidatorCacheItem, len(items)) for i, v := range items { ret[i] = ConsolidatorCacheItem{Query: v.Key, Count: v.Value.(*ccount).get()} } return ret }
go
func (cc *ConsolidatorCache) Items() []ConsolidatorCacheItem { items := cc.LRUCache.Items() ret := make([]ConsolidatorCacheItem, len(items)) for i, v := range items { ret[i] = ConsolidatorCacheItem{Query: v.Key, Count: v.Value.(*ccount).get()} } return ret }
[ "func", "(", "cc", "*", "ConsolidatorCache", ")", "Items", "(", ")", "[", "]", "ConsolidatorCacheItem", "{", "items", ":=", "cc", ".", "LRUCache", ".", "Items", "(", ")", "\n", "ret", ":=", "make", "(", "[", "]", "ConsolidatorCacheItem", ",", "len", "(...
// Items returns the items in the cache as an array of String, int64 structs
[ "Items", "returns", "the", "items", "in", "the", "cache", "as", "an", "array", "of", "String", "int64", "structs" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sync2/consolidator.go#L118-L125
train
vitessio/vitess
go/vt/vtgate/planbuilder/postprocess.go
pushGroupBy
func (pb *primitiveBuilder) pushGroupBy(sel *sqlparser.Select, grouper groupByHandler) error { if sel.Distinct != "" { // We can be here only if the builder could handle a group by. if err := grouper.MakeDistinct(); err != nil { return err } } if len(sel.GroupBy) == 0 { return nil } if err := pb.st.Res...
go
func (pb *primitiveBuilder) pushGroupBy(sel *sqlparser.Select, grouper groupByHandler) error { if sel.Distinct != "" { // We can be here only if the builder could handle a group by. if err := grouper.MakeDistinct(); err != nil { return err } } if len(sel.GroupBy) == 0 { return nil } if err := pb.st.Res...
[ "func", "(", "pb", "*", "primitiveBuilder", ")", "pushGroupBy", "(", "sel", "*", "sqlparser", ".", "Select", ",", "grouper", "groupByHandler", ")", "error", "{", "if", "sel", ".", "Distinct", "!=", "\"", "\"", "{", "// We can be here only if the builder could ha...
// pushGroupBy processes the group by clause. It resolves all symbols, // and ensures that there are no subqueries.
[ "pushGroupBy", "processes", "the", "group", "by", "clause", ".", "It", "resolves", "all", "symbols", "and", "ensures", "that", "there", "are", "no", "subqueries", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/postprocess.go#L42-L59
train
vitessio/vitess
go/vt/vtgate/planbuilder/postprocess.go
pushOrderBy
func (pb *primitiveBuilder) pushOrderBy(orderBy sqlparser.OrderBy) error { if oa, ok := pb.bldr.(*orderedAggregate); ok { return oa.PushOrderBy(pb, orderBy) } switch len(orderBy) { case 0: return nil case 1: // Special handling for ORDER BY NULL. Push it everywhere. if _, ok := orderBy[0].Expr.(*sqlparser...
go
func (pb *primitiveBuilder) pushOrderBy(orderBy sqlparser.OrderBy) error { if oa, ok := pb.bldr.(*orderedAggregate); ok { return oa.PushOrderBy(pb, orderBy) } switch len(orderBy) { case 0: return nil case 1: // Special handling for ORDER BY NULL. Push it everywhere. if _, ok := orderBy[0].Expr.(*sqlparser...
[ "func", "(", "pb", "*", "primitiveBuilder", ")", "pushOrderBy", "(", "orderBy", "sqlparser", ".", "OrderBy", ")", "error", "{", "if", "oa", ",", "ok", ":=", "pb", ".", "bldr", ".", "(", "*", "orderedAggregate", ")", ";", "ok", "{", "return", "oa", "....
// pushOrderBy pushes the order by clause to the appropriate route. // In the case of a join, it's only possible to push down if the // order by references columns of the left-most route. Otherwise, the // function returns an unsupported error.
[ "pushOrderBy", "pushes", "the", "order", "by", "clause", "to", "the", "appropriate", "route", ".", "In", "the", "case", "of", "a", "join", "it", "s", "only", "possible", "to", "push", "down", "if", "the", "order", "by", "references", "columns", "of", "th...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/postprocess.go#L65-L131
train
vitessio/vitess
go/vt/throttler/memory.go
touchBadRateAge
func (m *memory) touchBadRateAge(now time.Time) { m.nextBadRateAging = now.Add(m.ageBadRateAfter) }
go
func (m *memory) touchBadRateAge(now time.Time) { m.nextBadRateAging = now.Add(m.ageBadRateAfter) }
[ "func", "(", "m", "*", "memory", ")", "touchBadRateAge", "(", "now", "time", ".", "Time", ")", "{", "m", ".", "nextBadRateAging", "=", "now", ".", "Add", "(", "m", ".", "ageBadRateAfter", ")", "\n", "}" ]
// touchBadRateAge records that the bad rate was changed and the aging should be // further delayed.
[ "touchBadRateAge", "records", "that", "the", "bad", "rate", "was", "changed", "and", "the", "aging", "should", "be", "further", "delayed", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/memory.go#L142-L144
train
vitessio/vitess
go/vt/worker/diff_utils.go
RollbackTransaction
func RollbackTransaction(ctx context.Context, ts *topo.Server, tabletAlias *topodatapb.TabletAlias, txID int64) error { shortCtx, cancel := context.WithTimeout(ctx, *remoteActionsTimeout) tablet, err := ts.GetTablet(shortCtx, tabletAlias) cancel() if err != nil { return err } conn, err := tabletconn.GetDialer(...
go
func RollbackTransaction(ctx context.Context, ts *topo.Server, tabletAlias *topodatapb.TabletAlias, txID int64) error { shortCtx, cancel := context.WithTimeout(ctx, *remoteActionsTimeout) tablet, err := ts.GetTablet(shortCtx, tabletAlias) cancel() if err != nil { return err } conn, err := tabletconn.GetDialer(...
[ "func", "RollbackTransaction", "(", "ctx", "context", ".", "Context", ",", "ts", "*", "topo", ".", "Server", ",", "tabletAlias", "*", "topodatapb", ".", "TabletAlias", ",", "txID", "int64", ")", "error", "{", "shortCtx", ",", "cancel", ":=", "context", "."...
// RollbackTransaction rolls back the transaction
[ "RollbackTransaction", "rolls", "back", "the", "transaction" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/diff_utils.go#L132-L150
train
vitessio/vitess
go/vt/worker/diff_utils.go
Recv
func (f *v3KeyRangeFilter) Recv() (*sqltypes.Result, error) { r, err := f.input.Recv() if err != nil { return nil, err } rows := make([][]sqltypes.Value, 0, len(r.Rows)) for _, row := range r.Rows { ksid, err := f.resolver.keyspaceID(row) if err != nil { return nil, err } if key.KeyRangeContains(f.k...
go
func (f *v3KeyRangeFilter) Recv() (*sqltypes.Result, error) { r, err := f.input.Recv() if err != nil { return nil, err } rows := make([][]sqltypes.Value, 0, len(r.Rows)) for _, row := range r.Rows { ksid, err := f.resolver.keyspaceID(row) if err != nil { return nil, err } if key.KeyRangeContains(f.k...
[ "func", "(", "f", "*", "v3KeyRangeFilter", ")", "Recv", "(", ")", "(", "*", "sqltypes", ".", "Result", ",", "error", ")", "{", "r", ",", "err", ":=", "f", ".", "input", ".", "Recv", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil"...
// Recv is part of sqltypes.ResultStream interface.
[ "Recv", "is", "part", "of", "sqltypes", ".", "ResultStream", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/diff_utils.go#L176-L195
train
vitessio/vitess
go/vt/worker/diff_utils.go
uint64FromKeyspaceID
func uint64FromKeyspaceID(keyspaceID []byte) uint64 { // Copy into 8 bytes because keyspaceID could be shorter. bits := make([]byte, 8) copy(bits, keyspaceID) return binary.BigEndian.Uint64(bits) }
go
func uint64FromKeyspaceID(keyspaceID []byte) uint64 { // Copy into 8 bytes because keyspaceID could be shorter. bits := make([]byte, 8) copy(bits, keyspaceID) return binary.BigEndian.Uint64(bits) }
[ "func", "uint64FromKeyspaceID", "(", "keyspaceID", "[", "]", "byte", ")", "uint64", "{", "// Copy into 8 bytes because keyspaceID could be shorter.", "bits", ":=", "make", "(", "[", "]", "byte", ",", "8", ")", "\n", "copy", "(", "bits", ",", "keyspaceID", ")", ...
// uint64FromKeyspaceID returns the 64 bit number representation // of the keyspaceID.
[ "uint64FromKeyspaceID", "returns", "the", "64", "bit", "number", "representation", "of", "the", "keyspaceID", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/diff_utils.go#L243-L248
train
vitessio/vitess
go/vt/worker/diff_utils.go
TableScan
func TableScan(ctx context.Context, log logutil.Logger, ts *topo.Server, tabletAlias *topodatapb.TabletAlias, td *tabletmanagerdatapb.TableDefinition) (*QueryResultReader, error) { sql := fmt.Sprintf("SELECT %v FROM %v", strings.Join(escapeAll(orderedColumns(td)), ", "), sqlescape.EscapeID(td.Name)) if len(td.Primary...
go
func TableScan(ctx context.Context, log logutil.Logger, ts *topo.Server, tabletAlias *topodatapb.TabletAlias, td *tabletmanagerdatapb.TableDefinition) (*QueryResultReader, error) { sql := fmt.Sprintf("SELECT %v FROM %v", strings.Join(escapeAll(orderedColumns(td)), ", "), sqlescape.EscapeID(td.Name)) if len(td.Primary...
[ "func", "TableScan", "(", "ctx", "context", ".", "Context", ",", "log", "logutil", ".", "Logger", ",", "ts", "*", "topo", ".", "Server", ",", "tabletAlias", "*", "topodatapb", ".", "TabletAlias", ",", "td", "*", "tabletmanagerdatapb", ".", "TableDefinition",...
// TableScan returns a QueryResultReader that gets all the rows from a // table, ordered by Primary Key. The returned columns are ordered // with the Primary Key columns in front.
[ "TableScan", "returns", "a", "QueryResultReader", "that", "gets", "all", "the", "rows", "from", "a", "table", "ordered", "by", "Primary", "Key", ".", "The", "returned", "columns", "are", "ordered", "with", "the", "Primary", "Key", "columns", "in", "front", "...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/diff_utils.go#L253-L260
train
vitessio/vitess
go/vt/worker/diff_utils.go
CreateTargetFrom
func CreateTargetFrom(tablet *topodatapb.Tablet) *query.Target { return &query.Target{ Cell: tablet.Alias.Cell, Keyspace: tablet.Keyspace, Shard: tablet.Shard, TabletType: tablet.Type, } }
go
func CreateTargetFrom(tablet *topodatapb.Tablet) *query.Target { return &query.Target{ Cell: tablet.Alias.Cell, Keyspace: tablet.Keyspace, Shard: tablet.Shard, TabletType: tablet.Type, } }
[ "func", "CreateTargetFrom", "(", "tablet", "*", "topodatapb", ".", "Tablet", ")", "*", "query", ".", "Target", "{", "return", "&", "query", ".", "Target", "{", "Cell", ":", "tablet", ".", "Alias", ".", "Cell", ",", "Keyspace", ":", "tablet", ".", "Keys...
// CreateTargetFrom is a helper function
[ "CreateTargetFrom", "is", "a", "helper", "function" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/diff_utils.go#L273-L280
train
vitessio/vitess
go/vt/worker/diff_utils.go
Drain
func (rr *RowReader) Drain() (int, error) { count := 0 for { row, err := rr.Next() if err != nil { return 0, err } if row == nil { return count, nil } count++ } }
go
func (rr *RowReader) Drain() (int, error) { count := 0 for { row, err := rr.Next() if err != nil { return 0, err } if row == nil { return count, nil } count++ } }
[ "func", "(", "rr", "*", "RowReader", ")", "Drain", "(", ")", "(", "int", ",", "error", ")", "{", "count", ":=", "0", "\n", "for", "{", "row", ",", "err", ":=", "rr", ".", "Next", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ...
// Drain will empty the RowReader and return how many rows we got
[ "Drain", "will", "empty", "the", "RowReader", "and", "return", "how", "many", "rows", "we", "got" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/diff_utils.go#L407-L419
train
vitessio/vitess
go/vt/worker/diff_utils.go
HasDifferences
func (dr *DiffReport) HasDifferences() bool { return dr.mismatchedRows > 0 || dr.extraRowsLeft > 0 || dr.extraRowsRight > 0 }
go
func (dr *DiffReport) HasDifferences() bool { return dr.mismatchedRows > 0 || dr.extraRowsLeft > 0 || dr.extraRowsRight > 0 }
[ "func", "(", "dr", "*", "DiffReport", ")", "HasDifferences", "(", ")", "bool", "{", "return", "dr", ".", "mismatchedRows", ">", "0", "||", "dr", ".", "extraRowsLeft", ">", "0", "||", "dr", ".", "extraRowsRight", ">", "0", "\n", "}" ]
// HasDifferences returns true if the diff job recorded any difference
[ "HasDifferences", "returns", "true", "if", "the", "diff", "job", "recorded", "any", "difference" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/diff_utils.go#L448-L450
train
vitessio/vitess
go/vt/worker/diff_utils.go
ComputeQPS
func (dr *DiffReport) ComputeQPS() { if dr.processedRows > 0 { dr.processingQPS = int(time.Duration(dr.processedRows) * time.Second / time.Since(dr.startingTime)) } }
go
func (dr *DiffReport) ComputeQPS() { if dr.processedRows > 0 { dr.processingQPS = int(time.Duration(dr.processedRows) * time.Second / time.Since(dr.startingTime)) } }
[ "func", "(", "dr", "*", "DiffReport", ")", "ComputeQPS", "(", ")", "{", "if", "dr", ".", "processedRows", ">", "0", "{", "dr", ".", "processingQPS", "=", "int", "(", "time", ".", "Duration", "(", "dr", ".", "processedRows", ")", "*", "time", ".", "...
// ComputeQPS fills in processingQPS
[ "ComputeQPS", "fills", "in", "processingQPS" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/diff_utils.go#L453-L457
train
vitessio/vitess
go/vt/worker/diff_utils.go
RowsEqual
func RowsEqual(left, right []sqltypes.Value) int { for i, l := range left { if !bytes.Equal(l.Raw(), right[i].Raw()) { return i } } return -1 }
go
func RowsEqual(left, right []sqltypes.Value) int { for i, l := range left { if !bytes.Equal(l.Raw(), right[i].Raw()) { return i } } return -1 }
[ "func", "RowsEqual", "(", "left", ",", "right", "[", "]", "sqltypes", ".", "Value", ")", "int", "{", "for", "i", ",", "l", ":=", "range", "left", "{", "if", "!", "bytes", ".", "Equal", "(", "l", ".", "Raw", "(", ")", ",", "right", "[", "i", "...
// RowsEqual returns the index of the first different column, or -1 if // both rows are the same.
[ "RowsEqual", "returns", "the", "index", "of", "the", "first", "different", "column", "or", "-", "1", "if", "both", "rows", "are", "the", "same", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/diff_utils.go#L465-L472
train
vitessio/vitess
go/vt/worker/diff_utils.go
NewRowDiffer
func NewRowDiffer(left, right ResultReader, tableDefinition *tabletmanagerdatapb.TableDefinition) (*RowDiffer, error) { leftFields := left.Fields() rightFields := right.Fields() if len(leftFields) != len(rightFields) { return nil, vterrors.Errorf(vtrpc.Code_FAILED_PRECONDITION, "[table=%v] Cannot diff inputs with ...
go
func NewRowDiffer(left, right ResultReader, tableDefinition *tabletmanagerdatapb.TableDefinition) (*RowDiffer, error) { leftFields := left.Fields() rightFields := right.Fields() if len(leftFields) != len(rightFields) { return nil, vterrors.Errorf(vtrpc.Code_FAILED_PRECONDITION, "[table=%v] Cannot diff inputs with ...
[ "func", "NewRowDiffer", "(", "left", ",", "right", "ResultReader", ",", "tableDefinition", "*", "tabletmanagerdatapb", ".", "TableDefinition", ")", "(", "*", "RowDiffer", ",", "error", ")", "{", "leftFields", ":=", "left", ".", "Fields", "(", ")", "\n", "rig...
// NewRowDiffer returns a new RowDiffer
[ "NewRowDiffer", "returns", "a", "new", "RowDiffer" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/diff_utils.go#L527-L543
train
vitessio/vitess
go/vt/worker/diff_utils.go
createTransactions
func createTransactions(ctx context.Context, numberOfScanners int, wr *wrangler.Wrangler, cleaner *wrangler.Cleaner, queryService queryservice.QueryService, target *query.Target, tabletInfo *topodatapb.Tablet) ([]int64, error) { scanners := make([]int64, numberOfScanners) for i := 0; i < numberOfScanners; i++ { tx...
go
func createTransactions(ctx context.Context, numberOfScanners int, wr *wrangler.Wrangler, cleaner *wrangler.Cleaner, queryService queryservice.QueryService, target *query.Target, tabletInfo *topodatapb.Tablet) ([]int64, error) { scanners := make([]int64, numberOfScanners) for i := 0; i < numberOfScanners; i++ { tx...
[ "func", "createTransactions", "(", "ctx", "context", ".", "Context", ",", "numberOfScanners", "int", ",", "wr", "*", "wrangler", ".", "Wrangler", ",", "cleaner", "*", "wrangler", ".", "Cleaner", ",", "queryService", "queryservice", ".", "QueryService", ",", "t...
// createTransactions returns an array of transactions that all share the same view of the data. // It will check that no new transactions have been seen between the creation of the underlying transactions, // to guarantee that all TransactionalTableScanner are pointing to the same point
[ "createTransactions", "returns", "an", "array", "of", "transactions", "that", "all", "share", "the", "same", "view", "of", "the", "data", ".", "It", "will", "check", "that", "no", "new", "transactions", "have", "been", "seen", "between", "the", "creation", "...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/diff_utils.go#L657-L683
train
vitessio/vitess
go/vt/worker/diff_utils.go
CreateConsistentTableScanners
func CreateConsistentTableScanners(ctx context.Context, tablet *topo.TabletInfo, wr *wrangler.Wrangler, cleaner *wrangler.Cleaner, numberOfScanners int) ([]TableScanner, string, error) { txs, gtid, err := CreateConsistentTransactions(ctx, tablet, wr, cleaner, numberOfScanners) if err != nil { return nil, "", err }...
go
func CreateConsistentTableScanners(ctx context.Context, tablet *topo.TabletInfo, wr *wrangler.Wrangler, cleaner *wrangler.Cleaner, numberOfScanners int) ([]TableScanner, string, error) { txs, gtid, err := CreateConsistentTransactions(ctx, tablet, wr, cleaner, numberOfScanners) if err != nil { return nil, "", err }...
[ "func", "CreateConsistentTableScanners", "(", "ctx", "context", ".", "Context", ",", "tablet", "*", "topo", ".", "TabletInfo", ",", "wr", "*", "wrangler", ".", "Wrangler", ",", "cleaner", "*", "wrangler", ".", "Cleaner", ",", "numberOfScanners", "int", ")", ...
// CreateConsistentTableScanners will momentarily stop updates on the tablet, and then create connections that are all // consistent snapshots of the same point in the transaction history
[ "CreateConsistentTableScanners", "will", "momentarily", "stop", "updates", "on", "the", "tablet", "and", "then", "create", "connections", "that", "are", "all", "consistent", "snapshots", "of", "the", "same", "point", "in", "the", "transaction", "history" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/diff_utils.go#L720-L741
train
vitessio/vitess
go/vt/worker/diff_utils.go
CreateConsistentTransactions
func CreateConsistentTransactions(ctx context.Context, tablet *topo.TabletInfo, wr *wrangler.Wrangler, cleaner *wrangler.Cleaner, numberOfScanners int) ([]int64, string, error) { if numberOfScanners < 1 { return nil, "", vterrors.Errorf(vtrpc.Code_INVALID_ARGUMENT, "need more than zero scanners: %d", numberOfScanner...
go
func CreateConsistentTransactions(ctx context.Context, tablet *topo.TabletInfo, wr *wrangler.Wrangler, cleaner *wrangler.Cleaner, numberOfScanners int) ([]int64, string, error) { if numberOfScanners < 1 { return nil, "", vterrors.Errorf(vtrpc.Code_INVALID_ARGUMENT, "need more than zero scanners: %d", numberOfScanner...
[ "func", "CreateConsistentTransactions", "(", "ctx", "context", ".", "Context", ",", "tablet", "*", "topo", ".", "TabletInfo", ",", "wr", "*", "wrangler", ".", "Wrangler", ",", "cleaner", "*", "wrangler", ".", "Cleaner", ",", "numberOfScanners", "int", ")", "...
// CreateConsistentTransactions creates a number of consistent snapshot transactions, // all starting from the same spot in the tx log
[ "CreateConsistentTransactions", "creates", "a", "number", "of", "consistent", "snapshot", "transactions", "all", "starting", "from", "the", "same", "spot", "in", "the", "tx", "log" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/diff_utils.go#L745-L782
train
vitessio/vitess
go/vt/worker/ping.go
NewPingWorker
func NewPingWorker(wr *wrangler.Wrangler, message string) (Worker, error) { return &PingWorker{ StatusWorker: NewStatusWorker(), wr: wr, message: message, }, nil }
go
func NewPingWorker(wr *wrangler.Wrangler, message string) (Worker, error) { return &PingWorker{ StatusWorker: NewStatusWorker(), wr: wr, message: message, }, nil }
[ "func", "NewPingWorker", "(", "wr", "*", "wrangler", ".", "Wrangler", ",", "message", "string", ")", "(", "Worker", ",", "error", ")", "{", "return", "&", "PingWorker", "{", "StatusWorker", ":", "NewStatusWorker", "(", ")", ",", "wr", ":", "wr", ",", "...
// NewPingWorker returns a new PingWorker object.
[ "NewPingWorker", "returns", "a", "new", "PingWorker", "object", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/ping.go#L37-L43
train
vitessio/vitess
go/vt/vtctl/backup.go
execBackup
func execBackup(ctx context.Context, wr *wrangler.Wrangler, tablet *topodatapb.Tablet, concurrency int, allowMaster bool) error { stream, err := wr.TabletManagerClient().Backup(ctx, tablet, concurrency, allowMaster) if err != nil { return err } for { e, err := stream.Recv() switch err { case nil: logutil...
go
func execBackup(ctx context.Context, wr *wrangler.Wrangler, tablet *topodatapb.Tablet, concurrency int, allowMaster bool) error { stream, err := wr.TabletManagerClient().Backup(ctx, tablet, concurrency, allowMaster) if err != nil { return err } for { e, err := stream.Recv() switch err { case nil: logutil...
[ "func", "execBackup", "(", "ctx", "context", ".", "Context", ",", "wr", "*", "wrangler", ".", "Wrangler", ",", "tablet", "*", "topodatapb", ".", "Tablet", ",", "concurrency", "int", ",", "allowMaster", "bool", ")", "error", "{", "stream", ",", "err", ":=...
// execBackup is shared by Backup and BackupShard
[ "execBackup", "is", "shared", "by", "Backup", "and", "BackupShard" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtctl/backup.go#L153-L169
train
vitessio/vitess
go/vt/vttablet/customrule/filecustomrule/filecustomrule.go
NewFileCustomRule
func NewFileCustomRule() (fcr *FileCustomRule) { fcr = new(FileCustomRule) fcr.path = "" fcr.currentRuleSet = rules.New() return fcr }
go
func NewFileCustomRule() (fcr *FileCustomRule) { fcr = new(FileCustomRule) fcr.path = "" fcr.currentRuleSet = rules.New() return fcr }
[ "func", "NewFileCustomRule", "(", ")", "(", "fcr", "*", "FileCustomRule", ")", "{", "fcr", "=", "new", "(", "FileCustomRule", ")", "\n", "fcr", ".", "path", "=", "\"", "\"", "\n", "fcr", ".", "currentRuleSet", "=", "rules", ".", "New", "(", ")", "\n"...
// NewFileCustomRule returns pointer to new FileCustomRule structure
[ "NewFileCustomRule", "returns", "pointer", "to", "new", "FileCustomRule", "structure" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/customrule/filecustomrule/filecustomrule.go#L49-L54
train
vitessio/vitess
go/vt/vttablet/customrule/filecustomrule/filecustomrule.go
Open
func (fcr *FileCustomRule) Open(qsc tabletserver.Controller, rulePath string) error { fcr.path = rulePath if fcr.path == "" { // Don't go further if path is empty return nil } data, err := ioutil.ReadFile(fcr.path) if err != nil { log.Warningf("Error reading file %v: %v", fcr.path, err) // Don't update any...
go
func (fcr *FileCustomRule) Open(qsc tabletserver.Controller, rulePath string) error { fcr.path = rulePath if fcr.path == "" { // Don't go further if path is empty return nil } data, err := ioutil.ReadFile(fcr.path) if err != nil { log.Warningf("Error reading file %v: %v", fcr.path, err) // Don't update any...
[ "func", "(", "fcr", "*", "FileCustomRule", ")", "Open", "(", "qsc", "tabletserver", ".", "Controller", ",", "rulePath", "string", ")", "error", "{", "fcr", ".", "path", "=", "rulePath", "\n", "if", "fcr", ".", "path", "==", "\"", "\"", "{", "// Don't g...
// Open try to build query rules from local file and push the rules to vttablet
[ "Open", "try", "to", "build", "query", "rules", "from", "local", "file", "and", "push", "the", "rules", "to", "vttablet" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/customrule/filecustomrule/filecustomrule.go#L57-L81
train
vitessio/vitess
go/vt/vttablet/customrule/filecustomrule/filecustomrule.go
GetRules
func (fcr *FileCustomRule) GetRules() (qrs *rules.Rules, version int64, err error) { return fcr.currentRuleSet.Copy(), fcr.currentRuleSetTimestamp, nil }
go
func (fcr *FileCustomRule) GetRules() (qrs *rules.Rules, version int64, err error) { return fcr.currentRuleSet.Copy(), fcr.currentRuleSetTimestamp, nil }
[ "func", "(", "fcr", "*", "FileCustomRule", ")", "GetRules", "(", ")", "(", "qrs", "*", "rules", ".", "Rules", ",", "version", "int64", ",", "err", "error", ")", "{", "return", "fcr", ".", "currentRuleSet", ".", "Copy", "(", ")", ",", "fcr", ".", "c...
// GetRules returns query rules built from local file
[ "GetRules", "returns", "query", "rules", "built", "from", "local", "file" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/customrule/filecustomrule/filecustomrule.go#L84-L86
train
vitessio/vitess
go/vt/vttablet/customrule/filecustomrule/filecustomrule.go
ActivateFileCustomRules
func ActivateFileCustomRules(qsc tabletserver.Controller) { if *fileRulePath != "" { qsc.RegisterQueryRuleSource(FileCustomRuleSource) fileCustomRule.Open(qsc, *fileRulePath) } }
go
func ActivateFileCustomRules(qsc tabletserver.Controller) { if *fileRulePath != "" { qsc.RegisterQueryRuleSource(FileCustomRuleSource) fileCustomRule.Open(qsc, *fileRulePath) } }
[ "func", "ActivateFileCustomRules", "(", "qsc", "tabletserver", ".", "Controller", ")", "{", "if", "*", "fileRulePath", "!=", "\"", "\"", "{", "qsc", ".", "RegisterQueryRuleSource", "(", "FileCustomRuleSource", ")", "\n", "fileCustomRule", ".", "Open", "(", "qsc"...
// ActivateFileCustomRules activates this static file based custom rule mechanism
[ "ActivateFileCustomRules", "activates", "this", "static", "file", "based", "custom", "rule", "mechanism" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/customrule/filecustomrule/filecustomrule.go#L89-L94
train
vitessio/vitess
go/vt/topotools/rebuild_keyspace.go
RebuildKeyspace
func RebuildKeyspace(ctx context.Context, log logutil.Logger, ts *topo.Server, keyspace string, cells []string) (err error) { ctx, unlock, lockErr := ts.LockKeyspace(ctx, keyspace, "RebuildKeyspace") if lockErr != nil { return lockErr } defer unlock(&err) return RebuildKeyspaceLocked(ctx, log, ts, keyspace, cel...
go
func RebuildKeyspace(ctx context.Context, log logutil.Logger, ts *topo.Server, keyspace string, cells []string) (err error) { ctx, unlock, lockErr := ts.LockKeyspace(ctx, keyspace, "RebuildKeyspace") if lockErr != nil { return lockErr } defer unlock(&err) return RebuildKeyspaceLocked(ctx, log, ts, keyspace, cel...
[ "func", "RebuildKeyspace", "(", "ctx", "context", ".", "Context", ",", "log", "logutil", ".", "Logger", ",", "ts", "*", "topo", ".", "Server", ",", "keyspace", "string", ",", "cells", "[", "]", "string", ")", "(", "err", "error", ")", "{", "ctx", ","...
// RebuildKeyspace rebuilds the serving graph data while locking out other changes.
[ "RebuildKeyspace", "rebuilds", "the", "serving", "graph", "data", "while", "locking", "out", "other", "changes", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topotools/rebuild_keyspace.go#L33-L41
train
vitessio/vitess
go/vt/vttablet/tabletmanager/vreplication/controller_plan.go
buildControllerPlan
func buildControllerPlan(query string) (*controllerPlan, error) { stmt, err := sqlparser.Parse(query) if err != nil { return nil, err } switch stmt := stmt.(type) { case *sqlparser.Insert: return buildInsertPlan(stmt) case *sqlparser.Update: return buildUpdatePlan(stmt) case *sqlparser.Delete: return bui...
go
func buildControllerPlan(query string) (*controllerPlan, error) { stmt, err := sqlparser.Parse(query) if err != nil { return nil, err } switch stmt := stmt.(type) { case *sqlparser.Insert: return buildInsertPlan(stmt) case *sqlparser.Update: return buildUpdatePlan(stmt) case *sqlparser.Delete: return bui...
[ "func", "buildControllerPlan", "(", "query", "string", ")", "(", "*", "controllerPlan", ",", "error", ")", "{", "stmt", ",", "err", ":=", "sqlparser", ".", "Parse", "(", "query", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", ...
// buildControllerPlan parses the input query and returns an appropriate plan.
[ "buildControllerPlan", "parses", "the", "input", "query", "and", "returns", "an", "appropriate", "plan", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/vreplication/controller_plan.go#L41-L58
train
vitessio/vitess
go/vt/vttablet/tabletserver/tabletenv/tabletenv.go
RecordUserQuery
func RecordUserQuery(ctx context.Context, tableName sqlparser.TableIdent, queryType string, duration int64) { username := callerid.GetPrincipal(callerid.EffectiveCallerIDFromContext(ctx)) if username == "" { username = callerid.GetUsername(callerid.ImmediateCallerIDFromContext(ctx)) } UserTableQueryCount.Add([]st...
go
func RecordUserQuery(ctx context.Context, tableName sqlparser.TableIdent, queryType string, duration int64) { username := callerid.GetPrincipal(callerid.EffectiveCallerIDFromContext(ctx)) if username == "" { username = callerid.GetUsername(callerid.ImmediateCallerIDFromContext(ctx)) } UserTableQueryCount.Add([]st...
[ "func", "RecordUserQuery", "(", "ctx", "context", ".", "Context", ",", "tableName", "sqlparser", ".", "TableIdent", ",", "queryType", "string", ",", "duration", "int64", ")", "{", "username", ":=", "callerid", ".", "GetPrincipal", "(", "callerid", ".", "Effect...
// RecordUserQuery records the query data against the user.
[ "RecordUserQuery", "records", "the", "query", "data", "against", "the", "user", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletenv/tabletenv.go#L123-L130
train
vitessio/vitess
go/vt/vttablet/tabletserver/tabletenv/tabletenv.go
LogError
func LogError() { if x := recover(); x != nil { log.Errorf("Uncaught panic:\n%v\n%s", x, tb.Stack(4)) InternalErrors.Add("Panic", 1) } }
go
func LogError() { if x := recover(); x != nil { log.Errorf("Uncaught panic:\n%v\n%s", x, tb.Stack(4)) InternalErrors.Add("Panic", 1) } }
[ "func", "LogError", "(", ")", "{", "if", "x", ":=", "recover", "(", ")", ";", "x", "!=", "nil", "{", "log", ".", "Errorf", "(", "\"", "\\n", "\\n", "\"", ",", "x", ",", "tb", ".", "Stack", "(", "4", ")", ")", "\n", "InternalErrors", ".", "Add...
// LogError logs panics and increments InternalErrors.
[ "LogError", "logs", "panics", "and", "increments", "InternalErrors", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletenv/tabletenv.go#L133-L138
train
vitessio/vitess
go/vt/vttablet/tabletservermock/controller.go
NewController
func NewController() *Controller { return &Controller{ queryServiceEnabled: false, BroadcastData: make(chan *BroadcastData, 10), StateChanges: make(chan *StateChange, 10), queryRulesMap: make(map[string]*rules.Rules), } }
go
func NewController() *Controller { return &Controller{ queryServiceEnabled: false, BroadcastData: make(chan *BroadcastData, 10), StateChanges: make(chan *StateChange, 10), queryRulesMap: make(map[string]*rules.Rules), } }
[ "func", "NewController", "(", ")", "*", "Controller", "{", "return", "&", "Controller", "{", "queryServiceEnabled", ":", "false", ",", "BroadcastData", ":", "make", "(", "chan", "*", "BroadcastData", ",", "10", ")", ",", "StateChanges", ":", "make", "(", "...
// NewController returns a mock of tabletserver.Controller
[ "NewController", "returns", "a", "mock", "of", "tabletserver", ".", "Controller" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletservermock/controller.go#L94-L101
train
vitessio/vitess
go/vt/vttablet/tabletservermock/controller.go
InitDBConfig
func (tqsc *Controller) InitDBConfig(target querypb.Target, dbcfgs *dbconfigs.DBConfigs) error { tqsc.mu.Lock() defer tqsc.mu.Unlock() tqsc.CurrentTarget = target return nil }
go
func (tqsc *Controller) InitDBConfig(target querypb.Target, dbcfgs *dbconfigs.DBConfigs) error { tqsc.mu.Lock() defer tqsc.mu.Unlock() tqsc.CurrentTarget = target return nil }
[ "func", "(", "tqsc", "*", "Controller", ")", "InitDBConfig", "(", "target", "querypb", ".", "Target", ",", "dbcfgs", "*", "dbconfigs", ".", "DBConfigs", ")", "error", "{", "tqsc", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "tqsc", ".", "mu", "....
// InitDBConfig is part of the tabletserver.Controller interface
[ "InitDBConfig", "is", "part", "of", "the", "tabletserver", ".", "Controller", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletservermock/controller.go#L112-L118
train
vitessio/vitess
go/vt/vttablet/tabletservermock/controller.go
SetServingType
func (tqsc *Controller) SetServingType(tabletType topodatapb.TabletType, serving bool, alsoAllow []topodatapb.TabletType) (bool, error) { tqsc.mu.Lock() defer tqsc.mu.Unlock() stateChanged := false if tqsc.SetServingTypeError == nil { stateChanged = tqsc.queryServiceEnabled != serving || tqsc.CurrentTarget.Table...
go
func (tqsc *Controller) SetServingType(tabletType topodatapb.TabletType, serving bool, alsoAllow []topodatapb.TabletType) (bool, error) { tqsc.mu.Lock() defer tqsc.mu.Unlock() stateChanged := false if tqsc.SetServingTypeError == nil { stateChanged = tqsc.queryServiceEnabled != serving || tqsc.CurrentTarget.Table...
[ "func", "(", "tqsc", "*", "Controller", ")", "SetServingType", "(", "tabletType", "topodatapb", ".", "TabletType", ",", "serving", "bool", ",", "alsoAllow", "[", "]", "topodatapb", ".", "TabletType", ")", "(", "bool", ",", "error", ")", "{", "tqsc", ".", ...
// SetServingType is part of the tabletserver.Controller interface
[ "SetServingType", "is", "part", "of", "the", "tabletserver", ".", "Controller", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletservermock/controller.go#L121-L139
train
vitessio/vitess
go/vt/vttablet/tabletservermock/controller.go
IsServing
func (tqsc *Controller) IsServing() bool { tqsc.mu.Lock() defer tqsc.mu.Unlock() return tqsc.queryServiceEnabled }
go
func (tqsc *Controller) IsServing() bool { tqsc.mu.Lock() defer tqsc.mu.Unlock() return tqsc.queryServiceEnabled }
[ "func", "(", "tqsc", "*", "Controller", ")", "IsServing", "(", ")", "bool", "{", "tqsc", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "tqsc", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "return", "tqsc", ".", "queryServiceEnabled", "\n", "}" ]
// IsServing is part of the tabletserver.Controller interface
[ "IsServing", "is", "part", "of", "the", "tabletserver", ".", "Controller", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletservermock/controller.go#L142-L147
train
vitessio/vitess
go/vt/vttablet/tabletservermock/controller.go
SetQueryRules
func (tqsc *Controller) SetQueryRules(ruleSource string, qrs *rules.Rules) error { tqsc.mu.Lock() defer tqsc.mu.Unlock() tqsc.queryRulesMap[ruleSource] = qrs return nil }
go
func (tqsc *Controller) SetQueryRules(ruleSource string, qrs *rules.Rules) error { tqsc.mu.Lock() defer tqsc.mu.Unlock() tqsc.queryRulesMap[ruleSource] = qrs return nil }
[ "func", "(", "tqsc", "*", "Controller", ")", "SetQueryRules", "(", "ruleSource", "string", ",", "qrs", "*", "rules", ".", "Rules", ")", "error", "{", "tqsc", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "tqsc", ".", "mu", ".", "Unlock", "(", ")...
// SetQueryRules is part of the tabletserver.Controller interface
[ "SetQueryRules", "is", "part", "of", "the", "tabletserver", ".", "Controller", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletservermock/controller.go#L172-L177
train
vitessio/vitess
go/vt/vttablet/tabletservermock/controller.go
BroadcastHealth
func (tqsc *Controller) BroadcastHealth(terTimestamp int64, stats *querypb.RealtimeStats, maxCache time.Duration) { tqsc.mu.Lock() defer tqsc.mu.Unlock() tqsc.BroadcastData <- &BroadcastData{ TERTimestamp: terTimestamp, RealtimeStats: *stats, Serving: tqsc.queryServiceEnabled && (!tqsc.isInLameduck), ...
go
func (tqsc *Controller) BroadcastHealth(terTimestamp int64, stats *querypb.RealtimeStats, maxCache time.Duration) { tqsc.mu.Lock() defer tqsc.mu.Unlock() tqsc.BroadcastData <- &BroadcastData{ TERTimestamp: terTimestamp, RealtimeStats: *stats, Serving: tqsc.queryServiceEnabled && (!tqsc.isInLameduck), ...
[ "func", "(", "tqsc", "*", "Controller", ")", "BroadcastHealth", "(", "terTimestamp", "int64", ",", "stats", "*", "querypb", ".", "RealtimeStats", ",", "maxCache", "time", ".", "Duration", ")", "{", "tqsc", ".", "mu", ".", "Lock", "(", ")", "\n", "defer",...
// BroadcastHealth is part of the tabletserver.Controller interface
[ "BroadcastHealth", "is", "part", "of", "the", "tabletserver", ".", "Controller", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletservermock/controller.go#L190-L199
train
vitessio/vitess
go/vt/vttablet/tabletservermock/controller.go
EnterLameduck
func (tqsc *Controller) EnterLameduck() { tqsc.mu.Lock() defer tqsc.mu.Unlock() tqsc.isInLameduck = true }
go
func (tqsc *Controller) EnterLameduck() { tqsc.mu.Lock() defer tqsc.mu.Unlock() tqsc.isInLameduck = true }
[ "func", "(", "tqsc", "*", "Controller", ")", "EnterLameduck", "(", ")", "{", "tqsc", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "tqsc", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "tqsc", ".", "isInLameduck", "=", "true", "\n", "}" ]
// EnterLameduck implements tabletserver.Controller.
[ "EnterLameduck", "implements", "tabletserver", ".", "Controller", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletservermock/controller.go#L212-L217
train
vitessio/vitess
go/vt/vttablet/tabletservermock/controller.go
GetQueryRules
func (tqsc *Controller) GetQueryRules(ruleSource string) *rules.Rules { tqsc.mu.Lock() defer tqsc.mu.Unlock() return tqsc.queryRulesMap[ruleSource] }
go
func (tqsc *Controller) GetQueryRules(ruleSource string) *rules.Rules { tqsc.mu.Lock() defer tqsc.mu.Unlock() return tqsc.queryRulesMap[ruleSource] }
[ "func", "(", "tqsc", "*", "Controller", ")", "GetQueryRules", "(", "ruleSource", "string", ")", "*", "rules", ".", "Rules", "{", "tqsc", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "tqsc", ".", "mu", ".", "Unlock", "(", ")", "\n", "return", "t...
// GetQueryRules allows a test to check what was set.
[ "GetQueryRules", "allows", "a", "test", "to", "check", "what", "was", "set", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletservermock/controller.go#L228-L232
train
vitessio/vitess
go/vt/vttablet/tabletserver/txthrottler/tx_throttler.go
CreateTxThrottlerFromTabletConfig
func CreateTxThrottlerFromTabletConfig(topoServer *topo.Server) *TxThrottler { txThrottler, err := tryCreateTxThrottler(topoServer) if err != nil { log.Errorf("Error creating transaction throttler. Transaction throttling will"+ " be disabled. Error: %v", err) txThrottler, err = newTxThrottler(&txThrottlerConfi...
go
func CreateTxThrottlerFromTabletConfig(topoServer *topo.Server) *TxThrottler { txThrottler, err := tryCreateTxThrottler(topoServer) if err != nil { log.Errorf("Error creating transaction throttler. Transaction throttling will"+ " be disabled. Error: %v", err) txThrottler, err = newTxThrottler(&txThrottlerConfi...
[ "func", "CreateTxThrottlerFromTabletConfig", "(", "topoServer", "*", "topo", ".", "Server", ")", "*", "TxThrottler", "{", "txThrottler", ",", "err", ":=", "tryCreateTxThrottler", "(", "topoServer", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Errorf"...
// CreateTxThrottlerFromTabletConfig tries to construct a TxThrottler from the // relevant fields in the tabletenv.Config object. It returns a disabled TxThrottler if // any error occurs. // This function calls tryCreateTxThrottler that does the actual creation work // and returns an error if one occurred.
[ "CreateTxThrottlerFromTabletConfig", "tries", "to", "construct", "a", "TxThrottler", "from", "the", "relevant", "fields", "in", "the", "tabletenv", ".", "Config", "object", ".", "It", "returns", "a", "disabled", "TxThrottler", "if", "any", "error", "occurs", ".", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/txthrottler/tx_throttler.go#L79-L92
train
vitessio/vitess
go/vt/vttablet/tabletserver/txthrottler/tx_throttler.go
Open
func (t *TxThrottler) Open(keyspace, shard string) error { if !t.config.enabled { return nil } if t.state != nil { return fmt.Errorf("transaction throttler already opened") } var err error t.state, err = newTxThrottlerState(t.config, keyspace, shard) return err }
go
func (t *TxThrottler) Open(keyspace, shard string) error { if !t.config.enabled { return nil } if t.state != nil { return fmt.Errorf("transaction throttler already opened") } var err error t.state, err = newTxThrottlerState(t.config, keyspace, shard) return err }
[ "func", "(", "t", "*", "TxThrottler", ")", "Open", "(", "keyspace", ",", "shard", "string", ")", "error", "{", "if", "!", "t", ".", "config", ".", "enabled", "{", "return", "nil", "\n", "}", "\n", "if", "t", ".", "state", "!=", "nil", "{", "retur...
// Open opens the transaction throttler. It must be called prior to 'Throttle'.
[ "Open", "opens", "the", "transaction", "throttler", ".", "It", "must", "be", "called", "prior", "to", "Throttle", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/txthrottler/tx_throttler.go#L213-L223
train
vitessio/vitess
go/vt/vitessdriver/driver.go
toJSON
func (c Configuration) toJSON() (string, error) { c.setDefaults() jsonBytes, err := json.Marshal(c) if err != nil { return "", err } return string(jsonBytes), nil }
go
func (c Configuration) toJSON() (string, error) { c.setDefaults() jsonBytes, err := json.Marshal(c) if err != nil { return "", err } return string(jsonBytes), nil }
[ "func", "(", "c", "Configuration", ")", "toJSON", "(", ")", "(", "string", ",", "error", ")", "{", "c", ".", "setDefaults", "(", ")", "\n", "jsonBytes", ",", "err", ":=", "json", ".", "Marshal", "(", "c", ")", "\n", "if", "err", "!=", "nil", "{",...
// toJSON converts Configuration to the JSON string which is required by the // Vitess driver. Default values for empty fields will be set.
[ "toJSON", "converts", "Configuration", "to", "the", "JSON", "string", "which", "is", "required", "by", "the", "Vitess", "driver", ".", "Default", "values", "for", "empty", "fields", "will", "be", "set", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vitessdriver/driver.go#L146-L153
train
vitessio/vitess
go/acl/fallback_policy.go
CheckAccessHTTP
func (fp FallbackPolicy) CheckAccessHTTP(req *http.Request, role string) error { return errFallback }
go
func (fp FallbackPolicy) CheckAccessHTTP(req *http.Request, role string) error { return errFallback }
[ "func", "(", "fp", "FallbackPolicy", ")", "CheckAccessHTTP", "(", "req", "*", "http", ".", "Request", ",", "role", "string", ")", "error", "{", "return", "errFallback", "\n", "}" ]
// CheckAccessHTTP disallows all HTTP access.
[ "CheckAccessHTTP", "disallows", "all", "HTTP", "access", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/acl/fallback_policy.go#L37-L39
train
vitessio/vitess
go/vt/logutil/console_logger.go
WarningDepth
func (cl *ConsoleLogger) WarningDepth(depth int, s string) { log.WarningDepth(1+depth, s) }
go
func (cl *ConsoleLogger) WarningDepth(depth int, s string) { log.WarningDepth(1+depth, s) }
[ "func", "(", "cl", "*", "ConsoleLogger", ")", "WarningDepth", "(", "depth", "int", ",", "s", "string", ")", "{", "log", ".", "WarningDepth", "(", "1", "+", "depth", ",", "s", ")", "\n", "}" ]
// WarningDepth is part of the Logger interface.
[ "WarningDepth", "is", "part", "of", "the", "Logger", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/logutil/console_logger.go#L74-L76
train
vitessio/vitess
go/vt/logutil/console_logger.go
ErrorDepth
func (cl *ConsoleLogger) ErrorDepth(depth int, s string) { log.ErrorDepth(1+depth, s) }
go
func (cl *ConsoleLogger) ErrorDepth(depth int, s string) { log.ErrorDepth(1+depth, s) }
[ "func", "(", "cl", "*", "ConsoleLogger", ")", "ErrorDepth", "(", "depth", "int", ",", "s", "string", ")", "{", "log", ".", "ErrorDepth", "(", "1", "+", "depth", ",", "s", ")", "\n", "}" ]
// ErrorDepth is part of the Logger interface.
[ "ErrorDepth", "is", "part", "of", "the", "Logger", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/logutil/console_logger.go#L79-L81
train
vitessio/vitess
go/vt/topo/srv_keyspace.go
WatchSrvKeyspace
func (ts *Server) WatchSrvKeyspace(ctx context.Context, cell, keyspace string) (*WatchSrvKeyspaceData, <-chan *WatchSrvKeyspaceData, CancelFunc) { conn, err := ts.ConnForCell(ctx, cell) if err != nil { return &WatchSrvKeyspaceData{Err: err}, nil, nil } filePath := srvKeyspaceFileName(keyspace) current, wdChanne...
go
func (ts *Server) WatchSrvKeyspace(ctx context.Context, cell, keyspace string) (*WatchSrvKeyspaceData, <-chan *WatchSrvKeyspaceData, CancelFunc) { conn, err := ts.ConnForCell(ctx, cell) if err != nil { return &WatchSrvKeyspaceData{Err: err}, nil, nil } filePath := srvKeyspaceFileName(keyspace) current, wdChanne...
[ "func", "(", "ts", "*", "Server", ")", "WatchSrvKeyspace", "(", "ctx", "context", ".", "Context", ",", "cell", ",", "keyspace", "string", ")", "(", "*", "WatchSrvKeyspaceData", ",", "<-", "chan", "*", "WatchSrvKeyspaceData", ",", "CancelFunc", ")", "{", "c...
// WatchSrvKeyspace will set a watch on the SrvKeyspace object. // It has the same contract as Conn.Watch, but it also unpacks the // contents into a SrvKeyspace object.
[ "WatchSrvKeyspace", "will", "set", "a", "watch", "on", "the", "SrvKeyspace", "object", ".", "It", "has", "the", "same", "contract", "as", "Conn", ".", "Watch", "but", "it", "also", "unpacks", "the", "contents", "into", "a", "SrvKeyspace", "object", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/srv_keyspace.go#L54-L107
train
vitessio/vitess
go/vt/topo/srv_keyspace.go
GetSrvKeyspaceNames
func (ts *Server) GetSrvKeyspaceNames(ctx context.Context, cell string) ([]string, error) { conn, err := ts.ConnForCell(ctx, cell) if err != nil { return nil, err } children, err := conn.ListDir(ctx, KeyspacesPath, false /*full*/) switch { case err == nil: return DirEntriesToStringArray(children), nil case ...
go
func (ts *Server) GetSrvKeyspaceNames(ctx context.Context, cell string) ([]string, error) { conn, err := ts.ConnForCell(ctx, cell) if err != nil { return nil, err } children, err := conn.ListDir(ctx, KeyspacesPath, false /*full*/) switch { case err == nil: return DirEntriesToStringArray(children), nil case ...
[ "func", "(", "ts", "*", "Server", ")", "GetSrvKeyspaceNames", "(", "ctx", "context", ".", "Context", ",", "cell", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "conn", ",", "err", ":=", "ts", ".", "ConnForCell", "(", "ctx", ",", "...
// GetSrvKeyspaceNames returns the SrvKeyspace objects for a cell.
[ "GetSrvKeyspaceNames", "returns", "the", "SrvKeyspace", "objects", "for", "a", "cell", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/srv_keyspace.go#L110-L125
train
vitessio/vitess
go/vt/topo/srv_keyspace.go
GetShardServingCells
func (ts *Server) GetShardServingCells(ctx context.Context, si *ShardInfo) (servingCells []string, err error) { cells, err := ts.GetCellInfoNames(ctx) if err != nil { return nil, err } wg := sync.WaitGroup{} rec := concurrency.AllErrorRecorder{} servingCells = make([]string, 0) var mu sync.Mutex for _, cell ...
go
func (ts *Server) GetShardServingCells(ctx context.Context, si *ShardInfo) (servingCells []string, err error) { cells, err := ts.GetCellInfoNames(ctx) if err != nil { return nil, err } wg := sync.WaitGroup{} rec := concurrency.AllErrorRecorder{} servingCells = make([]string, 0) var mu sync.Mutex for _, cell ...
[ "func", "(", "ts", "*", "Server", ")", "GetShardServingCells", "(", "ctx", "context", ".", "Context", ",", "si", "*", "ShardInfo", ")", "(", "servingCells", "[", "]", "string", ",", "err", "error", ")", "{", "cells", ",", "err", ":=", "ts", ".", "Get...
// GetShardServingCells returns cells where this shard is serving
[ "GetShardServingCells", "returns", "cells", "where", "this", "shard", "is", "serving" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/srv_keyspace.go#L128-L176
train
vitessio/vitess
go/vt/topo/srv_keyspace.go
GetShardServingTypes
func (ts *Server) GetShardServingTypes(ctx context.Context, si *ShardInfo) (servingTypes []topodatapb.TabletType, err error) { cells, err := ts.GetCellInfoNames(ctx) if err != nil { return nil, err } wg := sync.WaitGroup{} rec := concurrency.AllErrorRecorder{} servingTypes = make([]topodatapb.TabletType, 0) v...
go
func (ts *Server) GetShardServingTypes(ctx context.Context, si *ShardInfo) (servingTypes []topodatapb.TabletType, err error) { cells, err := ts.GetCellInfoNames(ctx) if err != nil { return nil, err } wg := sync.WaitGroup{} rec := concurrency.AllErrorRecorder{} servingTypes = make([]topodatapb.TabletType, 0) v...
[ "func", "(", "ts", "*", "Server", ")", "GetShardServingTypes", "(", "ctx", "context", ".", "Context", ",", "si", "*", "ShardInfo", ")", "(", "servingTypes", "[", "]", "topodatapb", ".", "TabletType", ",", "err", "error", ")", "{", "cells", ",", "err", ...
// GetShardServingTypes returns served types for given shard across all cells
[ "GetShardServingTypes", "returns", "served", "types", "for", "given", "shard", "across", "all", "cells" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/srv_keyspace.go#L179-L233
train
vitessio/vitess
go/vt/topo/srv_keyspace.go
AddSrvKeyspacePartitions
func (ts *Server) AddSrvKeyspacePartitions(ctx context.Context, keyspace string, shards []*ShardInfo, tabletType topodatapb.TabletType, cells []string) (err error) { if err = CheckKeyspaceLocked(ctx, keyspace); err != nil { return err } // The caller intents to update all cells in this case if len(cells) == 0 { ...
go
func (ts *Server) AddSrvKeyspacePartitions(ctx context.Context, keyspace string, shards []*ShardInfo, tabletType topodatapb.TabletType, cells []string) (err error) { if err = CheckKeyspaceLocked(ctx, keyspace); err != nil { return err } // The caller intents to update all cells in this case if len(cells) == 0 { ...
[ "func", "(", "ts", "*", "Server", ")", "AddSrvKeyspacePartitions", "(", "ctx", "context", ".", "Context", ",", "keyspace", "string", ",", "shards", "[", "]", "*", "ShardInfo", ",", "tabletType", "topodatapb", ".", "TabletType", ",", "cells", "[", "]", "str...
// AddSrvKeyspacePartitions adds partitions to srvKeyspace
[ "AddSrvKeyspacePartitions", "adds", "partitions", "to", "srvKeyspace" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/srv_keyspace.go#L236-L323
train
vitessio/vitess
go/vt/topo/srv_keyspace.go
UpdateDisableQueryService
func (ts *Server) UpdateDisableQueryService(ctx context.Context, keyspace string, shards []*ShardInfo, tabletType topodatapb.TabletType, cells []string, disableQueryService bool) (err error) { if err = CheckKeyspaceLocked(ctx, keyspace); err != nil { return err } // The caller intents to update all cells in this ...
go
func (ts *Server) UpdateDisableQueryService(ctx context.Context, keyspace string, shards []*ShardInfo, tabletType topodatapb.TabletType, cells []string, disableQueryService bool) (err error) { if err = CheckKeyspaceLocked(ctx, keyspace); err != nil { return err } // The caller intents to update all cells in this ...
[ "func", "(", "ts", "*", "Server", ")", "UpdateDisableQueryService", "(", "ctx", "context", ".", "Context", ",", "keyspace", "string", ",", "shards", "[", "]", "*", "ShardInfo", ",", "tabletType", "topodatapb", ".", "TabletType", ",", "cells", "[", "]", "st...
// UpdateDisableQueryService will make sure the disableQueryService is // set appropriately in tablet controls in srvKeyspace.
[ "UpdateDisableQueryService", "will", "make", "sure", "the", "disableQueryService", "is", "set", "appropriately", "in", "tablet", "controls", "in", "srvKeyspace", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/srv_keyspace.go#L395-L480
train
vitessio/vitess
go/vt/topo/srv_keyspace.go
UpdateSrvKeyspace
func (ts *Server) UpdateSrvKeyspace(ctx context.Context, cell, keyspace string, srvKeyspace *topodatapb.SrvKeyspace) error { conn, err := ts.ConnForCell(ctx, cell) if err != nil { return err } nodePath := srvKeyspaceFileName(keyspace) data, err := proto.Marshal(srvKeyspace) if err != nil { return err } _, ...
go
func (ts *Server) UpdateSrvKeyspace(ctx context.Context, cell, keyspace string, srvKeyspace *topodatapb.SrvKeyspace) error { conn, err := ts.ConnForCell(ctx, cell) if err != nil { return err } nodePath := srvKeyspaceFileName(keyspace) data, err := proto.Marshal(srvKeyspace) if err != nil { return err } _, ...
[ "func", "(", "ts", "*", "Server", ")", "UpdateSrvKeyspace", "(", "ctx", "context", ".", "Context", ",", "cell", ",", "keyspace", "string", ",", "srvKeyspace", "*", "topodatapb", ".", "SrvKeyspace", ")", "error", "{", "conn", ",", "err", ":=", "ts", ".", ...
// UpdateSrvKeyspace saves a new SrvKeyspace. It is a blind write.
[ "UpdateSrvKeyspace", "saves", "a", "new", "SrvKeyspace", ".", "It", "is", "a", "blind", "write", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/srv_keyspace.go#L582-L595
train
vitessio/vitess
go/vt/topo/srv_keyspace.go
DeleteSrvKeyspace
func (ts *Server) DeleteSrvKeyspace(ctx context.Context, cell, keyspace string) error { conn, err := ts.ConnForCell(ctx, cell) if err != nil { return err } nodePath := srvKeyspaceFileName(keyspace) return conn.Delete(ctx, nodePath, nil) }
go
func (ts *Server) DeleteSrvKeyspace(ctx context.Context, cell, keyspace string) error { conn, err := ts.ConnForCell(ctx, cell) if err != nil { return err } nodePath := srvKeyspaceFileName(keyspace) return conn.Delete(ctx, nodePath, nil) }
[ "func", "(", "ts", "*", "Server", ")", "DeleteSrvKeyspace", "(", "ctx", "context", ".", "Context", ",", "cell", ",", "keyspace", "string", ")", "error", "{", "conn", ",", "err", ":=", "ts", ".", "ConnForCell", "(", "ctx", ",", "cell", ")", "\n", "if"...
// DeleteSrvKeyspace deletes a SrvKeyspace.
[ "DeleteSrvKeyspace", "deletes", "a", "SrvKeyspace", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/srv_keyspace.go#L598-L606
train
vitessio/vitess
go/vt/topo/srv_keyspace.go
GetSrvKeyspaceAllCells
func (ts *Server) GetSrvKeyspaceAllCells(ctx context.Context, keyspace string) ([]*topodatapb.SrvKeyspace, error) { cells, err := ts.GetCellInfoNames(ctx) if err != nil { return nil, err } srvKeyspaces := make([]*topodatapb.SrvKeyspace, len(cells)) for _, cell := range cells { srvKeyspace, err := ts.GetSrvKey...
go
func (ts *Server) GetSrvKeyspaceAllCells(ctx context.Context, keyspace string) ([]*topodatapb.SrvKeyspace, error) { cells, err := ts.GetCellInfoNames(ctx) if err != nil { return nil, err } srvKeyspaces := make([]*topodatapb.SrvKeyspace, len(cells)) for _, cell := range cells { srvKeyspace, err := ts.GetSrvKey...
[ "func", "(", "ts", "*", "Server", ")", "GetSrvKeyspaceAllCells", "(", "ctx", "context", ".", "Context", ",", "keyspace", "string", ")", "(", "[", "]", "*", "topodatapb", ".", "SrvKeyspace", ",", "error", ")", "{", "cells", ",", "err", ":=", "ts", ".", ...
// GetSrvKeyspaceAllCells returns the SrvKeyspace for all cells
[ "GetSrvKeyspaceAllCells", "returns", "the", "SrvKeyspace", "for", "all", "cells" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/srv_keyspace.go#L609-L628
train
vitessio/vitess
go/vt/topo/srv_keyspace.go
OrderAndCheckPartitions
func OrderAndCheckPartitions(cell string, srvKeyspace *topodatapb.SrvKeyspace) error { // now check them all for _, partition := range srvKeyspace.Partitions { tabletType := partition.ServedType topoproto.ShardReferenceArray(partition.ShardReferences).Sort() // check the first Start is MinKey, the last End is ...
go
func OrderAndCheckPartitions(cell string, srvKeyspace *topodatapb.SrvKeyspace) error { // now check them all for _, partition := range srvKeyspace.Partitions { tabletType := partition.ServedType topoproto.ShardReferenceArray(partition.ShardReferences).Sort() // check the first Start is MinKey, the last End is ...
[ "func", "OrderAndCheckPartitions", "(", "cell", "string", ",", "srvKeyspace", "*", "topodatapb", ".", "SrvKeyspace", ")", "error", "{", "// now check them all", "for", "_", ",", "partition", ":=", "range", "srvKeyspace", ".", "Partitions", "{", "tabletType", ":=",...
// OrderAndCheckPartitions will re-order the partition list, and check // it's correct.
[ "OrderAndCheckPartitions", "will", "re", "-", "order", "the", "partition", "list", "and", "check", "it", "s", "correct", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/srv_keyspace.go#L651-L686
train
vitessio/vitess
go/vt/topo/srv_keyspace.go
ShardIsServing
func ShardIsServing(srvKeyspace *topodatapb.SrvKeyspace, shard *topodatapb.Shard) bool { for _, partition := range srvKeyspace.GetPartitions() { for _, shardReference := range partition.GetShardReferences() { if key.KeyRangeEqual(shardReference.GetKeyRange(), shard.GetKeyRange()) { return true } } } re...
go
func ShardIsServing(srvKeyspace *topodatapb.SrvKeyspace, shard *topodatapb.Shard) bool { for _, partition := range srvKeyspace.GetPartitions() { for _, shardReference := range partition.GetShardReferences() { if key.KeyRangeEqual(shardReference.GetKeyRange(), shard.GetKeyRange()) { return true } } } re...
[ "func", "ShardIsServing", "(", "srvKeyspace", "*", "topodatapb", ".", "SrvKeyspace", ",", "shard", "*", "topodatapb", ".", "Shard", ")", "bool", "{", "for", "_", ",", "partition", ":=", "range", "srvKeyspace", ".", "GetPartitions", "(", ")", "{", "for", "_...
// ShardIsServing returns true if this shard is found in any of the partitions in the srvKeyspace
[ "ShardIsServing", "returns", "true", "if", "this", "shard", "is", "found", "in", "any", "of", "the", "partitions", "in", "the", "srvKeyspace" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/srv_keyspace.go#L689-L698
train
vitessio/vitess
go/vt/topo/cell_info.go
GetCellInfoNames
func (ts *Server) GetCellInfoNames(ctx context.Context) ([]string, error) { entries, err := ts.globalCell.ListDir(ctx, CellsPath, false /*full*/) switch { case IsErrType(err, NoNode): return nil, nil case err == nil: return DirEntriesToStringArray(entries), nil default: return nil, err } }
go
func (ts *Server) GetCellInfoNames(ctx context.Context) ([]string, error) { entries, err := ts.globalCell.ListDir(ctx, CellsPath, false /*full*/) switch { case IsErrType(err, NoNode): return nil, nil case err == nil: return DirEntriesToStringArray(entries), nil default: return nil, err } }
[ "func", "(", "ts", "*", "Server", ")", "GetCellInfoNames", "(", "ctx", "context", ".", "Context", ")", "(", "[", "]", "string", ",", "error", ")", "{", "entries", ",", "err", ":=", "ts", ".", "globalCell", ".", "ListDir", "(", "ctx", ",", "CellsPath"...
// GetCellInfoNames returns the names of the existing cells. They are // sorted by name.
[ "GetCellInfoNames", "returns", "the", "names", "of", "the", "existing", "cells", ".", "They", "are", "sorted", "by", "name", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/cell_info.go#L47-L57
train
vitessio/vitess
go/vt/topo/cell_info.go
GetCellInfo
func (ts *Server) GetCellInfo(ctx context.Context, cell string, strongRead bool) (*topodatapb.CellInfo, error) { conn := ts.globalCell if !strongRead { conn = ts.globalReadOnlyCell } // Read the file. filePath := pathForCellInfo(cell) contents, _, err := conn.Get(ctx, filePath) if err != nil { return nil, er...
go
func (ts *Server) GetCellInfo(ctx context.Context, cell string, strongRead bool) (*topodatapb.CellInfo, error) { conn := ts.globalCell if !strongRead { conn = ts.globalReadOnlyCell } // Read the file. filePath := pathForCellInfo(cell) contents, _, err := conn.Get(ctx, filePath) if err != nil { return nil, er...
[ "func", "(", "ts", "*", "Server", ")", "GetCellInfo", "(", "ctx", "context", ".", "Context", ",", "cell", "string", ",", "strongRead", "bool", ")", "(", "*", "topodatapb", ".", "CellInfo", ",", "error", ")", "{", "conn", ":=", "ts", ".", "globalCell", ...
// GetCellInfo reads a CellInfo from the global Conn.
[ "GetCellInfo", "reads", "a", "CellInfo", "from", "the", "global", "Conn", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/cell_info.go#L60-L78
train
vitessio/vitess
go/vt/topo/cell_info.go
CreateCellInfo
func (ts *Server) CreateCellInfo(ctx context.Context, cell string, ci *topodatapb.CellInfo) error { // Pack the content. contents, err := proto.Marshal(ci) if err != nil { return err } // Save it. filePath := pathForCellInfo(cell) _, err = ts.globalCell.Create(ctx, filePath, contents) return err }
go
func (ts *Server) CreateCellInfo(ctx context.Context, cell string, ci *topodatapb.CellInfo) error { // Pack the content. contents, err := proto.Marshal(ci) if err != nil { return err } // Save it. filePath := pathForCellInfo(cell) _, err = ts.globalCell.Create(ctx, filePath, contents) return err }
[ "func", "(", "ts", "*", "Server", ")", "CreateCellInfo", "(", "ctx", "context", ".", "Context", ",", "cell", "string", ",", "ci", "*", "topodatapb", ".", "CellInfo", ")", "error", "{", "// Pack the content.", "contents", ",", "err", ":=", "proto", ".", "...
// CreateCellInfo creates a new CellInfo with the provided content.
[ "CreateCellInfo", "creates", "a", "new", "CellInfo", "with", "the", "provided", "content", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/cell_info.go#L81-L92
train
vitessio/vitess
go/vt/topo/cell_info.go
UpdateCellInfoFields
func (ts *Server) UpdateCellInfoFields(ctx context.Context, cell string, update func(*topodatapb.CellInfo) error) error { filePath := pathForCellInfo(cell) for { ci := &topodatapb.CellInfo{} // Read the file, unpack the contents. contents, version, err := ts.globalCell.Get(ctx, filePath) switch { case err ...
go
func (ts *Server) UpdateCellInfoFields(ctx context.Context, cell string, update func(*topodatapb.CellInfo) error) error { filePath := pathForCellInfo(cell) for { ci := &topodatapb.CellInfo{} // Read the file, unpack the contents. contents, version, err := ts.globalCell.Get(ctx, filePath) switch { case err ...
[ "func", "(", "ts", "*", "Server", ")", "UpdateCellInfoFields", "(", "ctx", "context", ".", "Context", ",", "cell", "string", ",", "update", "func", "(", "*", "topodatapb", ".", "CellInfo", ")", "error", ")", "error", "{", "filePath", ":=", "pathForCellInfo...
// UpdateCellInfoFields is a high level helper method to read a CellInfo // object, update its fields, and then write it back. If the write fails due to // a version mismatch, it will re-read the record and retry the update. // If the update method returns ErrNoUpdateNeeded, nothing is written, // and nil is returned.
[ "UpdateCellInfoFields", "is", "a", "high", "level", "helper", "method", "to", "read", "a", "CellInfo", "object", "update", "its", "fields", "and", "then", "write", "it", "back", ".", "If", "the", "write", "fails", "due", "to", "a", "version", "mismatch", "...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/cell_info.go#L99-L135
train
vitessio/vitess
go/vt/topo/cell_info.go
DeleteCellInfo
func (ts *Server) DeleteCellInfo(ctx context.Context, cell string) error { srvKeyspaces, err := ts.GetSrvKeyspaceNames(ctx, cell) switch { case err == nil: if len(srvKeyspaces) != 0 { return vterrors.Wrap(err, fmt.Sprintf("cell %v has serving keyspaces. Before deleting, delete keyspace with: DeleteKeyspace", ce...
go
func (ts *Server) DeleteCellInfo(ctx context.Context, cell string) error { srvKeyspaces, err := ts.GetSrvKeyspaceNames(ctx, cell) switch { case err == nil: if len(srvKeyspaces) != 0 { return vterrors.Wrap(err, fmt.Sprintf("cell %v has serving keyspaces. Before deleting, delete keyspace with: DeleteKeyspace", ce...
[ "func", "(", "ts", "*", "Server", ")", "DeleteCellInfo", "(", "ctx", "context", ".", "Context", ",", "cell", "string", ")", "error", "{", "srvKeyspaces", ",", "err", ":=", "ts", ".", "GetSrvKeyspaceNames", "(", "ctx", ",", "cell", ")", "\n", "switch", ...
// DeleteCellInfo deletes the specified CellInfo. // We first make sure no Shard record points to the cell.
[ "DeleteCellInfo", "deletes", "the", "specified", "CellInfo", ".", "We", "first", "make", "sure", "no", "Shard", "record", "points", "to", "the", "cell", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/cell_info.go#L139-L154
train
vitessio/vitess
go/vt/throttler/manager.go
MaxRates
func (m *managerImpl) MaxRates() map[string]int64 { m.mu.Lock() defer m.mu.Unlock() rates := make(map[string]int64, len(m.throttlers)) for name, t := range m.throttlers { rates[name] = t.MaxRate() } return rates }
go
func (m *managerImpl) MaxRates() map[string]int64 { m.mu.Lock() defer m.mu.Unlock() rates := make(map[string]int64, len(m.throttlers)) for name, t := range m.throttlers { rates[name] = t.MaxRate() } return rates }
[ "func", "(", "m", "*", "managerImpl", ")", "MaxRates", "(", ")", "map", "[", "string", "]", "int64", "{", "m", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "rates", ":=", "make", "(", "map", ...
// MaxRates returns the max rate of all known throttlers.
[ "MaxRates", "returns", "the", "max", "rate", "of", "all", "known", "throttlers", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/manager.go#L99-L108
train
vitessio/vitess
go/vt/throttler/manager.go
SetMaxRate
func (m *managerImpl) SetMaxRate(rate int64) []string { m.mu.Lock() defer m.mu.Unlock() for _, t := range m.throttlers { t.SetMaxRate(rate) } return m.throttlerNamesLocked() }
go
func (m *managerImpl) SetMaxRate(rate int64) []string { m.mu.Lock() defer m.mu.Unlock() for _, t := range m.throttlers { t.SetMaxRate(rate) } return m.throttlerNamesLocked() }
[ "func", "(", "m", "*", "managerImpl", ")", "SetMaxRate", "(", "rate", "int64", ")", "[", "]", "string", "{", "m", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "for", "_", ",", "t", ":=", "r...
// SetMaxRate sets the max rate on all known throttlers.
[ "SetMaxRate", "sets", "the", "max", "rate", "on", "all", "known", "throttlers", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/manager.go#L111-L119
train
vitessio/vitess
go/vt/throttler/manager.go
GetConfiguration
func (m *managerImpl) GetConfiguration(throttlerName string) (map[string]*throttlerdatapb.Configuration, error) { m.mu.Lock() defer m.mu.Unlock() configurations := make(map[string]*throttlerdatapb.Configuration) if throttlerName != "" { t, ok := m.throttlers[throttlerName] if !ok { return nil, fmt.Errorf("...
go
func (m *managerImpl) GetConfiguration(throttlerName string) (map[string]*throttlerdatapb.Configuration, error) { m.mu.Lock() defer m.mu.Unlock() configurations := make(map[string]*throttlerdatapb.Configuration) if throttlerName != "" { t, ok := m.throttlers[throttlerName] if !ok { return nil, fmt.Errorf("...
[ "func", "(", "m", "*", "managerImpl", ")", "GetConfiguration", "(", "throttlerName", "string", ")", "(", "map", "[", "string", "]", "*", "throttlerdatapb", ".", "Configuration", ",", "error", ")", "{", "m", ".", "mu", ".", "Lock", "(", ")", "\n", "defe...
// GetConfiguration implements the "Manager" interface.
[ "GetConfiguration", "implements", "the", "Manager", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/manager.go#L122-L141
train
vitessio/vitess
go/vt/throttler/manager.go
UpdateConfiguration
func (m *managerImpl) UpdateConfiguration(throttlerName string, configuration *throttlerdatapb.Configuration, copyZeroValues bool) ([]string, error) { m.mu.Lock() defer m.mu.Unlock() // Note: The calls to t.UpdateConfiguration() below return no error but the // called protobuf library functions may panic. This is ...
go
func (m *managerImpl) UpdateConfiguration(throttlerName string, configuration *throttlerdatapb.Configuration, copyZeroValues bool) ([]string, error) { m.mu.Lock() defer m.mu.Unlock() // Note: The calls to t.UpdateConfiguration() below return no error but the // called protobuf library functions may panic. This is ...
[ "func", "(", "m", "*", "managerImpl", ")", "UpdateConfiguration", "(", "throttlerName", "string", ",", "configuration", "*", "throttlerdatapb", ".", "Configuration", ",", "copyZeroValues", "bool", ")", "(", "[", "]", "string", ",", "error", ")", "{", "m", "....
// UpdateConfiguration implements the "Manager" interface.
[ "UpdateConfiguration", "implements", "the", "Manager", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/manager.go#L144-L169
train
vitessio/vitess
go/vt/throttler/manager.go
ResetConfiguration
func (m *managerImpl) ResetConfiguration(throttlerName string) ([]string, error) { m.mu.Lock() defer m.mu.Unlock() if throttlerName != "" { t, ok := m.throttlers[throttlerName] if !ok { return nil, fmt.Errorf("throttler: %v does not exist", throttlerName) } t.ResetConfiguration() return []string{thrott...
go
func (m *managerImpl) ResetConfiguration(throttlerName string) ([]string, error) { m.mu.Lock() defer m.mu.Unlock() if throttlerName != "" { t, ok := m.throttlers[throttlerName] if !ok { return nil, fmt.Errorf("throttler: %v does not exist", throttlerName) } t.ResetConfiguration() return []string{thrott...
[ "func", "(", "m", "*", "managerImpl", ")", "ResetConfiguration", "(", "throttlerName", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "m", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "mu", ".", "Unlock", "(", ")", ...
// ResetConfiguration implements the "Manager" interface.
[ "ResetConfiguration", "implements", "the", "Manager", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/manager.go#L172-L189
train
vitessio/vitess
go/vt/throttler/manager.go
Throttlers
func (m *managerImpl) Throttlers() []string { m.mu.Lock() defer m.mu.Unlock() return m.throttlerNamesLocked() }
go
func (m *managerImpl) Throttlers() []string { m.mu.Lock() defer m.mu.Unlock() return m.throttlerNamesLocked() }
[ "func", "(", "m", "*", "managerImpl", ")", "Throttlers", "(", ")", "[", "]", "string", "{", "m", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "return", "m", ".", "throttlerNamesLocked", "(", ")...
// Throttlers returns the sorted list of active throttlers.
[ "Throttlers", "returns", "the", "sorted", "list", "of", "active", "throttlers", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/manager.go#L192-L197
train
vitessio/vitess
go/vt/throttler/manager.go
Log
func (m *managerImpl) Log(throttlerName string) ([]result, error) { m.mu.Lock() defer m.mu.Unlock() t, ok := m.throttlers[throttlerName] if !ok { return nil, fmt.Errorf("throttler: %v does not exist", throttlerName) } return t.Log(), nil }
go
func (m *managerImpl) Log(throttlerName string) ([]result, error) { m.mu.Lock() defer m.mu.Unlock() t, ok := m.throttlers[throttlerName] if !ok { return nil, fmt.Errorf("throttler: %v does not exist", throttlerName) } return t.Log(), nil }
[ "func", "(", "m", "*", "managerImpl", ")", "Log", "(", "throttlerName", "string", ")", "(", "[", "]", "result", ",", "error", ")", "{", "m", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "t", ...
// Log returns the most recent changes of the MaxReplicationLag module. // There will be one result for each processed replication lag record.
[ "Log", "returns", "the", "most", "recent", "changes", "of", "the", "MaxReplicationLag", "module", ".", "There", "will", "be", "one", "result", "for", "each", "processed", "replication", "lag", "record", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/manager.go#L210-L220
train
vitessio/vitess
go/vt/vtgate/vindexes/binarymd5.go
NewBinaryMD5
func NewBinaryMD5(name string, _ map[string]string) (Vindex, error) { return &BinaryMD5{name: name}, nil }
go
func NewBinaryMD5(name string, _ map[string]string) (Vindex, error) { return &BinaryMD5{name: name}, nil }
[ "func", "NewBinaryMD5", "(", "name", "string", ",", "_", "map", "[", "string", "]", "string", ")", "(", "Vindex", ",", "error", ")", "{", "return", "&", "BinaryMD5", "{", "name", ":", "name", "}", ",", "nil", "\n", "}" ]
// NewBinaryMD5 creates a new BinaryMD5.
[ "NewBinaryMD5", "creates", "a", "new", "BinaryMD5", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vindexes/binarymd5.go#L37-L39
train
vitessio/vitess
go/vt/vttablet/tabletserver/tx_prep_pool.go
NewTxPreparedPool
func NewTxPreparedPool(capacity int) *TxPreparedPool { if capacity < 0 { // If capacity is 0 all prepares will fail. capacity = 0 } return &TxPreparedPool{ conns: make(map[string]*TxConnection, capacity), reserved: make(map[string]error), capacity: capacity, } }
go
func NewTxPreparedPool(capacity int) *TxPreparedPool { if capacity < 0 { // If capacity is 0 all prepares will fail. capacity = 0 } return &TxPreparedPool{ conns: make(map[string]*TxConnection, capacity), reserved: make(map[string]error), capacity: capacity, } }
[ "func", "NewTxPreparedPool", "(", "capacity", "int", ")", "*", "TxPreparedPool", "{", "if", "capacity", "<", "0", "{", "// If capacity is 0 all prepares will fail.", "capacity", "=", "0", "\n", "}", "\n", "return", "&", "TxPreparedPool", "{", "conns", ":", "make...
// NewTxPreparedPool creates a new TxPreparedPool.
[ "NewTxPreparedPool", "creates", "a", "new", "TxPreparedPool", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tx_prep_pool.go#L41-L51
train
vitessio/vitess
go/vt/vttablet/tabletserver/tx_prep_pool.go
Put
func (pp *TxPreparedPool) Put(c *TxConnection, dtid string) error { pp.mu.Lock() defer pp.mu.Unlock() if _, ok := pp.reserved[dtid]; ok { return errors.New("duplicate DTID in Prepare: " + dtid) } if _, ok := pp.conns[dtid]; ok { return errors.New("duplicate DTID in Prepare: " + dtid) } if len(pp.conns) >= pp...
go
func (pp *TxPreparedPool) Put(c *TxConnection, dtid string) error { pp.mu.Lock() defer pp.mu.Unlock() if _, ok := pp.reserved[dtid]; ok { return errors.New("duplicate DTID in Prepare: " + dtid) } if _, ok := pp.conns[dtid]; ok { return errors.New("duplicate DTID in Prepare: " + dtid) } if len(pp.conns) >= pp...
[ "func", "(", "pp", "*", "TxPreparedPool", ")", "Put", "(", "c", "*", "TxConnection", ",", "dtid", "string", ")", "error", "{", "pp", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "pp", ".", "mu", ".", "Unlock", "(", ")", "\n", "if", "_", ","...
// Put adds the connection to the pool. It returns an error // if the pool is full or on duplicate key.
[ "Put", "adds", "the", "connection", "to", "the", "pool", ".", "It", "returns", "an", "error", "if", "the", "pool", "is", "full", "or", "on", "duplicate", "key", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tx_prep_pool.go#L55-L69
train
vitessio/vitess
go/vt/vttablet/tabletserver/tx_prep_pool.go
FetchForRollback
func (pp *TxPreparedPool) FetchForRollback(dtid string) *TxConnection { pp.mu.Lock() defer pp.mu.Unlock() if _, ok := pp.reserved[dtid]; ok { delete(pp.reserved, dtid) return nil } c := pp.conns[dtid] delete(pp.conns, dtid) return c }
go
func (pp *TxPreparedPool) FetchForRollback(dtid string) *TxConnection { pp.mu.Lock() defer pp.mu.Unlock() if _, ok := pp.reserved[dtid]; ok { delete(pp.reserved, dtid) return nil } c := pp.conns[dtid] delete(pp.conns, dtid) return c }
[ "func", "(", "pp", "*", "TxPreparedPool", ")", "FetchForRollback", "(", "dtid", "string", ")", "*", "TxConnection", "{", "pp", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "pp", ".", "mu", ".", "Unlock", "(", ")", "\n", "if", "_", ",", "ok", ...
// FetchForRollback returns the connection and removes it from the pool. // If the connection is not found, it returns nil. If the dtid // is in the reserved list, it means that an operator is trying // to resolve a previously failed commit. So, it removes the entry // and returns nil.
[ "FetchForRollback", "returns", "the", "connection", "and", "removes", "it", "from", "the", "pool", ".", "If", "the", "connection", "is", "not", "found", "it", "returns", "nil", ".", "If", "the", "dtid", "is", "in", "the", "reserved", "list", "it", "means",...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tx_prep_pool.go#L76-L86
train
vitessio/vitess
go/vt/vttablet/tabletserver/tx_prep_pool.go
FetchForCommit
func (pp *TxPreparedPool) FetchForCommit(dtid string) (*TxConnection, error) { pp.mu.Lock() defer pp.mu.Unlock() if err, ok := pp.reserved[dtid]; ok { return nil, err } c, ok := pp.conns[dtid] if ok { delete(pp.conns, dtid) pp.reserved[dtid] = errPrepCommitting } return c, nil }
go
func (pp *TxPreparedPool) FetchForCommit(dtid string) (*TxConnection, error) { pp.mu.Lock() defer pp.mu.Unlock() if err, ok := pp.reserved[dtid]; ok { return nil, err } c, ok := pp.conns[dtid] if ok { delete(pp.conns, dtid) pp.reserved[dtid] = errPrepCommitting } return c, nil }
[ "func", "(", "pp", "*", "TxPreparedPool", ")", "FetchForCommit", "(", "dtid", "string", ")", "(", "*", "TxConnection", ",", "error", ")", "{", "pp", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "pp", ".", "mu", ".", "Unlock", "(", ")", "\n", ...
// FetchForCommit returns the connection for commit. Before returning, // it remembers the dtid in its reserved list as "committing". If // the dtid is already in the reserved list, it returns an error. // If the commit is successful, the dtid can be removed from the // reserved list by calling Forget. If the commit fa...
[ "FetchForCommit", "returns", "the", "connection", "for", "commit", ".", "Before", "returning", "it", "remembers", "the", "dtid", "in", "its", "reserved", "list", "as", "committing", ".", "If", "the", "dtid", "is", "already", "in", "the", "reserved", "list", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tx_prep_pool.go#L95-L107
train
vitessio/vitess
go/vt/vttablet/tabletserver/tx_prep_pool.go
SetFailed
func (pp *TxPreparedPool) SetFailed(dtid string) { pp.mu.Lock() defer pp.mu.Unlock() pp.reserved[dtid] = errPrepFailed }
go
func (pp *TxPreparedPool) SetFailed(dtid string) { pp.mu.Lock() defer pp.mu.Unlock() pp.reserved[dtid] = errPrepFailed }
[ "func", "(", "pp", "*", "TxPreparedPool", ")", "SetFailed", "(", "dtid", "string", ")", "{", "pp", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "pp", ".", "mu", ".", "Unlock", "(", ")", "\n", "pp", ".", "reserved", "[", "dtid", "]", "=", "e...
// SetFailed marks the reserved dtid as failed. // If there was no previous entry, one is created.
[ "SetFailed", "marks", "the", "reserved", "dtid", "as", "failed", ".", "If", "there", "was", "no", "previous", "entry", "one", "is", "created", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tx_prep_pool.go#L111-L115
train
vitessio/vitess
go/vt/vttablet/tabletserver/tx_prep_pool.go
Forget
func (pp *TxPreparedPool) Forget(dtid string) { pp.mu.Lock() defer pp.mu.Unlock() delete(pp.reserved, dtid) }
go
func (pp *TxPreparedPool) Forget(dtid string) { pp.mu.Lock() defer pp.mu.Unlock() delete(pp.reserved, dtid) }
[ "func", "(", "pp", "*", "TxPreparedPool", ")", "Forget", "(", "dtid", "string", ")", "{", "pp", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "pp", ".", "mu", ".", "Unlock", "(", ")", "\n", "delete", "(", "pp", ".", "reserved", ",", "dtid", ...
// Forget removes the dtid from the reserved list.
[ "Forget", "removes", "the", "dtid", "from", "the", "reserved", "list", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tx_prep_pool.go#L118-L122
train
vitessio/vitess
go/vt/vttablet/tabletserver/tx_prep_pool.go
FetchAll
func (pp *TxPreparedPool) FetchAll() []*TxConnection { pp.mu.Lock() defer pp.mu.Unlock() conns := make([]*TxConnection, 0, len(pp.conns)) for _, c := range pp.conns { conns = append(conns, c) } pp.conns = make(map[string]*TxConnection, pp.capacity) pp.reserved = make(map[string]error) return conns }
go
func (pp *TxPreparedPool) FetchAll() []*TxConnection { pp.mu.Lock() defer pp.mu.Unlock() conns := make([]*TxConnection, 0, len(pp.conns)) for _, c := range pp.conns { conns = append(conns, c) } pp.conns = make(map[string]*TxConnection, pp.capacity) pp.reserved = make(map[string]error) return conns }
[ "func", "(", "pp", "*", "TxPreparedPool", ")", "FetchAll", "(", ")", "[", "]", "*", "TxConnection", "{", "pp", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "pp", ".", "mu", ".", "Unlock", "(", ")", "\n", "conns", ":=", "make", "(", "[", "]"...
// FetchAll removes all connections and returns them as a list. // It also forgets all reserved dtids.
[ "FetchAll", "removes", "all", "connections", "and", "returns", "them", "as", "a", "list", ".", "It", "also", "forgets", "all", "reserved", "dtids", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tx_prep_pool.go#L126-L136
train
vitessio/vitess
go/vt/vttablet/tabletmanager/rpc_schema.go
GetSchema
func (agent *ActionAgent) GetSchema(ctx context.Context, tables, excludeTables []string, includeViews bool) (*tabletmanagerdatapb.SchemaDefinition, error) { return agent.MysqlDaemon.GetSchema(topoproto.TabletDbName(agent.Tablet()), tables, excludeTables, includeViews) }
go
func (agent *ActionAgent) GetSchema(ctx context.Context, tables, excludeTables []string, includeViews bool) (*tabletmanagerdatapb.SchemaDefinition, error) { return agent.MysqlDaemon.GetSchema(topoproto.TabletDbName(agent.Tablet()), tables, excludeTables, includeViews) }
[ "func", "(", "agent", "*", "ActionAgent", ")", "GetSchema", "(", "ctx", "context", ".", "Context", ",", "tables", ",", "excludeTables", "[", "]", "string", ",", "includeViews", "bool", ")", "(", "*", "tabletmanagerdatapb", ".", "SchemaDefinition", ",", "erro...
// GetSchema returns the schema.
[ "GetSchema", "returns", "the", "schema", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/rpc_schema.go#L33-L35
train
vitessio/vitess
go/vt/vttablet/tabletmanager/rpc_schema.go
ReloadSchema
func (agent *ActionAgent) ReloadSchema(ctx context.Context, waitPosition string) error { if agent.DBConfigs.IsZero() { // we skip this for test instances that can't connect to the DB anyway return nil } if waitPosition != "" { pos, err := mysql.DecodePosition(waitPosition) if err != nil { return vterrors...
go
func (agent *ActionAgent) ReloadSchema(ctx context.Context, waitPosition string) error { if agent.DBConfigs.IsZero() { // we skip this for test instances that can't connect to the DB anyway return nil } if waitPosition != "" { pos, err := mysql.DecodePosition(waitPosition) if err != nil { return vterrors...
[ "func", "(", "agent", "*", "ActionAgent", ")", "ReloadSchema", "(", "ctx", "context", ".", "Context", ",", "waitPosition", "string", ")", "error", "{", "if", "agent", ".", "DBConfigs", ".", "IsZero", "(", ")", "{", "// we skip this for test instances that can't ...
// ReloadSchema will reload the schema // This doesn't need the action mutex because periodic schema reloads happen // in the background anyway.
[ "ReloadSchema", "will", "reload", "the", "schema", "This", "doesn", "t", "need", "the", "action", "mutex", "because", "periodic", "schema", "reloads", "happen", "in", "the", "background", "anyway", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/rpc_schema.go#L40-L59
train
vitessio/vitess
go/vt/vttablet/tabletmanager/rpc_schema.go
PreflightSchema
func (agent *ActionAgent) PreflightSchema(ctx context.Context, changes []string) ([]*tabletmanagerdatapb.SchemaChangeResult, error) { if err := agent.lock(ctx); err != nil { return nil, err } defer agent.unlock() // get the db name from the tablet dbName := topoproto.TabletDbName(agent.Tablet()) // and prefli...
go
func (agent *ActionAgent) PreflightSchema(ctx context.Context, changes []string) ([]*tabletmanagerdatapb.SchemaChangeResult, error) { if err := agent.lock(ctx); err != nil { return nil, err } defer agent.unlock() // get the db name from the tablet dbName := topoproto.TabletDbName(agent.Tablet()) // and prefli...
[ "func", "(", "agent", "*", "ActionAgent", ")", "PreflightSchema", "(", "ctx", "context", ".", "Context", ",", "changes", "[", "]", "string", ")", "(", "[", "]", "*", "tabletmanagerdatapb", ".", "SchemaChangeResult", ",", "error", ")", "{", "if", "err", "...
// PreflightSchema will try out the schema changes in "changes".
[ "PreflightSchema", "will", "try", "out", "the", "schema", "changes", "in", "changes", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/rpc_schema.go#L62-L73
train
vitessio/vitess
go/vt/vttablet/tabletmanager/rpc_schema.go
ApplySchema
func (agent *ActionAgent) ApplySchema(ctx context.Context, change *tmutils.SchemaChange) (*tabletmanagerdatapb.SchemaChangeResult, error) { if err := agent.lock(ctx); err != nil { return nil, err } defer agent.unlock() // get the db name from the tablet dbName := topoproto.TabletDbName(agent.Tablet()) // appl...
go
func (agent *ActionAgent) ApplySchema(ctx context.Context, change *tmutils.SchemaChange) (*tabletmanagerdatapb.SchemaChangeResult, error) { if err := agent.lock(ctx); err != nil { return nil, err } defer agent.unlock() // get the db name from the tablet dbName := topoproto.TabletDbName(agent.Tablet()) // appl...
[ "func", "(", "agent", "*", "ActionAgent", ")", "ApplySchema", "(", "ctx", "context", ".", "Context", ",", "change", "*", "tmutils", ".", "SchemaChange", ")", "(", "*", "tabletmanagerdatapb", ".", "SchemaChangeResult", ",", "error", ")", "{", "if", "err", "...
// ApplySchema will apply a schema change
[ "ApplySchema", "will", "apply", "a", "schema", "change" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/rpc_schema.go#L76-L94
train
vitessio/vitess
go/vt/throttler/max_replication_lag_module.go
NewMaxReplicationLagModule
func NewMaxReplicationLagModule(config MaxReplicationLagModuleConfig, actualRatesHistory *aggregatedIntervalHistory, nowFunc func() time.Time) (*MaxReplicationLagModule, error) { if err := config.Verify(); err != nil { return nil, fmt.Errorf("invalid NewMaxReplicationLagModuleConfig: %v", err) } rate := int64(Repl...
go
func NewMaxReplicationLagModule(config MaxReplicationLagModuleConfig, actualRatesHistory *aggregatedIntervalHistory, nowFunc func() time.Time) (*MaxReplicationLagModule, error) { if err := config.Verify(); err != nil { return nil, fmt.Errorf("invalid NewMaxReplicationLagModuleConfig: %v", err) } rate := int64(Repl...
[ "func", "NewMaxReplicationLagModule", "(", "config", "MaxReplicationLagModuleConfig", ",", "actualRatesHistory", "*", "aggregatedIntervalHistory", ",", "nowFunc", "func", "(", ")", "time", ".", "Time", ")", "(", "*", "MaxReplicationLagModule", ",", "error", ")", "{", ...
// NewMaxReplicationLagModule will create a new module instance and set the // initial max replication lag limit to maxReplicationLag.
[ "NewMaxReplicationLagModule", "will", "create", "a", "new", "module", "instance", "and", "set", "the", "initial", "max", "replication", "lag", "limit", "to", "maxReplicationLag", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/max_replication_lag_module.go#L128-L161
train
vitessio/vitess
go/vt/throttler/max_replication_lag_module.go
Start
func (m *MaxReplicationLagModule) Start(rateUpdateChan chan<- struct{}) { m.rateUpdateChan = rateUpdateChan m.wg.Add(1) go m.ProcessRecords() }
go
func (m *MaxReplicationLagModule) Start(rateUpdateChan chan<- struct{}) { m.rateUpdateChan = rateUpdateChan m.wg.Add(1) go m.ProcessRecords() }
[ "func", "(", "m", "*", "MaxReplicationLagModule", ")", "Start", "(", "rateUpdateChan", "chan", "<-", "struct", "{", "}", ")", "{", "m", ".", "rateUpdateChan", "=", "rateUpdateChan", "\n", "m", ".", "wg", ".", "Add", "(", "1", ")", "\n", "go", "m", "....
// Start launches a Go routine which reacts on replication lag records. // It implements the Module interface.
[ "Start", "launches", "a", "Go", "routine", "which", "reacts", "on", "replication", "lag", "records", ".", "It", "implements", "the", "Module", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/max_replication_lag_module.go#L165-L169
train
vitessio/vitess
go/vt/throttler/max_replication_lag_module.go
RecordReplicationLag
func (m *MaxReplicationLagModule) RecordReplicationLag(t time.Time, ts *discovery.TabletStats) { m.mutableConfigMu.Lock() if m.mutableConfig.MaxReplicationLagSec == ReplicationLagModuleDisabled { m.mutableConfigMu.Unlock() return } m.mutableConfigMu.Unlock() // Buffer data point for now to unblock the HealthC...
go
func (m *MaxReplicationLagModule) RecordReplicationLag(t time.Time, ts *discovery.TabletStats) { m.mutableConfigMu.Lock() if m.mutableConfig.MaxReplicationLagSec == ReplicationLagModuleDisabled { m.mutableConfigMu.Unlock() return } m.mutableConfigMu.Unlock() // Buffer data point for now to unblock the HealthC...
[ "func", "(", "m", "*", "MaxReplicationLagModule", ")", "RecordReplicationLag", "(", "t", "time", ".", "Time", ",", "ts", "*", "discovery", ".", "TabletStats", ")", "{", "m", ".", "mutableConfigMu", ".", "Lock", "(", ")", "\n", "if", "m", ".", "mutableCon...
// RecordReplicationLag records the current replication lag for processing.
[ "RecordReplicationLag", "records", "the", "current", "replication", "lag", "for", "processing", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/max_replication_lag_module.go#L243-L254
train
vitessio/vitess
go/vt/throttler/max_replication_lag_module.go
stateGreater
func stateGreater(a, b state) bool { switch a { case stateIncreaseRate: return false case stateDecreaseAndGuessRate: return b == stateIncreaseRate case stateEmergency: return b == stateIncreaseRate || b == stateDecreaseAndGuessRate default: panic(fmt.Sprintf("BUG: cannot compare states: %v and %v", a, b)) ...
go
func stateGreater(a, b state) bool { switch a { case stateIncreaseRate: return false case stateDecreaseAndGuessRate: return b == stateIncreaseRate case stateEmergency: return b == stateIncreaseRate || b == stateDecreaseAndGuessRate default: panic(fmt.Sprintf("BUG: cannot compare states: %v and %v", a, b)) ...
[ "func", "stateGreater", "(", "a", ",", "b", "state", ")", "bool", "{", "switch", "a", "{", "case", "stateIncreaseRate", ":", "return", "false", "\n", "case", "stateDecreaseAndGuessRate", ":", "return", "b", "==", "stateIncreaseRate", "\n", "case", "stateEmerge...
// stateGreater returns true if a > b i.e. the state "a" is more severe than // "b". For example, "decrease" > "increase" returns true.
[ "stateGreater", "returns", "true", "if", "a", ">", "b", "i", ".", "e", ".", "the", "state", "a", "is", "more", "severe", "than", "b", ".", "For", "example", "decrease", ">", "increase", "returns", "true", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/max_replication_lag_module.go#L428-L439
train
vitessio/vitess
go/vt/throttler/max_replication_lag_module.go
markCurrentRateAsBadOrGood
func (m *MaxReplicationLagModule) markCurrentRateAsBadOrGood(r *result, now time.Time, newState state, replicationLagChange replicationLagChange) { if m.lastRateChange.IsZero() { // Module was just started. We don't have any data points yet. r.GoodOrBad = ignoredRate r.MemorySkipReason = "rate was never changed ...
go
func (m *MaxReplicationLagModule) markCurrentRateAsBadOrGood(r *result, now time.Time, newState state, replicationLagChange replicationLagChange) { if m.lastRateChange.IsZero() { // Module was just started. We don't have any data points yet. r.GoodOrBad = ignoredRate r.MemorySkipReason = "rate was never changed ...
[ "func", "(", "m", "*", "MaxReplicationLagModule", ")", "markCurrentRateAsBadOrGood", "(", "r", "*", "result", ",", "now", "time", ".", "Time", ",", "newState", "state", ",", "replicationLagChange", "replicationLagChange", ")", "{", "if", "m", ".", "lastRateChang...
// markCurrentRateAsBadOrGood determines the actual rate between the last rate // change and "now" and determines if that rate was bad or good.
[ "markCurrentRateAsBadOrGood", "determines", "the", "actual", "rate", "between", "the", "last", "rate", "change", "and", "now", "and", "determines", "if", "that", "rate", "was", "bad", "or", "good", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/max_replication_lag_module.go#L722-L794
train
vitessio/vitess
go/vt/vttablet/grpctmserver/server.go
SetReadOnly
func (s *server) SetReadOnly(ctx context.Context, request *tabletmanagerdatapb.SetReadOnlyRequest) (response *tabletmanagerdatapb.SetReadOnlyResponse, err error) { defer s.agent.HandleRPCPanic(ctx, "SetReadOnly", request, response, true /*verbose*/, &err) ctx = callinfo.GRPCCallInfo(ctx) response = &tabletmanagerdat...
go
func (s *server) SetReadOnly(ctx context.Context, request *tabletmanagerdatapb.SetReadOnlyRequest) (response *tabletmanagerdatapb.SetReadOnlyResponse, err error) { defer s.agent.HandleRPCPanic(ctx, "SetReadOnly", request, response, true /*verbose*/, &err) ctx = callinfo.GRPCCallInfo(ctx) response = &tabletmanagerdat...
[ "func", "(", "s", "*", "server", ")", "SetReadOnly", "(", "ctx", "context", ".", "Context", ",", "request", "*", "tabletmanagerdatapb", ".", "SetReadOnlyRequest", ")", "(", "response", "*", "tabletmanagerdatapb", ".", "SetReadOnlyResponse", ",", "err", "error", ...
// // Various read-write methods //
[ "Various", "read", "-", "write", "methods" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/grpctmserver/server.go#L102-L107
train
vitessio/vitess
go/vt/vttablet/grpctmserver/server.go
SlaveStatus
func (s *server) SlaveStatus(ctx context.Context, request *tabletmanagerdatapb.SlaveStatusRequest) (response *tabletmanagerdatapb.SlaveStatusResponse, err error) { defer s.agent.HandleRPCPanic(ctx, "SlaveStatus", request, response, false /*verbose*/, &err) ctx = callinfo.GRPCCallInfo(ctx) response = &tabletmanagerda...
go
func (s *server) SlaveStatus(ctx context.Context, request *tabletmanagerdatapb.SlaveStatusRequest) (response *tabletmanagerdatapb.SlaveStatusResponse, err error) { defer s.agent.HandleRPCPanic(ctx, "SlaveStatus", request, response, false /*verbose*/, &err) ctx = callinfo.GRPCCallInfo(ctx) response = &tabletmanagerda...
[ "func", "(", "s", "*", "server", ")", "SlaveStatus", "(", "ctx", "context", ".", "Context", ",", "request", "*", "tabletmanagerdatapb", ".", "SlaveStatusRequest", ")", "(", "response", "*", "tabletmanagerdatapb", ".", "SlaveStatusResponse", ",", "err", "error", ...
// // Replication related methods //
[ "Replication", "related", "methods" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/grpctmserver/server.go#L237-L246
train
vitessio/vitess
go/vt/vttablet/grpctmserver/server.go
ResetReplication
func (s *server) ResetReplication(ctx context.Context, request *tabletmanagerdatapb.ResetReplicationRequest) (response *tabletmanagerdatapb.ResetReplicationResponse, err error) { defer s.agent.HandleRPCPanic(ctx, "ResetReplication", request, response, true /*verbose*/, &err) ctx = callinfo.GRPCCallInfo(ctx) response...
go
func (s *server) ResetReplication(ctx context.Context, request *tabletmanagerdatapb.ResetReplicationRequest) (response *tabletmanagerdatapb.ResetReplicationResponse, err error) { defer s.agent.HandleRPCPanic(ctx, "ResetReplication", request, response, true /*verbose*/, &err) ctx = callinfo.GRPCCallInfo(ctx) response...
[ "func", "(", "s", "*", "server", ")", "ResetReplication", "(", "ctx", "context", ".", "Context", ",", "request", "*", "tabletmanagerdatapb", ".", "ResetReplicationRequest", ")", "(", "response", "*", "tabletmanagerdatapb", ".", "ResetReplicationResponse", ",", "er...
// // Reparenting related functions //
[ "Reparenting", "related", "functions" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/grpctmserver/server.go#L332-L337
train
vitessio/vitess
go/vt/wrangler/wrangler.go
New
func New(logger logutil.Logger, ts *topo.Server, tmc tmclient.TabletManagerClient) *Wrangler { return &Wrangler{ logger: logger, ts: ts, tmc: tmc, } }
go
func New(logger logutil.Logger, ts *topo.Server, tmc tmclient.TabletManagerClient) *Wrangler { return &Wrangler{ logger: logger, ts: ts, tmc: tmc, } }
[ "func", "New", "(", "logger", "logutil", ".", "Logger", ",", "ts", "*", "topo", ".", "Server", ",", "tmc", "tmclient", ".", "TabletManagerClient", ")", "*", "Wrangler", "{", "return", "&", "Wrangler", "{", "logger", ":", "logger", ",", "ts", ":", "ts",...
// New creates a new Wrangler object.
[ "New", "creates", "a", "new", "Wrangler", "object", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/wrangler.go#L48-L54
train
vitessio/vitess
go/vt/mysqlctl/cmd.go
CreateMysqldAndMycnf
func CreateMysqldAndMycnf(tabletUID uint32, mysqlSocket string, mysqlPort int32) (*Mysqld, *Mycnf, error) { mycnf := NewMycnf(tabletUID, mysqlPort) // Choose a random MySQL server-id, since this is a fresh data dir. // We don't want to use the tablet UID as the MySQL server-id, // because reusing server-ids is not ...
go
func CreateMysqldAndMycnf(tabletUID uint32, mysqlSocket string, mysqlPort int32) (*Mysqld, *Mycnf, error) { mycnf := NewMycnf(tabletUID, mysqlPort) // Choose a random MySQL server-id, since this is a fresh data dir. // We don't want to use the tablet UID as the MySQL server-id, // because reusing server-ids is not ...
[ "func", "CreateMysqldAndMycnf", "(", "tabletUID", "uint32", ",", "mysqlSocket", "string", ",", "mysqlPort", "int32", ")", "(", "*", "Mysqld", ",", "*", "Mycnf", ",", "error", ")", "{", "mycnf", ":=", "NewMycnf", "(", "tabletUID", ",", "mysqlPort", ")", "\n...
// CreateMysqldAndMycnf returns a Mysqld and a Mycnf object to use for working with a MySQL // installation that hasn't been set up yet.
[ "CreateMysqldAndMycnf", "returns", "a", "Mysqld", "and", "a", "Mycnf", "object", "to", "use", "for", "working", "with", "a", "MySQL", "installation", "that", "hasn", "t", "been", "set", "up", "yet", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/cmd.go#L31-L55
train
vitessio/vitess
go/vt/mysqlctl/cmd.go
OpenMysqldAndMycnf
func OpenMysqldAndMycnf(tabletUID uint32) (*Mysqld, *Mycnf, error) { // We pass a port of 0, this will be read and overwritten from the path on disk mycnf, err := ReadMycnf(NewMycnf(tabletUID, 0)) if err != nil { return nil, nil, fmt.Errorf("couldn't read my.cnf file: %v", err) } dbcfgs, err := dbconfigs.Init(m...
go
func OpenMysqldAndMycnf(tabletUID uint32) (*Mysqld, *Mycnf, error) { // We pass a port of 0, this will be read and overwritten from the path on disk mycnf, err := ReadMycnf(NewMycnf(tabletUID, 0)) if err != nil { return nil, nil, fmt.Errorf("couldn't read my.cnf file: %v", err) } dbcfgs, err := dbconfigs.Init(m...
[ "func", "OpenMysqldAndMycnf", "(", "tabletUID", "uint32", ")", "(", "*", "Mysqld", ",", "*", "Mycnf", ",", "error", ")", "{", "// We pass a port of 0, this will be read and overwritten from the path on disk", "mycnf", ",", "err", ":=", "ReadMycnf", "(", "NewMycnf", "(...
// OpenMysqldAndMycnf returns a Mysqld and a Mycnf object to use for working with a MySQL // installation that already exists. The Mycnf will be built based on the my.cnf file // of the MySQL instance.
[ "OpenMysqldAndMycnf", "returns", "a", "Mysqld", "and", "a", "Mycnf", "object", "to", "use", "for", "working", "with", "a", "MySQL", "installation", "that", "already", "exists", ".", "The", "Mycnf", "will", "be", "built", "based", "on", "the", "my", ".", "c...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/cmd.go#L60-L73
train
vitessio/vitess
go/vt/callinfo/callinfo.go
NewContext
func NewContext(ctx context.Context, ci CallInfo) context.Context { return context.WithValue(ctx, callInfoKey, ci) }
go
func NewContext(ctx context.Context, ci CallInfo) context.Context { return context.WithValue(ctx, callInfoKey, ci) }
[ "func", "NewContext", "(", "ctx", "context", ".", "Context", ",", "ci", "CallInfo", ")", "context", ".", "Context", "{", "return", "context", ".", "WithValue", "(", "ctx", ",", "callInfoKey", ",", "ci", ")", "\n", "}" ]
// NewContext adds the provided CallInfo to the context
[ "NewContext", "adds", "the", "provided", "CallInfo", "to", "the", "context" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/callinfo/callinfo.go#L48-L50
train
vitessio/vitess
go/vt/callinfo/callinfo.go
FromContext
func FromContext(ctx context.Context) (CallInfo, bool) { ci, ok := ctx.Value(callInfoKey).(CallInfo) return ci, ok }
go
func FromContext(ctx context.Context) (CallInfo, bool) { ci, ok := ctx.Value(callInfoKey).(CallInfo) return ci, ok }
[ "func", "FromContext", "(", "ctx", "context", ".", "Context", ")", "(", "CallInfo", ",", "bool", ")", "{", "ci", ",", "ok", ":=", "ctx", ".", "Value", "(", "callInfoKey", ")", ".", "(", "CallInfo", ")", "\n", "return", "ci", ",", "ok", "\n", "}" ]
// FromContext returns the CallInfo value stored in ctx, if any.
[ "FromContext", "returns", "the", "CallInfo", "value", "stored", "in", "ctx", "if", "any", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/callinfo/callinfo.go#L53-L56
train
vitessio/vitess
go/vt/vttablet/tabletserver/splitquery/split_params.go
getPrimaryKeyColumns
func getPrimaryKeyColumns(table *schema.Table) []*schema.TableColumn { result := make([]*schema.TableColumn, 0, len(table.PKColumns)) for _, pkColIndex := range table.PKColumns { result = append(result, &table.Columns[pkColIndex]) } return result }
go
func getPrimaryKeyColumns(table *schema.Table) []*schema.TableColumn { result := make([]*schema.TableColumn, 0, len(table.PKColumns)) for _, pkColIndex := range table.PKColumns { result = append(result, &table.Columns[pkColIndex]) } return result }
[ "func", "getPrimaryKeyColumns", "(", "table", "*", "schema", ".", "Table", ")", "[", "]", "*", "schema", ".", "TableColumn", "{", "result", ":=", "make", "(", "[", "]", "*", "schema", ".", "TableColumn", ",", "0", ",", "len", "(", "table", ".", "PKCo...
// getPrimaryKeyColumns returns the list of primary-key column names, in order, for the // given table.
[ "getPrimaryKeyColumns", "returns", "the", "list", "of", "primary", "-", "key", "column", "names", "in", "order", "for", "the", "given", "table", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/splitquery/split_params.go#L237-L243
train
vitessio/vitess
go/vt/vttablet/tabletserver/splitquery/split_params.go
areColumnsAPrefixOfAnIndex
func areColumnsAPrefixOfAnIndex(columns []*schema.TableColumn, table *schema.Table) bool { for _, index := range table.Indexes { if areColumnsAPrefixOfIndex(columns, index) { return true } } return false }
go
func areColumnsAPrefixOfAnIndex(columns []*schema.TableColumn, table *schema.Table) bool { for _, index := range table.Indexes { if areColumnsAPrefixOfIndex(columns, index) { return true } } return false }
[ "func", "areColumnsAPrefixOfAnIndex", "(", "columns", "[", "]", "*", "schema", ".", "TableColumn", ",", "table", "*", "schema", ".", "Table", ")", "bool", "{", "for", "_", ",", "index", ":=", "range", "table", ".", "Indexes", "{", "if", "areColumnsAPrefixO...
// areColumnsAPrefixOfAnIndex returns true if 'columns' form a prefix of the columns that // make up some index in 'table'.
[ "areColumnsAPrefixOfAnIndex", "returns", "true", "if", "columns", "form", "a", "prefix", "of", "the", "columns", "that", "make", "up", "some", "index", "in", "table", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/splitquery/split_params.go#L247-L254
train
vitessio/vitess
go/vt/vttablet/tabletserver/splitquery/split_params.go
areColumnsAPrefixOfIndex
func areColumnsAPrefixOfIndex(potentialPrefix []*schema.TableColumn, index *schema.Index) bool { if len(potentialPrefix) > len(index.Columns) { return false } for i := range potentialPrefix { if !potentialPrefix[i].Name.Equal(index.Columns[i]) { return false } } return true }
go
func areColumnsAPrefixOfIndex(potentialPrefix []*schema.TableColumn, index *schema.Index) bool { if len(potentialPrefix) > len(index.Columns) { return false } for i := range potentialPrefix { if !potentialPrefix[i].Name.Equal(index.Columns[i]) { return false } } return true }
[ "func", "areColumnsAPrefixOfIndex", "(", "potentialPrefix", "[", "]", "*", "schema", ".", "TableColumn", ",", "index", "*", "schema", ".", "Index", ")", "bool", "{", "if", "len", "(", "potentialPrefix", ")", ">", "len", "(", "index", ".", "Columns", ")", ...
// areColumnsAPrefixOfIndex returns true if 'potentialPrefix' forms a prefix of the columns // composing 'index'.
[ "areColumnsAPrefixOfIndex", "returns", "true", "if", "potentialPrefix", "forms", "a", "prefix", "of", "the", "columns", "composing", "index", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/splitquery/split_params.go#L258-L268
train
vitessio/vitess
go/vt/vttablet/tabletserver/splitquery/split_params.go
areSplitColumnsPrimaryKey
func (sp *SplitParams) areSplitColumnsPrimaryKey() bool { pkCols := getPrimaryKeyColumns(sp.splitTableSchema) if len(sp.splitColumns) != len(pkCols) { return false } // Compare the names of sp.splitColumns to the names of pkCols. for i := 0; i < len(sp.splitColumns); i++ { if !sp.splitColumns[i].Name.Equal(pkC...
go
func (sp *SplitParams) areSplitColumnsPrimaryKey() bool { pkCols := getPrimaryKeyColumns(sp.splitTableSchema) if len(sp.splitColumns) != len(pkCols) { return false } // Compare the names of sp.splitColumns to the names of pkCols. for i := 0; i < len(sp.splitColumns); i++ { if !sp.splitColumns[i].Name.Equal(pkC...
[ "func", "(", "sp", "*", "SplitParams", ")", "areSplitColumnsPrimaryKey", "(", ")", "bool", "{", "pkCols", ":=", "getPrimaryKeyColumns", "(", "sp", ".", "splitTableSchema", ")", "\n", "if", "len", "(", "sp", ".", "splitColumns", ")", "!=", "len", "(", "pkCo...
// areSplitColumnsPrimaryKey returns true if the splitColumns in 'splitParams' // are the primary key columns in order.
[ "areSplitColumnsPrimaryKey", "returns", "true", "if", "the", "splitColumns", "in", "splitParams", "are", "the", "primary", "key", "columns", "in", "order", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/splitquery/split_params.go#L272-L284
train