id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
136,200
vitessio/vitess
go/vt/sqlparser/normalizer.go
WalkSelect
func (nz *normalizer) WalkSelect(node SQLNode) (bool, error) { switch node := node.(type) { case *SQLVal: nz.convertSQLValDedup(node) case *ComparisonExpr: nz.convertComparison(node) case *ColName, TableName: // Common node types that never contain SQLVals or ListArgs but create a lot of object // allocatio...
go
func (nz *normalizer) WalkSelect(node SQLNode) (bool, error) { switch node := node.(type) { case *SQLVal: nz.convertSQLValDedup(node) case *ComparisonExpr: nz.convertComparison(node) case *ColName, TableName: // Common node types that never contain SQLVals or ListArgs but create a lot of object // allocatio...
[ "func", "(", "nz", "*", "normalizer", ")", "WalkSelect", "(", "node", "SQLNode", ")", "(", "bool", ",", "error", ")", "{", "switch", "node", ":=", "node", ".", "(", "type", ")", "{", "case", "*", "SQLVal", ":", "nz", ".", "convertSQLValDedup", "(", ...
// WalkSelect normalizes the AST in Select mode.
[ "WalkSelect", "normalizes", "the", "AST", "in", "Select", "mode", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/sqlparser/normalizer.go#L81-L96
136,201
vitessio/vitess
go/vt/sqlparser/normalizer.go
convertSQLVal
func (nz *normalizer) convertSQLVal(node *SQLVal) { bval := nz.sqlToBindvar(node) if bval == nil { return } bvname := nz.newName() nz.bindVars[bvname] = bval node.Type = ValArg node.Val = append([]byte(":"), bvname...) }
go
func (nz *normalizer) convertSQLVal(node *SQLVal) { bval := nz.sqlToBindvar(node) if bval == nil { return } bvname := nz.newName() nz.bindVars[bvname] = bval node.Type = ValArg node.Val = append([]byte(":"), bvname...) }
[ "func", "(", "nz", "*", "normalizer", ")", "convertSQLVal", "(", "node", "*", "SQLVal", ")", "{", "bval", ":=", "nz", ".", "sqlToBindvar", "(", "node", ")", "\n", "if", "bval", "==", "nil", "{", "return", "\n", "}", "\n\n", "bvname", ":=", "nz", "....
// convertSQLVal converts an SQLVal without the dedup.
[ "convertSQLVal", "converts", "an", "SQLVal", "without", "the", "dedup", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/sqlparser/normalizer.go#L138-L149
136,202
vitessio/vitess
go/vt/sqlparser/normalizer.go
convertComparison
func (nz *normalizer) convertComparison(node *ComparisonExpr) { if node.Operator != InStr && node.Operator != NotInStr { return } tupleVals, ok := node.Right.(ValTuple) if !ok { return } // The RHS is a tuple of values. // Make a list bindvar. bvals := &querypb.BindVariable{ Type: querypb.Type_TUPLE, } ...
go
func (nz *normalizer) convertComparison(node *ComparisonExpr) { if node.Operator != InStr && node.Operator != NotInStr { return } tupleVals, ok := node.Right.(ValTuple) if !ok { return } // The RHS is a tuple of values. // Make a list bindvar. bvals := &querypb.BindVariable{ Type: querypb.Type_TUPLE, } ...
[ "func", "(", "nz", "*", "normalizer", ")", "convertComparison", "(", "node", "*", "ComparisonExpr", ")", "{", "if", "node", ".", "Operator", "!=", "InStr", "&&", "node", ".", "Operator", "!=", "NotInStr", "{", "return", "\n", "}", "\n", "tupleVals", ",",...
// convertComparison attempts to convert IN clauses to // use the list bind var construct. If it fails, it returns // with no change made. The walk function will then continue // and iterate on converting each individual value into separate // bind vars.
[ "convertComparison", "attempts", "to", "convert", "IN", "clauses", "to", "use", "the", "list", "bind", "var", "construct", ".", "If", "it", "fails", "it", "returns", "with", "no", "change", "made", ".", "The", "walk", "function", "will", "then", "continue", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/sqlparser/normalizer.go#L156-L183
136,203
vitessio/vitess
go/mysql/auth_server_none.go
ValidateHash
func (a *AuthServerNone) ValidateHash(salt []byte, user string, authResponse []byte, remoteAddr net.Addr) (Getter, error) { return &NoneGetter{}, nil }
go
func (a *AuthServerNone) ValidateHash(salt []byte, user string, authResponse []byte, remoteAddr net.Addr) (Getter, error) { return &NoneGetter{}, nil }
[ "func", "(", "a", "*", "AuthServerNone", ")", "ValidateHash", "(", "salt", "[", "]", "byte", ",", "user", "string", ",", "authResponse", "[", "]", "byte", ",", "remoteAddr", "net", ".", "Addr", ")", "(", "Getter", ",", "error", ")", "{", "return", "&...
// ValidateHash validates hash
[ "ValidateHash", "validates", "hash" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/auth_server_none.go#L44-L46
136,204
vitessio/vitess
go/mysql/auth_server_none.go
Negotiate
func (a *AuthServerNone) Negotiate(c *Conn, user string, remotAddr net.Addr) (Getter, error) { panic("Negotiate should not be called as AuthMethod returned mysql_native_password") }
go
func (a *AuthServerNone) Negotiate(c *Conn, user string, remotAddr net.Addr) (Getter, error) { panic("Negotiate should not be called as AuthMethod returned mysql_native_password") }
[ "func", "(", "a", "*", "AuthServerNone", ")", "Negotiate", "(", "c", "*", "Conn", ",", "user", "string", ",", "remotAddr", "net", ".", "Addr", ")", "(", "Getter", ",", "error", ")", "{", "panic", "(", "\"", "\"", ")", "\n", "}" ]
// Negotiate is part of the AuthServer interface. // It will never be called.
[ "Negotiate", "is", "part", "of", "the", "AuthServer", "interface", ".", "It", "will", "never", "be", "called", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/auth_server_none.go#L50-L52
136,205
vitessio/vitess
go/vt/wrangler/split.go
SetSourceShards
func (wr *Wrangler) SetSourceShards(ctx context.Context, keyspace, shard string, sources []*topodatapb.TabletAlias, tables []string) error { // Read the source tablets. sourceTablets, err := wr.ts.GetTabletMap(ctx, sources) if err != nil { return err } // Insert their KeyRange in the SourceShards array. // We ...
go
func (wr *Wrangler) SetSourceShards(ctx context.Context, keyspace, shard string, sources []*topodatapb.TabletAlias, tables []string) error { // Read the source tablets. sourceTablets, err := wr.ts.GetTabletMap(ctx, sources) if err != nil { return err } // Insert their KeyRange in the SourceShards array. // We ...
[ "func", "(", "wr", "*", "Wrangler", ")", "SetSourceShards", "(", "ctx", "context", ".", "Context", ",", "keyspace", ",", "shard", "string", ",", "sources", "[", "]", "*", "topodatapb", ".", "TabletAlias", ",", "tables", "[", "]", "string", ")", "error", ...
// SetSourceShards is a utility function to override the SourceShards fields // on a Shard.
[ "SetSourceShards", "is", "a", "utility", "function", "to", "override", "the", "SourceShards", "fields", "on", "a", "Shard", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/split.go#L42-L78
136,206
vitessio/vitess
go/vt/wrangler/split.go
WaitForFilteredReplication
func (wr *Wrangler) WaitForFilteredReplication(ctx context.Context, keyspace, shard string, maxDelay time.Duration) error { shardInfo, err := wr.TopoServer().GetShard(ctx, keyspace, shard) if err != nil { return err } if len(shardInfo.SourceShards) == 0 { return fmt.Errorf("shard %v/%v has no source shard", key...
go
func (wr *Wrangler) WaitForFilteredReplication(ctx context.Context, keyspace, shard string, maxDelay time.Duration) error { shardInfo, err := wr.TopoServer().GetShard(ctx, keyspace, shard) if err != nil { return err } if len(shardInfo.SourceShards) == 0 { return fmt.Errorf("shard %v/%v has no source shard", key...
[ "func", "(", "wr", "*", "Wrangler", ")", "WaitForFilteredReplication", "(", "ctx", "context", ".", "Context", ",", "keyspace", ",", "shard", "string", ",", "maxDelay", "time", ".", "Duration", ")", "error", "{", "shardInfo", ",", "err", ":=", "wr", ".", ...
// WaitForFilteredReplication will wait until the Filtered Replication process has finished.
[ "WaitForFilteredReplication", "will", "wait", "until", "the", "Filtered", "Replication", "process", "has", "finished", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/split.go#L81-L145
136,207
vitessio/vitess
go/vt/vtctl/grpcvtctlclient/client.go
ExecuteVtctlCommand
func (client *gRPCVtctlClient) ExecuteVtctlCommand(ctx context.Context, args []string, actionTimeout time.Duration) (logutil.EventStream, error) { query := &vtctldatapb.ExecuteVtctlCommandRequest{ Args: args, ActionTimeout: int64(actionTimeout.Nanoseconds()), } stream, err := client.c.ExecuteVtctlComma...
go
func (client *gRPCVtctlClient) ExecuteVtctlCommand(ctx context.Context, args []string, actionTimeout time.Duration) (logutil.EventStream, error) { query := &vtctldatapb.ExecuteVtctlCommandRequest{ Args: args, ActionTimeout: int64(actionTimeout.Nanoseconds()), } stream, err := client.c.ExecuteVtctlComma...
[ "func", "(", "client", "*", "gRPCVtctlClient", ")", "ExecuteVtctlCommand", "(", "ctx", "context", ".", "Context", ",", "args", "[", "]", "string", ",", "actionTimeout", "time", ".", "Duration", ")", "(", "logutil", ".", "EventStream", ",", "error", ")", "{...
// ExecuteVtctlCommand is part of the VtctlClient interface
[ "ExecuteVtctlCommand", "is", "part", "of", "the", "VtctlClient", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtctl/grpcvtctlclient/client.go#L78-L89
136,208
vitessio/vitess
go/netutil/netutil.go
JoinHostPort
func JoinHostPort(host string, port int32) string { return net.JoinHostPort(host, strconv.FormatInt(int64(port), 10)) }
go
func JoinHostPort(host string, port int32) string { return net.JoinHostPort(host, strconv.FormatInt(int64(port), 10)) }
[ "func", "JoinHostPort", "(", "host", "string", ",", "port", "int32", ")", "string", "{", "return", "net", ".", "JoinHostPort", "(", "host", ",", "strconv", ".", "FormatInt", "(", "int64", "(", "port", ")", ",", "10", ")", ")", "\n", "}" ]
// JoinHostPort is an extension to net.JoinHostPort that also formats the // integer port.
[ "JoinHostPort", "is", "an", "extension", "to", "net", ".", "JoinHostPort", "that", "also", "formats", "the", "integer", "port", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/netutil/netutil.go#L114-L116
136,209
vitessio/vitess
go/netutil/netutil.go
FullyQualifiedHostname
func FullyQualifiedHostname() (string, error) { // The machine hostname (which is also returned by os.Hostname()) may not be // set to the FQDN, but only the first part of it e.g. "localhost" instead of // "localhost.localdomain". // To get the full FQDN, we do the following: // 1. Get the machine hostname. Examp...
go
func FullyQualifiedHostname() (string, error) { // The machine hostname (which is also returned by os.Hostname()) may not be // set to the FQDN, but only the first part of it e.g. "localhost" instead of // "localhost.localdomain". // To get the full FQDN, we do the following: // 1. Get the machine hostname. Examp...
[ "func", "FullyQualifiedHostname", "(", ")", "(", "string", ",", "error", ")", "{", "// The machine hostname (which is also returned by os.Hostname()) may not be", "// set to the FQDN, but only the first part of it e.g. \"localhost\" instead of", "// \"localhost.localdomain\".", "// To get ...
// FullyQualifiedHostname returns the FQDN of the machine.
[ "FullyQualifiedHostname", "returns", "the", "FQDN", "of", "the", "machine", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/netutil/netutil.go#L119-L158
136,210
vitessio/vitess
go/netutil/netutil.go
FullyQualifiedHostnameOrPanic
func FullyQualifiedHostnameOrPanic() string { hostname, err := FullyQualifiedHostname() if err != nil { panic(err) } return hostname }
go
func FullyQualifiedHostnameOrPanic() string { hostname, err := FullyQualifiedHostname() if err != nil { panic(err) } return hostname }
[ "func", "FullyQualifiedHostnameOrPanic", "(", ")", "string", "{", "hostname", ",", "err", ":=", "FullyQualifiedHostname", "(", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "return", "hostname", "\n", "}" ]
// FullyQualifiedHostnameOrPanic is the same as FullyQualifiedHostname // but panics in case of an error.
[ "FullyQualifiedHostnameOrPanic", "is", "the", "same", "as", "FullyQualifiedHostname", "but", "panics", "in", "case", "of", "an", "error", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/netutil/netutil.go#L162-L168
136,211
vitessio/vitess
go/vt/vttablet/tabletconn/tablet_conn.go
RegisterDialer
func RegisterDialer(name string, dialer TabletDialer) { if _, ok := dialers[name]; ok { log.Fatalf("Dialer %s already exists", name) } dialers[name] = dialer }
go
func RegisterDialer(name string, dialer TabletDialer) { if _, ok := dialers[name]; ok { log.Fatalf("Dialer %s already exists", name) } dialers[name] = dialer }
[ "func", "RegisterDialer", "(", "name", "string", ",", "dialer", "TabletDialer", ")", "{", "if", "_", ",", "ok", ":=", "dialers", "[", "name", "]", ";", "ok", "{", "log", ".", "Fatalf", "(", "\"", "\"", ",", "name", ")", "\n", "}", "\n", "dialers", ...
// RegisterDialer is meant to be used by TabletDialer implementations // to self register.
[ "RegisterDialer", "is", "meant", "to", "be", "used", "by", "TabletDialer", "implementations", "to", "self", "register", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletconn/tablet_conn.go#L59-L64
136,212
vitessio/vitess
go/vt/vttablet/tabletconn/tablet_conn.go
GetDialer
func GetDialer() TabletDialer { td, ok := dialers[*TabletProtocol] if !ok { log.Exitf("No dialer registered for tablet protocol %s", *TabletProtocol) } return td }
go
func GetDialer() TabletDialer { td, ok := dialers[*TabletProtocol] if !ok { log.Exitf("No dialer registered for tablet protocol %s", *TabletProtocol) } return td }
[ "func", "GetDialer", "(", ")", "TabletDialer", "{", "td", ",", "ok", ":=", "dialers", "[", "*", "TabletProtocol", "]", "\n", "if", "!", "ok", "{", "log", ".", "Exitf", "(", "\"", "\"", ",", "*", "TabletProtocol", ")", "\n", "}", "\n", "return", "td...
// GetDialer returns the dialer to use, described by the command line flag
[ "GetDialer", "returns", "the", "dialer", "to", "use", "described", "by", "the", "command", "line", "flag" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletconn/tablet_conn.go#L67-L73
136,213
vitessio/vitess
go/vt/worker/instance.go
NewInstance
func NewInstance(ts *topo.Server, cell string, commandDisplayInterval time.Duration) *Instance { wi := &Instance{topoServer: ts, cell: cell, commandDisplayInterval: commandDisplayInterval} // Note: setAndStartWorker() also adds a MemoryLogger for the webserver. wi.wr = wi.CreateWrangler(logutil.NewConsoleLogger()) ...
go
func NewInstance(ts *topo.Server, cell string, commandDisplayInterval time.Duration) *Instance { wi := &Instance{topoServer: ts, cell: cell, commandDisplayInterval: commandDisplayInterval} // Note: setAndStartWorker() also adds a MemoryLogger for the webserver. wi.wr = wi.CreateWrangler(logutil.NewConsoleLogger()) ...
[ "func", "NewInstance", "(", "ts", "*", "topo", ".", "Server", ",", "cell", "string", ",", "commandDisplayInterval", "time", ".", "Duration", ")", "*", "Instance", "{", "wi", ":=", "&", "Instance", "{", "topoServer", ":", "ts", ",", "cell", ":", "cell", ...
// NewInstance creates a new Instance.
[ "NewInstance", "creates", "a", "new", "Instance", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/instance.go#L68-L73
136,214
vitessio/vitess
go/vt/worker/instance.go
CreateWrangler
func (wi *Instance) CreateWrangler(logger logutil.Logger) *wrangler.Wrangler { return wrangler.New(logger, wi.topoServer, tmclient.NewTabletManagerClient()) }
go
func (wi *Instance) CreateWrangler(logger logutil.Logger) *wrangler.Wrangler { return wrangler.New(logger, wi.topoServer, tmclient.NewTabletManagerClient()) }
[ "func", "(", "wi", "*", "Instance", ")", "CreateWrangler", "(", "logger", "logutil", ".", "Logger", ")", "*", "wrangler", ".", "Wrangler", "{", "return", "wrangler", ".", "New", "(", "logger", ",", "wi", ".", "topoServer", ",", "tmclient", ".", "NewTable...
// CreateWrangler creates a new wrangler using the instance specific configuration.
[ "CreateWrangler", "creates", "a", "new", "wrangler", "using", "the", "instance", "specific", "configuration", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/instance.go#L76-L78
136,215
vitessio/vitess
go/vt/worker/instance.go
InstallSignalHandlers
func (wi *Instance) InstallSignalHandlers() { sigChan := make(chan os.Signal, 1) signal.Notify(sigChan, syscall.SIGTERM, syscall.SIGINT) go func() { for s := range sigChan { // We got a signal, notify our modules. // Use an extra function to properly unlock using defer. func() { wi.currentWorkerMutex....
go
func (wi *Instance) InstallSignalHandlers() { sigChan := make(chan os.Signal, 1) signal.Notify(sigChan, syscall.SIGTERM, syscall.SIGINT) go func() { for s := range sigChan { // We got a signal, notify our modules. // Use an extra function to properly unlock using defer. func() { wi.currentWorkerMutex....
[ "func", "(", "wi", "*", "Instance", ")", "InstallSignalHandlers", "(", ")", "{", "sigChan", ":=", "make", "(", "chan", "os", ".", "Signal", ",", "1", ")", "\n", "signal", ".", "Notify", "(", "sigChan", ",", "syscall", ".", "SIGTERM", ",", "syscall", ...
// InstallSignalHandlers installs signal handler which exit vtworker gracefully.
[ "InstallSignalHandlers", "installs", "signal", "handler", "which", "exit", "vtworker", "gracefully", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/instance.go#L173-L193
136,216
vitessio/vitess
go/vt/worker/instance.go
Reset
func (wi *Instance) Reset() error { wi.currentWorkerMutex.Lock() defer wi.currentWorkerMutex.Unlock() if wi.currentWorker == nil { return nil } // check the worker is really done if wi.currentContext == nil { wi.currentWorker = nil wi.currentMemoryLogger = nil return nil } return vterrors.New(vtrpcpb...
go
func (wi *Instance) Reset() error { wi.currentWorkerMutex.Lock() defer wi.currentWorkerMutex.Unlock() if wi.currentWorker == nil { return nil } // check the worker is really done if wi.currentContext == nil { wi.currentWorker = nil wi.currentMemoryLogger = nil return nil } return vterrors.New(vtrpcpb...
[ "func", "(", "wi", "*", "Instance", ")", "Reset", "(", ")", "error", "{", "wi", ".", "currentWorkerMutex", ".", "Lock", "(", ")", "\n", "defer", "wi", ".", "currentWorkerMutex", ".", "Unlock", "(", ")", "\n\n", "if", "wi", ".", "currentWorker", "==", ...
// Reset resets the state of a finished worker. It returns an error if the worker is still running.
[ "Reset", "resets", "the", "state", "of", "a", "finished", "worker", ".", "It", "returns", "an", "error", "if", "the", "worker", "is", "still", "running", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/instance.go#L196-L212
136,217
vitessio/vitess
go/vt/worker/row_differ.go
skipRow
func (rd *RowDiffer2) skipRow() { rd.equalRowsStatsCounters.Add(rd.tableName, 1) rd.tableStatusList.addCopiedRows(rd.tableIndex, 1) }
go
func (rd *RowDiffer2) skipRow() { rd.equalRowsStatsCounters.Add(rd.tableName, 1) rd.tableStatusList.addCopiedRows(rd.tableIndex, 1) }
[ "func", "(", "rd", "*", "RowDiffer2", ")", "skipRow", "(", ")", "{", "rd", ".", "equalRowsStatsCounters", ".", "Add", "(", "rd", ".", "tableName", ",", "1", ")", "\n", "rd", ".", "tableStatusList", ".", "addCopiedRows", "(", "rd", ".", "tableIndex", ",...
// skipRow is used for the DiffType DiffEqual. // Currently, it only updates the statistics and therefore does not require the // row as input.
[ "skipRow", "is", "used", "for", "the", "DiffType", "DiffEqual", ".", "Currently", "it", "only", "updates", "the", "statistics", "and", "therefore", "does", "not", "require", "the", "row", "as", "input", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/row_differ.go#L272-L275
136,218
vitessio/vitess
go/vt/worker/row_differ.go
reconcileRow
func (rd *RowDiffer2) reconcileRow(row []sqltypes.Value, typ DiffType) error { if typ == DiffNotEqual { panic(fmt.Sprintf("reconcileRow() called with wrong type: %v", typ)) } destShardIndex, err := rd.router.Route(row) if err != nil { return vterrors.Wrapf(err, "failed to route row (%v) to correct shard", row) ...
go
func (rd *RowDiffer2) reconcileRow(row []sqltypes.Value, typ DiffType) error { if typ == DiffNotEqual { panic(fmt.Sprintf("reconcileRow() called with wrong type: %v", typ)) } destShardIndex, err := rd.router.Route(row) if err != nil { return vterrors.Wrapf(err, "failed to route row (%v) to correct shard", row) ...
[ "func", "(", "rd", "*", "RowDiffer2", ")", "reconcileRow", "(", "row", "[", "]", "sqltypes", ".", "Value", ",", "typ", "DiffType", ")", "error", "{", "if", "typ", "==", "DiffNotEqual", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", ...
// reconcileRow is used for the DiffType DiffMissing and DiffExtraneous.
[ "reconcileRow", "is", "used", "for", "the", "DiffType", "DiffMissing", "and", "DiffExtraneous", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/row_differ.go#L278-L293
136,219
vitessio/vitess
go/vt/worker/row_differ.go
NewRowRouter
func NewRowRouter(shardInfos []*topo.ShardInfo, keyResolver keyspaceIDResolver) RowRouter { keyRanges := make([]*topodatapb.KeyRange, len(shardInfos)) for i, si := range shardInfos { keyRanges[i] = si.KeyRange } return RowRouter{keyResolver, keyRanges} }
go
func NewRowRouter(shardInfos []*topo.ShardInfo, keyResolver keyspaceIDResolver) RowRouter { keyRanges := make([]*topodatapb.KeyRange, len(shardInfos)) for i, si := range shardInfos { keyRanges[i] = si.KeyRange } return RowRouter{keyResolver, keyRanges} }
[ "func", "NewRowRouter", "(", "shardInfos", "[", "]", "*", "topo", ".", "ShardInfo", ",", "keyResolver", "keyspaceIDResolver", ")", "RowRouter", "{", "keyRanges", ":=", "make", "(", "[", "]", "*", "topodatapb", ".", "KeyRange", ",", "len", "(", "shardInfos", ...
// NewRowRouter creates a RowRouter. // We assume that the key ranges in shardInfo cover the full keyrange i.e. // for any possible keyspaceID there is a shard we can route to.
[ "NewRowRouter", "creates", "a", "RowRouter", ".", "We", "assume", "that", "the", "key", "ranges", "in", "shardInfo", "cover", "the", "full", "keyrange", "i", ".", "e", ".", "for", "any", "possible", "keyspaceID", "there", "is", "a", "shard", "we", "can", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/row_differ.go#L343-L349
136,220
vitessio/vitess
go/vt/wrangler/schema.go
GetSchema
func (wr *Wrangler) GetSchema(ctx context.Context, tabletAlias *topodatapb.TabletAlias, tables, excludeTables []string, includeViews bool) (*tabletmanagerdatapb.SchemaDefinition, error) { ti, err := wr.ts.GetTablet(ctx, tabletAlias) if err != nil { return nil, fmt.Errorf("GetTablet(%v) failed: %v", tabletAlias, err...
go
func (wr *Wrangler) GetSchema(ctx context.Context, tabletAlias *topodatapb.TabletAlias, tables, excludeTables []string, includeViews bool) (*tabletmanagerdatapb.SchemaDefinition, error) { ti, err := wr.ts.GetTablet(ctx, tabletAlias) if err != nil { return nil, fmt.Errorf("GetTablet(%v) failed: %v", tabletAlias, err...
[ "func", "(", "wr", "*", "Wrangler", ")", "GetSchema", "(", "ctx", "context", ".", "Context", ",", "tabletAlias", "*", "topodatapb", ".", "TabletAlias", ",", "tables", ",", "excludeTables", "[", "]", "string", ",", "includeViews", "bool", ")", "(", "*", "...
// GetSchema uses an RPC to get the schema from a remote tablet
[ "GetSchema", "uses", "an", "RPC", "to", "get", "the", "schema", "from", "a", "remote", "tablet" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/schema.go#L47-L54
136,221
vitessio/vitess
go/vt/wrangler/schema.go
ReloadSchema
func (wr *Wrangler) ReloadSchema(ctx context.Context, tabletAlias *topodatapb.TabletAlias) error { ti, err := wr.ts.GetTablet(ctx, tabletAlias) if err != nil { return fmt.Errorf("GetTablet(%v) failed: %v", tabletAlias, err) } return wr.tmc.ReloadSchema(ctx, ti.Tablet, "") }
go
func (wr *Wrangler) ReloadSchema(ctx context.Context, tabletAlias *topodatapb.TabletAlias) error { ti, err := wr.ts.GetTablet(ctx, tabletAlias) if err != nil { return fmt.Errorf("GetTablet(%v) failed: %v", tabletAlias, err) } return wr.tmc.ReloadSchema(ctx, ti.Tablet, "") }
[ "func", "(", "wr", "*", "Wrangler", ")", "ReloadSchema", "(", "ctx", "context", ".", "Context", ",", "tabletAlias", "*", "topodatapb", ".", "TabletAlias", ")", "error", "{", "ti", ",", "err", ":=", "wr", ".", "ts", ".", "GetTablet", "(", "ctx", ",", ...
// ReloadSchema forces the remote tablet to reload its schema.
[ "ReloadSchema", "forces", "the", "remote", "tablet", "to", "reload", "its", "schema", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/schema.go#L57-L64
136,222
vitessio/vitess
go/vt/wrangler/schema.go
diffSchema
func (wr *Wrangler) diffSchema(ctx context.Context, masterSchema *tabletmanagerdatapb.SchemaDefinition, masterTabletAlias, alias *topodatapb.TabletAlias, excludeTables []string, includeViews bool, wg *sync.WaitGroup, er concurrency.ErrorRecorder) { defer wg.Done() log.Infof("Gathering schema for %v", topoproto.Tablet...
go
func (wr *Wrangler) diffSchema(ctx context.Context, masterSchema *tabletmanagerdatapb.SchemaDefinition, masterTabletAlias, alias *topodatapb.TabletAlias, excludeTables []string, includeViews bool, wg *sync.WaitGroup, er concurrency.ErrorRecorder) { defer wg.Done() log.Infof("Gathering schema for %v", topoproto.Tablet...
[ "func", "(", "wr", "*", "Wrangler", ")", "diffSchema", "(", "ctx", "context", ".", "Context", ",", "masterSchema", "*", "tabletmanagerdatapb", ".", "SchemaDefinition", ",", "masterTabletAlias", ",", "alias", "*", "topodatapb", ".", "TabletAlias", ",", "excludeTa...
// helper method to asynchronously diff a schema
[ "helper", "method", "to", "asynchronously", "diff", "a", "schema" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/schema.go#L132-L143
136,223
vitessio/vitess
go/vt/wrangler/schema.go
ValidateSchemaShard
func (wr *Wrangler) ValidateSchemaShard(ctx context.Context, keyspace, shard string, excludeTables []string, includeViews bool) error { si, err := wr.ts.GetShard(ctx, keyspace, shard) if err != nil { return fmt.Errorf("GetShard(%v, %v) failed: %v", keyspace, shard, err) } // get schema from the master, or error ...
go
func (wr *Wrangler) ValidateSchemaShard(ctx context.Context, keyspace, shard string, excludeTables []string, includeViews bool) error { si, err := wr.ts.GetShard(ctx, keyspace, shard) if err != nil { return fmt.Errorf("GetShard(%v, %v) failed: %v", keyspace, shard, err) } // get schema from the master, or error ...
[ "func", "(", "wr", "*", "Wrangler", ")", "ValidateSchemaShard", "(", "ctx", "context", ".", "Context", ",", "keyspace", ",", "shard", "string", ",", "excludeTables", "[", "]", "string", ",", "includeViews", "bool", ")", "error", "{", "si", ",", "err", ":...
// ValidateSchemaShard will diff the schema from all the tablets in the shard.
[ "ValidateSchemaShard", "will", "diff", "the", "schema", "from", "all", "the", "tablets", "in", "the", "shard", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/schema.go#L146-L185
136,224
vitessio/vitess
go/vt/wrangler/schema.go
PreflightSchema
func (wr *Wrangler) PreflightSchema(ctx context.Context, tabletAlias *topodatapb.TabletAlias, changes []string) ([]*tabletmanagerdatapb.SchemaChangeResult, error) { ti, err := wr.ts.GetTablet(ctx, tabletAlias) if err != nil { return nil, fmt.Errorf("GetTablet(%v) failed: %v", tabletAlias, err) } return wr.tmc.Pre...
go
func (wr *Wrangler) PreflightSchema(ctx context.Context, tabletAlias *topodatapb.TabletAlias, changes []string) ([]*tabletmanagerdatapb.SchemaChangeResult, error) { ti, err := wr.ts.GetTablet(ctx, tabletAlias) if err != nil { return nil, fmt.Errorf("GetTablet(%v) failed: %v", tabletAlias, err) } return wr.tmc.Pre...
[ "func", "(", "wr", "*", "Wrangler", ")", "PreflightSchema", "(", "ctx", "context", ".", "Context", ",", "tabletAlias", "*", "topodatapb", ".", "TabletAlias", ",", "changes", "[", "]", "string", ")", "(", "[", "]", "*", "tabletmanagerdatapb", ".", "SchemaCh...
// PreflightSchema will try a schema change on the remote tablet.
[ "PreflightSchema", "will", "try", "a", "schema", "change", "on", "the", "remote", "tablet", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/schema.go#L271-L277
136,225
vitessio/vitess
go/vt/wrangler/schema.go
CopySchemaShardFromShard
func (wr *Wrangler) CopySchemaShardFromShard(ctx context.Context, tables, excludeTables []string, includeViews bool, sourceKeyspace, sourceShard, destKeyspace, destShard string, waitSlaveTimeout time.Duration) error { sourceShardInfo, err := wr.ts.GetShard(ctx, sourceKeyspace, sourceShard) if err != nil { return fm...
go
func (wr *Wrangler) CopySchemaShardFromShard(ctx context.Context, tables, excludeTables []string, includeViews bool, sourceKeyspace, sourceShard, destKeyspace, destShard string, waitSlaveTimeout time.Duration) error { sourceShardInfo, err := wr.ts.GetShard(ctx, sourceKeyspace, sourceShard) if err != nil { return fm...
[ "func", "(", "wr", "*", "Wrangler", ")", "CopySchemaShardFromShard", "(", "ctx", "context", ".", "Context", ",", "tables", ",", "excludeTables", "[", "]", "string", ",", "includeViews", "bool", ",", "sourceKeyspace", ",", "sourceShard", ",", "destKeyspace", ",...
// CopySchemaShardFromShard copies the schema from a source shard to the specified destination shard. // For both source and destination it picks the master tablet. See also CopySchemaShard.
[ "CopySchemaShardFromShard", "copies", "the", "schema", "from", "a", "source", "shard", "to", "the", "specified", "destination", "shard", ".", "For", "both", "source", "and", "destination", "it", "picks", "the", "master", "tablet", ".", "See", "also", "CopySchema...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/schema.go#L281-L291
136,226
vitessio/vitess
go/vt/wrangler/schema.go
copyShardMetadata
func (wr *Wrangler) copyShardMetadata(ctx context.Context, srcTabletAlias *topodatapb.TabletAlias, destTabletAlias *topodatapb.TabletAlias) error { sql := "SELECT 1 FROM information_schema.tables WHERE table_schema = '_vt' AND table_name = 'shard_metadata'" presenceResult, err := wr.ExecuteFetchAsDba(ctx, srcTabletAl...
go
func (wr *Wrangler) copyShardMetadata(ctx context.Context, srcTabletAlias *topodatapb.TabletAlias, destTabletAlias *topodatapb.TabletAlias) error { sql := "SELECT 1 FROM information_schema.tables WHERE table_schema = '_vt' AND table_name = 'shard_metadata'" presenceResult, err := wr.ExecuteFetchAsDba(ctx, srcTabletAl...
[ "func", "(", "wr", "*", "Wrangler", ")", "copyShardMetadata", "(", "ctx", "context", ".", "Context", ",", "srcTabletAlias", "*", "topodatapb", ".", "TabletAlias", ",", "destTabletAlias", "*", "topodatapb", ".", "TabletAlias", ")", "error", "{", "sql", ":=", ...
// copyShardMetadata copies contents of _vt.shard_metadata table from the source // tablet to the destination tablet. It's assumed that destination tablet is a // master and binlogging is not turned off when INSERT statements are executed.
[ "copyShardMetadata", "copies", "contents", "of", "_vt", ".", "shard_metadata", "table", "from", "the", "source", "tablet", "to", "the", "destination", "tablet", ".", "It", "s", "assumed", "that", "destination", "tablet", "is", "a", "master", "and", "binlogging",...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/schema.go#L371-L409
136,227
vitessio/vitess
go/vt/wrangler/schema.go
fillStringTemplate
func fillStringTemplate(tmpl string, vars interface{}) (string, error) { myTemplate := template.Must(template.New("").Parse(tmpl)) data := new(bytes.Buffer) if err := myTemplate.Execute(data, vars); err != nil { return "", err } return data.String(), nil }
go
func fillStringTemplate(tmpl string, vars interface{}) (string, error) { myTemplate := template.Must(template.New("").Parse(tmpl)) data := new(bytes.Buffer) if err := myTemplate.Execute(data, vars); err != nil { return "", err } return data.String(), nil }
[ "func", "fillStringTemplate", "(", "tmpl", "string", ",", "vars", "interface", "{", "}", ")", "(", "string", ",", "error", ")", "{", "myTemplate", ":=", "template", ".", "Must", "(", "template", ".", "New", "(", "\"", "\"", ")", ".", "Parse", "(", "t...
// fillStringTemplate returns the string template filled
[ "fillStringTemplate", "returns", "the", "string", "template", "filled" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/schema.go#L446-L453
136,228
vitessio/vitess
go/vt/dbconnpool/connection_pool.go
NewConnectionPool
func NewConnectionPool(name string, capacity int, idleTimeout time.Duration, dnsResolutionFrequency time.Duration) *ConnectionPool { cp := &ConnectionPool{capacity: capacity, idleTimeout: idleTimeout, resolutionFrequency: dnsResolutionFrequency} if name == "" || usedNames[name] { return cp } usedNames[name] = tru...
go
func NewConnectionPool(name string, capacity int, idleTimeout time.Duration, dnsResolutionFrequency time.Duration) *ConnectionPool { cp := &ConnectionPool{capacity: capacity, idleTimeout: idleTimeout, resolutionFrequency: dnsResolutionFrequency} if name == "" || usedNames[name] { return cp } usedNames[name] = tru...
[ "func", "NewConnectionPool", "(", "name", "string", ",", "capacity", "int", ",", "idleTimeout", "time", ".", "Duration", ",", "dnsResolutionFrequency", "time", ".", "Duration", ")", "*", "ConnectionPool", "{", "cp", ":=", "&", "ConnectionPool", "{", "capacity", ...
// NewConnectionPool creates a new ConnectionPool. The name is used // to publish stats only.
[ "NewConnectionPool", "creates", "a", "new", "ConnectionPool", ".", "The", "name", "is", "used", "to", "publish", "stats", "only", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/dbconnpool/connection_pool.go#L72-L88
136,229
vitessio/vitess
go/vt/dbconnpool/connection_pool.go
connect
func (cp *ConnectionPool) connect() (pools.Resource, error) { c, err := NewDBConnection(cp.info, cp.mysqlStats) if err != nil { return nil, err } return &PooledDBConnection{ DBConnection: c, pool: cp, }, nil }
go
func (cp *ConnectionPool) connect() (pools.Resource, error) { c, err := NewDBConnection(cp.info, cp.mysqlStats) if err != nil { return nil, err } return &PooledDBConnection{ DBConnection: c, pool: cp, }, nil }
[ "func", "(", "cp", "*", "ConnectionPool", ")", "connect", "(", ")", "(", "pools", ".", "Resource", ",", "error", ")", "{", "c", ",", "err", ":=", "NewDBConnection", "(", "cp", ".", "info", ",", "cp", ".", "mysqlStats", ")", "\n", "if", "err", "!=",...
// connect is used by the resource pool to create a new Resource.
[ "connect", "is", "used", "by", "the", "resource", "pool", "to", "create", "a", "new", "Resource", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/dbconnpool/connection_pool.go#L171-L180
136,230
vitessio/vitess
go/vt/dbconnpool/connection_pool.go
Get
func (cp *ConnectionPool) Get(ctx context.Context) (*PooledDBConnection, error) { p := cp.pool() if p == nil { return nil, ErrConnPoolClosed } r, err := p.Get(ctx) if err != nil { return nil, err } // Check that the RemoteAddr is still a valid Address if cp.resolutionFrequency > 0 && cp.hostIsNotIP && ...
go
func (cp *ConnectionPool) Get(ctx context.Context) (*PooledDBConnection, error) { p := cp.pool() if p == nil { return nil, ErrConnPoolClosed } r, err := p.Get(ctx) if err != nil { return nil, err } // Check that the RemoteAddr is still a valid Address if cp.resolutionFrequency > 0 && cp.hostIsNotIP && ...
[ "func", "(", "cp", "*", "ConnectionPool", ")", "Get", "(", "ctx", "context", ".", "Context", ")", "(", "*", "PooledDBConnection", ",", "error", ")", "{", "p", ":=", "cp", ".", "pool", "(", ")", "\n", "if", "p", "==", "nil", "{", "return", "nil", ...
// Get returns a connection. // You must call Recycle on the PooledDBConnection once done.
[ "Get", "returns", "a", "connection", ".", "You", "must", "call", "Recycle", "on", "the", "PooledDBConnection", "once", "done", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/dbconnpool/connection_pool.go#L206-L227
136,231
vitessio/vitess
go/vt/dbconnpool/connection_pool.go
SetCapacity
func (cp *ConnectionPool) SetCapacity(capacity int) (err error) { cp.mu.Lock() defer cp.mu.Unlock() if cp.connections != nil { err = cp.connections.SetCapacity(capacity) if err != nil { return err } } cp.capacity = capacity return nil }
go
func (cp *ConnectionPool) SetCapacity(capacity int) (err error) { cp.mu.Lock() defer cp.mu.Unlock() if cp.connections != nil { err = cp.connections.SetCapacity(capacity) if err != nil { return err } } cp.capacity = capacity return nil }
[ "func", "(", "cp", "*", "ConnectionPool", ")", "SetCapacity", "(", "capacity", "int", ")", "(", "err", "error", ")", "{", "cp", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "cp", ".", "mu", ".", "Unlock", "(", ")", "\n", "if", "cp", ".", "c...
// SetCapacity alters the size of the pool at runtime.
[ "SetCapacity", "alters", "the", "size", "of", "the", "pool", "at", "runtime", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/dbconnpool/connection_pool.go#L246-L257
136,232
vitessio/vitess
go/vt/dbconnpool/connection_pool.go
StatsJSON
func (cp *ConnectionPool) StatsJSON() string { p := cp.pool() if p == nil { return "{}" } return p.StatsJSON() }
go
func (cp *ConnectionPool) StatsJSON() string { p := cp.pool() if p == nil { return "{}" } return p.StatsJSON() }
[ "func", "(", "cp", "*", "ConnectionPool", ")", "StatsJSON", "(", ")", "string", "{", "p", ":=", "cp", ".", "pool", "(", ")", "\n", "if", "p", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "p", ".", "StatsJSON", "(", ")", "\...
// StatsJSON returns the pool stats as a JSOn object.
[ "StatsJSON", "returns", "the", "pool", "stats", "as", "a", "JSOn", "object", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/dbconnpool/connection_pool.go#L270-L276
136,233
vitessio/vitess
go/mysql/constants.go
IsConnErr
func IsConnErr(err error) bool { if sqlErr, ok := err.(*SQLError); ok { num := sqlErr.Number() return (num >= CRUnknownError && num <= CRNamedPipeStateError) || num == ERQueryInterrupted } return false }
go
func IsConnErr(err error) bool { if sqlErr, ok := err.(*SQLError); ok { num := sqlErr.Number() return (num >= CRUnknownError && num <= CRNamedPipeStateError) || num == ERQueryInterrupted } return false }
[ "func", "IsConnErr", "(", "err", "error", ")", "bool", "{", "if", "sqlErr", ",", "ok", ":=", "err", ".", "(", "*", "SQLError", ")", ";", "ok", "{", "num", ":=", "sqlErr", ".", "Number", "(", ")", "\n", "return", "(", "num", ">=", "CRUnknownError", ...
// IsConnErr returns true if the error is a connection error.
[ "IsConnErr", "returns", "true", "if", "the", "error", "is", "a", "connection", "error", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/constants.go#L548-L554
136,234
vitessio/vitess
go/vt/discovery/tablet_stats_cache_wait.go
WaitForAnyTablet
func (tc *TabletStatsCache) WaitForAnyTablet(ctx context.Context, cell, keyspace, shard string, tabletTypes []topodatapb.TabletType) error { return tc.waitForAnyTablet(ctx, keyspace, shard, tabletTypes) }
go
func (tc *TabletStatsCache) WaitForAnyTablet(ctx context.Context, cell, keyspace, shard string, tabletTypes []topodatapb.TabletType) error { return tc.waitForAnyTablet(ctx, keyspace, shard, tabletTypes) }
[ "func", "(", "tc", "*", "TabletStatsCache", ")", "WaitForAnyTablet", "(", "ctx", "context", ".", "Context", ",", "cell", ",", "keyspace", ",", "shard", "string", ",", "tabletTypes", "[", "]", "topodatapb", ".", "TabletType", ")", "error", "{", "return", "t...
// WaitForAnyTablet waits for a single tablet of any of the types. // It doesn't have to be serving.
[ "WaitForAnyTablet", "waits", "for", "a", "single", "tablet", "of", "any", "of", "the", "types", ".", "It", "doesn", "t", "have", "to", "be", "serving", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/tablet_stats_cache_wait.go#L49-L51
136,235
vitessio/vitess
go/vt/discovery/tablet_stats_cache_wait.go
waitForTablets
func (tc *TabletStatsCache) waitForTablets(ctx context.Context, targets []*querypb.Target, requireServing bool) error { for { // We nil targets as we find them. allPresent := true for i, target := range targets { if target == nil { continue } var stats []TabletStats if requireServing { stats...
go
func (tc *TabletStatsCache) waitForTablets(ctx context.Context, targets []*querypb.Target, requireServing bool) error { for { // We nil targets as we find them. allPresent := true for i, target := range targets { if target == nil { continue } var stats []TabletStats if requireServing { stats...
[ "func", "(", "tc", "*", "TabletStatsCache", ")", "waitForTablets", "(", "ctx", "context", ".", "Context", ",", "targets", "[", "]", "*", "querypb", ".", "Target", ",", "requireServing", "bool", ")", "error", "{", "for", "{", "// We nil targets as we find them....
// waitForTablets is the internal method that polls for tablets.
[ "waitForTablets", "is", "the", "internal", "method", "that", "polls", "for", "tablets", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/tablet_stats_cache_wait.go#L62-L98
136,236
vitessio/vitess
go/vt/discovery/tablet_stats_cache_wait.go
waitForAnyTablet
func (tc *TabletStatsCache) waitForAnyTablet(ctx context.Context, keyspace, shard string, types []topodatapb.TabletType) error { for { for _, tt := range types { stats := tc.GetTabletStats(keyspace, shard, tt) if len(stats) > 0 { return nil } } // Unblock after the sleep or when the context has exp...
go
func (tc *TabletStatsCache) waitForAnyTablet(ctx context.Context, keyspace, shard string, types []topodatapb.TabletType) error { for { for _, tt := range types { stats := tc.GetTabletStats(keyspace, shard, tt) if len(stats) > 0 { return nil } } // Unblock after the sleep or when the context has exp...
[ "func", "(", "tc", "*", "TabletStatsCache", ")", "waitForAnyTablet", "(", "ctx", "context", ".", "Context", ",", "keyspace", ",", "shard", "string", ",", "types", "[", "]", "topodatapb", ".", "TabletType", ")", "error", "{", "for", "{", "for", "_", ",", ...
// waitForAnyTablet is the internal method that polls for any tablet of required type
[ "waitForAnyTablet", "is", "the", "internal", "method", "that", "polls", "for", "any", "tablet", "of", "required", "type" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/tablet_stats_cache_wait.go#L101-L119
136,237
vitessio/vitess
go/vt/topotools/events/reparent_syslog.go
Syslog
func (r *Reparent) Syslog() (syslog.Priority, string) { return syslog.LOG_INFO, fmt.Sprintf("%s/%s [reparent %v -> %v] %s (%s)", r.ShardInfo.Keyspace(), r.ShardInfo.ShardName(), topoproto.TabletAliasString(r.OldMaster.Alias), topoproto.TabletAliasString(r.NewMaster.Alias), r.Status, r.ExternalID) }
go
func (r *Reparent) Syslog() (syslog.Priority, string) { return syslog.LOG_INFO, fmt.Sprintf("%s/%s [reparent %v -> %v] %s (%s)", r.ShardInfo.Keyspace(), r.ShardInfo.ShardName(), topoproto.TabletAliasString(r.OldMaster.Alias), topoproto.TabletAliasString(r.NewMaster.Alias), r.Status, r.ExternalID) }
[ "func", "(", "r", "*", "Reparent", ")", "Syslog", "(", ")", "(", "syslog", ".", "Priority", ",", "string", ")", "{", "return", "syslog", ".", "LOG_INFO", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "r", ".", "ShardInfo", ".", "Keyspace", "(",...
// Syslog writes a Reparent event to syslog.
[ "Syslog", "writes", "a", "Reparent", "event", "to", "syslog", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topotools/events/reparent_syslog.go#L28-L34
136,238
vitessio/vitess
go/sqltypes/arithmetic.go
Min
func Min(v1, v2 Value) (Value, error) { return minmax(v1, v2, true) }
go
func Min(v1, v2 Value) (Value, error) { return minmax(v1, v2, true) }
[ "func", "Min", "(", "v1", ",", "v2", "Value", ")", "(", "Value", ",", "error", ")", "{", "return", "minmax", "(", "v1", ",", "v2", ",", "true", ")", "\n", "}" ]
// Min returns the minimum of v1 and v2. If one of the // values is NULL, it returns the other value. If both // are NULL, it returns NULL.
[ "Min", "returns", "the", "minimum", "of", "v1", "and", "v2", ".", "If", "one", "of", "the", "values", "is", "NULL", "it", "returns", "the", "other", "value", ".", "If", "both", "are", "NULL", "it", "returns", "NULL", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/arithmetic.go#L123-L125
136,239
vitessio/vitess
go/sqltypes/arithmetic.go
Max
func Max(v1, v2 Value) (Value, error) { return minmax(v1, v2, false) }
go
func Max(v1, v2 Value) (Value, error) { return minmax(v1, v2, false) }
[ "func", "Max", "(", "v1", ",", "v2", "Value", ")", "(", "Value", ",", "error", ")", "{", "return", "minmax", "(", "v1", ",", "v2", ",", "false", ")", "\n", "}" ]
// Max returns the maximum of v1 and v2. If one of the // values is NULL, it returns the other value. If both // are NULL, it returns NULL.
[ "Max", "returns", "the", "maximum", "of", "v1", "and", "v2", ".", "If", "one", "of", "the", "values", "is", "NULL", "it", "returns", "the", "other", "value", ".", "If", "both", "are", "NULL", "it", "returns", "NULL", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/arithmetic.go#L130-L132
136,240
vitessio/vitess
go/sqltypes/arithmetic.go
Cast
func Cast(v Value, typ querypb.Type) (Value, error) { if v.Type() == typ || v.IsNull() { return v, nil } if IsSigned(typ) && v.IsSigned() { return MakeTrusted(typ, v.ToBytes()), nil } if IsUnsigned(typ) && v.IsUnsigned() { return MakeTrusted(typ, v.ToBytes()), nil } if (IsFloat(typ) || typ == Decimal) && (...
go
func Cast(v Value, typ querypb.Type) (Value, error) { if v.Type() == typ || v.IsNull() { return v, nil } if IsSigned(typ) && v.IsSigned() { return MakeTrusted(typ, v.ToBytes()), nil } if IsUnsigned(typ) && v.IsUnsigned() { return MakeTrusted(typ, v.ToBytes()), nil } if (IsFloat(typ) || typ == Decimal) && (...
[ "func", "Cast", "(", "v", "Value", ",", "typ", "querypb", ".", "Type", ")", "(", "Value", ",", "error", ")", "{", "if", "v", ".", "Type", "(", ")", "==", "typ", "||", "v", ".", "IsNull", "(", ")", "{", "return", "v", ",", "nil", "\n", "}", ...
// Cast converts a Value to the target type.
[ "Cast", "converts", "a", "Value", "to", "the", "target", "type", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/arithmetic.go#L156-L181
136,241
vitessio/vitess
go/sqltypes/arithmetic.go
ToUint64
func ToUint64(v Value) (uint64, error) { num, err := newIntegralNumeric(v) if err != nil { return 0, err } switch num.typ { case Int64: if num.ival < 0 { return 0, vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "negative number cannot be converted to unsigned: %d", num.ival) } return uint64(num.ival), n...
go
func ToUint64(v Value) (uint64, error) { num, err := newIntegralNumeric(v) if err != nil { return 0, err } switch num.typ { case Int64: if num.ival < 0 { return 0, vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "negative number cannot be converted to unsigned: %d", num.ival) } return uint64(num.ival), n...
[ "func", "ToUint64", "(", "v", "Value", ")", "(", "uint64", ",", "error", ")", "{", "num", ",", "err", ":=", "newIntegralNumeric", "(", "v", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n", "switch", "num", "."...
// ToUint64 converts Value to uint64.
[ "ToUint64", "converts", "Value", "to", "uint64", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/arithmetic.go#L184-L199
136,242
vitessio/vitess
go/sqltypes/arithmetic.go
ToFloat64
func ToFloat64(v Value) (float64, error) { num, err := newNumeric(v) if err != nil { return 0, err } switch num.typ { case Int64: return float64(num.ival), nil case Uint64: return float64(num.uval), nil case Float64: return num.fval, nil } panic("unreachable") }
go
func ToFloat64(v Value) (float64, error) { num, err := newNumeric(v) if err != nil { return 0, err } switch num.typ { case Int64: return float64(num.ival), nil case Uint64: return float64(num.uval), nil case Float64: return num.fval, nil } panic("unreachable") }
[ "func", "ToFloat64", "(", "v", "Value", ")", "(", "float64", ",", "error", ")", "{", "num", ",", "err", ":=", "newNumeric", "(", "v", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n", "switch", "num", ".", "t...
// ToFloat64 converts Value to float64.
[ "ToFloat64", "converts", "Value", "to", "float64", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/arithmetic.go#L221-L235
136,243
vitessio/vitess
go/sqltypes/arithmetic.go
newNumeric
func newNumeric(v Value) (numeric, error) { str := v.ToString() switch { case v.IsSigned(): ival, err := strconv.ParseInt(str, 10, 64) if err != nil { return numeric{}, vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "%v", err) } return numeric{ival: ival, typ: Int64}, nil case v.IsUnsigned(): uval, err...
go
func newNumeric(v Value) (numeric, error) { str := v.ToString() switch { case v.IsSigned(): ival, err := strconv.ParseInt(str, 10, 64) if err != nil { return numeric{}, vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "%v", err) } return numeric{ival: ival, typ: Int64}, nil case v.IsUnsigned(): uval, err...
[ "func", "newNumeric", "(", "v", "Value", ")", "(", "numeric", ",", "error", ")", "{", "str", ":=", "v", ".", "ToString", "(", ")", "\n", "switch", "{", "case", "v", ".", "IsSigned", "(", ")", ":", "ival", ",", "err", ":=", "strconv", ".", "ParseI...
// newNumeric parses a value and produces an Int64, Uint64 or Float64.
[ "newNumeric", "parses", "a", "value", "and", "produces", "an", "Int64", "Uint64", "or", "Float64", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/arithmetic.go#L260-L291
136,244
vitessio/vitess
go/sqltypes/arithmetic.go
newIntegralNumeric
func newIntegralNumeric(v Value) (numeric, error) { str := v.ToString() switch { case v.IsSigned(): ival, err := strconv.ParseInt(str, 10, 64) if err != nil { return numeric{}, vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "%v", err) } return numeric{ival: ival, typ: Int64}, nil case v.IsUnsigned(): u...
go
func newIntegralNumeric(v Value) (numeric, error) { str := v.ToString() switch { case v.IsSigned(): ival, err := strconv.ParseInt(str, 10, 64) if err != nil { return numeric{}, vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "%v", err) } return numeric{ival: ival, typ: Int64}, nil case v.IsUnsigned(): u...
[ "func", "newIntegralNumeric", "(", "v", "Value", ")", "(", "numeric", ",", "error", ")", "{", "str", ":=", "v", ".", "ToString", "(", ")", "\n", "switch", "{", "case", "v", ".", "IsSigned", "(", ")", ":", "ival", ",", "err", ":=", "strconv", ".", ...
// newIntegralNumeric parses a value and produces an Int64 or Uint64.
[ "newIntegralNumeric", "parses", "a", "value", "and", "produces", "an", "Int64", "or", "Uint64", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/arithmetic.go#L294-L319
136,245
vitessio/vitess
go/sqltypes/arithmetic.go
prioritize
func prioritize(v1, v2 numeric) (altv1, altv2 numeric) { switch v1.typ { case Int64: if v2.typ == Uint64 || v2.typ == Float64 { return v2, v1 } case Uint64: if v2.typ == Float64 { return v2, v1 } } return v1, v2 }
go
func prioritize(v1, v2 numeric) (altv1, altv2 numeric) { switch v1.typ { case Int64: if v2.typ == Uint64 || v2.typ == Float64 { return v2, v1 } case Uint64: if v2.typ == Float64 { return v2, v1 } } return v1, v2 }
[ "func", "prioritize", "(", "v1", ",", "v2", "numeric", ")", "(", "altv1", ",", "altv2", "numeric", ")", "{", "switch", "v1", ".", "typ", "{", "case", "Int64", ":", "if", "v2", ".", "typ", "==", "Uint64", "||", "v2", ".", "typ", "==", "Float64", "...
// prioritize reorders the input parameters // to be Float64, Uint64, Int64.
[ "prioritize", "reorders", "the", "input", "parameters", "to", "be", "Float64", "Uint64", "Int64", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/arithmetic.go#L341-L353
136,246
vitessio/vitess
go/vt/vtgate/logstats.go
RemoteAddrUsername
func (stats *LogStats) RemoteAddrUsername() (string, string) { ci, ok := callinfo.FromContext(stats.Ctx) if !ok { return "", "" } return ci.RemoteAddr(), ci.Username() }
go
func (stats *LogStats) RemoteAddrUsername() (string, string) { ci, ok := callinfo.FromContext(stats.Ctx) if !ok { return "", "" } return ci.RemoteAddr(), ci.Username() }
[ "func", "(", "stats", "*", "LogStats", ")", "RemoteAddrUsername", "(", ")", "(", "string", ",", "string", ")", "{", "ci", ",", "ok", ":=", "callinfo", ".", "FromContext", "(", "stats", ".", "Ctx", ")", "\n", "if", "!", "ok", "{", "return", "\"", "\...
// RemoteAddrUsername returns some parts of CallInfo if set
[ "RemoteAddrUsername", "returns", "some", "parts", "of", "CallInfo", "if", "set" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/logstats.go#L113-L119
136,247
vitessio/vitess
go/vt/vtgate/vschemaacl/vschemaacl.go
Authorized
func Authorized(caller *querypb.VTGateCallerID) bool { if allowAll { return true } user := caller.GetUsername() _, ok := acl[user] return ok }
go
func Authorized(caller *querypb.VTGateCallerID) bool { if allowAll { return true } user := caller.GetUsername() _, ok := acl[user] return ok }
[ "func", "Authorized", "(", "caller", "*", "querypb", ".", "VTGateCallerID", ")", "bool", "{", "if", "allowAll", "{", "return", "true", "\n", "}", "\n\n", "user", ":=", "caller", ".", "GetUsername", "(", ")", "\n", "_", ",", "ok", ":=", "acl", "[", "u...
// Authorized returns true if the given caller is allowed to execute vschema operations
[ "Authorized", "returns", "true", "if", "the", "given", "caller", "is", "allowed", "to", "execute", "vschema", "operations" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vschemaacl/vschemaacl.go#L56-L64
136,248
vitessio/vitess
go/vt/worker/status_worker.go
SetState
func (w *StatusWorker) SetState(state StatusWorkerState) { w.mu.Lock() defer w.mu.Unlock() w.state = state statsState.Set(string(state)) }
go
func (w *StatusWorker) SetState(state StatusWorkerState) { w.mu.Lock() defer w.mu.Unlock() w.state = state statsState.Set(string(state)) }
[ "func", "(", "w", "*", "StatusWorker", ")", "SetState", "(", "state", "StatusWorkerState", ")", "{", "w", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "w", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "w", ".", "state", "=", "state", "\n", "st...
// SetState is a convenience function for workers.
[ "SetState", "is", "a", "convenience", "function", "for", "workers", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/status_worker.go#L88-L94
136,249
vitessio/vitess
go/vt/worker/status_worker.go
State
func (w *StatusWorker) State() StatusWorkerState { w.mu.Lock() defer w.mu.Unlock() return w.state }
go
func (w *StatusWorker) State() StatusWorkerState { w.mu.Lock() defer w.mu.Unlock() return w.state }
[ "func", "(", "w", "*", "StatusWorker", ")", "State", "(", ")", "StatusWorkerState", "{", "w", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "w", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "return", "w", ".", "state", "\n", "}" ]
// State is part of the Worker interface.
[ "State", "is", "part", "of", "the", "Worker", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/status_worker.go#L97-L102
136,250
vitessio/vitess
go/vt/automation/id_generator.go
GetNextID
func (ig *IDGenerator) GetNextID() string { return strconv.FormatInt(atomic.AddInt64(&ig.counter, 1), 10) }
go
func (ig *IDGenerator) GetNextID() string { return strconv.FormatInt(atomic.AddInt64(&ig.counter, 1), 10) }
[ "func", "(", "ig", "*", "IDGenerator", ")", "GetNextID", "(", ")", "string", "{", "return", "strconv", ".", "FormatInt", "(", "atomic", ".", "AddInt64", "(", "&", "ig", ".", "counter", ",", "1", ")", ",", "10", ")", "\n", "}" ]
// GetNextID returns an ID which wasn't returned before.
[ "GetNextID", "returns", "an", "ID", "which", "wasn", "t", "returned", "before", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/automation/id_generator.go#L30-L32
136,251
vitessio/vitess
go/pools/id_pool.go
Get
func (pool *IDPool) Get() (id uint32) { pool.Lock() defer pool.Unlock() // Pick a value that's been returned, if any. for key := range pool.used { delete(pool.used, key) return key } // No recycled IDs are available, so increase the pool size. pool.maxUsed += 1 return pool.maxUsed }
go
func (pool *IDPool) Get() (id uint32) { pool.Lock() defer pool.Unlock() // Pick a value that's been returned, if any. for key := range pool.used { delete(pool.used, key) return key } // No recycled IDs are available, so increase the pool size. pool.maxUsed += 1 return pool.maxUsed }
[ "func", "(", "pool", "*", "IDPool", ")", "Get", "(", ")", "(", "id", "uint32", ")", "{", "pool", ".", "Lock", "(", ")", "\n", "defer", "pool", ".", "Unlock", "(", ")", "\n\n", "// Pick a value that's been returned, if any.", "for", "key", ":=", "range", ...
// Get returns an ID that is unique among currently active users of this pool.
[ "Get", "returns", "an", "ID", "that", "is", "unique", "among", "currently", "active", "users", "of", "this", "pool", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/pools/id_pool.go#L46-L59
136,252
vitessio/vitess
go/pools/id_pool.go
Put
func (pool *IDPool) Put(id uint32) { pool.Lock() defer pool.Unlock() if id < 1 || id > pool.maxUsed { panic(fmt.Errorf("IDPool.Put(%v): invalid value, must be in the range [1,%v]", id, pool.maxUsed)) } if pool.used[id] { panic(fmt.Errorf("IDPool.Put(%v): can't put value that was already recycled", id)) } ...
go
func (pool *IDPool) Put(id uint32) { pool.Lock() defer pool.Unlock() if id < 1 || id > pool.maxUsed { panic(fmt.Errorf("IDPool.Put(%v): invalid value, must be in the range [1,%v]", id, pool.maxUsed)) } if pool.used[id] { panic(fmt.Errorf("IDPool.Put(%v): can't put value that was already recycled", id)) } ...
[ "func", "(", "pool", "*", "IDPool", ")", "Put", "(", "id", "uint32", ")", "{", "pool", ".", "Lock", "(", ")", "\n", "defer", "pool", ".", "Unlock", "(", ")", "\n\n", "if", "id", "<", "1", "||", "id", ">", "pool", ".", "maxUsed", "{", "panic", ...
// Put recycles an ID back into the pool for others to use. Putting back a value // or 0, or a value that is not currently "checked out", will result in a panic // because that should never happen except in the case of a programming error.
[ "Put", "recycles", "an", "ID", "back", "into", "the", "pool", "for", "others", "to", "use", ".", "Putting", "back", "a", "value", "or", "0", "or", "a", "value", "that", "is", "not", "currently", "checked", "out", "will", "result", "in", "a", "panic", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/pools/id_pool.go#L64-L84
136,253
vitessio/vitess
go/vt/mysqlctl/backup.go
removeExistingFiles
func removeExistingFiles(cnf *Mycnf) error { paths := map[string]string{ "BinLogPath.*": cnf.BinLogPath, "DataDir": cnf.DataDir, "InnodbDataHomeDir": cnf.InnodbDataHomeDir, "InnodbLogGroupHomeDir": cnf.InnodbLogGroupHomeDir, "RelayLogPath.*": cnf.RelayLogPath, "RelayLogInd...
go
func removeExistingFiles(cnf *Mycnf) error { paths := map[string]string{ "BinLogPath.*": cnf.BinLogPath, "DataDir": cnf.DataDir, "InnodbDataHomeDir": cnf.InnodbDataHomeDir, "InnodbLogGroupHomeDir": cnf.InnodbLogGroupHomeDir, "RelayLogPath.*": cnf.RelayLogPath, "RelayLogInd...
[ "func", "removeExistingFiles", "(", "cnf", "*", "Mycnf", ")", "error", "{", "paths", ":=", "map", "[", "string", "]", "string", "{", "\"", "\"", ":", "cnf", ".", "BinLogPath", ",", "\"", "\"", ":", "cnf", ".", "DataDir", ",", "\"", "\"", ":", "cnf"...
// removeExistingFiles will delete existing files in the data dir to prevent // conflicts with the restored archive. In particular, binlogs can be created // even during initial bootstrap, and these can interfere with configuring // replication if kept around after the restore.
[ "removeExistingFiles", "will", "delete", "existing", "files", "in", "the", "data", "dir", "to", "prevent", "conflicts", "with", "the", "restored", "archive", ".", "In", "particular", "binlogs", "can", "be", "created", "even", "during", "initial", "bootstrap", "a...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/backup.go#L163-L206
136,254
vitessio/vitess
go/vt/workflow/node.go
BroadcastChanges
func (n *Node) BroadcastChanges(updateChildren bool) error { n.nodeManager.mu.Lock() defer n.nodeManager.mu.Unlock() return n.nodeManager.updateNodeAndBroadcastLocked(n, updateChildren) }
go
func (n *Node) BroadcastChanges(updateChildren bool) error { n.nodeManager.mu.Lock() defer n.nodeManager.mu.Unlock() return n.nodeManager.updateNodeAndBroadcastLocked(n, updateChildren) }
[ "func", "(", "n", "*", "Node", ")", "BroadcastChanges", "(", "updateChildren", "bool", ")", "error", "{", "n", ".", "nodeManager", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "n", ".", "nodeManager", ".", "mu", ".", "Unlock", "(", ")", "\n", "...
// BroadcastChanges sends the new contents of the node to the watchers.
[ "BroadcastChanges", "sends", "the", "new", "contents", "of", "the", "node", "to", "the", "watchers", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/node.go#L193-L197
136,255
vitessio/vitess
go/vt/workflow/node.go
deepCopyFrom
func (n *Node) deepCopyFrom(otherNode *Node, copyChildren bool) error { oldChildren := n.Children *n = *otherNode n.Children = oldChildren n.Actions = []*Action{} for _, otherAction := range otherNode.Actions { action := &Action{} *action = *otherAction n.Actions = append(n.Actions, action) } if !copyChi...
go
func (n *Node) deepCopyFrom(otherNode *Node, copyChildren bool) error { oldChildren := n.Children *n = *otherNode n.Children = oldChildren n.Actions = []*Action{} for _, otherAction := range otherNode.Actions { action := &Action{} *action = *otherAction n.Actions = append(n.Actions, action) } if !copyChi...
[ "func", "(", "n", "*", "Node", ")", "deepCopyFrom", "(", "otherNode", "*", "Node", ",", "copyChildren", "bool", ")", "error", "{", "oldChildren", ":=", "n", ".", "Children", "\n", "*", "n", "=", "*", "otherNode", "\n", "n", ".", "Children", "=", "old...
// deepCopyFrom copies contents of otherNode into this node. Contents of Actions // is copied into new Action objects, so that changes in otherNode are not // immediately visible in this node. When copyChildren is false the contents of // Children in this node is preserved fully even if it doesn't match the contents //...
[ "deepCopyFrom", "copies", "contents", "of", "otherNode", "into", "this", "node", ".", "Contents", "of", "Actions", "is", "copied", "into", "new", "Action", "objects", "so", "that", "changes", "in", "otherNode", "are", "not", "immediately", "visible", "in", "th...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/node.go#L207-L239
136,256
vitessio/vitess
go/vt/workflow/node.go
GetChildByPath
func (n *Node) GetChildByPath(subPath string) (*Node, error) { // Find the subnode if needed. parts := strings.Split(subPath, "/") currentNode := n for i := 0; i < len(parts); i++ { childPathName := parts[i] found := false for _, child := range currentNode.Children { if child.PathName == childPathName { ...
go
func (n *Node) GetChildByPath(subPath string) (*Node, error) { // Find the subnode if needed. parts := strings.Split(subPath, "/") currentNode := n for i := 0; i < len(parts); i++ { childPathName := parts[i] found := false for _, child := range currentNode.Children { if child.PathName == childPathName { ...
[ "func", "(", "n", "*", "Node", ")", "GetChildByPath", "(", "subPath", "string", ")", "(", "*", "Node", ",", "error", ")", "{", "// Find the subnode if needed.", "parts", ":=", "strings", ".", "Split", "(", "subPath", ",", "\"", "\"", ")", "\n\n", "curren...
// GetChildByPath returns the child node given the relative path to this node. // The caller must ensure that the node tree is not modified during the call.
[ "GetChildByPath", "returns", "the", "child", "node", "given", "the", "relative", "path", "to", "this", "node", ".", "The", "caller", "must", "ensure", "that", "the", "node", "tree", "is", "not", "modified", "during", "the", "call", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/node.go#L243-L263
136,257
vitessio/vitess
go/vt/workflow/node.go
NewNodeManager
func NewNodeManager() *NodeManager { return &NodeManager{ roots: make(map[string]*Node), watchers: make(map[int]chan []byte), nextWatcherIndex: 1, } }
go
func NewNodeManager() *NodeManager { return &NodeManager{ roots: make(map[string]*Node), watchers: make(map[int]chan []byte), nextWatcherIndex: 1, } }
[ "func", "NewNodeManager", "(", ")", "*", "NodeManager", "{", "return", "&", "NodeManager", "{", "roots", ":", "make", "(", "map", "[", "string", "]", "*", "Node", ")", ",", "watchers", ":", "make", "(", "map", "[", "int", "]", "chan", "[", "]", "by...
// NewNodeManager returns a new NodeManager.
[ "NewNodeManager", "returns", "a", "new", "NodeManager", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/node.go#L291-L297
136,258
vitessio/vitess
go/vt/workflow/node.go
AddRootNode
func (m *NodeManager) AddRootNode(n *Node) error { m.mu.Lock() defer m.mu.Unlock() if _, ok := m.roots[n.PathName]; ok { return fmt.Errorf("toplevel node %v (with name %v) already exists", n.Path, n.Name) } n.Path = "/" + n.PathName n.nodeManager = m savedNode := NewNode() m.roots[n.PathName] = savedNode r...
go
func (m *NodeManager) AddRootNode(n *Node) error { m.mu.Lock() defer m.mu.Unlock() if _, ok := m.roots[n.PathName]; ok { return fmt.Errorf("toplevel node %v (with name %v) already exists", n.Path, n.Name) } n.Path = "/" + n.PathName n.nodeManager = m savedNode := NewNode() m.roots[n.PathName] = savedNode r...
[ "func", "(", "m", "*", "NodeManager", ")", "AddRootNode", "(", "n", "*", "Node", ")", "error", "{", "m", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "if", "_", ",", "ok", ":=", "m", ".", ...
// AddRootNode adds a toplevel Node to the NodeManager, // and broadcasts the Node to the listeners.
[ "AddRootNode", "adds", "a", "toplevel", "Node", "to", "the", "NodeManager", "and", "broadcasts", "the", "Node", "to", "the", "listeners", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/node.go#L301-L314
136,259
vitessio/vitess
go/vt/workflow/node.go
RemoveRootNode
func (m *NodeManager) RemoveRootNode(n *Node) { m.mu.Lock() defer m.mu.Unlock() delete(m.roots, n.PathName) u := &Update{ Deletes: []string{n.Path}, } m.broadcastUpdateLocked(u) }
go
func (m *NodeManager) RemoveRootNode(n *Node) { m.mu.Lock() defer m.mu.Unlock() delete(m.roots, n.PathName) u := &Update{ Deletes: []string{n.Path}, } m.broadcastUpdateLocked(u) }
[ "func", "(", "m", "*", "NodeManager", ")", "RemoveRootNode", "(", "n", "*", "Node", ")", "{", "m", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "delete", "(", "m", ".", "roots", ",", "n", "...
// RemoveRootNode removes a toplevel Node from the NodeManager, // and broadcasts the change to the listeners.
[ "RemoveRootNode", "removes", "a", "toplevel", "Node", "from", "the", "NodeManager", "and", "broadcasts", "the", "change", "to", "the", "listeners", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/node.go#L318-L328
136,260
vitessio/vitess
go/vt/workflow/node.go
GetFullTree
func (m *NodeManager) GetFullTree() ([]byte, error) { m.mu.Lock() defer m.mu.Unlock() return m.toJSON(0) }
go
func (m *NodeManager) GetFullTree() ([]byte, error) { m.mu.Lock() defer m.mu.Unlock() return m.toJSON(0) }
[ "func", "(", "m", "*", "NodeManager", ")", "GetFullTree", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "m", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "mu", ".", "Unlock", "(", ")", "\n", "return", "m", ".", "toJSO...
// GetFullTree returns the JSON representation of the entire Node tree.
[ "GetFullTree", "returns", "the", "JSON", "representation", "of", "the", "entire", "Node", "tree", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/node.go#L345-L349
136,261
vitessio/vitess
go/vt/workflow/node.go
GetAndWatchFullTree
func (m *NodeManager) GetAndWatchFullTree(notifications chan []byte) ([]byte, int, error) { m.mu.Lock() defer m.mu.Unlock() i := m.nextWatcherIndex m.nextWatcherIndex++ result, err := m.toJSON(i) if err != nil { return nil, 0, err } // It worked, register the watcher. m.watchers[i] = notifications return...
go
func (m *NodeManager) GetAndWatchFullTree(notifications chan []byte) ([]byte, int, error) { m.mu.Lock() defer m.mu.Unlock() i := m.nextWatcherIndex m.nextWatcherIndex++ result, err := m.toJSON(i) if err != nil { return nil, 0, err } // It worked, register the watcher. m.watchers[i] = notifications return...
[ "func", "(", "m", "*", "NodeManager", ")", "GetAndWatchFullTree", "(", "notifications", "chan", "[", "]", "byte", ")", "(", "[", "]", "byte", ",", "int", ",", "error", ")", "{", "m", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "mu"...
// GetAndWatchFullTree returns the JSON representation of the entire Node tree, // and registers a watcher to monitor changes to the tree.
[ "GetAndWatchFullTree", "returns", "the", "JSON", "representation", "of", "the", "entire", "Node", "tree", "and", "registers", "a", "watcher", "to", "monitor", "changes", "to", "the", "tree", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/node.go#L353-L368
136,262
vitessio/vitess
go/vt/workflow/node.go
broadcastUpdateLocked
func (m *NodeManager) broadcastUpdateLocked(u *Update) { data, err := json.Marshal(u) if err != nil { log.Errorf("Cannot JSON encode update: %v", err) return } // If we can't write on the channel, we close it and remove it // from the list. It probably means the web browser on the // other side is not there ...
go
func (m *NodeManager) broadcastUpdateLocked(u *Update) { data, err := json.Marshal(u) if err != nil { log.Errorf("Cannot JSON encode update: %v", err) return } // If we can't write on the channel, we close it and remove it // from the list. It probably means the web browser on the // other side is not there ...
[ "func", "(", "m", "*", "NodeManager", ")", "broadcastUpdateLocked", "(", "u", "*", "Update", ")", "{", "data", ",", "err", ":=", "json", ".", "Marshal", "(", "u", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Errorf", "(", "\"", "\"", ",...
// broadcastUpdateLocked sends the provided update to all watchers. // Has to be called with the lock.
[ "broadcastUpdateLocked", "sends", "the", "provided", "update", "to", "all", "watchers", ".", "Has", "to", "be", "called", "with", "the", "lock", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/node.go#L372-L391
136,263
vitessio/vitess
go/vt/workflow/node.go
CloseWatcher
func (m *NodeManager) CloseWatcher(i int) { m.mu.Lock() defer m.mu.Unlock() delete(m.watchers, i) }
go
func (m *NodeManager) CloseWatcher(i int) { m.mu.Lock() defer m.mu.Unlock() delete(m.watchers, i) }
[ "func", "(", "m", "*", "NodeManager", ")", "CloseWatcher", "(", "i", "int", ")", "{", "m", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "delete", "(", "m", ".", "watchers", ",", "i", ")", "...
// CloseWatcher unregisters the watcher from this Manager.
[ "CloseWatcher", "unregisters", "the", "watcher", "from", "this", "Manager", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/node.go#L426-L431
136,264
vitessio/vitess
go/vt/workflow/node.go
Action
func (m *NodeManager) Action(ctx context.Context, ap *ActionParameters) error { n, err := m.getNodeByPath(ap.Path) if err != nil { return err } m.mu.Lock() if n.Listener == nil { m.mu.Unlock() return fmt.Errorf("Action %v is invoked on a node without listener (node path is %v)", ap.Name, ap.Path) } nodeL...
go
func (m *NodeManager) Action(ctx context.Context, ap *ActionParameters) error { n, err := m.getNodeByPath(ap.Path) if err != nil { return err } m.mu.Lock() if n.Listener == nil { m.mu.Unlock() return fmt.Errorf("Action %v is invoked on a node without listener (node path is %v)", ap.Name, ap.Path) } nodeL...
[ "func", "(", "m", "*", "NodeManager", ")", "Action", "(", "ctx", "context", ".", "Context", ",", "ap", "*", "ActionParameters", ")", "error", "{", "n", ",", "err", ":=", "m", ".", "getNodeByPath", "(", "ap", ".", "Path", ")", "\n", "if", "err", "!=...
// Action is called by the UI agents to trigger actions.
[ "Action", "is", "called", "by", "the", "UI", "agents", "to", "trigger", "actions", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/node.go#L434-L450
136,265
vitessio/vitess
go/mysql/mysql56_gtid.go
parseMysql56GTID
func parseMysql56GTID(s string) (GTID, error) { // Split into parts. parts := strings.Split(s, ":") if len(parts) != 2 { return nil, vterrors.Errorf(vtrpc.Code_INTERNAL, "invalid MySQL 5.6 GTID (%v): expecting UUID:Sequence", s) } // Parse Server ID. sid, err := ParseSID(parts[0]) if err != nil { return nil...
go
func parseMysql56GTID(s string) (GTID, error) { // Split into parts. parts := strings.Split(s, ":") if len(parts) != 2 { return nil, vterrors.Errorf(vtrpc.Code_INTERNAL, "invalid MySQL 5.6 GTID (%v): expecting UUID:Sequence", s) } // Parse Server ID. sid, err := ParseSID(parts[0]) if err != nil { return nil...
[ "func", "parseMysql56GTID", "(", "s", "string", ")", "(", "GTID", ",", "error", ")", "{", "// Split into parts.", "parts", ":=", "strings", ".", "Split", "(", "s", ",", "\"", "\"", ")", "\n", "if", "len", "(", "parts", ")", "!=", "2", "{", "return", ...
// parseMysql56GTID is registered as a GTID parser.
[ "parseMysql56GTID", "is", "registered", "as", "a", "GTID", "parser", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/mysql56_gtid.go#L32-L52
136,266
vitessio/vitess
go/mysql/mysql56_gtid.go
String
func (sid SID) String() string { dst := []byte("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx") hex.Encode(dst, sid[:4]) hex.Encode(dst[9:], sid[4:6]) hex.Encode(dst[14:], sid[6:8]) hex.Encode(dst[19:], sid[8:10]) hex.Encode(dst[24:], sid[10:16]) return string(dst) }
go
func (sid SID) String() string { dst := []byte("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx") hex.Encode(dst, sid[:4]) hex.Encode(dst[9:], sid[4:6]) hex.Encode(dst[14:], sid[6:8]) hex.Encode(dst[19:], sid[8:10]) hex.Encode(dst[24:], sid[10:16]) return string(dst) }
[ "func", "(", "sid", "SID", ")", "String", "(", ")", "string", "{", "dst", ":=", "[", "]", "byte", "(", "\"", "\"", ")", "\n", "hex", ".", "Encode", "(", "dst", ",", "sid", "[", ":", "4", "]", ")", "\n", "hex", ".", "Encode", "(", "dst", "["...
// String prints an SID in the form used by MySQL 5.6.
[ "String", "prints", "an", "SID", "in", "the", "form", "used", "by", "MySQL", "5", ".", "6", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/mysql56_gtid.go#L58-L66
136,267
vitessio/vitess
go/mysql/mysql56_gtid.go
ParseSID
func ParseSID(s string) (sid SID, err error) { if len(s) != 36 || s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-' { return sid, vterrors.Errorf(vtrpc.Code_INTERNAL, "invalid MySQL 5.6 SID %q", s) } // Drop the dashes so we can just check the error of Decode once. b := make([]byte, 0, 32) b = append(...
go
func ParseSID(s string) (sid SID, err error) { if len(s) != 36 || s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-' { return sid, vterrors.Errorf(vtrpc.Code_INTERNAL, "invalid MySQL 5.6 SID %q", s) } // Drop the dashes so we can just check the error of Decode once. b := make([]byte, 0, 32) b = append(...
[ "func", "ParseSID", "(", "s", "string", ")", "(", "sid", "SID", ",", "err", "error", ")", "{", "if", "len", "(", "s", ")", "!=", "36", "||", "s", "[", "8", "]", "!=", "'-'", "||", "s", "[", "13", "]", "!=", "'-'", "||", "s", "[", "18", "]...
// ParseSID parses an SID in the form used by MySQL 5.6.
[ "ParseSID", "parses", "an", "SID", "in", "the", "form", "used", "by", "MySQL", "5", ".", "6", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/mysql56_gtid.go#L69-L86
136,268
vitessio/vitess
go/vt/vttablet/tabletserver/twopc.go
Open
func (tpc *TwoPC) Open(dbconfigs *dbconfigs.DBConfigs) { tpc.readPool.Open(dbconfigs.AppWithDB(), dbconfigs.DbaWithDB(), dbconfigs.DbaWithDB()) }
go
func (tpc *TwoPC) Open(dbconfigs *dbconfigs.DBConfigs) { tpc.readPool.Open(dbconfigs.AppWithDB(), dbconfigs.DbaWithDB(), dbconfigs.DbaWithDB()) }
[ "func", "(", "tpc", "*", "TwoPC", ")", "Open", "(", "dbconfigs", "*", "dbconfigs", ".", "DBConfigs", ")", "{", "tpc", ".", "readPool", ".", "Open", "(", "dbconfigs", ".", "AppWithDB", "(", ")", ",", "dbconfigs", ".", "DbaWithDB", "(", ")", ",", "dbco...
// Open starts the TwoPC service.
[ "Open", "starts", "the", "TwoPC", "service", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/twopc.go#L203-L205
136,269
vitessio/vitess
go/vt/vttablet/tabletserver/twopc.go
SaveRedo
func (tpc *TwoPC) SaveRedo(ctx context.Context, conn *TxConnection, dtid string, queries []string) error { bindVars := map[string]*querypb.BindVariable{ "dtid": sqltypes.StringBindVariable(dtid), "state": sqltypes.Int64BindVariable(RedoStatePrepared), "time_created": sqltypes.Int64BindVariable(tim...
go
func (tpc *TwoPC) SaveRedo(ctx context.Context, conn *TxConnection, dtid string, queries []string) error { bindVars := map[string]*querypb.BindVariable{ "dtid": sqltypes.StringBindVariable(dtid), "state": sqltypes.Int64BindVariable(RedoStatePrepared), "time_created": sqltypes.Int64BindVariable(tim...
[ "func", "(", "tpc", "*", "TwoPC", ")", "SaveRedo", "(", "ctx", "context", ".", "Context", ",", "conn", "*", "TxConnection", ",", "dtid", "string", ",", "queries", "[", "]", "string", ")", "error", "{", "bindVars", ":=", "map", "[", "string", "]", "*"...
// SaveRedo saves the statements in the redo log using the supplied connection.
[ "SaveRedo", "saves", "the", "statements", "in", "the", "redo", "log", "using", "the", "supplied", "connection", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/twopc.go#L213-L241
136,270
vitessio/vitess
go/vt/vttablet/tabletserver/twopc.go
UpdateRedo
func (tpc *TwoPC) UpdateRedo(ctx context.Context, conn *TxConnection, dtid string, state int) error { bindVars := map[string]*querypb.BindVariable{ "dtid": sqltypes.StringBindVariable(dtid), "state": sqltypes.Int64BindVariable(int64(state)), } _, err := tpc.exec(ctx, conn, tpc.updateRedoTx, bindVars) return er...
go
func (tpc *TwoPC) UpdateRedo(ctx context.Context, conn *TxConnection, dtid string, state int) error { bindVars := map[string]*querypb.BindVariable{ "dtid": sqltypes.StringBindVariable(dtid), "state": sqltypes.Int64BindVariable(int64(state)), } _, err := tpc.exec(ctx, conn, tpc.updateRedoTx, bindVars) return er...
[ "func", "(", "tpc", "*", "TwoPC", ")", "UpdateRedo", "(", "ctx", "context", ".", "Context", ",", "conn", "*", "TxConnection", ",", "dtid", "string", ",", "state", "int", ")", "error", "{", "bindVars", ":=", "map", "[", "string", "]", "*", "querypb", ...
// UpdateRedo changes the state of the redo log for the dtid.
[ "UpdateRedo", "changes", "the", "state", "of", "the", "redo", "log", "for", "the", "dtid", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/twopc.go#L244-L251
136,271
vitessio/vitess
go/vt/vttablet/tabletserver/twopc.go
DeleteRedo
func (tpc *TwoPC) DeleteRedo(ctx context.Context, conn *TxConnection, dtid string) error { bindVars := map[string]*querypb.BindVariable{ "dtid": sqltypes.StringBindVariable(dtid), } _, err := tpc.exec(ctx, conn, tpc.deleteRedoTx, bindVars) if err != nil { return err } _, err = tpc.exec(ctx, conn, tpc.deleteRe...
go
func (tpc *TwoPC) DeleteRedo(ctx context.Context, conn *TxConnection, dtid string) error { bindVars := map[string]*querypb.BindVariable{ "dtid": sqltypes.StringBindVariable(dtid), } _, err := tpc.exec(ctx, conn, tpc.deleteRedoTx, bindVars) if err != nil { return err } _, err = tpc.exec(ctx, conn, tpc.deleteRe...
[ "func", "(", "tpc", "*", "TwoPC", ")", "DeleteRedo", "(", "ctx", "context", ".", "Context", ",", "conn", "*", "TxConnection", ",", "dtid", "string", ")", "error", "{", "bindVars", ":=", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable", "{...
// DeleteRedo deletes the redo log for the dtid.
[ "DeleteRedo", "deletes", "the", "redo", "log", "for", "the", "dtid", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/twopc.go#L254-L264
136,272
vitessio/vitess
go/vt/vttablet/tabletserver/twopc.go
ReadAllRedo
func (tpc *TwoPC) ReadAllRedo(ctx context.Context) (prepared, failed []*PreparedTx, err error) { conn, err := tpc.readPool.Get(ctx) if err != nil { return nil, nil, err } defer conn.Recycle() qr, err := conn.Exec(ctx, tpc.readAllRedo, 10000, false) if err != nil { return nil, nil, err } var curTx *Prepare...
go
func (tpc *TwoPC) ReadAllRedo(ctx context.Context) (prepared, failed []*PreparedTx, err error) { conn, err := tpc.readPool.Get(ctx) if err != nil { return nil, nil, err } defer conn.Recycle() qr, err := conn.Exec(ctx, tpc.readAllRedo, 10000, false) if err != nil { return nil, nil, err } var curTx *Prepare...
[ "func", "(", "tpc", "*", "TwoPC", ")", "ReadAllRedo", "(", "ctx", "context", ".", "Context", ")", "(", "prepared", ",", "failed", "[", "]", "*", "PreparedTx", ",", "err", "error", ")", "{", "conn", ",", "err", ":=", "tpc", ".", "readPool", ".", "Ge...
// ReadAllRedo returns all the prepared transactions from the redo logs.
[ "ReadAllRedo", "returns", "all", "the", "prepared", "transactions", "from", "the", "redo", "logs", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/twopc.go#L274-L315
136,273
vitessio/vitess
go/vt/vttablet/tabletserver/twopc.go
CountUnresolvedRedo
func (tpc *TwoPC) CountUnresolvedRedo(ctx context.Context, unresolvedTime time.Time) (int64, error) { conn, err := tpc.readPool.Get(ctx) if err != nil { return 0, err } defer conn.Recycle() bindVars := map[string]*querypb.BindVariable{ "time_created": sqltypes.Int64BindVariable(unresolvedTime.UnixNano()), } ...
go
func (tpc *TwoPC) CountUnresolvedRedo(ctx context.Context, unresolvedTime time.Time) (int64, error) { conn, err := tpc.readPool.Get(ctx) if err != nil { return 0, err } defer conn.Recycle() bindVars := map[string]*querypb.BindVariable{ "time_created": sqltypes.Int64BindVariable(unresolvedTime.UnixNano()), } ...
[ "func", "(", "tpc", "*", "TwoPC", ")", "CountUnresolvedRedo", "(", "ctx", "context", ".", "Context", ",", "unresolvedTime", "time", ".", "Time", ")", "(", "int64", ",", "error", ")", "{", "conn", ",", "err", ":=", "tpc", ".", "readPool", ".", "Get", ...
// CountUnresolvedRedo returns the number of prepared transactions that are still unresolved.
[ "CountUnresolvedRedo", "returns", "the", "number", "of", "prepared", "transactions", "that", "are", "still", "unresolved", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/twopc.go#L318-L337
136,274
vitessio/vitess
go/vt/vttablet/tabletserver/twopc.go
CreateTransaction
func (tpc *TwoPC) CreateTransaction(ctx context.Context, conn *TxConnection, dtid string, participants []*querypb.Target) error { bindVars := map[string]*querypb.BindVariable{ "dtid": sqltypes.StringBindVariable(dtid), "state": sqltypes.Int64BindVariable(int64(DTStatePrepare)), "cur_time": sqltypes.Int64B...
go
func (tpc *TwoPC) CreateTransaction(ctx context.Context, conn *TxConnection, dtid string, participants []*querypb.Target) error { bindVars := map[string]*querypb.BindVariable{ "dtid": sqltypes.StringBindVariable(dtid), "state": sqltypes.Int64BindVariable(int64(DTStatePrepare)), "cur_time": sqltypes.Int64B...
[ "func", "(", "tpc", "*", "TwoPC", ")", "CreateTransaction", "(", "ctx", "context", ".", "Context", ",", "conn", "*", "TxConnection", ",", "dtid", "string", ",", "participants", "[", "]", "*", "querypb", ".", "Target", ")", "error", "{", "bindVars", ":=",...
// CreateTransaction saves the metadata of a 2pc transaction as Prepared.
[ "CreateTransaction", "saves", "the", "metadata", "of", "a", "2pc", "transaction", "as", "Prepared", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/twopc.go#L340-L369
136,275
vitessio/vitess
go/vt/vttablet/tabletserver/twopc.go
Transition
func (tpc *TwoPC) Transition(ctx context.Context, conn *TxConnection, dtid string, state querypb.TransactionState) error { bindVars := map[string]*querypb.BindVariable{ "dtid": sqltypes.StringBindVariable(dtid), "state": sqltypes.Int64BindVariable(int64(state)), "prepare": sqltypes.Int64BindVariable(int64(q...
go
func (tpc *TwoPC) Transition(ctx context.Context, conn *TxConnection, dtid string, state querypb.TransactionState) error { bindVars := map[string]*querypb.BindVariable{ "dtid": sqltypes.StringBindVariable(dtid), "state": sqltypes.Int64BindVariable(int64(state)), "prepare": sqltypes.Int64BindVariable(int64(q...
[ "func", "(", "tpc", "*", "TwoPC", ")", "Transition", "(", "ctx", "context", ".", "Context", ",", "conn", "*", "TxConnection", ",", "dtid", "string", ",", "state", "querypb", ".", "TransactionState", ")", "error", "{", "bindVars", ":=", "map", "[", "strin...
// Transition performs a transition from Prepare to the specified state. // If the transaction is not a in the Prepare state, an error is returned.
[ "Transition", "performs", "a", "transition", "from", "Prepare", "to", "the", "specified", "state", ".", "If", "the", "transaction", "is", "not", "a", "in", "the", "Prepare", "state", "an", "error", "is", "returned", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/twopc.go#L373-L387
136,276
vitessio/vitess
go/vt/vttablet/tabletserver/twopc.go
DeleteTransaction
func (tpc *TwoPC) DeleteTransaction(ctx context.Context, conn *TxConnection, dtid string) error { bindVars := map[string]*querypb.BindVariable{ "dtid": sqltypes.StringBindVariable(dtid), } _, err := tpc.exec(ctx, conn, tpc.deleteTransaction, bindVars) if err != nil { return err } _, err = tpc.exec(ctx, conn, ...
go
func (tpc *TwoPC) DeleteTransaction(ctx context.Context, conn *TxConnection, dtid string) error { bindVars := map[string]*querypb.BindVariable{ "dtid": sqltypes.StringBindVariable(dtid), } _, err := tpc.exec(ctx, conn, tpc.deleteTransaction, bindVars) if err != nil { return err } _, err = tpc.exec(ctx, conn, ...
[ "func", "(", "tpc", "*", "TwoPC", ")", "DeleteTransaction", "(", "ctx", "context", ".", "Context", ",", "conn", "*", "TxConnection", ",", "dtid", "string", ")", "error", "{", "bindVars", ":=", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable...
// DeleteTransaction deletes the metadata for the specified transaction.
[ "DeleteTransaction", "deletes", "the", "metadata", "for", "the", "specified", "transaction", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/twopc.go#L390-L400
136,277
vitessio/vitess
go/vt/vttablet/tabletserver/twopc.go
ReadTransaction
func (tpc *TwoPC) ReadTransaction(ctx context.Context, dtid string) (*querypb.TransactionMetadata, error) { conn, err := tpc.readPool.Get(ctx) if err != nil { return nil, err } defer conn.Recycle() result := &querypb.TransactionMetadata{} bindVars := map[string]*querypb.BindVariable{ "dtid": sqltypes.StringB...
go
func (tpc *TwoPC) ReadTransaction(ctx context.Context, dtid string) (*querypb.TransactionMetadata, error) { conn, err := tpc.readPool.Get(ctx) if err != nil { return nil, err } defer conn.Recycle() result := &querypb.TransactionMetadata{} bindVars := map[string]*querypb.BindVariable{ "dtid": sqltypes.StringB...
[ "func", "(", "tpc", "*", "TwoPC", ")", "ReadTransaction", "(", "ctx", "context", ".", "Context", ",", "dtid", "string", ")", "(", "*", "querypb", ".", "TransactionMetadata", ",", "error", ")", "{", "conn", ",", "err", ":=", "tpc", ".", "readPool", ".",...
// ReadTransaction returns the metadata for the transaction.
[ "ReadTransaction", "returns", "the", "metadata", "for", "the", "transaction", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/twopc.go#L403-L449
136,278
vitessio/vitess
go/vt/vttablet/tabletserver/twopc.go
ReadAbandoned
func (tpc *TwoPC) ReadAbandoned(ctx context.Context, abandonTime time.Time) (map[string]time.Time, error) { conn, err := tpc.readPool.Get(ctx) if err != nil { return nil, err } defer conn.Recycle() bindVars := map[string]*querypb.BindVariable{ "time_created": sqltypes.Int64BindVariable(abandonTime.UnixNano())...
go
func (tpc *TwoPC) ReadAbandoned(ctx context.Context, abandonTime time.Time) (map[string]time.Time, error) { conn, err := tpc.readPool.Get(ctx) if err != nil { return nil, err } defer conn.Recycle() bindVars := map[string]*querypb.BindVariable{ "time_created": sqltypes.Int64BindVariable(abandonTime.UnixNano())...
[ "func", "(", "tpc", "*", "TwoPC", ")", "ReadAbandoned", "(", "ctx", "context", ".", "Context", ",", "abandonTime", "time", ".", "Time", ")", "(", "map", "[", "string", "]", "time", ".", "Time", ",", "error", ")", "{", "conn", ",", "err", ":=", "tpc...
// ReadAbandoned returns the list of abandoned transactions // and their associated start time.
[ "ReadAbandoned", "returns", "the", "list", "of", "abandoned", "transactions", "and", "their", "associated", "start", "time", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/twopc.go#L453-L476
136,279
vitessio/vitess
go/vt/vttablet/tabletserver/twopc.go
ReadAllTransactions
func (tpc *TwoPC) ReadAllTransactions(ctx context.Context) ([]*DistributedTx, error) { conn, err := tpc.readPool.Get(ctx) if err != nil { return nil, err } defer conn.Recycle() qr, err := conn.Exec(ctx, tpc.readAllTransactions, 10000, false) if err != nil { return nil, err } var curTx *DistributedTx var ...
go
func (tpc *TwoPC) ReadAllTransactions(ctx context.Context) ([]*DistributedTx, error) { conn, err := tpc.readPool.Get(ctx) if err != nil { return nil, err } defer conn.Recycle() qr, err := conn.Exec(ctx, tpc.readAllTransactions, 10000, false) if err != nil { return nil, err } var curTx *DistributedTx var ...
[ "func", "(", "tpc", "*", "TwoPC", ")", "ReadAllTransactions", "(", "ctx", "context", ".", "Context", ")", "(", "[", "]", "*", "DistributedTx", ",", "error", ")", "{", "conn", ",", "err", ":=", "tpc", ".", "readPool", ".", "Get", "(", "ctx", ")", "\...
// ReadAllTransactions returns info about all distributed transactions.
[ "ReadAllTransactions", "returns", "info", "about", "all", "distributed", "transactions", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/twopc.go#L488-L532
136,280
vitessio/vitess
go/vt/servenv/run.go
Run
func Run(port int) { populateListeningURL(int32(port)) createGRPCServer() onRunHooks.Fire() serveGRPC() serveSocketFile() l, err := proc.Listen(fmt.Sprintf("%v", port)) if err != nil { log.Exit(err) } go http.Serve(l, nil) proc.Wait() l.Close() startTime := time.Now() log.Infof("Entering lameduck mode...
go
func Run(port int) { populateListeningURL(int32(port)) createGRPCServer() onRunHooks.Fire() serveGRPC() serveSocketFile() l, err := proc.Listen(fmt.Sprintf("%v", port)) if err != nil { log.Exit(err) } go http.Serve(l, nil) proc.Wait() l.Close() startTime := time.Now() log.Infof("Entering lameduck mode...
[ "func", "Run", "(", "port", "int", ")", "{", "populateListeningURL", "(", "int32", "(", "port", ")", ")", "\n", "createGRPCServer", "(", ")", "\n", "onRunHooks", ".", "Fire", "(", ")", "\n", "serveGRPC", "(", ")", "\n", "serveSocketFile", "(", ")", "\n...
// Run starts listening for RPC and HTTP requests, // and blocks until it the process gets a signal.
[ "Run", "starts", "listening", "for", "RPC", "and", "HTTP", "requests", "and", "blocks", "until", "it", "the", "process", "gets", "a", "signal", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/servenv/run.go#L36-L65
136,281
vitessio/vitess
go/vt/workflow/resharding/tasks.go
GetTasks
func (hw *horizontalReshardingWorkflow) GetTasks(phase workflow.PhaseType) []*workflowpb.Task { var shards []string switch phase { case phaseCopySchema, phaseWaitForFilteredReplication, phaseDiff: shards = strings.Split(hw.checkpoint.Settings["destination_shards"], ",") case phaseClone, phaseMigrateRdonly, phaseM...
go
func (hw *horizontalReshardingWorkflow) GetTasks(phase workflow.PhaseType) []*workflowpb.Task { var shards []string switch phase { case phaseCopySchema, phaseWaitForFilteredReplication, phaseDiff: shards = strings.Split(hw.checkpoint.Settings["destination_shards"], ",") case phaseClone, phaseMigrateRdonly, phaseM...
[ "func", "(", "hw", "*", "horizontalReshardingWorkflow", ")", "GetTasks", "(", "phase", "workflow", ".", "PhaseType", ")", "[", "]", "*", "workflowpb", ".", "Task", "{", "var", "shards", "[", "]", "string", "\n", "switch", "phase", "{", "case", "phaseCopySc...
// GetTasks returns selected tasks for a phase from the checkpoint // with expected execution order.
[ "GetTasks", "returns", "selected", "tasks", "for", "a", "phase", "from", "the", "checkpoint", "with", "expected", "execution", "order", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/resharding/tasks.go#L41-L58
136,282
vitessio/vitess
go/vt/worker/split_clone.go
newSplitCloneWorker
func newSplitCloneWorker(wr *wrangler.Wrangler, cell, keyspace, shard string, online, offline bool, excludeTables []string, chunkCount, minRowsPerChunk, sourceReaderCount, writeQueryMaxRows, writeQueryMaxSize, destinationWriterCount, minHealthyTablets int, tabletType topodatapb.TabletType, maxTPS, maxReplicationLag int...
go
func newSplitCloneWorker(wr *wrangler.Wrangler, cell, keyspace, shard string, online, offline bool, excludeTables []string, chunkCount, minRowsPerChunk, sourceReaderCount, writeQueryMaxRows, writeQueryMaxSize, destinationWriterCount, minHealthyTablets int, tabletType topodatapb.TabletType, maxTPS, maxReplicationLag int...
[ "func", "newSplitCloneWorker", "(", "wr", "*", "wrangler", ".", "Wrangler", ",", "cell", ",", "keyspace", ",", "shard", "string", ",", "online", ",", "offline", "bool", ",", "excludeTables", "[", "]", "string", ",", "chunkCount", ",", "minRowsPerChunk", ",",...
// newSplitCloneWorker returns a new worker object for the SplitClone command.
[ "newSplitCloneWorker", "returns", "a", "new", "worker", "object", "for", "the", "SplitClone", "command", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/split_clone.go#L147-L149
136,283
vitessio/vitess
go/vt/worker/split_clone.go
FormattedOfflineSources
func (scw *SplitCloneWorker) FormattedOfflineSources() string { scw.formattedOfflineSourcesMu.Lock() defer scw.formattedOfflineSourcesMu.Unlock() if scw.formattedOfflineSources == "" { return "no offline source tablets currently in use" } return scw.formattedOfflineSources }
go
func (scw *SplitCloneWorker) FormattedOfflineSources() string { scw.formattedOfflineSourcesMu.Lock() defer scw.formattedOfflineSourcesMu.Unlock() if scw.formattedOfflineSources == "" { return "no offline source tablets currently in use" } return scw.formattedOfflineSources }
[ "func", "(", "scw", "*", "SplitCloneWorker", ")", "FormattedOfflineSources", "(", ")", "string", "{", "scw", ".", "formattedOfflineSourcesMu", ".", "Lock", "(", ")", "\n", "defer", "scw", ".", "formattedOfflineSourcesMu", ".", "Unlock", "(", ")", "\n\n", "if",...
// FormattedOfflineSources returns a space separated list of tablets which // are in use during the offline clone phase.
[ "FormattedOfflineSources", "returns", "a", "space", "separated", "list", "of", "tablets", "which", "are", "in", "use", "during", "the", "offline", "clone", "phase", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/split_clone.go#L290-L298
136,284
vitessio/vitess
go/vt/worker/split_clone.go
findDestinationMasters
func (scw *SplitCloneWorker) findDestinationMasters(ctx context.Context) error { scw.setState(WorkerStateFindTargets) // Make sure we find a master for each destination shard and log it. scw.wr.Logger().Infof("Finding a MASTER tablet for each destination shard...") for _, si := range scw.destinationShards { wait...
go
func (scw *SplitCloneWorker) findDestinationMasters(ctx context.Context) error { scw.setState(WorkerStateFindTargets) // Make sure we find a master for each destination shard and log it. scw.wr.Logger().Infof("Finding a MASTER tablet for each destination shard...") for _, si := range scw.destinationShards { wait...
[ "func", "(", "scw", "*", "SplitCloneWorker", ")", "findDestinationMasters", "(", "ctx", "context", ".", "Context", ")", "error", "{", "scw", ".", "setState", "(", "WorkerStateFindTargets", ")", "\n\n", "// Make sure we find a master for each destination shard and log it."...
// findDestinationMasters finds for each destination shard the current master.
[ "findDestinationMasters", "finds", "for", "each", "destination", "shard", "the", "current", "master", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/split_clone.go#L840-L867
136,285
vitessio/vitess
go/vt/worker/split_clone.go
createKeyResolver
func (scw *SplitCloneWorker) createKeyResolver(td *tabletmanagerdatapb.TableDefinition) (keyspaceIDResolver, error) { if scw.cloneType == verticalSplit { // VerticalSplitClone currently always has exactly one destination shard // and therefore does not require routing between multiple shards. return nil, nil } ...
go
func (scw *SplitCloneWorker) createKeyResolver(td *tabletmanagerdatapb.TableDefinition) (keyspaceIDResolver, error) { if scw.cloneType == verticalSplit { // VerticalSplitClone currently always has exactly one destination shard // and therefore does not require routing between multiple shards. return nil, nil } ...
[ "func", "(", "scw", "*", "SplitCloneWorker", ")", "createKeyResolver", "(", "td", "*", "tabletmanagerdatapb", ".", "TableDefinition", ")", "(", "keyspaceIDResolver", ",", "error", ")", "{", "if", "scw", ".", "cloneType", "==", "verticalSplit", "{", "// VerticalS...
// createKeyResolver is called at the start of each chunk pipeline. // It creates a keyspaceIDResolver which translates a given row to a // keyspace ID. This is necessary to route the to be copied rows to the // different destination shards.
[ "createKeyResolver", "is", "called", "at", "the", "start", "of", "each", "chunk", "pipeline", ".", "It", "creates", "a", "keyspaceIDResolver", "which", "translates", "a", "given", "row", "to", "a", "keyspace", "ID", ".", "This", "is", "necessary", "to", "rou...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/split_clone.go#L1343-L1354
136,286
vitessio/vitess
go/vt/worker/split_clone.go
StatsUpdate
func (scw *SplitCloneWorker) StatsUpdate(ts *discovery.TabletStats) { scw.tsc.StatsUpdate(ts) // Ignore unless REPLICA or RDONLY. if ts.Target.TabletType != topodatapb.TabletType_REPLICA && ts.Target.TabletType != topodatapb.TabletType_RDONLY { return } // Lock throttlers mutex to avoid that this method (and t...
go
func (scw *SplitCloneWorker) StatsUpdate(ts *discovery.TabletStats) { scw.tsc.StatsUpdate(ts) // Ignore unless REPLICA or RDONLY. if ts.Target.TabletType != topodatapb.TabletType_REPLICA && ts.Target.TabletType != topodatapb.TabletType_RDONLY { return } // Lock throttlers mutex to avoid that this method (and t...
[ "func", "(", "scw", "*", "SplitCloneWorker", ")", "StatsUpdate", "(", "ts", "*", "discovery", ".", "TabletStats", ")", "{", "scw", ".", "tsc", ".", "StatsUpdate", "(", "ts", ")", "\n\n", "// Ignore unless REPLICA or RDONLY.", "if", "ts", ".", "Target", ".", ...
// StatsUpdate receives replication lag updates for each destination master // and forwards them to the respective throttler instance. // It also forwards any update to the TabletStatsCache to keep it up to date. // It is part of the discovery.HealthCheckStatsListener interface.
[ "StatsUpdate", "receives", "replication", "lag", "updates", "for", "each", "destination", "master", "and", "forwards", "them", "to", "the", "respective", "throttler", "instance", ".", "It", "also", "forwards", "any", "update", "to", "the", "TabletStatsCache", "to"...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/split_clone.go#L1360-L1378
136,287
vitessio/vitess
go/vt/worker/tablet_tracker.go
Track
func (t *TabletTracker) Track(stats []discovery.TabletStats) *topodatapb.Tablet { if len(stats) == 0 { panic("stats must not be empty") } t.mu.Lock() defer t.mu.Unlock() // Try to find a tablet which is not in use yet. for _, stat := range stats { key := topoproto.TabletAliasString(stat.Tablet.Alias) if _,...
go
func (t *TabletTracker) Track(stats []discovery.TabletStats) *topodatapb.Tablet { if len(stats) == 0 { panic("stats must not be empty") } t.mu.Lock() defer t.mu.Unlock() // Try to find a tablet which is not in use yet. for _, stat := range stats { key := topoproto.TabletAliasString(stat.Tablet.Alias) if _,...
[ "func", "(", "t", "*", "TabletTracker", ")", "Track", "(", "stats", "[", "]", "discovery", ".", "TabletStats", ")", "*", "topodatapb", ".", "Tablet", "{", "if", "len", "(", "stats", ")", "==", "0", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "...
// Track will pick the least used tablet from "stats", increment its usage by 1 // and return it. // "stats" must not be empty.
[ "Track", "will", "pick", "the", "least", "used", "tablet", "from", "stats", "increment", "its", "usage", "by", "1", "and", "return", "it", ".", "stats", "must", "not", "be", "empty", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/tablet_tracker.go#L53-L81
136,288
vitessio/vitess
go/vt/worker/tablet_tracker.go
Untrack
func (t *TabletTracker) Untrack(alias *topodatapb.TabletAlias) { t.mu.Lock() defer t.mu.Unlock() key := topoproto.TabletAliasString(alias) count, ok := t.usedTablets[key] if !ok { panic(fmt.Sprintf("tablet: %v was never tracked", key)) } count-- if count == 0 { delete(t.usedTablets, key) } else { t.used...
go
func (t *TabletTracker) Untrack(alias *topodatapb.TabletAlias) { t.mu.Lock() defer t.mu.Unlock() key := topoproto.TabletAliasString(alias) count, ok := t.usedTablets[key] if !ok { panic(fmt.Sprintf("tablet: %v was never tracked", key)) } count-- if count == 0 { delete(t.usedTablets, key) } else { t.used...
[ "func", "(", "t", "*", "TabletTracker", ")", "Untrack", "(", "alias", "*", "topodatapb", ".", "TabletAlias", ")", "{", "t", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "t", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "key", ":=", "topoproto", ...
// Untrack decrements the usage of "alias" by 1.
[ "Untrack", "decrements", "the", "usage", "of", "alias", "by", "1", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/tablet_tracker.go#L84-L99
136,289
vitessio/vitess
go/vt/worker/tablet_tracker.go
TabletsInUse
func (t *TabletTracker) TabletsInUse() string { t.mu.Lock() defer t.mu.Unlock() var aliases []string for alias := range t.usedTablets { aliases = append(aliases, alias) } sort.Strings(aliases) return strings.Join(aliases, " ") }
go
func (t *TabletTracker) TabletsInUse() string { t.mu.Lock() defer t.mu.Unlock() var aliases []string for alias := range t.usedTablets { aliases = append(aliases, alias) } sort.Strings(aliases) return strings.Join(aliases, " ") }
[ "func", "(", "t", "*", "TabletTracker", ")", "TabletsInUse", "(", ")", "string", "{", "t", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "t", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "var", "aliases", "[", "]", "string", "\n", "for", "alias...
// TabletsInUse returns a string of all tablet aliases currently in use. // The tablets are separated by a space.
[ "TabletsInUse", "returns", "a", "string", "of", "all", "tablet", "aliases", "currently", "in", "use", ".", "The", "tablets", "are", "separated", "by", "a", "space", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/tablet_tracker.go#L103-L113
136,290
vitessio/vitess
go/vt/vttablet/endtoend/framework/client.go
NewClient
func NewClient() *QueryClient { return &QueryClient{ ctx: callerid.NewContext( context.Background(), &vtrpcpb.CallerID{}, &querypb.VTGateCallerID{Username: "dev"}, ), target: Target, server: Server, } }
go
func NewClient() *QueryClient { return &QueryClient{ ctx: callerid.NewContext( context.Background(), &vtrpcpb.CallerID{}, &querypb.VTGateCallerID{Username: "dev"}, ), target: Target, server: Server, } }
[ "func", "NewClient", "(", ")", "*", "QueryClient", "{", "return", "&", "QueryClient", "{", "ctx", ":", "callerid", ".", "NewContext", "(", "context", ".", "Background", "(", ")", ",", "&", "vtrpcpb", ".", "CallerID", "{", "}", ",", "&", "querypb", ".",...
// NewClient creates a new client for Server.
[ "NewClient", "creates", "a", "new", "client", "for", "Server", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/endtoend/framework/client.go#L43-L53
136,291
vitessio/vitess
go/vt/vttablet/endtoend/framework/client.go
NewClientWithContext
func NewClientWithContext(ctx context.Context) *QueryClient { return &QueryClient{ ctx: ctx, target: Target, server: Server, } }
go
func NewClientWithContext(ctx context.Context) *QueryClient { return &QueryClient{ ctx: ctx, target: Target, server: Server, } }
[ "func", "NewClientWithContext", "(", "ctx", "context", ".", "Context", ")", "*", "QueryClient", "{", "return", "&", "QueryClient", "{", "ctx", ":", "ctx", ",", "target", ":", "Target", ",", "server", ":", "Server", ",", "}", "\n", "}" ]
// NewClientWithContext creates a new client for Server with the provided context.
[ "NewClientWithContext", "creates", "a", "new", "client", "for", "Server", "with", "the", "provided", "context", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/endtoend/framework/client.go#L56-L62
136,292
vitessio/vitess
go/vt/vttablet/endtoend/framework/client.go
Begin
func (client *QueryClient) Begin(clientFoundRows bool) error { if client.transactionID != 0 { return errors.New("already in transaction") } var options *querypb.ExecuteOptions if clientFoundRows { options = &querypb.ExecuteOptions{ClientFoundRows: clientFoundRows} } transactionID, err := client.server.Begin(c...
go
func (client *QueryClient) Begin(clientFoundRows bool) error { if client.transactionID != 0 { return errors.New("already in transaction") } var options *querypb.ExecuteOptions if clientFoundRows { options = &querypb.ExecuteOptions{ClientFoundRows: clientFoundRows} } transactionID, err := client.server.Begin(c...
[ "func", "(", "client", "*", "QueryClient", ")", "Begin", "(", "clientFoundRows", "bool", ")", "error", "{", "if", "client", ".", "transactionID", "!=", "0", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "var", "options", ...
// Begin begins a transaction.
[ "Begin", "begins", "a", "transaction", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/endtoend/framework/client.go#L65-L79
136,293
vitessio/vitess
go/vt/vttablet/endtoend/framework/client.go
Prepare
func (client *QueryClient) Prepare(dtid string) error { defer func() { client.transactionID = 0 }() return client.server.Prepare(client.ctx, &client.target, client.transactionID, dtid) }
go
func (client *QueryClient) Prepare(dtid string) error { defer func() { client.transactionID = 0 }() return client.server.Prepare(client.ctx, &client.target, client.transactionID, dtid) }
[ "func", "(", "client", "*", "QueryClient", ")", "Prepare", "(", "dtid", "string", ")", "error", "{", "defer", "func", "(", ")", "{", "client", ".", "transactionID", "=", "0", "}", "(", ")", "\n", "return", "client", ".", "server", ".", "Prepare", "("...
// Prepare executes a prepare on the current transaction.
[ "Prepare", "executes", "a", "prepare", "on", "the", "current", "transaction", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/endtoend/framework/client.go#L94-L97
136,294
vitessio/vitess
go/vt/vttablet/endtoend/framework/client.go
RollbackPrepared
func (client *QueryClient) RollbackPrepared(dtid string, originalID int64) error { return client.server.RollbackPrepared(client.ctx, &client.target, dtid, originalID) }
go
func (client *QueryClient) RollbackPrepared(dtid string, originalID int64) error { return client.server.RollbackPrepared(client.ctx, &client.target, dtid, originalID) }
[ "func", "(", "client", "*", "QueryClient", ")", "RollbackPrepared", "(", "dtid", "string", ",", "originalID", "int64", ")", "error", "{", "return", "client", ".", "server", ".", "RollbackPrepared", "(", "client", ".", "ctx", ",", "&", "client", ".", "targe...
// RollbackPrepared rollsback a prepared transaction.
[ "RollbackPrepared", "rollsback", "a", "prepared", "transaction", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/endtoend/framework/client.go#L105-L107
136,295
vitessio/vitess
go/vt/vttablet/endtoend/framework/client.go
CreateTransaction
func (client *QueryClient) CreateTransaction(dtid string, participants []*querypb.Target) error { return client.server.CreateTransaction(client.ctx, &client.target, dtid, participants) }
go
func (client *QueryClient) CreateTransaction(dtid string, participants []*querypb.Target) error { return client.server.CreateTransaction(client.ctx, &client.target, dtid, participants) }
[ "func", "(", "client", "*", "QueryClient", ")", "CreateTransaction", "(", "dtid", "string", ",", "participants", "[", "]", "*", "querypb", ".", "Target", ")", "error", "{", "return", "client", ".", "server", ".", "CreateTransaction", "(", "client", ".", "c...
// CreateTransaction issues a CreateTransaction to TabletServer.
[ "CreateTransaction", "issues", "a", "CreateTransaction", "to", "TabletServer", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/endtoend/framework/client.go#L110-L112
136,296
vitessio/vitess
go/vt/vttablet/endtoend/framework/client.go
SetRollback
func (client *QueryClient) SetRollback(dtid string, transactionID int64) error { return client.server.SetRollback(client.ctx, &client.target, dtid, client.transactionID) }
go
func (client *QueryClient) SetRollback(dtid string, transactionID int64) error { return client.server.SetRollback(client.ctx, &client.target, dtid, client.transactionID) }
[ "func", "(", "client", "*", "QueryClient", ")", "SetRollback", "(", "dtid", "string", ",", "transactionID", "int64", ")", "error", "{", "return", "client", ".", "server", ".", "SetRollback", "(", "client", ".", "ctx", ",", "&", "client", ".", "target", "...
// SetRollback issues a SetRollback to TabletServer.
[ "SetRollback", "issues", "a", "SetRollback", "to", "TabletServer", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/endtoend/framework/client.go#L121-L123
136,297
vitessio/vitess
go/vt/vttablet/endtoend/framework/client.go
ConcludeTransaction
func (client *QueryClient) ConcludeTransaction(dtid string) error { return client.server.ConcludeTransaction(client.ctx, &client.target, dtid) }
go
func (client *QueryClient) ConcludeTransaction(dtid string) error { return client.server.ConcludeTransaction(client.ctx, &client.target, dtid) }
[ "func", "(", "client", "*", "QueryClient", ")", "ConcludeTransaction", "(", "dtid", "string", ")", "error", "{", "return", "client", ".", "server", ".", "ConcludeTransaction", "(", "client", ".", "ctx", ",", "&", "client", ".", "target", ",", "dtid", ")", ...
// ConcludeTransaction issues a ConcludeTransaction to TabletServer.
[ "ConcludeTransaction", "issues", "a", "ConcludeTransaction", "to", "TabletServer", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/endtoend/framework/client.go#L126-L128
136,298
vitessio/vitess
go/vt/vttablet/endtoend/framework/client.go
ReadTransaction
func (client *QueryClient) ReadTransaction(dtid string) (*querypb.TransactionMetadata, error) { return client.server.ReadTransaction(client.ctx, &client.target, dtid) }
go
func (client *QueryClient) ReadTransaction(dtid string) (*querypb.TransactionMetadata, error) { return client.server.ReadTransaction(client.ctx, &client.target, dtid) }
[ "func", "(", "client", "*", "QueryClient", ")", "ReadTransaction", "(", "dtid", "string", ")", "(", "*", "querypb", ".", "TransactionMetadata", ",", "error", ")", "{", "return", "client", ".", "server", ".", "ReadTransaction", "(", "client", ".", "ctx", ",...
// ReadTransaction returns the transaction metadata.
[ "ReadTransaction", "returns", "the", "transaction", "metadata", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/endtoend/framework/client.go#L131-L133
136,299
vitessio/vitess
go/vt/vttablet/endtoend/framework/client.go
SetServingType
func (client *QueryClient) SetServingType(tabletType topodatapb.TabletType) error { _, err := client.server.SetServingType(tabletType, true, nil) return err }
go
func (client *QueryClient) SetServingType(tabletType topodatapb.TabletType) error { _, err := client.server.SetServingType(tabletType, true, nil) return err }
[ "func", "(", "client", "*", "QueryClient", ")", "SetServingType", "(", "tabletType", "topodatapb", ".", "TabletType", ")", "error", "{", "_", ",", "err", ":=", "client", ".", "server", ".", "SetServingType", "(", "tabletType", ",", "true", ",", "nil", ")",...
// SetServingType is for testing transitions. // It currently supports only master->replica and back.
[ "SetServingType", "is", "for", "testing", "transitions", ".", "It", "currently", "supports", "only", "master", "-", ">", "replica", "and", "back", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/endtoend/framework/client.go#L137-L140