repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
partition
stringclasses
1 value
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
SetSuperReadOnly
func (fmd *FakeMysqlDaemon) SetSuperReadOnly(on bool) error { fmd.SuperReadOnly = on fmd.ReadOnly = on return nil }
go
func (fmd *FakeMysqlDaemon) SetSuperReadOnly(on bool) error { fmd.SuperReadOnly = on fmd.ReadOnly = on return nil }
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "SetSuperReadOnly", "(", "on", "bool", ")", "error", "{", "fmd", ".", "SuperReadOnly", "=", "on", "\n", "fmd", ".", "ReadOnly", "=", "on", "\n", "return", "nil", "\n", "}" ]
// SetSuperReadOnly is part of the MysqlDaemon interface
[ "SetSuperReadOnly", "is", "part", "of", "the", "MysqlDaemon", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L247-L251
train
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
StartSlave
func (fmd *FakeMysqlDaemon) StartSlave(hookExtraEnv map[string]string) error { return fmd.ExecuteSuperQueryList(context.Background(), []string{ "START SLAVE", }) }
go
func (fmd *FakeMysqlDaemon) StartSlave(hookExtraEnv map[string]string) error { return fmd.ExecuteSuperQueryList(context.Background(), []string{ "START SLAVE", }) }
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "StartSlave", "(", "hookExtraEnv", "map", "[", "string", "]", "string", ")", "error", "{", "return", "fmd", ".", "ExecuteSuperQueryList", "(", "context", ".", "Background", "(", ")", ",", "[", "]", "string",...
// StartSlave is part of the MysqlDaemon interface.
[ "StartSlave", "is", "part", "of", "the", "MysqlDaemon", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L254-L258
train
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
StartSlaveUntilAfter
func (fmd *FakeMysqlDaemon) StartSlaveUntilAfter(ctx context.Context, pos mysql.Position) error { if !reflect.DeepEqual(fmd.StartSlaveUntilAfterPos, pos) { return fmt.Errorf("wrong pos for StartSlaveUntilAfter: expected %v got %v", fmd.SetSlavePositionPos, pos) } return fmd.ExecuteSuperQueryList(context.Backgroun...
go
func (fmd *FakeMysqlDaemon) StartSlaveUntilAfter(ctx context.Context, pos mysql.Position) error { if !reflect.DeepEqual(fmd.StartSlaveUntilAfterPos, pos) { return fmt.Errorf("wrong pos for StartSlaveUntilAfter: expected %v got %v", fmd.SetSlavePositionPos, pos) } return fmd.ExecuteSuperQueryList(context.Backgroun...
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "StartSlaveUntilAfter", "(", "ctx", "context", ".", "Context", ",", "pos", "mysql", ".", "Position", ")", "error", "{", "if", "!", "reflect", ".", "DeepEqual", "(", "fmd", ".", "StartSlaveUntilAfterPos", ",", ...
// StartSlaveUntilAfter is part of the MysqlDaemon interface.
[ "StartSlaveUntilAfter", "is", "part", "of", "the", "MysqlDaemon", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L261-L269
train
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
SetMaster
func (fmd *FakeMysqlDaemon) SetMaster(ctx context.Context, masterHost string, masterPort int, slaveStopBefore bool, slaveStartAfter bool) error { input := fmt.Sprintf("%v:%v", masterHost, masterPort) if fmd.SetMasterInput != input { return fmt.Errorf("wrong input for SetMasterCommands: expected %v got %v", fmd.SetM...
go
func (fmd *FakeMysqlDaemon) SetMaster(ctx context.Context, masterHost string, masterPort int, slaveStopBefore bool, slaveStartAfter bool) error { input := fmt.Sprintf("%v:%v", masterHost, masterPort) if fmd.SetMasterInput != input { return fmt.Errorf("wrong input for SetMasterCommands: expected %v got %v", fmd.SetM...
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "SetMaster", "(", "ctx", "context", ".", "Context", ",", "masterHost", "string", ",", "masterPort", "int", ",", "slaveStopBefore", "bool", ",", "slaveStartAfter", "bool", ")", "error", "{", "input", ":=", "fmt...
// SetMaster is part of the MysqlDaemon interface.
[ "SetMaster", "is", "part", "of", "the", "MysqlDaemon", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L289-L303
train
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
WaitForReparentJournal
func (fmd *FakeMysqlDaemon) WaitForReparentJournal(ctx context.Context, timeCreatedNS int64) error { return nil }
go
func (fmd *FakeMysqlDaemon) WaitForReparentJournal(ctx context.Context, timeCreatedNS int64) error { return nil }
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "WaitForReparentJournal", "(", "ctx", "context", ".", "Context", ",", "timeCreatedNS", "int64", ")", "error", "{", "return", "nil", "\n", "}" ]
// WaitForReparentJournal is part of the MysqlDaemon interface
[ "WaitForReparentJournal", "is", "part", "of", "the", "MysqlDaemon", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L306-L308
train
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
WaitMasterPos
func (fmd *FakeMysqlDaemon) WaitMasterPos(_ context.Context, pos mysql.Position) error { if fmd.TimeoutHook != nil { return fmd.TimeoutHook() } if reflect.DeepEqual(fmd.WaitMasterPosition, pos) { return nil } return fmt.Errorf("wrong input for WaitMasterPos: expected %v got %v", fmd.WaitMasterPosition, pos) }
go
func (fmd *FakeMysqlDaemon) WaitMasterPos(_ context.Context, pos mysql.Position) error { if fmd.TimeoutHook != nil { return fmd.TimeoutHook() } if reflect.DeepEqual(fmd.WaitMasterPosition, pos) { return nil } return fmt.Errorf("wrong input for WaitMasterPos: expected %v got %v", fmd.WaitMasterPosition, pos) }
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "WaitMasterPos", "(", "_", "context", ".", "Context", ",", "pos", "mysql", ".", "Position", ")", "error", "{", "if", "fmd", ".", "TimeoutHook", "!=", "nil", "{", "return", "fmd", ".", "TimeoutHook", "(", ...
// WaitMasterPos is part of the MysqlDaemon interface
[ "WaitMasterPos", "is", "part", "of", "the", "MysqlDaemon", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L316-L324
train
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
PromoteSlave
func (fmd *FakeMysqlDaemon) PromoteSlave(hookExtraEnv map[string]string) (mysql.Position, error) { return fmd.PromoteSlaveResult, nil }
go
func (fmd *FakeMysqlDaemon) PromoteSlave(hookExtraEnv map[string]string) (mysql.Position, error) { return fmd.PromoteSlaveResult, nil }
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "PromoteSlave", "(", "hookExtraEnv", "map", "[", "string", "]", "string", ")", "(", "mysql", ".", "Position", ",", "error", ")", "{", "return", "fmd", ".", "PromoteSlaveResult", ",", "nil", "\n", "}" ]
// PromoteSlave is part of the MysqlDaemon interface
[ "PromoteSlave", "is", "part", "of", "the", "MysqlDaemon", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L327-L329
train
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
ExecuteSuperQueryList
func (fmd *FakeMysqlDaemon) ExecuteSuperQueryList(ctx context.Context, queryList []string) error { for _, query := range queryList { // test we still have a query to compare if fmd.ExpectedExecuteSuperQueryCurrent >= len(fmd.ExpectedExecuteSuperQueryList) { return fmt.Errorf("unexpected extra query in ExecuteSu...
go
func (fmd *FakeMysqlDaemon) ExecuteSuperQueryList(ctx context.Context, queryList []string) error { for _, query := range queryList { // test we still have a query to compare if fmd.ExpectedExecuteSuperQueryCurrent >= len(fmd.ExpectedExecuteSuperQueryList) { return fmt.Errorf("unexpected extra query in ExecuteSu...
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "ExecuteSuperQueryList", "(", "ctx", "context", ".", "Context", ",", "queryList", "[", "]", "string", ")", "error", "{", "for", "_", ",", "query", ":=", "range", "queryList", "{", "// test we still have a query ...
// ExecuteSuperQueryList is part of the MysqlDaemon interface
[ "ExecuteSuperQueryList", "is", "part", "of", "the", "MysqlDaemon", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L332-L363
train
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
FetchSuperQuery
func (fmd *FakeMysqlDaemon) FetchSuperQuery(ctx context.Context, query string) (*sqltypes.Result, error) { if fmd.FetchSuperQueryMap == nil { return nil, fmt.Errorf("unexpected query: %v", query) } qr, ok := fmd.FetchSuperQueryMap[query] if !ok { return nil, fmt.Errorf("unexpected query: %v", query) } return...
go
func (fmd *FakeMysqlDaemon) FetchSuperQuery(ctx context.Context, query string) (*sqltypes.Result, error) { if fmd.FetchSuperQueryMap == nil { return nil, fmt.Errorf("unexpected query: %v", query) } qr, ok := fmd.FetchSuperQueryMap[query] if !ok { return nil, fmt.Errorf("unexpected query: %v", query) } return...
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "FetchSuperQuery", "(", "ctx", "context", ".", "Context", ",", "query", "string", ")", "(", "*", "sqltypes", ".", "Result", ",", "error", ")", "{", "if", "fmd", ".", "FetchSuperQueryMap", "==", "nil", "{",...
// FetchSuperQuery returns the results from the map, if any
[ "FetchSuperQuery", "returns", "the", "results", "from", "the", "map", "if", "any" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L366-L376
train
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
CheckSuperQueryList
func (fmd *FakeMysqlDaemon) CheckSuperQueryList() error { if fmd.ExpectedExecuteSuperQueryCurrent != len(fmd.ExpectedExecuteSuperQueryList) { return fmt.Errorf("SuperQueryList wasn't consumed, saw %v queries, was expecting %v", fmd.ExpectedExecuteSuperQueryCurrent, len(fmd.ExpectedExecuteSuperQueryList)) } return ...
go
func (fmd *FakeMysqlDaemon) CheckSuperQueryList() error { if fmd.ExpectedExecuteSuperQueryCurrent != len(fmd.ExpectedExecuteSuperQueryList) { return fmt.Errorf("SuperQueryList wasn't consumed, saw %v queries, was expecting %v", fmd.ExpectedExecuteSuperQueryCurrent, len(fmd.ExpectedExecuteSuperQueryList)) } return ...
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "CheckSuperQueryList", "(", ")", "error", "{", "if", "fmd", ".", "ExpectedExecuteSuperQueryCurrent", "!=", "len", "(", "fmd", ".", "ExpectedExecuteSuperQueryList", ")", "{", "return", "fmt", ".", "Errorf", "(", ...
// CheckSuperQueryList returns an error if all the queries we expected // haven't been seen.
[ "CheckSuperQueryList", "returns", "an", "error", "if", "all", "the", "queries", "we", "expected", "haven", "t", "been", "seen", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L399-L404
train
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
GetSchema
func (fmd *FakeMysqlDaemon) GetSchema(dbName string, tables, excludeTables []string, includeViews bool) (*tabletmanagerdatapb.SchemaDefinition, error) { if fmd.SchemaFunc != nil { return fmd.SchemaFunc() } if fmd.Schema == nil { return nil, fmt.Errorf("no schema defined") } return tmutils.FilterTables(fmd.Sche...
go
func (fmd *FakeMysqlDaemon) GetSchema(dbName string, tables, excludeTables []string, includeViews bool) (*tabletmanagerdatapb.SchemaDefinition, error) { if fmd.SchemaFunc != nil { return fmd.SchemaFunc() } if fmd.Schema == nil { return nil, fmt.Errorf("no schema defined") } return tmutils.FilterTables(fmd.Sche...
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "GetSchema", "(", "dbName", "string", ",", "tables", ",", "excludeTables", "[", "]", "string", ",", "includeViews", "bool", ")", "(", "*", "tabletmanagerdatapb", ".", "SchemaDefinition", ",", "error", ")", "{"...
// GetSchema is part of the MysqlDaemon interface
[ "GetSchema", "is", "part", "of", "the", "MysqlDaemon", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L407-L415
train
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
GetColumns
func (fmd *FakeMysqlDaemon) GetColumns(dbName, table string) ([]string, error) { return []string{}, nil }
go
func (fmd *FakeMysqlDaemon) GetColumns(dbName, table string) ([]string, error) { return []string{}, nil }
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "GetColumns", "(", "dbName", ",", "table", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "return", "[", "]", "string", "{", "}", ",", "nil", "\n", "}" ]
// GetColumns is part of the MysqlDaemon interface
[ "GetColumns", "is", "part", "of", "the", "MysqlDaemon", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L418-L420
train
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
GetPrimaryKeyColumns
func (fmd *FakeMysqlDaemon) GetPrimaryKeyColumns(dbName, table string) ([]string, error) { return []string{}, nil }
go
func (fmd *FakeMysqlDaemon) GetPrimaryKeyColumns(dbName, table string) ([]string, error) { return []string{}, nil }
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "GetPrimaryKeyColumns", "(", "dbName", ",", "table", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "return", "[", "]", "string", "{", "}", ",", "nil", "\n", "}" ]
// GetPrimaryKeyColumns is part of the MysqlDaemon interface
[ "GetPrimaryKeyColumns", "is", "part", "of", "the", "MysqlDaemon", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L423-L425
train
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
PreflightSchemaChange
func (fmd *FakeMysqlDaemon) PreflightSchemaChange(dbName string, changes []string) ([]*tabletmanagerdatapb.SchemaChangeResult, error) { if fmd.PreflightSchemaChangeResult == nil { return nil, fmt.Errorf("no preflight result defined") } return fmd.PreflightSchemaChangeResult, nil }
go
func (fmd *FakeMysqlDaemon) PreflightSchemaChange(dbName string, changes []string) ([]*tabletmanagerdatapb.SchemaChangeResult, error) { if fmd.PreflightSchemaChangeResult == nil { return nil, fmt.Errorf("no preflight result defined") } return fmd.PreflightSchemaChangeResult, nil }
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "PreflightSchemaChange", "(", "dbName", "string", ",", "changes", "[", "]", "string", ")", "(", "[", "]", "*", "tabletmanagerdatapb", ".", "SchemaChangeResult", ",", "error", ")", "{", "if", "fmd", ".", "Pre...
// PreflightSchemaChange is part of the MysqlDaemon interface
[ "PreflightSchemaChange", "is", "part", "of", "the", "MysqlDaemon", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L428-L433
train
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
ApplySchemaChange
func (fmd *FakeMysqlDaemon) ApplySchemaChange(dbName string, change *tmutils.SchemaChange) (*tabletmanagerdatapb.SchemaChangeResult, error) { if fmd.ApplySchemaChangeResult == nil { return nil, fmt.Errorf("no apply schema defined") } return fmd.ApplySchemaChangeResult, nil }
go
func (fmd *FakeMysqlDaemon) ApplySchemaChange(dbName string, change *tmutils.SchemaChange) (*tabletmanagerdatapb.SchemaChangeResult, error) { if fmd.ApplySchemaChangeResult == nil { return nil, fmt.Errorf("no apply schema defined") } return fmd.ApplySchemaChangeResult, nil }
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "ApplySchemaChange", "(", "dbName", "string", ",", "change", "*", "tmutils", ".", "SchemaChange", ")", "(", "*", "tabletmanagerdatapb", ".", "SchemaChangeResult", ",", "error", ")", "{", "if", "fmd", ".", "App...
// ApplySchemaChange is part of the MysqlDaemon interface
[ "ApplySchemaChange", "is", "part", "of", "the", "MysqlDaemon", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L436-L441
train
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
GetAppConnection
func (fmd *FakeMysqlDaemon) GetAppConnection(ctx context.Context) (*dbconnpool.PooledDBConnection, error) { return fmd.appPool.Get(ctx) }
go
func (fmd *FakeMysqlDaemon) GetAppConnection(ctx context.Context) (*dbconnpool.PooledDBConnection, error) { return fmd.appPool.Get(ctx) }
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "GetAppConnection", "(", "ctx", "context", ".", "Context", ")", "(", "*", "dbconnpool", ".", "PooledDBConnection", ",", "error", ")", "{", "return", "fmd", ".", "appPool", ".", "Get", "(", "ctx", ")", "\n"...
// GetAppConnection is part of the MysqlDaemon interface.
[ "GetAppConnection", "is", "part", "of", "the", "MysqlDaemon", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L444-L446
train
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
GetAllPrivsConnection
func (fmd *FakeMysqlDaemon) GetAllPrivsConnection() (*dbconnpool.DBConnection, error) { return dbconnpool.NewDBConnection(fmd.db.ConnParams(), stats.NewTimings("", "", "")) }
go
func (fmd *FakeMysqlDaemon) GetAllPrivsConnection() (*dbconnpool.DBConnection, error) { return dbconnpool.NewDBConnection(fmd.db.ConnParams(), stats.NewTimings("", "", "")) }
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "GetAllPrivsConnection", "(", ")", "(", "*", "dbconnpool", ".", "DBConnection", ",", "error", ")", "{", "return", "dbconnpool", ".", "NewDBConnection", "(", "fmd", ".", "db", ".", "ConnParams", "(", ")", ","...
// GetAllPrivsConnection is part of the MysqlDaemon interface.
[ "GetAllPrivsConnection", "is", "part", "of", "the", "MysqlDaemon", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L454-L456
train
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
SetSemiSyncEnabled
func (fmd *FakeMysqlDaemon) SetSemiSyncEnabled(master, slave bool) error { fmd.SemiSyncMasterEnabled = master fmd.SemiSyncSlaveEnabled = slave return nil }
go
func (fmd *FakeMysqlDaemon) SetSemiSyncEnabled(master, slave bool) error { fmd.SemiSyncMasterEnabled = master fmd.SemiSyncSlaveEnabled = slave return nil }
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "SetSemiSyncEnabled", "(", "master", ",", "slave", "bool", ")", "error", "{", "fmd", ".", "SemiSyncMasterEnabled", "=", "master", "\n", "fmd", ".", "SemiSyncSlaveEnabled", "=", "slave", "\n", "return", "nil", ...
// SetSemiSyncEnabled is part of the MysqlDaemon interface.
[ "SetSemiSyncEnabled", "is", "part", "of", "the", "MysqlDaemon", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L459-L463
train
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
SemiSyncEnabled
func (fmd *FakeMysqlDaemon) SemiSyncEnabled() (master, slave bool) { return fmd.SemiSyncMasterEnabled, fmd.SemiSyncSlaveEnabled }
go
func (fmd *FakeMysqlDaemon) SemiSyncEnabled() (master, slave bool) { return fmd.SemiSyncMasterEnabled, fmd.SemiSyncSlaveEnabled }
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "SemiSyncEnabled", "(", ")", "(", "master", ",", "slave", "bool", ")", "{", "return", "fmd", ".", "SemiSyncMasterEnabled", ",", "fmd", ".", "SemiSyncSlaveEnabled", "\n", "}" ]
// SemiSyncEnabled is part of the MysqlDaemon interface.
[ "SemiSyncEnabled", "is", "part", "of", "the", "MysqlDaemon", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L466-L468
train
vitessio/vitess
go/vt/schemamanager/plain_controller.go
NewPlainController
func NewPlainController(sqlStr string, keyspace string) *PlainController { controller := &PlainController{ sqls: make([]string, 0, 32), keyspace: keyspace, } sqls, err := sqlparser.SplitStatementToPieces(sqlStr) if err != nil { panic(err.Error()) } for _, sql := range sqls { s := strings.TrimSpace(s...
go
func NewPlainController(sqlStr string, keyspace string) *PlainController { controller := &PlainController{ sqls: make([]string, 0, 32), keyspace: keyspace, } sqls, err := sqlparser.SplitStatementToPieces(sqlStr) if err != nil { panic(err.Error()) } for _, sql := range sqls { s := strings.TrimSpace(s...
[ "func", "NewPlainController", "(", "sqlStr", "string", ",", "keyspace", "string", ")", "*", "PlainController", "{", "controller", ":=", "&", "PlainController", "{", "sqls", ":", "make", "(", "[", "]", "string", ",", "0", ",", "32", ")", ",", "keyspace", ...
// NewPlainController creates a new PlainController instance.
[ "NewPlainController", "creates", "a", "new", "PlainController", "instance", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/plain_controller.go#L36-L54
train
vitessio/vitess
go/vt/schemamanager/plain_controller.go
Read
func (controller *PlainController) Read(ctx context.Context) ([]string, error) { return controller.sqls, nil }
go
func (controller *PlainController) Read(ctx context.Context) ([]string, error) { return controller.sqls, nil }
[ "func", "(", "controller", "*", "PlainController", ")", "Read", "(", "ctx", "context", ".", "Context", ")", "(", "[", "]", "string", ",", "error", ")", "{", "return", "controller", ".", "sqls", ",", "nil", "\n", "}" ]
// Read reads schema changes
[ "Read", "reads", "schema", "changes" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/plain_controller.go#L62-L64
train
vitessio/vitess
go/vt/schemamanager/plain_controller.go
OnReadSuccess
func (controller *PlainController) OnReadSuccess(ctx context.Context) error { log.Info("Successfully read all schema changes.") return nil }
go
func (controller *PlainController) OnReadSuccess(ctx context.Context) error { log.Info("Successfully read all schema changes.") return nil }
[ "func", "(", "controller", "*", "PlainController", ")", "OnReadSuccess", "(", "ctx", "context", ".", "Context", ")", "error", "{", "log", ".", "Info", "(", "\"", "\"", ")", "\n", "return", "nil", "\n", "}" ]
// OnReadSuccess is called when schemamanager successfully // reads all sql statements.
[ "OnReadSuccess", "is", "called", "when", "schemamanager", "successfully", "reads", "all", "sql", "statements", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/plain_controller.go#L77-L80
train
vitessio/vitess
go/vt/schemamanager/plain_controller.go
OnReadFail
func (controller *PlainController) OnReadFail(ctx context.Context, err error) error { log.Errorf("Failed to read schema changes, error: %v\n", err) return err }
go
func (controller *PlainController) OnReadFail(ctx context.Context, err error) error { log.Errorf("Failed to read schema changes, error: %v\n", err) return err }
[ "func", "(", "controller", "*", "PlainController", ")", "OnReadFail", "(", "ctx", "context", ".", "Context", ",", "err", "error", ")", "error", "{", "log", ".", "Errorf", "(", "\"", "\\n", "\"", ",", "err", ")", "\n", "return", "err", "\n", "}" ]
// OnReadFail is called when schemamanager fails to read all sql statements.
[ "OnReadFail", "is", "called", "when", "schemamanager", "fails", "to", "read", "all", "sql", "statements", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/plain_controller.go#L83-L86
train
vitessio/vitess
go/vt/schemamanager/plain_controller.go
OnExecutorComplete
func (controller *PlainController) OnExecutorComplete(ctx context.Context, result *ExecuteResult) error { out, _ := json.MarshalIndent(result, "", " ") log.Infof("Executor finished, result: %s\n", string(out)) return nil }
go
func (controller *PlainController) OnExecutorComplete(ctx context.Context, result *ExecuteResult) error { out, _ := json.MarshalIndent(result, "", " ") log.Infof("Executor finished, result: %s\n", string(out)) return nil }
[ "func", "(", "controller", "*", "PlainController", ")", "OnExecutorComplete", "(", "ctx", "context", ".", "Context", ",", "result", "*", "ExecuteResult", ")", "error", "{", "out", ",", "_", ":=", "json", ".", "MarshalIndent", "(", "result", ",", "\"", "\""...
// OnExecutorComplete is called when schemamanager finishes applying schema changes.
[ "OnExecutorComplete", "is", "called", "when", "schemamanager", "finishes", "applying", "schema", "changes", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/plain_controller.go#L101-L105
train
vitessio/vitess
go/vt/discovery/fake_healthcheck.go
SetListener
func (fhc *FakeHealthCheck) SetListener(listener HealthCheckStatsListener, sendDownEvents bool) { fhc.listener = listener }
go
func (fhc *FakeHealthCheck) SetListener(listener HealthCheckStatsListener, sendDownEvents bool) { fhc.listener = listener }
[ "func", "(", "fhc", "*", "FakeHealthCheck", ")", "SetListener", "(", "listener", "HealthCheckStatsListener", ",", "sendDownEvents", "bool", ")", "{", "fhc", ".", "listener", "=", "listener", "\n", "}" ]
// SetListener is not implemented.
[ "SetListener", "is", "not", "implemented", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/fake_healthcheck.go#L66-L68
train
vitessio/vitess
go/vt/discovery/fake_healthcheck.go
AddTablet
func (fhc *FakeHealthCheck) AddTablet(tablet *topodatapb.Tablet, name string) { key := TabletToMapKey(tablet) item := &fhcItem{ ts: &TabletStats{ Key: key, Tablet: tablet, Target: &querypb.Target{ Keyspace: tablet.Keyspace, Shard: tablet.Shard, TabletType: tablet.Type, }, Servin...
go
func (fhc *FakeHealthCheck) AddTablet(tablet *topodatapb.Tablet, name string) { key := TabletToMapKey(tablet) item := &fhcItem{ ts: &TabletStats{ Key: key, Tablet: tablet, Target: &querypb.Target{ Keyspace: tablet.Keyspace, Shard: tablet.Shard, TabletType: tablet.Type, }, Servin...
[ "func", "(", "fhc", "*", "FakeHealthCheck", ")", "AddTablet", "(", "tablet", "*", "topodatapb", ".", "Tablet", ",", "name", "string", ")", "{", "key", ":=", "TabletToMapKey", "(", "tablet", ")", "\n", "item", ":=", "&", "fhcItem", "{", "ts", ":", "&", ...
// AddTablet adds the tablet and calls the listener.
[ "AddTablet", "adds", "the", "tablet", "and", "calls", "the", "listener", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/fake_healthcheck.go#L75-L100
train
vitessio/vitess
go/vt/discovery/fake_healthcheck.go
RemoveTablet
func (fhc *FakeHealthCheck) RemoveTablet(tablet *topodatapb.Tablet) { fhc.mu.Lock() defer fhc.mu.Unlock() key := TabletToMapKey(tablet) delete(fhc.items, key) }
go
func (fhc *FakeHealthCheck) RemoveTablet(tablet *topodatapb.Tablet) { fhc.mu.Lock() defer fhc.mu.Unlock() key := TabletToMapKey(tablet) delete(fhc.items, key) }
[ "func", "(", "fhc", "*", "FakeHealthCheck", ")", "RemoveTablet", "(", "tablet", "*", "topodatapb", ".", "Tablet", ")", "{", "fhc", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "fhc", ".", "mu", ".", "Unlock", "(", ")", "\n", "key", ":=", "Table...
// RemoveTablet removes the tablet.
[ "RemoveTablet", "removes", "the", "tablet", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/fake_healthcheck.go#L103-L108
train
vitessio/vitess
go/vt/discovery/fake_healthcheck.go
ReplaceTablet
func (fhc *FakeHealthCheck) ReplaceTablet(old, new *topodatapb.Tablet, name string) { fhc.RemoveTablet(old) fhc.AddTablet(new, name) }
go
func (fhc *FakeHealthCheck) ReplaceTablet(old, new *topodatapb.Tablet, name string) { fhc.RemoveTablet(old) fhc.AddTablet(new, name) }
[ "func", "(", "fhc", "*", "FakeHealthCheck", ")", "ReplaceTablet", "(", "old", ",", "new", "*", "topodatapb", ".", "Tablet", ",", "name", "string", ")", "{", "fhc", ".", "RemoveTablet", "(", "old", ")", "\n", "fhc", ".", "AddTablet", "(", "new", ",", ...
// ReplaceTablet removes the old tablet and adds the new.
[ "ReplaceTablet", "removes", "the", "old", "tablet", "and", "adds", "the", "new", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/fake_healthcheck.go#L111-L114
train
vitessio/vitess
go/vt/discovery/fake_healthcheck.go
CacheStatus
func (fhc *FakeHealthCheck) CacheStatus() TabletsCacheStatusList { fhc.mu.Lock() defer fhc.mu.Unlock() stats := make(TabletsCacheStatusList, 0, len(fhc.items)) for _, item := range fhc.items { stats = append(stats, &TabletsCacheStatus{ Cell: "FakeCell", Target: item.ts.Target, TabletsStats...
go
func (fhc *FakeHealthCheck) CacheStatus() TabletsCacheStatusList { fhc.mu.Lock() defer fhc.mu.Unlock() stats := make(TabletsCacheStatusList, 0, len(fhc.items)) for _, item := range fhc.items { stats = append(stats, &TabletsCacheStatus{ Cell: "FakeCell", Target: item.ts.Target, TabletsStats...
[ "func", "(", "fhc", "*", "FakeHealthCheck", ")", "CacheStatus", "(", ")", "TabletsCacheStatusList", "{", "fhc", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "fhc", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "stats", ":=", "make", "(", "TabletsCach...
// CacheStatus returns the status for each tablet
[ "CacheStatus", "returns", "the", "status", "for", "each", "tablet" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/fake_healthcheck.go#L127-L141
train
vitessio/vitess
go/vt/discovery/fake_healthcheck.go
Reset
func (fhc *FakeHealthCheck) Reset() { fhc.mu.Lock() defer fhc.mu.Unlock() fhc.items = make(map[string]*fhcItem) }
go
func (fhc *FakeHealthCheck) Reset() { fhc.mu.Lock() defer fhc.mu.Unlock() fhc.items = make(map[string]*fhcItem) }
[ "func", "(", "fhc", "*", "FakeHealthCheck", ")", "Reset", "(", ")", "{", "fhc", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "fhc", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "fhc", ".", "items", "=", "make", "(", "map", "[", "string", "]"...
// // Management methods // // Reset cleans up the internal state.
[ "Management", "methods", "Reset", "cleans", "up", "the", "internal", "state", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/fake_healthcheck.go#L153-L158
train
vitessio/vitess
go/vt/discovery/fake_healthcheck.go
AddFakeTablet
func (fhc *FakeHealthCheck) AddFakeTablet(cell, host string, port int32, keyspace, shard string, tabletType topodatapb.TabletType, serving bool, reparentTS int64, err error, connFactory func(*topodatapb.Tablet) queryservice.QueryService) queryservice.QueryService { t := topo.NewTablet(0, cell, host) t.Keyspace = keys...
go
func (fhc *FakeHealthCheck) AddFakeTablet(cell, host string, port int32, keyspace, shard string, tabletType topodatapb.TabletType, serving bool, reparentTS int64, err error, connFactory func(*topodatapb.Tablet) queryservice.QueryService) queryservice.QueryService { t := topo.NewTablet(0, cell, host) t.Keyspace = keys...
[ "func", "(", "fhc", "*", "FakeHealthCheck", ")", "AddFakeTablet", "(", "cell", ",", "host", "string", ",", "port", "int32", ",", "keyspace", ",", "shard", "string", ",", "tabletType", "topodatapb", ".", "TabletType", ",", "serving", "bool", ",", "reparentTS"...
// AddFakeTablet inserts a fake entry into FakeHealthCheck. // The Tablet can be talked to using the provided connection. // The Listener is called, as if AddTablet had been called. // For flexibility the connection is created via a connFactory callback
[ "AddFakeTablet", "inserts", "a", "fake", "entry", "into", "FakeHealthCheck", ".", "The", "Tablet", "can", "be", "talked", "to", "using", "the", "provided", "connection", ".", "The", "Listener", "is", "called", "as", "if", "AddTablet", "had", "been", "called", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/fake_healthcheck.go#L164-L201
train
vitessio/vitess
go/vt/discovery/fake_healthcheck.go
GetAllTablets
func (fhc *FakeHealthCheck) GetAllTablets() map[string]*topodatapb.Tablet { res := make(map[string]*topodatapb.Tablet) fhc.mu.RLock() defer fhc.mu.RUnlock() for key, t := range fhc.items { res[key] = t.ts.Tablet } return res }
go
func (fhc *FakeHealthCheck) GetAllTablets() map[string]*topodatapb.Tablet { res := make(map[string]*topodatapb.Tablet) fhc.mu.RLock() defer fhc.mu.RUnlock() for key, t := range fhc.items { res[key] = t.ts.Tablet } return res }
[ "func", "(", "fhc", "*", "FakeHealthCheck", ")", "GetAllTablets", "(", ")", "map", "[", "string", "]", "*", "topodatapb", ".", "Tablet", "{", "res", ":=", "make", "(", "map", "[", "string", "]", "*", "topodatapb", ".", "Tablet", ")", "\n", "fhc", "."...
// GetAllTablets returns all the tablets we have.
[ "GetAllTablets", "returns", "all", "the", "tablets", "we", "have", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/fake_healthcheck.go#L213-L221
train
vitessio/vitess
go/vt/vtgate/planbuilder/expr.go
splitAndExpression
func splitAndExpression(filters []sqlparser.Expr, node sqlparser.Expr) []sqlparser.Expr { if node == nil { return filters } switch node := node.(type) { case *sqlparser.AndExpr: filters = splitAndExpression(filters, node.Left) return splitAndExpression(filters, node.Right) case *sqlparser.ParenExpr: // If ...
go
func splitAndExpression(filters []sqlparser.Expr, node sqlparser.Expr) []sqlparser.Expr { if node == nil { return filters } switch node := node.(type) { case *sqlparser.AndExpr: filters = splitAndExpression(filters, node.Left) return splitAndExpression(filters, node.Right) case *sqlparser.ParenExpr: // If ...
[ "func", "splitAndExpression", "(", "filters", "[", "]", "sqlparser", ".", "Expr", ",", "node", "sqlparser", ".", "Expr", ")", "[", "]", "sqlparser", ".", "Expr", "{", "if", "node", "==", "nil", "{", "return", "filters", "\n", "}", "\n", "switch", "node...
// splitAndExpression breaks up the Expr into AND-separated conditions // and appends them to filters, which can be shuffled and recombined // as needed.
[ "splitAndExpression", "breaks", "up", "the", "Expr", "into", "AND", "-", "separated", "conditions", "and", "appends", "them", "to", "filters", "which", "can", "be", "shuffled", "and", "recombined", "as", "needed", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/expr.go#L31-L47
train
vitessio/vitess
go/proc/proc.go
Listen
func Listen(port string) (l net.Listener, err error) { if port != "" { killPredecessor(port) } return listen(port) }
go
func Listen(port string) (l net.Listener, err error) { if port != "" { killPredecessor(port) } return listen(port) }
[ "func", "Listen", "(", "port", "string", ")", "(", "l", "net", ".", "Listener", ",", "err", "error", ")", "{", "if", "port", "!=", "\"", "\"", "{", "killPredecessor", "(", "port", ")", "\n", "}", "\n", "return", "listen", "(", "port", ")", "\n", ...
// Listen tries to create a listener on the specified tcp port. // Before creating the listener, it checks to see if there is another // server already using the port. If there is one, it sends a USR1 // signal requesting the server to shutdown, and then attempts to // to create the listener.
[ "Listen", "tries", "to", "create", "a", "listener", "on", "the", "specified", "tcp", "port", ".", "Before", "creating", "the", "listener", "it", "checks", "to", "see", "if", "there", "is", "another", "server", "already", "using", "the", "port", ".", "If", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/proc/proc.go#L43-L48
train
vitessio/vitess
go/proc/proc.go
Wait
func Wait() os.Signal { c := make(chan os.Signal, 1) signal.Notify(c, syscall.SIGTERM, syscall.SIGUSR1, syscall.SIGINT) http.HandleFunc(pidURL, func(r http.ResponseWriter, req *http.Request) { r.Write(strconv.AppendInt(nil, int64(os.Getpid()), 10)) }) return <-c }
go
func Wait() os.Signal { c := make(chan os.Signal, 1) signal.Notify(c, syscall.SIGTERM, syscall.SIGUSR1, syscall.SIGINT) http.HandleFunc(pidURL, func(r http.ResponseWriter, req *http.Request) { r.Write(strconv.AppendInt(nil, int64(os.Getpid()), 10)) }) return <-c }
[ "func", "Wait", "(", ")", "os", ".", "Signal", "{", "c", ":=", "make", "(", "chan", "os", ".", "Signal", ",", "1", ")", "\n", "signal", ".", "Notify", "(", "c", ",", "syscall", ".", "SIGTERM", ",", "syscall", ".", "SIGUSR1", ",", "syscall", ".", ...
// Wait creates an HTTP handler on pidURL, and serves the current process // pid on it. It then creates a signal handler and waits for SIGTERM or // SIGUSR1, and returns when the signal is received. A new server that comes // up will query this URL. If it receives a valid response, it will send a // SIGUSR1 signal and ...
[ "Wait", "creates", "an", "HTTP", "handler", "on", "pidURL", "and", "serves", "the", "current", "process", "pid", "on", "it", ".", "It", "then", "creates", "a", "signal", "handler", "and", "waits", "for", "SIGTERM", "or", "SIGUSR1", "and", "returns", "when"...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/proc/proc.go#L55-L64
train
vitessio/vitess
go/proc/proc.go
ListenAndServe
func ListenAndServe(port string) os.Signal { l, err := Listen(port) if err != nil { log.Fatalf("%s", err) } go http.Serve(l, nil) s := Wait() l.Close() return s }
go
func ListenAndServe(port string) os.Signal { l, err := Listen(port) if err != nil { log.Fatalf("%s", err) } go http.Serve(l, nil) s := Wait() l.Close() return s }
[ "func", "ListenAndServe", "(", "port", "string", ")", "os", ".", "Signal", "{", "l", ",", "err", ":=", "Listen", "(", "port", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Fatalf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "go...
// ListenAndServe combines Listen and Wait to also run an http // server on the specified port. If it fails to obtain a listener, // the program is fatally terminated. The return value is the signal // received for termination
[ "ListenAndServe", "combines", "Listen", "and", "Wait", "to", "also", "run", "an", "http", "server", "on", "the", "specified", "port", ".", "If", "it", "fails", "to", "obtain", "a", "listener", "the", "program", "is", "fatally", "terminated", ".", "The", "r...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/proc/proc.go#L70-L79
train
vitessio/vitess
go/vt/callerid/callerid.go
NewEffectiveCallerID
func NewEffectiveCallerID(principal string, component string, subComponent string) *vtrpcpb.CallerID { return &vtrpcpb.CallerID{Principal: principal, Component: component, Subcomponent: subComponent} }
go
func NewEffectiveCallerID(principal string, component string, subComponent string) *vtrpcpb.CallerID { return &vtrpcpb.CallerID{Principal: principal, Component: component, Subcomponent: subComponent} }
[ "func", "NewEffectiveCallerID", "(", "principal", "string", ",", "component", "string", ",", "subComponent", "string", ")", "*", "vtrpcpb", ".", "CallerID", "{", "return", "&", "vtrpcpb", ".", "CallerID", "{", "Principal", ":", "principal", ",", "Component", "...
// NewEffectiveCallerID creates a new vtrpcpb.CallerID with principal, component and // subComponent
[ "NewEffectiveCallerID", "creates", "a", "new", "vtrpcpb", ".", "CallerID", "with", "principal", "component", "and", "subComponent" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/callerid/callerid.go#L53-L55
train
vitessio/vitess
go/mysql/binlog_event_json.go
printJSONData
func printJSONData(data []byte) ([]byte, error) { // It's possible for data to be empty. If so, we have to // treat it as 'null'. // The mysql code also says why, but this wasn't reproduceable: // https://github.com/mysql/mysql-server/blob/8.0/sql/json_binary.cc#L1070 if len(data) == 0 { return []byte("'null'"),...
go
func printJSONData(data []byte) ([]byte, error) { // It's possible for data to be empty. If so, we have to // treat it as 'null'. // The mysql code also says why, but this wasn't reproduceable: // https://github.com/mysql/mysql-server/blob/8.0/sql/json_binary.cc#L1070 if len(data) == 0 { return []byte("'null'"),...
[ "func", "printJSONData", "(", "data", "[", "]", "byte", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "// It's possible for data to be empty. If so, we have to", "// treat it as 'null'.", "// The mysql code also says why, but this wasn't reproduceable:", "// https://githu...
// printJSONData parses the MySQL binary format for JSON data, and prints // the result as a string.
[ "printJSONData", "parses", "the", "MySQL", "binary", "format", "for", "JSON", "data", "and", "prints", "the", "result", "as", "a", "string", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/binlog_event_json.go#L55-L69
train
vitessio/vitess
go/vt/vttablet/tabletserver/status.go
AddStatusPart
func (tsv *TabletServer) AddStatusPart() { servenv.AddStatusPart("Queryservice", queryserviceStatusTemplate, func() interface{} { status := queryserviceStatus{ State: tsv.GetState(), History: tsv.history.Records(), } rates := tabletenv.QPSRates.Get() if qps, ok := rates["All"]; ok && len(qps) > 0 { ...
go
func (tsv *TabletServer) AddStatusPart() { servenv.AddStatusPart("Queryservice", queryserviceStatusTemplate, func() interface{} { status := queryserviceStatus{ State: tsv.GetState(), History: tsv.history.Records(), } rates := tabletenv.QPSRates.Get() if qps, ok := rates["All"]; ok && len(qps) > 0 { ...
[ "func", "(", "tsv", "*", "TabletServer", ")", "AddStatusPart", "(", ")", "{", "servenv", ".", "AddStatusPart", "(", "\"", "\"", ",", "queryserviceStatusTemplate", ",", "func", "(", ")", "interface", "{", "}", "{", "status", ":=", "queryserviceStatus", "{", ...
// AddStatusPart registers the status part for the status page.
[ "AddStatusPart", "registers", "the", "status", "part", "for", "the", "status", "page", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/status.go#L130-L142
train
vitessio/vitess
go/trace/utils.go
LogErrorsWhenClosing
func LogErrorsWhenClosing(in io.Closer) func() { return func() { err := in.Close() if err != nil { log.Error(err) } } }
go
func LogErrorsWhenClosing(in io.Closer) func() { return func() { err := in.Close() if err != nil { log.Error(err) } } }
[ "func", "LogErrorsWhenClosing", "(", "in", "io", ".", "Closer", ")", "func", "(", ")", "{", "return", "func", "(", ")", "{", "err", ":=", "in", ".", "Close", "(", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Error", "(", "err", ")", "...
// LogErrorsWhenClosing will close the provided Closer, and log any errors it generates
[ "LogErrorsWhenClosing", "will", "close", "the", "provided", "Closer", "and", "log", "any", "errors", "it", "generates" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/trace/utils.go#L26-L33
train
vitessio/vitess
go/vt/mysqlctl/mycnf_flag.go
RegisterFlags
func RegisterFlags() { flagServerID = flag.Int("mycnf_server_id", 0, "mysql server id of the server (if specified, mycnf-file will be ignored)") flagMysqlPort = flag.Int("mycnf_mysql_port", 0, "port mysql is listening on") flagDataDir = flag.String("mycnf_data_dir", "", "data directory for mysql") flagInnodbDataHom...
go
func RegisterFlags() { flagServerID = flag.Int("mycnf_server_id", 0, "mysql server id of the server (if specified, mycnf-file will be ignored)") flagMysqlPort = flag.Int("mycnf_mysql_port", 0, "port mysql is listening on") flagDataDir = flag.String("mycnf_data_dir", "", "data directory for mysql") flagInnodbDataHom...
[ "func", "RegisterFlags", "(", ")", "{", "flagServerID", "=", "flag", ".", "Int", "(", "\"", "\"", ",", "0", ",", "\"", "\"", ")", "\n", "flagMysqlPort", "=", "flag", ".", "Int", "(", "\"", "\"", ",", "0", ",", "\"", "\"", ")", "\n", "flagDataDir"...
// RegisterFlags registers the command line flags for // specifying the values of a mycnf config file. See NewMycnfFromFlags // to get the supported modes.
[ "RegisterFlags", "registers", "the", "command", "line", "flags", "for", "specifying", "the", "values", "of", "a", "mycnf", "config", "file", ".", "See", "NewMycnfFromFlags", "to", "get", "the", "supported", "modes", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/mycnf_flag.go#L56-L76
train
vitessio/vitess
go/stats/timings.go
NewTimings
func NewTimings(name, help, label string, categories ...string) *Timings { t := &Timings{ histograms: make(map[string]*Histogram), help: help, label: label, } for _, cat := range categories { t.histograms[cat] = NewGenericHistogram("", "", bucketCutoffs, bucketLabels, "Count", "Time") } if name ...
go
func NewTimings(name, help, label string, categories ...string) *Timings { t := &Timings{ histograms: make(map[string]*Histogram), help: help, label: label, } for _, cat := range categories { t.histograms[cat] = NewGenericHistogram("", "", bucketCutoffs, bucketLabels, "Count", "Time") } if name ...
[ "func", "NewTimings", "(", "name", ",", "help", ",", "label", "string", ",", "categories", "...", "string", ")", "*", "Timings", "{", "t", ":=", "&", "Timings", "{", "histograms", ":", "make", "(", "map", "[", "string", "]", "*", "Histogram", ")", ",...
// NewTimings creates a new Timings object, and publishes it if name is set. // categories is an optional list of categories to initialize to 0. // Categories that aren't initialized will be missing from the map until the // first time they are updated.
[ "NewTimings", "creates", "a", "new", "Timings", "object", "and", "publishes", "it", "if", "name", "is", "set", ".", "categories", "is", "an", "optional", "list", "of", "categories", "to", "initialize", "to", "0", ".", "Categories", "that", "aren", "t", "in...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/timings.go#L48-L62
train
vitessio/vitess
go/stats/timings.go
safeJoinLabels
func safeJoinLabels(labels []string) string { sanitizedLabels := make([]string, len(labels)) for idx, label := range labels { sanitizedLabels[idx] = safeLabel(label) } return strings.Join(sanitizedLabels, ".") }
go
func safeJoinLabels(labels []string) string { sanitizedLabels := make([]string, len(labels)) for idx, label := range labels { sanitizedLabels[idx] = safeLabel(label) } return strings.Join(sanitizedLabels, ".") }
[ "func", "safeJoinLabels", "(", "labels", "[", "]", "string", ")", "string", "{", "sanitizedLabels", ":=", "make", "(", "[", "]", "string", ",", "len", "(", "labels", ")", ")", "\n", "for", "idx", ",", "label", ":=", "range", "labels", "{", "sanitizedLa...
// safeJoinLabels joins the label values with ".", but first replaces any existing // "." characters in the labels with the proper replacement, to avoid issues parsing // them apart later.
[ "safeJoinLabels", "joins", "the", "label", "values", "with", ".", "but", "first", "replaces", "any", "existing", ".", "characters", "in", "the", "labels", "with", "the", "proper", "replacement", "to", "avoid", "issues", "parsing", "them", "apart", "later", "."...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/timings.go#L214-L220
train
vitessio/vitess
go/vt/vtgate/buffer/buffer.go
mode
func (b *Buffer) mode(keyspace, shard string) bufferMode { // Actual buffering is enabled if // a) no keyspaces and shards were listed in particular, if *enabled && len(b.keyspaces) == 0 && len(b.shards) == 0 { // No explicit whitelist given i.e. all shards should be buffered. return bufferEnabled } // b) or t...
go
func (b *Buffer) mode(keyspace, shard string) bufferMode { // Actual buffering is enabled if // a) no keyspaces and shards were listed in particular, if *enabled && len(b.keyspaces) == 0 && len(b.shards) == 0 { // No explicit whitelist given i.e. all shards should be buffered. return bufferEnabled } // b) or t...
[ "func", "(", "b", "*", "Buffer", ")", "mode", "(", "keyspace", ",", "shard", "string", ")", "bufferMode", "{", "// Actual buffering is enabled if", "// a) no keyspaces and shards were listed in particular,", "if", "*", "enabled", "&&", "len", "(", "b", ".", "keyspac...
// mode determines for the given keyspace and shard if buffering, dry-run // buffering or no buffering at all should be enabled.
[ "mode", "determines", "for", "the", "given", "keyspace", "and", "shard", "if", "buffering", "dry", "-", "run", "buffering", "or", "no", "buffering", "at", "all", "should", "be", "enabled", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/buffer/buffer.go#L158-L180
train
vitessio/vitess
go/vt/vtgate/buffer/buffer.go
StatsUpdate
func (b *Buffer) StatsUpdate(ts *discovery.TabletStats) { if ts.Target.TabletType != topodatapb.TabletType_MASTER { panic(fmt.Sprintf("BUG: non MASTER TabletStats object must not be forwarded: %#v", ts)) } timestamp := ts.TabletExternallyReparentedTimestamp if timestamp == 0 { // Masters where TabletExternally...
go
func (b *Buffer) StatsUpdate(ts *discovery.TabletStats) { if ts.Target.TabletType != topodatapb.TabletType_MASTER { panic(fmt.Sprintf("BUG: non MASTER TabletStats object must not be forwarded: %#v", ts)) } timestamp := ts.TabletExternallyReparentedTimestamp if timestamp == 0 { // Masters where TabletExternally...
[ "func", "(", "b", "*", "Buffer", ")", "StatsUpdate", "(", "ts", "*", "discovery", ".", "TabletStats", ")", "{", "if", "ts", ".", "Target", ".", "TabletType", "!=", "topodatapb", ".", "TabletType_MASTER", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "...
// StatsUpdate keeps track of the "tablet_externally_reparented_timestamp" of // each master. This way we can detect the end of a failover. // It is part of the discovery.HealthCheckStatsListener interface.
[ "StatsUpdate", "keeps", "track", "of", "the", "tablet_externally_reparented_timestamp", "of", "each", "master", ".", "This", "way", "we", "can", "detect", "the", "end", "of", "a", "failover", ".", "It", "is", "part", "of", "the", "discovery", ".", "HealthCheck...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/buffer/buffer.go#L219-L237
train
vitessio/vitess
go/vt/vtgate/buffer/buffer.go
getOrCreateBuffer
func (b *Buffer) getOrCreateBuffer(keyspace, shard string) *shardBuffer { key := topoproto.KeyspaceShardString(keyspace, shard) b.mu.RLock() sb, ok := b.buffers[key] stopped := b.stopped b.mu.RUnlock() if stopped { return nil } if ok { return sb } b.mu.Lock() defer b.mu.Unlock() // Look it up again be...
go
func (b *Buffer) getOrCreateBuffer(keyspace, shard string) *shardBuffer { key := topoproto.KeyspaceShardString(keyspace, shard) b.mu.RLock() sb, ok := b.buffers[key] stopped := b.stopped b.mu.RUnlock() if stopped { return nil } if ok { return sb } b.mu.Lock() defer b.mu.Unlock() // Look it up again be...
[ "func", "(", "b", "*", "Buffer", ")", "getOrCreateBuffer", "(", "keyspace", ",", "shard", "string", ")", "*", "shardBuffer", "{", "key", ":=", "topoproto", ".", "KeyspaceShardString", "(", "keyspace", ",", "shard", ")", "\n", "b", ".", "mu", ".", "RLock"...
// getOrCreateBuffer returns the ShardBuffer for the given keyspace and shard. // It returns nil if Buffer is shut down and all calls should be ignored.
[ "getOrCreateBuffer", "returns", "the", "ShardBuffer", "for", "the", "given", "keyspace", "and", "shard", ".", "It", "returns", "nil", "if", "Buffer", "is", "shut", "down", "and", "all", "calls", "should", "be", "ignored", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/buffer/buffer.go#L272-L295
train
vitessio/vitess
go/vt/topo/shard.go
addCells
func addCells(left, right []string) []string { if len(left) == 0 || len(right) == 0 { return nil } for _, cell := range right { if !InCellList(cell, left) { left = append(left, cell) } } return left }
go
func addCells(left, right []string) []string { if len(left) == 0 || len(right) == 0 { return nil } for _, cell := range right { if !InCellList(cell, left) { left = append(left, cell) } } return left }
[ "func", "addCells", "(", "left", ",", "right", "[", "]", "string", ")", "[", "]", "string", "{", "if", "len", "(", "left", ")", "==", "0", "||", "len", "(", "right", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n\n", "for", "_", ",", "c...
// Functions for dealing with shard representations in topology. // addCells will merge both cells list, settling on nil if either list is empty
[ "Functions", "for", "dealing", "with", "shard", "representations", "in", "topology", ".", "addCells", "will", "merge", "both", "cells", "list", "settling", "on", "nil", "if", "either", "list", "is", "empty" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/shard.go#L48-L59
train
vitessio/vitess
go/vt/topo/shard.go
removeCellsFromList
func removeCellsFromList(toRemove, fullList []string) []string { leftoverCells := make([]string, 0) for _, cell := range fullList { if !InCellList(cell, toRemove) { leftoverCells = append(leftoverCells, cell) } } return leftoverCells }
go
func removeCellsFromList(toRemove, fullList []string) []string { leftoverCells := make([]string, 0) for _, cell := range fullList { if !InCellList(cell, toRemove) { leftoverCells = append(leftoverCells, cell) } } return leftoverCells }
[ "func", "removeCellsFromList", "(", "toRemove", ",", "fullList", "[", "]", "string", ")", "[", "]", "string", "{", "leftoverCells", ":=", "make", "(", "[", "]", "string", ",", "0", ")", "\n", "for", "_", ",", "cell", ":=", "range", "fullList", "{", "...
// removeCellsFromList will remove the cells from the provided list. It returns // the new list, and a boolean that indicates the returned list is empty.
[ "removeCellsFromList", "will", "remove", "the", "cells", "from", "the", "provided", "list", ".", "It", "returns", "the", "new", "list", "and", "a", "boolean", "that", "indicates", "the", "returned", "list", "is", "empty", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/shard.go#L63-L71
train
vitessio/vitess
go/vt/topo/shard.go
removeCells
func removeCells(cells, toRemove, fullList []string) ([]string, bool) { // The assumption here is we already migrated something, // and we're reverting that part. So we're gonna remove // records only. leftoverCells := make([]string, 0, len(cells)) if len(cells) == 0 { // we migrated all the cells already, take ...
go
func removeCells(cells, toRemove, fullList []string) ([]string, bool) { // The assumption here is we already migrated something, // and we're reverting that part. So we're gonna remove // records only. leftoverCells := make([]string, 0, len(cells)) if len(cells) == 0 { // we migrated all the cells already, take ...
[ "func", "removeCells", "(", "cells", ",", "toRemove", ",", "fullList", "[", "]", "string", ")", "(", "[", "]", "string", ",", "bool", ")", "{", "// The assumption here is we already migrated something,", "// and we're reverting that part. So we're gonna remove", "// recor...
// removeCells will remove the cells from the provided list. It returns // the new list, and a boolean that indicates the returned list is empty.
[ "removeCells", "will", "remove", "the", "cells", "from", "the", "provided", "list", ".", "It", "returns", "the", "new", "list", "and", "a", "boolean", "that", "indicates", "the", "returned", "list", "is", "empty", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/shard.go#L75-L104
train
vitessio/vitess
go/vt/topo/shard.go
ValidateShardName
func ValidateShardName(shard string) (string, *topodatapb.KeyRange, error) { if !IsShardUsingRangeBasedSharding(shard) { return shard, nil, nil } parts := strings.Split(shard, "-") if len(parts) != 2 { return "", nil, vterrors.Errorf(vtrpc.Code_INVALID_ARGUMENT, "invalid shardId, can only contain one '-': %v",...
go
func ValidateShardName(shard string) (string, *topodatapb.KeyRange, error) { if !IsShardUsingRangeBasedSharding(shard) { return shard, nil, nil } parts := strings.Split(shard, "-") if len(parts) != 2 { return "", nil, vterrors.Errorf(vtrpc.Code_INVALID_ARGUMENT, "invalid shardId, can only contain one '-': %v",...
[ "func", "ValidateShardName", "(", "shard", "string", ")", "(", "string", ",", "*", "topodatapb", ".", "KeyRange", ",", "error", ")", "{", "if", "!", "IsShardUsingRangeBasedSharding", "(", "shard", ")", "{", "return", "shard", ",", "nil", ",", "nil", "\n", ...
// ValidateShardName takes a shard name and sanitizes it, and also returns // the KeyRange.
[ "ValidateShardName", "takes", "a", "shard", "name", "and", "sanitizes", "it", "and", "also", "returns", "the", "KeyRange", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/shard.go#L114-L134
train
vitessio/vitess
go/vt/topo/shard.go
GetShard
func (ts *Server) GetShard(ctx context.Context, keyspace, shard string) (*ShardInfo, error) { span, ctx := trace.NewSpan(ctx, "TopoServer.GetShard") span.Annotate("keyspace", keyspace) span.Annotate("shard", shard) defer span.Finish() shardPath := path.Join(KeyspacesPath, keyspace, ShardsPath, shard, ShardFile) ...
go
func (ts *Server) GetShard(ctx context.Context, keyspace, shard string) (*ShardInfo, error) { span, ctx := trace.NewSpan(ctx, "TopoServer.GetShard") span.Annotate("keyspace", keyspace) span.Annotate("shard", shard) defer span.Finish() shardPath := path.Join(KeyspacesPath, keyspace, ShardsPath, shard, ShardFile) ...
[ "func", "(", "ts", "*", "Server", ")", "GetShard", "(", "ctx", "context", ".", "Context", ",", "keyspace", ",", "shard", "string", ")", "(", "*", "ShardInfo", ",", "error", ")", "{", "span", ",", "ctx", ":=", "trace", ".", "NewSpan", "(", "ctx", ",...
// GetShard is a high level function to read shard data. // It generates trace spans.
[ "GetShard", "is", "a", "high", "level", "function", "to", "read", "shard", "data", ".", "It", "generates", "trace", "spans", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/shard.go#L179-L201
train
vitessio/vitess
go/vt/topo/shard.go
updateShard
func (ts *Server) updateShard(ctx context.Context, si *ShardInfo) error { span, ctx := trace.NewSpan(ctx, "TopoServer.UpdateShard") span.Annotate("keyspace", si.keyspace) span.Annotate("shard", si.shardName) defer span.Finish() data, err := proto.Marshal(si.Shard) if err != nil { return err } shardPath := pa...
go
func (ts *Server) updateShard(ctx context.Context, si *ShardInfo) error { span, ctx := trace.NewSpan(ctx, "TopoServer.UpdateShard") span.Annotate("keyspace", si.keyspace) span.Annotate("shard", si.shardName) defer span.Finish() data, err := proto.Marshal(si.Shard) if err != nil { return err } shardPath := pa...
[ "func", "(", "ts", "*", "Server", ")", "updateShard", "(", "ctx", "context", ".", "Context", ",", "si", "*", "ShardInfo", ")", "error", "{", "span", ",", "ctx", ":=", "trace", ".", "NewSpan", "(", "ctx", ",", "\"", "\"", ")", "\n", "span", ".", "...
// updateShard updates the shard data, with the right version. // It also creates a span, and dispatches the event.
[ "updateShard", "updates", "the", "shard", "data", "with", "the", "right", "version", ".", "It", "also", "creates", "a", "span", "and", "dispatches", "the", "event", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/shard.go#L205-L229
train
vitessio/vitess
go/vt/topo/shard.go
UpdateShardFields
func (ts *Server) UpdateShardFields(ctx context.Context, keyspace, shard string, update func(*ShardInfo) error) (*ShardInfo, error) { for { si, err := ts.GetShard(ctx, keyspace, shard) if err != nil { return nil, err } if err = update(si); err != nil { if IsErrType(err, NoUpdateNeeded) { return nil, ...
go
func (ts *Server) UpdateShardFields(ctx context.Context, keyspace, shard string, update func(*ShardInfo) error) (*ShardInfo, error) { for { si, err := ts.GetShard(ctx, keyspace, shard) if err != nil { return nil, err } if err = update(si); err != nil { if IsErrType(err, NoUpdateNeeded) { return nil, ...
[ "func", "(", "ts", "*", "Server", ")", "UpdateShardFields", "(", "ctx", "context", ".", "Context", ",", "keyspace", ",", "shard", "string", ",", "update", "func", "(", "*", "ShardInfo", ")", "error", ")", "(", "*", "ShardInfo", ",", "error", ")", "{", ...
// UpdateShardFields is a high level helper to read a shard record, call an // update function on it, and then write it back. If the write fails due to // a version mismatch, it will re-read the record and retry the update. // If the update succeeds, it returns the updated ShardInfo. // If the update method returns Err...
[ "UpdateShardFields", "is", "a", "high", "level", "helper", "to", "read", "a", "shard", "record", "call", "an", "update", "function", "on", "it", "and", "then", "write", "it", "back", ".", "If", "the", "write", "fails", "due", "to", "a", "version", "misma...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/shard.go#L240-L256
train
vitessio/vitess
go/vt/topo/shard.go
CreateShard
func (ts *Server) CreateShard(ctx context.Context, keyspace, shard string) (err error) { // Lock the keyspace, because we'll be looking at ServedTypes. ctx, unlock, lockErr := ts.LockKeyspace(ctx, keyspace, "CreateShard") if lockErr != nil { return lockErr } defer unlock(&err) // validate parameters name, key...
go
func (ts *Server) CreateShard(ctx context.Context, keyspace, shard string) (err error) { // Lock the keyspace, because we'll be looking at ServedTypes. ctx, unlock, lockErr := ts.LockKeyspace(ctx, keyspace, "CreateShard") if lockErr != nil { return lockErr } defer unlock(&err) // validate parameters name, key...
[ "func", "(", "ts", "*", "Server", ")", "CreateShard", "(", "ctx", "context", ".", "Context", ",", "keyspace", ",", "shard", "string", ")", "(", "err", "error", ")", "{", "// Lock the keyspace, because we'll be looking at ServedTypes.", "ctx", ",", "unlock", ",",...
// CreateShard creates a new shard and tries to fill in the right information. // This will lock the Keyspace, as we may be looking at other shard servedTypes. // Using GetOrCreateShard is probably a better idea for most use cases.
[ "CreateShard", "creates", "a", "new", "shard", "and", "tries", "to", "fill", "in", "the", "right", "information", ".", "This", "will", "lock", "the", "Keyspace", "as", "we", "may", "be", "looking", "at", "other", "shard", "servedTypes", ".", "Using", "GetO...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/shard.go#L261-L319
train
vitessio/vitess
go/vt/topo/shard.go
GetOrCreateShard
func (ts *Server) GetOrCreateShard(ctx context.Context, keyspace, shard string) (si *ShardInfo, err error) { si, err = ts.GetShard(ctx, keyspace, shard) if !IsErrType(err, NoNode) { return } // create the keyspace, maybe it already exists if err = ts.CreateKeyspace(ctx, keyspace, &topodatapb.Keyspace{}); err !=...
go
func (ts *Server) GetOrCreateShard(ctx context.Context, keyspace, shard string) (si *ShardInfo, err error) { si, err = ts.GetShard(ctx, keyspace, shard) if !IsErrType(err, NoNode) { return } // create the keyspace, maybe it already exists if err = ts.CreateKeyspace(ctx, keyspace, &topodatapb.Keyspace{}); err !=...
[ "func", "(", "ts", "*", "Server", ")", "GetOrCreateShard", "(", "ctx", "context", ".", "Context", ",", "keyspace", ",", "shard", "string", ")", "(", "si", "*", "ShardInfo", ",", "err", "error", ")", "{", "si", ",", "err", "=", "ts", ".", "GetShard", ...
// GetOrCreateShard will return the shard object, or create one if it doesn't // already exist. Note the shard creation is protected by a keyspace Lock.
[ "GetOrCreateShard", "will", "return", "the", "shard", "object", "or", "create", "one", "if", "it", "doesn", "t", "already", "exist", ".", "Note", "the", "shard", "creation", "is", "protected", "by", "a", "keyspace", "Lock", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/shard.go#L323-L342
train
vitessio/vitess
go/vt/topo/shard.go
DeleteShard
func (ts *Server) DeleteShard(ctx context.Context, keyspace, shard string) error { shardPath := path.Join(KeyspacesPath, keyspace, ShardsPath, shard, ShardFile) if err := ts.globalCell.Delete(ctx, shardPath, nil); err != nil { return err } event.Dispatch(&events.ShardChange{ KeyspaceName: keyspace, ShardName:...
go
func (ts *Server) DeleteShard(ctx context.Context, keyspace, shard string) error { shardPath := path.Join(KeyspacesPath, keyspace, ShardsPath, shard, ShardFile) if err := ts.globalCell.Delete(ctx, shardPath, nil); err != nil { return err } event.Dispatch(&events.ShardChange{ KeyspaceName: keyspace, ShardName:...
[ "func", "(", "ts", "*", "Server", ")", "DeleteShard", "(", "ctx", "context", ".", "Context", ",", "keyspace", ",", "shard", "string", ")", "error", "{", "shardPath", ":=", "path", ".", "Join", "(", "KeyspacesPath", ",", "keyspace", ",", "ShardsPath", ","...
// DeleteShard wraps the underlying conn.Delete // and dispatches the event.
[ "DeleteShard", "wraps", "the", "underlying", "conn", ".", "Delete", "and", "dispatches", "the", "event", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/shard.go#L346-L358
train
vitessio/vitess
go/vt/topo/shard.go
GetTabletControl
func (si *ShardInfo) GetTabletControl(tabletType topodatapb.TabletType) *topodatapb.Shard_TabletControl { for _, tc := range si.TabletControls { if tc.TabletType == tabletType { return tc } } return nil }
go
func (si *ShardInfo) GetTabletControl(tabletType topodatapb.TabletType) *topodatapb.Shard_TabletControl { for _, tc := range si.TabletControls { if tc.TabletType == tabletType { return tc } } return nil }
[ "func", "(", "si", "*", "ShardInfo", ")", "GetTabletControl", "(", "tabletType", "topodatapb", ".", "TabletType", ")", "*", "topodatapb", ".", "Shard_TabletControl", "{", "for", "_", ",", "tc", ":=", "range", "si", ".", "TabletControls", "{", "if", "tc", "...
// GetTabletControl returns the Shard_TabletControl for the given tablet type, // or nil if it is not in the map.
[ "GetTabletControl", "returns", "the", "Shard_TabletControl", "for", "the", "given", "tablet", "type", "or", "nil", "if", "it", "is", "not", "in", "the", "map", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/shard.go#L362-L369
train
vitessio/vitess
go/vt/topo/shard.go
GetServedType
func (si *ShardInfo) GetServedType(tabletType topodatapb.TabletType) *topodatapb.Shard_ServedType { for _, st := range si.ServedTypes { if st.TabletType == tabletType { return st } } return nil }
go
func (si *ShardInfo) GetServedType(tabletType topodatapb.TabletType) *topodatapb.Shard_ServedType { for _, st := range si.ServedTypes { if st.TabletType == tabletType { return st } } return nil }
[ "func", "(", "si", "*", "ShardInfo", ")", "GetServedType", "(", "tabletType", "topodatapb", ".", "TabletType", ")", "*", "topodatapb", ".", "Shard_ServedType", "{", "for", "_", ",", "st", ":=", "range", "si", ".", "ServedTypes", "{", "if", "st", ".", "Ta...
// GetServedType returns the Shard_ServedType for a TabletType, or nil
[ "GetServedType", "returns", "the", "Shard_ServedType", "for", "a", "TabletType", "or", "nil" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/shard.go#L433-L440
train
vitessio/vitess
go/vt/topo/shard.go
InCellList
func InCellList(cell string, cells []string) bool { if len(cells) == 0 { return true } for _, c := range cells { if c == cell { return true } } return false }
go
func InCellList(cell string, cells []string) bool { if len(cells) == 0 { return true } for _, c := range cells { if c == cell { return true } } return false }
[ "func", "InCellList", "(", "cell", "string", ",", "cells", "[", "]", "string", ")", "bool", "{", "if", "len", "(", "cells", ")", "==", "0", "{", "return", "true", "\n", "}", "\n", "for", "_", ",", "c", ":=", "range", "cells", "{", "if", "c", "=...
// // Utility functions for shards // // InCellList returns true if the cell list is empty, // or if the passed cell is in the cell list.
[ "Utility", "functions", "for", "shards", "InCellList", "returns", "true", "if", "the", "cell", "list", "is", "empty", "or", "if", "the", "passed", "cell", "is", "in", "the", "cell", "list", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/shard.go#L448-L458
train
vitessio/vitess
go/vt/topo/shard.go
FindAllTabletAliasesInShard
func (ts *Server) FindAllTabletAliasesInShard(ctx context.Context, keyspace, shard string) ([]*topodatapb.TabletAlias, error) { return ts.FindAllTabletAliasesInShardByCell(ctx, keyspace, shard, nil) }
go
func (ts *Server) FindAllTabletAliasesInShard(ctx context.Context, keyspace, shard string) ([]*topodatapb.TabletAlias, error) { return ts.FindAllTabletAliasesInShardByCell(ctx, keyspace, shard, nil) }
[ "func", "(", "ts", "*", "Server", ")", "FindAllTabletAliasesInShard", "(", "ctx", "context", ".", "Context", ",", "keyspace", ",", "shard", "string", ")", "(", "[", "]", "*", "topodatapb", ".", "TabletAlias", ",", "error", ")", "{", "return", "ts", ".", ...
// FindAllTabletAliasesInShard uses the replication graph to find all the // tablet aliases in the given shard. // // It can return ErrPartialResult if some cells were not fetched, // in which case the result only contains the cells that were fetched. // // The tablet aliases are sorted by cell, then by UID.
[ "FindAllTabletAliasesInShard", "uses", "the", "replication", "graph", "to", "find", "all", "the", "tablet", "aliases", "in", "the", "given", "shard", ".", "It", "can", "return", "ErrPartialResult", "if", "some", "cells", "were", "not", "fetched", "in", "which", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/shard.go#L467-L469
train
vitessio/vitess
go/vt/topo/shard.go
FindAllTabletAliasesInShardByCell
func (ts *Server) FindAllTabletAliasesInShardByCell(ctx context.Context, keyspace, shard string, cells []string) ([]*topodatapb.TabletAlias, error) { span, ctx := trace.NewSpan(ctx, "topo.FindAllTabletAliasesInShardbyCell") span.Annotate("keyspace", keyspace) span.Annotate("shard", shard) span.Annotate("num_cells",...
go
func (ts *Server) FindAllTabletAliasesInShardByCell(ctx context.Context, keyspace, shard string, cells []string) ([]*topodatapb.TabletAlias, error) { span, ctx := trace.NewSpan(ctx, "topo.FindAllTabletAliasesInShardbyCell") span.Annotate("keyspace", keyspace) span.Annotate("shard", shard) span.Annotate("num_cells",...
[ "func", "(", "ts", "*", "Server", ")", "FindAllTabletAliasesInShardByCell", "(", "ctx", "context", ".", "Context", ",", "keyspace", ",", "shard", "string", ",", "cells", "[", "]", "string", ")", "(", "[", "]", "*", "topodatapb", ".", "TabletAlias", ",", ...
// FindAllTabletAliasesInShardByCell uses the replication graph to find all the // tablet aliases in the given shard. // // It can return ErrPartialResult if some cells were not fetched, // in which case the result only contains the cells that were fetched. // // The tablet aliases are sorted by cell, then by UID.
[ "FindAllTabletAliasesInShardByCell", "uses", "the", "replication", "graph", "to", "find", "all", "the", "tablet", "aliases", "in", "the", "given", "shard", ".", "It", "can", "return", "ErrPartialResult", "if", "some", "cells", "were", "not", "fetched", "in", "wh...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/shard.go#L478-L546
train
vitessio/vitess
go/mysql/gtid.go
ParseGTID
func ParseGTID(flavor, value string) (GTID, error) { parser := gtidParsers[flavor] if parser == nil { return nil, vterrors.Errorf(vtrpc.Code_INTERNAL, "parse error: unknown GTID flavor %#v", flavor) } return parser(value) }
go
func ParseGTID(flavor, value string) (GTID, error) { parser := gtidParsers[flavor] if parser == nil { return nil, vterrors.Errorf(vtrpc.Code_INTERNAL, "parse error: unknown GTID flavor %#v", flavor) } return parser(value) }
[ "func", "ParseGTID", "(", "flavor", ",", "value", "string", ")", "(", "GTID", ",", "error", ")", "{", "parser", ":=", "gtidParsers", "[", "flavor", "]", "\n", "if", "parser", "==", "nil", "{", "return", "nil", ",", "vterrors", ".", "Errorf", "(", "vt...
// ParseGTID calls the GTID parser for the specified flavor.
[ "ParseGTID", "calls", "the", "GTID", "parser", "for", "the", "specified", "flavor", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/gtid.go#L63-L69
train
vitessio/vitess
go/mysql/gtid.go
MustParseGTID
func MustParseGTID(flavor, value string) GTID { gtid, err := ParseGTID(flavor, value) if err != nil { panic(err) } return gtid }
go
func MustParseGTID(flavor, value string) GTID { gtid, err := ParseGTID(flavor, value) if err != nil { panic(err) } return gtid }
[ "func", "MustParseGTID", "(", "flavor", ",", "value", "string", ")", "GTID", "{", "gtid", ",", "err", ":=", "ParseGTID", "(", "flavor", ",", "value", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "return", "gt...
// MustParseGTID calls ParseGTID and panics on error.
[ "MustParseGTID", "calls", "ParseGTID", "and", "panics", "on", "error", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/gtid.go#L72-L78
train
vitessio/vitess
go/mysql/gtid.go
EncodeGTID
func EncodeGTID(gtid GTID) string { if gtid == nil { return "" } return fmt.Sprintf("%s/%s", gtid.Flavor(), gtid.String()) }
go
func EncodeGTID(gtid GTID) string { if gtid == nil { return "" } return fmt.Sprintf("%s/%s", gtid.Flavor(), gtid.String()) }
[ "func", "EncodeGTID", "(", "gtid", "GTID", ")", "string", "{", "if", "gtid", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "gtid", ".", "Flavor", "(", ")", ",", "gtid", ".", "Str...
// EncodeGTID returns a string that contains both the flavor and value of the // GTID, so that the correct parser can be selected when that string is passed // to DecodeGTID.
[ "EncodeGTID", "returns", "a", "string", "that", "contains", "both", "the", "flavor", "and", "value", "of", "the", "GTID", "so", "that", "the", "correct", "parser", "can", "be", "selected", "when", "that", "string", "is", "passed", "to", "DecodeGTID", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/gtid.go#L83-L89
train
vitessio/vitess
go/mysql/gtid.go
DecodeGTID
func DecodeGTID(s string) (GTID, error) { if s == "" { return nil, nil } parts := strings.SplitN(s, "/", 2) if len(parts) != 2 { // There is no flavor. Try looking for a default parser. return ParseGTID("", s) } return ParseGTID(parts[0], parts[1]) }
go
func DecodeGTID(s string) (GTID, error) { if s == "" { return nil, nil } parts := strings.SplitN(s, "/", 2) if len(parts) != 2 { // There is no flavor. Try looking for a default parser. return ParseGTID("", s) } return ParseGTID(parts[0], parts[1]) }
[ "func", "DecodeGTID", "(", "s", "string", ")", "(", "GTID", ",", "error", ")", "{", "if", "s", "==", "\"", "\"", "{", "return", "nil", ",", "nil", "\n", "}", "\n\n", "parts", ":=", "strings", ".", "SplitN", "(", "s", ",", "\"", "\"", ",", "2", ...
// DecodeGTID converts a string in the format returned by EncodeGTID back into // a GTID interface value with the correct underlying flavor.
[ "DecodeGTID", "converts", "a", "string", "in", "the", "format", "returned", "by", "EncodeGTID", "back", "into", "a", "GTID", "interface", "value", "with", "the", "correct", "underlying", "flavor", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/gtid.go#L93-L104
train
vitessio/vitess
go/mysql/gtid.go
MustDecodeGTID
func MustDecodeGTID(s string) GTID { gtid, err := DecodeGTID(s) if err != nil { panic(err) } return gtid }
go
func MustDecodeGTID(s string) GTID { gtid, err := DecodeGTID(s) if err != nil { panic(err) } return gtid }
[ "func", "MustDecodeGTID", "(", "s", "string", ")", "GTID", "{", "gtid", ",", "err", ":=", "DecodeGTID", "(", "s", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "return", "gtid", "\n", "}" ]
// MustDecodeGTID calls DecodeGTID and panics on error.
[ "MustDecodeGTID", "calls", "DecodeGTID", "and", "panics", "on", "error", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/gtid.go#L107-L113
train
vitessio/vitess
go/vt/binlog/binlogplayer/binlog_player.go
SetLastPosition
func (bps *Stats) SetLastPosition(pos mysql.Position) { bps.lastPositionMutex.Lock() defer bps.lastPositionMutex.Unlock() bps.lastPosition = pos }
go
func (bps *Stats) SetLastPosition(pos mysql.Position) { bps.lastPositionMutex.Lock() defer bps.lastPositionMutex.Unlock() bps.lastPosition = pos }
[ "func", "(", "bps", "*", "Stats", ")", "SetLastPosition", "(", "pos", "mysql", ".", "Position", ")", "{", "bps", ".", "lastPositionMutex", ".", "Lock", "(", ")", "\n", "defer", "bps", ".", "lastPositionMutex", ".", "Unlock", "(", ")", "\n", "bps", ".",...
// SetLastPosition sets the last replication position.
[ "SetLastPosition", "sets", "the", "last", "replication", "position", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/binlog/binlogplayer/binlog_player.go#L85-L89
train
vitessio/vitess
go/vt/binlog/binlogplayer/binlog_player.go
LastPosition
func (bps *Stats) LastPosition() mysql.Position { bps.lastPositionMutex.Lock() defer bps.lastPositionMutex.Unlock() return bps.lastPosition }
go
func (bps *Stats) LastPosition() mysql.Position { bps.lastPositionMutex.Lock() defer bps.lastPositionMutex.Unlock() return bps.lastPosition }
[ "func", "(", "bps", "*", "Stats", ")", "LastPosition", "(", ")", "mysql", ".", "Position", "{", "bps", ".", "lastPositionMutex", ".", "Lock", "(", ")", "\n", "defer", "bps", ".", "lastPositionMutex", ".", "Unlock", "(", ")", "\n", "return", "bps", ".",...
// LastPosition gets the last replication position.
[ "LastPosition", "gets", "the", "last", "replication", "position", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/binlog/binlogplayer/binlog_player.go#L92-L96
train
vitessio/vitess
go/vt/binlog/binlogplayer/binlog_player.go
MessageHistory
func (bps *Stats) MessageHistory() []string { strs := make([]string, 0, 3) for _, h := range bps.History.Records() { h1, _ := h.(*StatsHistoryRecord) if h1 != nil { strs = append(strs, h1.Message) } } return strs }
go
func (bps *Stats) MessageHistory() []string { strs := make([]string, 0, 3) for _, h := range bps.History.Records() { h1, _ := h.(*StatsHistoryRecord) if h1 != nil { strs = append(strs, h1.Message) } } return strs }
[ "func", "(", "bps", "*", "Stats", ")", "MessageHistory", "(", ")", "[", "]", "string", "{", "strs", ":=", "make", "(", "[", "]", "string", ",", "0", ",", "3", ")", "\n", "for", "_", ",", "h", ":=", "range", "bps", ".", "History", ".", "Records"...
// MessageHistory gets all the messages, we store 3 at a time
[ "MessageHistory", "gets", "all", "the", "messages", "we", "store", "3", "at", "a", "time" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/binlog/binlogplayer/binlog_player.go#L99-L108
train
vitessio/vitess
go/vt/binlog/binlogplayer/binlog_player.go
NewStats
func NewStats() *Stats { bps := &Stats{} bps.Timings = stats.NewTimings("", "", "") bps.Rates = stats.NewRates("", bps.Timings, 15, 60e9) bps.History = history.New(3) bps.SecondsBehindMaster.Set(math.MaxInt64) return bps }
go
func NewStats() *Stats { bps := &Stats{} bps.Timings = stats.NewTimings("", "", "") bps.Rates = stats.NewRates("", bps.Timings, 15, 60e9) bps.History = history.New(3) bps.SecondsBehindMaster.Set(math.MaxInt64) return bps }
[ "func", "NewStats", "(", ")", "*", "Stats", "{", "bps", ":=", "&", "Stats", "{", "}", "\n", "bps", ".", "Timings", "=", "stats", ".", "NewTimings", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "bps", ".", "Rates", "=", "stats",...
// NewStats creates a new Stats structure.
[ "NewStats", "creates", "a", "new", "Stats", "structure", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/binlog/binlogplayer/binlog_player.go#L111-L118
train
vitessio/vitess
go/vt/binlog/binlogplayer/binlog_player.go
ApplyBinlogEvents
func (blp *BinlogPlayer) ApplyBinlogEvents(ctx context.Context) error { if err := SetVReplicationState(blp.dbClient, blp.uid, BlpRunning, ""); err != nil { log.Errorf("Error writing Running state: %v", err) } if err := blp.applyEvents(ctx); err != nil { msg := err.Error() blp.blplStats.History.Add(&StatsHisto...
go
func (blp *BinlogPlayer) ApplyBinlogEvents(ctx context.Context) error { if err := SetVReplicationState(blp.dbClient, blp.uid, BlpRunning, ""); err != nil { log.Errorf("Error writing Running state: %v", err) } if err := blp.applyEvents(ctx); err != nil { msg := err.Error() blp.blplStats.History.Add(&StatsHisto...
[ "func", "(", "blp", "*", "BinlogPlayer", ")", "ApplyBinlogEvents", "(", "ctx", "context", ".", "Context", ")", "error", "{", "if", "err", ":=", "SetVReplicationState", "(", "blp", ".", "dbClient", ",", "blp", ".", "uid", ",", "BlpRunning", ",", "\"", "\"...
// ApplyBinlogEvents makes an RPC request to BinlogServer // and processes the events. It returns nil if the provided context // was canceled, or if we reached the stopping point. // If an error is encountered, it updates the vreplication state to "Error". // If a stop position was specifed, and reached, the state is u...
[ "ApplyBinlogEvents", "makes", "an", "RPC", "request", "to", "BinlogServer", "and", "processes", "the", "events", ".", "It", "returns", "nil", "if", "the", "provided", "context", "was", "canceled", "or", "if", "we", "reached", "the", "stopping", "point", ".", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/binlog/binlogplayer/binlog_player.go#L178-L195
train
vitessio/vitess
go/vt/binlog/binlogplayer/binlog_player.go
SetVReplicationState
func SetVReplicationState(dbClient DBClient, uid uint32, state, message string) error { query := fmt.Sprintf("update _vt.vreplication set state='%v', message=%v where id=%v", state, encodeString(message), uid) if _, err := dbClient.ExecuteFetch(query, 1); err != nil { return fmt.Errorf("could not set state: %v: %v"...
go
func SetVReplicationState(dbClient DBClient, uid uint32, state, message string) error { query := fmt.Sprintf("update _vt.vreplication set state='%v', message=%v where id=%v", state, encodeString(message), uid) if _, err := dbClient.ExecuteFetch(query, 1); err != nil { return fmt.Errorf("could not set state: %v: %v"...
[ "func", "SetVReplicationState", "(", "dbClient", "DBClient", ",", "uid", "uint32", ",", "state", ",", "message", "string", ")", "error", "{", "query", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "state", ",", "encodeString", "(", "message", ")", "...
// SetVReplicationState updates the state in the _vt.vreplication table.
[ "SetVReplicationState", "updates", "the", "state", "in", "the", "_vt", ".", "vreplication", "table", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/binlog/binlogplayer/binlog_player.go#L510-L516
train
vitessio/vitess
go/vt/binlog/binlogplayer/binlog_player.go
ReadVRSettings
func ReadVRSettings(dbClient DBClient, uid uint32) (VRSettings, error) { query := fmt.Sprintf("select pos, stop_pos, max_tps, max_replication_lag, state from _vt.vreplication where id=%v", uid) qr, err := dbClient.ExecuteFetch(query, 1) if err != nil { return VRSettings{}, fmt.Errorf("error %v in selecting vreplic...
go
func ReadVRSettings(dbClient DBClient, uid uint32) (VRSettings, error) { query := fmt.Sprintf("select pos, stop_pos, max_tps, max_replication_lag, state from _vt.vreplication where id=%v", uid) qr, err := dbClient.ExecuteFetch(query, 1) if err != nil { return VRSettings{}, fmt.Errorf("error %v in selecting vreplic...
[ "func", "ReadVRSettings", "(", "dbClient", "DBClient", ",", "uid", "uint32", ")", "(", "VRSettings", ",", "error", ")", "{", "query", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "uid", ")", "\n", "qr", ",", "err", ":=", "dbClient", ".", "Execu...
// ReadVRSettings retrieves the throttler settings for // vreplication from the checkpoint table.
[ "ReadVRSettings", "retrieves", "the", "throttler", "settings", "for", "vreplication", "from", "the", "checkpoint", "table", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/binlog/binlogplayer/binlog_player.go#L529-L565
train
vitessio/vitess
go/vt/binlog/binlogplayer/binlog_player.go
CreateVReplication
func CreateVReplication(workflow string, source *binlogdatapb.BinlogSource, position string, maxTPS, maxReplicationLag, timeUpdated int64, dbName string) string { return fmt.Sprintf("insert into _vt.vreplication "+ "(workflow, source, pos, max_tps, max_replication_lag, time_updated, transaction_timestamp, state, db_...
go
func CreateVReplication(workflow string, source *binlogdatapb.BinlogSource, position string, maxTPS, maxReplicationLag, timeUpdated int64, dbName string) string { return fmt.Sprintf("insert into _vt.vreplication "+ "(workflow, source, pos, max_tps, max_replication_lag, time_updated, transaction_timestamp, state, db_...
[ "func", "CreateVReplication", "(", "workflow", "string", ",", "source", "*", "binlogdatapb", ".", "BinlogSource", ",", "position", "string", ",", "maxTPS", ",", "maxReplicationLag", ",", "timeUpdated", "int64", ",", "dbName", "string", ")", "string", "{", "retur...
// CreateVReplication returns a statement to populate the first value into // the _vt.vreplication table.
[ "CreateVReplication", "returns", "a", "statement", "to", "populate", "the", "first", "value", "into", "the", "_vt", ".", "vreplication", "table", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/binlog/binlogplayer/binlog_player.go#L569-L574
train
vitessio/vitess
go/vt/binlog/binlogplayer/binlog_player.go
CreateVReplicationState
func CreateVReplicationState(workflow string, source *binlogdatapb.BinlogSource, position, state string, dbName string) string { return fmt.Sprintf("insert into _vt.vreplication "+ "(workflow, source, pos, max_tps, max_replication_lag, time_updated, transaction_timestamp, state, db_name) "+ "values (%v, %v, %v, %v...
go
func CreateVReplicationState(workflow string, source *binlogdatapb.BinlogSource, position, state string, dbName string) string { return fmt.Sprintf("insert into _vt.vreplication "+ "(workflow, source, pos, max_tps, max_replication_lag, time_updated, transaction_timestamp, state, db_name) "+ "values (%v, %v, %v, %v...
[ "func", "CreateVReplicationState", "(", "workflow", "string", ",", "source", "*", "binlogdatapb", ".", "BinlogSource", ",", "position", ",", "state", "string", ",", "dbName", "string", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", "+"...
// CreateVReplicationState returns a statement to create a stopped vreplication.
[ "CreateVReplicationState", "returns", "a", "statement", "to", "create", "a", "stopped", "vreplication", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/binlog/binlogplayer/binlog_player.go#L577-L582
train
vitessio/vitess
go/vt/binlog/binlogplayer/binlog_player.go
GenerateUpdatePos
func GenerateUpdatePos(uid uint32, pos mysql.Position, timeUpdated int64, txTimestamp int64) string { if txTimestamp != 0 { return fmt.Sprintf( "update _vt.vreplication set pos=%v, time_updated=%v, transaction_timestamp=%v, message='' where id=%v", encodeString(mysql.EncodePosition(pos)), timeUpdated, txTimest...
go
func GenerateUpdatePos(uid uint32, pos mysql.Position, timeUpdated int64, txTimestamp int64) string { if txTimestamp != 0 { return fmt.Sprintf( "update _vt.vreplication set pos=%v, time_updated=%v, transaction_timestamp=%v, message='' where id=%v", encodeString(mysql.EncodePosition(pos)), timeUpdated, txTimest...
[ "func", "GenerateUpdatePos", "(", "uid", "uint32", ",", "pos", "mysql", ".", "Position", ",", "timeUpdated", "int64", ",", "txTimestamp", "int64", ")", "string", "{", "if", "txTimestamp", "!=", "0", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ...
// GenerateUpdatePos returns a statement to update a value in the // _vt.vreplication table.
[ "GenerateUpdatePos", "returns", "a", "statement", "to", "update", "a", "value", "in", "the", "_vt", ".", "vreplication", "table", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/binlog/binlogplayer/binlog_player.go#L586-L596
train
vitessio/vitess
go/vt/binlog/binlogplayer/binlog_player.go
StartVReplicationUntil
func StartVReplicationUntil(uid uint32, pos string) string { return fmt.Sprintf( "update _vt.vreplication set state='%v', stop_pos=%v where id=%v", BlpRunning, encodeString(pos), uid) }
go
func StartVReplicationUntil(uid uint32, pos string) string { return fmt.Sprintf( "update _vt.vreplication set state='%v', stop_pos=%v where id=%v", BlpRunning, encodeString(pos), uid) }
[ "func", "StartVReplicationUntil", "(", "uid", "uint32", ",", "pos", "string", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "BlpRunning", ",", "encodeString", "(", "pos", ")", ",", "uid", ")", "\n", "}" ]
// StartVReplicationUntil returns a statement to start the replication with a stop position.
[ "StartVReplicationUntil", "returns", "a", "statement", "to", "start", "the", "replication", "with", "a", "stop", "position", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/binlog/binlogplayer/binlog_player.go#L606-L610
train
vitessio/vitess
go/vt/binlog/binlogplayer/binlog_player.go
StopVReplication
func StopVReplication(uid uint32, message string) string { return fmt.Sprintf( "update _vt.vreplication set state='%v', message=%v where id=%v", BlpStopped, encodeString(message), uid) }
go
func StopVReplication(uid uint32, message string) string { return fmt.Sprintf( "update _vt.vreplication set state='%v', message=%v where id=%v", BlpStopped, encodeString(message), uid) }
[ "func", "StopVReplication", "(", "uid", "uint32", ",", "message", "string", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "BlpStopped", ",", "encodeString", "(", "message", ")", ",", "uid", ")", "\n", "}" ]
// StopVReplication returns a statement to stop the replication.
[ "StopVReplication", "returns", "a", "statement", "to", "stop", "the", "replication", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/binlog/binlogplayer/binlog_player.go#L613-L617
train
vitessio/vitess
go/vt/vtctld/action_repository.go
NewActionRepository
func NewActionRepository(ts *topo.Server) *ActionRepository { return &ActionRepository{ keyspaceActions: make(map[string]actionKeyspaceMethod), shardActions: make(map[string]actionShardMethod), tabletActions: make(map[string]actionTabletRecord), ts: ts, } }
go
func NewActionRepository(ts *topo.Server) *ActionRepository { return &ActionRepository{ keyspaceActions: make(map[string]actionKeyspaceMethod), shardActions: make(map[string]actionShardMethod), tabletActions: make(map[string]actionTabletRecord), ts: ts, } }
[ "func", "NewActionRepository", "(", "ts", "*", "topo", ".", "Server", ")", "*", "ActionRepository", "{", "return", "&", "ActionRepository", "{", "keyspaceActions", ":", "make", "(", "map", "[", "string", "]", "actionKeyspaceMethod", ")", ",", "shardActions", "...
// NewActionRepository creates and returns a new ActionRepository, // with no actions.
[ "NewActionRepository", "creates", "and", "returns", "a", "new", "ActionRepository", "with", "no", "actions", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtctld/action_repository.go#L81-L88
train
vitessio/vitess
go/vt/vtctld/action_repository.go
RegisterKeyspaceAction
func (ar *ActionRepository) RegisterKeyspaceAction(name string, method actionKeyspaceMethod) { ar.keyspaceActions[name] = method }
go
func (ar *ActionRepository) RegisterKeyspaceAction(name string, method actionKeyspaceMethod) { ar.keyspaceActions[name] = method }
[ "func", "(", "ar", "*", "ActionRepository", ")", "RegisterKeyspaceAction", "(", "name", "string", ",", "method", "actionKeyspaceMethod", ")", "{", "ar", ".", "keyspaceActions", "[", "name", "]", "=", "method", "\n", "}" ]
// RegisterKeyspaceAction registers a new action on a keyspace.
[ "RegisterKeyspaceAction", "registers", "a", "new", "action", "on", "a", "keyspace", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtctld/action_repository.go#L91-L93
train
vitessio/vitess
go/vt/vtctld/action_repository.go
RegisterShardAction
func (ar *ActionRepository) RegisterShardAction(name string, method actionShardMethod) { ar.shardActions[name] = method }
go
func (ar *ActionRepository) RegisterShardAction(name string, method actionShardMethod) { ar.shardActions[name] = method }
[ "func", "(", "ar", "*", "ActionRepository", ")", "RegisterShardAction", "(", "name", "string", ",", "method", "actionShardMethod", ")", "{", "ar", ".", "shardActions", "[", "name", "]", "=", "method", "\n", "}" ]
// RegisterShardAction registers a new action on a shard.
[ "RegisterShardAction", "registers", "a", "new", "action", "on", "a", "shard", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtctld/action_repository.go#L96-L98
train
vitessio/vitess
go/vt/vtctld/action_repository.go
RegisterTabletAction
func (ar *ActionRepository) RegisterTabletAction(name, role string, method actionTabletMethod) { ar.tabletActions[name] = actionTabletRecord{ role: role, method: method, } }
go
func (ar *ActionRepository) RegisterTabletAction(name, role string, method actionTabletMethod) { ar.tabletActions[name] = actionTabletRecord{ role: role, method: method, } }
[ "func", "(", "ar", "*", "ActionRepository", ")", "RegisterTabletAction", "(", "name", ",", "role", "string", ",", "method", "actionTabletMethod", ")", "{", "ar", ".", "tabletActions", "[", "name", "]", "=", "actionTabletRecord", "{", "role", ":", "role", ","...
// RegisterTabletAction registers a new action on a tablet.
[ "RegisterTabletAction", "registers", "a", "new", "action", "on", "a", "tablet", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtctld/action_repository.go#L101-L106
train
vitessio/vitess
go/vt/vtctld/action_repository.go
ApplyKeyspaceAction
func (ar *ActionRepository) ApplyKeyspaceAction(ctx context.Context, actionName, keyspace string, r *http.Request) *ActionResult { result := &ActionResult{Name: actionName, Parameters: keyspace} action, ok := ar.keyspaceActions[actionName] if !ok { result.error("Unknown keyspace action") return result } ctx,...
go
func (ar *ActionRepository) ApplyKeyspaceAction(ctx context.Context, actionName, keyspace string, r *http.Request) *ActionResult { result := &ActionResult{Name: actionName, Parameters: keyspace} action, ok := ar.keyspaceActions[actionName] if !ok { result.error("Unknown keyspace action") return result } ctx,...
[ "func", "(", "ar", "*", "ActionRepository", ")", "ApplyKeyspaceAction", "(", "ctx", "context", ".", "Context", ",", "actionName", ",", "keyspace", "string", ",", "r", "*", "http", ".", "Request", ")", "*", "ActionResult", "{", "result", ":=", "&", "ActionR...
// ApplyKeyspaceAction applies the provided action to the keyspace.
[ "ApplyKeyspaceAction", "applies", "the", "provided", "action", "to", "the", "keyspace", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtctld/action_repository.go#L109-L128
train
vitessio/vitess
go/vt/vtctld/action_repository.go
ApplyTabletAction
func (ar *ActionRepository) ApplyTabletAction(ctx context.Context, actionName string, tabletAlias *topodatapb.TabletAlias, r *http.Request) *ActionResult { result := &ActionResult{ Name: actionName, Parameters: topoproto.TabletAliasString(tabletAlias), } action, ok := ar.tabletActions[actionName] if !ok ...
go
func (ar *ActionRepository) ApplyTabletAction(ctx context.Context, actionName string, tabletAlias *topodatapb.TabletAlias, r *http.Request) *ActionResult { result := &ActionResult{ Name: actionName, Parameters: topoproto.TabletAliasString(tabletAlias), } action, ok := ar.tabletActions[actionName] if !ok ...
[ "func", "(", "ar", "*", "ActionRepository", ")", "ApplyTabletAction", "(", "ctx", "context", ".", "Context", ",", "actionName", "string", ",", "tabletAlias", "*", "topodatapb", ".", "TabletAlias", ",", "r", "*", "http", ".", "Request", ")", "*", "ActionResul...
// ApplyTabletAction applies the provided action to the tablet.
[ "ApplyTabletAction", "applies", "the", "provided", "action", "to", "the", "tablet", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtctld/action_repository.go#L158-L189
train
vitessio/vitess
go/vt/worker/worker.go
resetVars
func resetVars() { statsState.Set("") statsRetryCount.Reset() statsRetryCounters.ResetAll() statsOnlineInsertsCounters.ResetAll() statsOnlineUpdatesCounters.ResetAll() statsOnlineDeletesCounters.ResetAll() statsOnlineEqualRowsCounters.ResetAll() statsOfflineInsertsCounters.ResetAll() statsOfflineUpdatesCount...
go
func resetVars() { statsState.Set("") statsRetryCount.Reset() statsRetryCounters.ResetAll() statsOnlineInsertsCounters.ResetAll() statsOnlineUpdatesCounters.ResetAll() statsOnlineDeletesCounters.ResetAll() statsOnlineEqualRowsCounters.ResetAll() statsOfflineInsertsCounters.ResetAll() statsOfflineUpdatesCount...
[ "func", "resetVars", "(", ")", "{", "statsState", ".", "Set", "(", "\"", "\"", ")", "\n", "statsRetryCount", ".", "Reset", "(", ")", "\n", "statsRetryCounters", ".", "ResetAll", "(", ")", "\n\n", "statsOnlineInsertsCounters", ".", "ResetAll", "(", ")", "\n...
// resetVars resets the debug variables that are meant to provide information on a // per-run basis. This should be called at the beginning of each worker run.
[ "resetVars", "resets", "the", "debug", "variables", "that", "are", "meant", "to", "provide", "information", "on", "a", "per", "-", "run", "basis", ".", "This", "should", "be", "called", "at", "the", "beginning", "of", "each", "worker", "run", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/worker.go#L132-L149
train
vitessio/vitess
go/vt/vtgate/engine/route.go
NewSimpleRoute
func NewSimpleRoute(opcode RouteOpcode, keyspace *vindexes.Keyspace) *Route { return &Route{ Opcode: opcode, Keyspace: keyspace, } }
go
func NewSimpleRoute(opcode RouteOpcode, keyspace *vindexes.Keyspace) *Route { return &Route{ Opcode: opcode, Keyspace: keyspace, } }
[ "func", "NewSimpleRoute", "(", "opcode", "RouteOpcode", ",", "keyspace", "*", "vindexes", ".", "Keyspace", ")", "*", "Route", "{", "return", "&", "Route", "{", "Opcode", ":", "opcode", ",", "Keyspace", ":", "keyspace", ",", "}", "\n", "}" ]
// NewSimpleRoute creates a Route with the bare minimum of parameters.
[ "NewSimpleRoute", "creates", "a", "Route", "with", "the", "bare", "minimum", "of", "parameters", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/engine/route.go#L87-L92
train
vitessio/vitess
go/vt/vtgate/engine/route.go
NewRoute
func NewRoute(opcode RouteOpcode, keyspace *vindexes.Keyspace, query, fieldQuery string) *Route { return &Route{ Opcode: opcode, Keyspace: keyspace, Query: query, FieldQuery: fieldQuery, } }
go
func NewRoute(opcode RouteOpcode, keyspace *vindexes.Keyspace, query, fieldQuery string) *Route { return &Route{ Opcode: opcode, Keyspace: keyspace, Query: query, FieldQuery: fieldQuery, } }
[ "func", "NewRoute", "(", "opcode", "RouteOpcode", ",", "keyspace", "*", "vindexes", ".", "Keyspace", ",", "query", ",", "fieldQuery", "string", ")", "*", "Route", "{", "return", "&", "Route", "{", "Opcode", ":", "opcode", ",", "Keyspace", ":", "keyspace", ...
// NewRoute creates a Route.
[ "NewRoute", "creates", "a", "Route", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/engine/route.go#L95-L102
train
vitessio/vitess
go/vt/vtgate/engine/route.go
MarshalJSON
func (route *Route) MarshalJSON() ([]byte, error) { var vindexName string if route.Vindex != nil { vindexName = route.Vindex.String() } marshalRoute := struct { Opcode RouteOpcode Keyspace *vindexes.Keyspace `json:",omitempty"` Query string `...
go
func (route *Route) MarshalJSON() ([]byte, error) { var vindexName string if route.Vindex != nil { vindexName = route.Vindex.String() } marshalRoute := struct { Opcode RouteOpcode Keyspace *vindexes.Keyspace `json:",omitempty"` Query string `...
[ "func", "(", "route", "*", "Route", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "var", "vindexName", "string", "\n", "if", "route", ".", "Vindex", "!=", "nil", "{", "vindexName", "=", "route", ".", "Vindex", ".", "S...
// MarshalJSON serializes the Route into a JSON representation. // It's used for testing and diagnostics.
[ "MarshalJSON", "serializes", "the", "Route", "into", "a", "JSON", "representation", ".", "It", "s", "used", "for", "testing", "and", "diagnostics", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/engine/route.go#L113-L142
train
vitessio/vitess
go/stats/duration.go
NewCounterDuration
func NewCounterDuration(name, help string) *CounterDuration { cd := &CounterDuration{ help: help, } publish(name, cd) return cd }
go
func NewCounterDuration(name, help string) *CounterDuration { cd := &CounterDuration{ help: help, } publish(name, cd) return cd }
[ "func", "NewCounterDuration", "(", "name", ",", "help", "string", ")", "*", "CounterDuration", "{", "cd", ":=", "&", "CounterDuration", "{", "help", ":", "help", ",", "}", "\n", "publish", "(", "name", ",", "cd", ")", "\n", "return", "cd", "\n", "}" ]
// NewCounterDuration returns a new CounterDuration.
[ "NewCounterDuration", "returns", "a", "new", "CounterDuration", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/duration.go#L33-L39
train
vitessio/vitess
go/stats/duration.go
String
func (cd CounterDuration) String() string { return strconv.FormatInt(int64(cd.i.Get()), 10) }
go
func (cd CounterDuration) String() string { return strconv.FormatInt(int64(cd.i.Get()), 10) }
[ "func", "(", "cd", "CounterDuration", ")", "String", "(", ")", "string", "{", "return", "strconv", ".", "FormatInt", "(", "int64", "(", "cd", ".", "i", ".", "Get", "(", ")", ")", ",", "10", ")", "\n", "}" ]
// String is the implementation of expvar.var.
[ "String", "is", "the", "implementation", "of", "expvar", ".", "var", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/duration.go#L47-L49
train
vitessio/vitess
go/stats/duration.go
Add
func (cd *CounterDuration) Add(delta time.Duration) { cd.i.Add(delta) }
go
func (cd *CounterDuration) Add(delta time.Duration) { cd.i.Add(delta) }
[ "func", "(", "cd", "*", "CounterDuration", ")", "Add", "(", "delta", "time", ".", "Duration", ")", "{", "cd", ".", "i", ".", "Add", "(", "delta", ")", "\n", "}" ]
// Add adds the provided value to the CounterDuration.
[ "Add", "adds", "the", "provided", "value", "to", "the", "CounterDuration", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/duration.go#L52-L54
train
vitessio/vitess
go/stats/duration.go
NewGaugeDuration
func NewGaugeDuration(name, help string) *GaugeDuration { gd := &GaugeDuration{ CounterDuration: CounterDuration{ help: help, }, } publish(name, gd) return gd }
go
func NewGaugeDuration(name, help string) *GaugeDuration { gd := &GaugeDuration{ CounterDuration: CounterDuration{ help: help, }, } publish(name, gd) return gd }
[ "func", "NewGaugeDuration", "(", "name", ",", "help", "string", ")", "*", "GaugeDuration", "{", "gd", ":=", "&", "GaugeDuration", "{", "CounterDuration", ":", "CounterDuration", "{", "help", ":", "help", ",", "}", ",", "}", "\n", "publish", "(", "name", ...
// NewGaugeDuration returns a new GaugeDuration.
[ "NewGaugeDuration", "returns", "a", "new", "GaugeDuration", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/duration.go#L69-L77
train
vitessio/vitess
go/stats/duration.go
Set
func (gd *GaugeDuration) Set(value time.Duration) { gd.i.Set(value) }
go
func (gd *GaugeDuration) Set(value time.Duration) { gd.i.Set(value) }
[ "func", "(", "gd", "*", "GaugeDuration", ")", "Set", "(", "value", "time", ".", "Duration", ")", "{", "gd", ".", "i", ".", "Set", "(", "value", ")", "\n", "}" ]
// Set sets the value.
[ "Set", "sets", "the", "value", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/duration.go#L80-L82
train
vitessio/vitess
go/stats/duration.go
NewCounterDurationFunc
func NewCounterDurationFunc(name string, help string, f func() time.Duration) *CounterDurationFunc { cf := &CounterDurationFunc{ F: f, help: help, } if name != "" { publish(name, cf) } return cf }
go
func NewCounterDurationFunc(name string, help string, f func() time.Duration) *CounterDurationFunc { cf := &CounterDurationFunc{ F: f, help: help, } if name != "" { publish(name, cf) } return cf }
[ "func", "NewCounterDurationFunc", "(", "name", "string", ",", "help", "string", ",", "f", "func", "(", ")", "time", ".", "Duration", ")", "*", "CounterDurationFunc", "{", "cf", ":=", "&", "CounterDurationFunc", "{", "F", ":", "f", ",", "help", ":", "help...
// NewCounterDurationFunc creates a new CounterDurationFunc instance and // publishes it if name is set.
[ "NewCounterDurationFunc", "creates", "a", "new", "CounterDurationFunc", "instance", "and", "publishes", "it", "if", "name", "is", "set", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/duration.go#L92-L102
train
vitessio/vitess
go/stats/duration.go
NewGaugeDurationFunc
func NewGaugeDurationFunc(name string, help string, f func() time.Duration) *GaugeDurationFunc { gf := &GaugeDurationFunc{ CounterDurationFunc: CounterDurationFunc{ F: f, help: help, }, } if name != "" { publish(name, gf) } return gf }
go
func NewGaugeDurationFunc(name string, help string, f func() time.Duration) *GaugeDurationFunc { gf := &GaugeDurationFunc{ CounterDurationFunc: CounterDurationFunc{ F: f, help: help, }, } if name != "" { publish(name, gf) } return gf }
[ "func", "NewGaugeDurationFunc", "(", "name", "string", ",", "help", "string", ",", "f", "func", "(", ")", "time", ".", "Duration", ")", "*", "GaugeDurationFunc", "{", "gf", ":=", "&", "GaugeDurationFunc", "{", "CounterDurationFunc", ":", "CounterDurationFunc", ...
// NewGaugeDurationFunc creates a new GaugeDurationFunc instance and // publishes it if name is set.
[ "NewGaugeDurationFunc", "creates", "a", "new", "GaugeDurationFunc", "instance", "and", "publishes", "it", "if", "name", "is", "set", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/duration.go#L121-L133
train
vitessio/vitess
go/vt/vttablet/tabletserver/replication_watcher.go
NewReplicationWatcher
func NewReplicationWatcher(se *schema.Engine, config tabletenv.TabletConfig) *ReplicationWatcher { rpw := &ReplicationWatcher{ watchReplication: config.WatchReplication, se: se, } replOnce.Do(func() { stats.Publish("EventTokenPosition", stats.StringFunc(func() string { if e := rpw.EventToken()...
go
func NewReplicationWatcher(se *schema.Engine, config tabletenv.TabletConfig) *ReplicationWatcher { rpw := &ReplicationWatcher{ watchReplication: config.WatchReplication, se: se, } replOnce.Do(func() { stats.Publish("EventTokenPosition", stats.StringFunc(func() string { if e := rpw.EventToken()...
[ "func", "NewReplicationWatcher", "(", "se", "*", "schema", ".", "Engine", ",", "config", "tabletenv", ".", "TabletConfig", ")", "*", "ReplicationWatcher", "{", "rpw", ":=", "&", "ReplicationWatcher", "{", "watchReplication", ":", "config", ".", "WatchReplication",...
// NewReplicationWatcher creates a new ReplicationWatcher.
[ "NewReplicationWatcher", "creates", "a", "new", "ReplicationWatcher", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/replication_watcher.go#L59-L82
train
vitessio/vitess
go/vt/vttablet/tabletserver/replication_watcher.go
Open
func (rpw *ReplicationWatcher) Open() { if rpw.isOpen || !rpw.watchReplication { return } ctx, cancel := context.WithCancel(tabletenv.LocalContext()) rpw.cancel = cancel rpw.wg.Add(1) go rpw.Process(ctx, rpw.dbconfigs) rpw.isOpen = true }
go
func (rpw *ReplicationWatcher) Open() { if rpw.isOpen || !rpw.watchReplication { return } ctx, cancel := context.WithCancel(tabletenv.LocalContext()) rpw.cancel = cancel rpw.wg.Add(1) go rpw.Process(ctx, rpw.dbconfigs) rpw.isOpen = true }
[ "func", "(", "rpw", "*", "ReplicationWatcher", ")", "Open", "(", ")", "{", "if", "rpw", ".", "isOpen", "||", "!", "rpw", ".", "watchReplication", "{", "return", "\n", "}", "\n", "ctx", ",", "cancel", ":=", "context", ".", "WithCancel", "(", "tabletenv"...
// Open starts the ReplicationWatcher service.
[ "Open", "starts", "the", "ReplicationWatcher", "service", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/replication_watcher.go#L90-L99
train
vitessio/vitess
go/vt/vttablet/tabletserver/replication_watcher.go
Close
func (rpw *ReplicationWatcher) Close() { if !rpw.isOpen { return } rpw.cancel() rpw.wg.Wait() rpw.isOpen = false }
go
func (rpw *ReplicationWatcher) Close() { if !rpw.isOpen { return } rpw.cancel() rpw.wg.Wait() rpw.isOpen = false }
[ "func", "(", "rpw", "*", "ReplicationWatcher", ")", "Close", "(", ")", "{", "if", "!", "rpw", ".", "isOpen", "{", "return", "\n", "}", "\n", "rpw", ".", "cancel", "(", ")", "\n", "rpw", ".", "wg", ".", "Wait", "(", ")", "\n", "rpw", ".", "isOpe...
// Close stops the ReplicationWatcher service.
[ "Close", "stops", "the", "ReplicationWatcher", "service", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/replication_watcher.go#L102-L109
train
vitessio/vitess
go/vt/vttablet/tabletserver/replication_watcher.go
Process
func (rpw *ReplicationWatcher) Process(ctx context.Context, dbconfigs *dbconfigs.DBConfigs) { defer func() { tabletenv.LogError() rpw.wg.Done() }() for { log.Infof("Starting a binlog Streamer from current replication position to monitor binlogs") streamer := binlog.NewStreamer(dbconfigs.DbaWithDB(), rpw.se, ...
go
func (rpw *ReplicationWatcher) Process(ctx context.Context, dbconfigs *dbconfigs.DBConfigs) { defer func() { tabletenv.LogError() rpw.wg.Done() }() for { log.Infof("Starting a binlog Streamer from current replication position to monitor binlogs") streamer := binlog.NewStreamer(dbconfigs.DbaWithDB(), rpw.se, ...
[ "func", "(", "rpw", "*", "ReplicationWatcher", ")", "Process", "(", "ctx", "context", ".", "Context", ",", "dbconfigs", "*", "dbconfigs", ".", "DBConfigs", ")", "{", "defer", "func", "(", ")", "{", "tabletenv", ".", "LogError", "(", ")", "\n", "rpw", "...
// Process processes the replication stream.
[ "Process", "processes", "the", "replication", "stream", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/replication_watcher.go#L112-L148
train
vitessio/vitess
go/vt/vttablet/tabletserver/replication_watcher.go
ComputeExtras
func (rpw *ReplicationWatcher) ComputeExtras(options *querypb.ExecuteOptions) *querypb.ResultExtras { if options == nil { // No options passed in. return nil } if !options.IncludeEventToken && options.CompareEventToken == nil { // The flags that make extras exist are not there. return nil } et := rpw.Eve...
go
func (rpw *ReplicationWatcher) ComputeExtras(options *querypb.ExecuteOptions) *querypb.ResultExtras { if options == nil { // No options passed in. return nil } if !options.IncludeEventToken && options.CompareEventToken == nil { // The flags that make extras exist are not there. return nil } et := rpw.Eve...
[ "func", "(", "rpw", "*", "ReplicationWatcher", ")", "ComputeExtras", "(", "options", "*", "querypb", ".", "ExecuteOptions", ")", "*", "querypb", ".", "ResultExtras", "{", "if", "options", "==", "nil", "{", "// No options passed in.", "return", "nil", "\n", "}"...
// ComputeExtras returns the requested ResultExtras based on the supplied options.
[ "ComputeExtras", "returns", "the", "requested", "ResultExtras", "based", "on", "the", "supplied", "options", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/replication_watcher.go#L151-L191
train