id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
135,900
vitessio/vitess
go/vt/throttler/manager.go
GetConfiguration
func (m *managerImpl) GetConfiguration(throttlerName string) (map[string]*throttlerdatapb.Configuration, error) { m.mu.Lock() defer m.mu.Unlock() configurations := make(map[string]*throttlerdatapb.Configuration) if throttlerName != "" { t, ok := m.throttlers[throttlerName] if !ok { return nil, fmt.Errorf("...
go
func (m *managerImpl) GetConfiguration(throttlerName string) (map[string]*throttlerdatapb.Configuration, error) { m.mu.Lock() defer m.mu.Unlock() configurations := make(map[string]*throttlerdatapb.Configuration) if throttlerName != "" { t, ok := m.throttlers[throttlerName] if !ok { return nil, fmt.Errorf("...
[ "func", "(", "m", "*", "managerImpl", ")", "GetConfiguration", "(", "throttlerName", "string", ")", "(", "map", "[", "string", "]", "*", "throttlerdatapb", ".", "Configuration", ",", "error", ")", "{", "m", ".", "mu", ".", "Lock", "(", ")", "\n", "defe...
// GetConfiguration implements the "Manager" interface.
[ "GetConfiguration", "implements", "the", "Manager", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/manager.go#L122-L141
135,901
vitessio/vitess
go/vt/throttler/manager.go
UpdateConfiguration
func (m *managerImpl) UpdateConfiguration(throttlerName string, configuration *throttlerdatapb.Configuration, copyZeroValues bool) ([]string, error) { m.mu.Lock() defer m.mu.Unlock() // Note: The calls to t.UpdateConfiguration() below return no error but the // called protobuf library functions may panic. This is ...
go
func (m *managerImpl) UpdateConfiguration(throttlerName string, configuration *throttlerdatapb.Configuration, copyZeroValues bool) ([]string, error) { m.mu.Lock() defer m.mu.Unlock() // Note: The calls to t.UpdateConfiguration() below return no error but the // called protobuf library functions may panic. This is ...
[ "func", "(", "m", "*", "managerImpl", ")", "UpdateConfiguration", "(", "throttlerName", "string", ",", "configuration", "*", "throttlerdatapb", ".", "Configuration", ",", "copyZeroValues", "bool", ")", "(", "[", "]", "string", ",", "error", ")", "{", "m", "....
// UpdateConfiguration implements the "Manager" interface.
[ "UpdateConfiguration", "implements", "the", "Manager", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/manager.go#L144-L169
135,902
vitessio/vitess
go/vt/throttler/manager.go
ResetConfiguration
func (m *managerImpl) ResetConfiguration(throttlerName string) ([]string, error) { m.mu.Lock() defer m.mu.Unlock() if throttlerName != "" { t, ok := m.throttlers[throttlerName] if !ok { return nil, fmt.Errorf("throttler: %v does not exist", throttlerName) } t.ResetConfiguration() return []string{thrott...
go
func (m *managerImpl) ResetConfiguration(throttlerName string) ([]string, error) { m.mu.Lock() defer m.mu.Unlock() if throttlerName != "" { t, ok := m.throttlers[throttlerName] if !ok { return nil, fmt.Errorf("throttler: %v does not exist", throttlerName) } t.ResetConfiguration() return []string{thrott...
[ "func", "(", "m", "*", "managerImpl", ")", "ResetConfiguration", "(", "throttlerName", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "m", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "mu", ".", "Unlock", "(", ")", ...
// ResetConfiguration implements the "Manager" interface.
[ "ResetConfiguration", "implements", "the", "Manager", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/manager.go#L172-L189
135,903
vitessio/vitess
go/vt/throttler/manager.go
Throttlers
func (m *managerImpl) Throttlers() []string { m.mu.Lock() defer m.mu.Unlock() return m.throttlerNamesLocked() }
go
func (m *managerImpl) Throttlers() []string { m.mu.Lock() defer m.mu.Unlock() return m.throttlerNamesLocked() }
[ "func", "(", "m", "*", "managerImpl", ")", "Throttlers", "(", ")", "[", "]", "string", "{", "m", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "return", "m", ".", "throttlerNamesLocked", "(", ")...
// Throttlers returns the sorted list of active throttlers.
[ "Throttlers", "returns", "the", "sorted", "list", "of", "active", "throttlers", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/manager.go#L192-L197
135,904
vitessio/vitess
go/vt/throttler/manager.go
Log
func (m *managerImpl) Log(throttlerName string) ([]result, error) { m.mu.Lock() defer m.mu.Unlock() t, ok := m.throttlers[throttlerName] if !ok { return nil, fmt.Errorf("throttler: %v does not exist", throttlerName) } return t.Log(), nil }
go
func (m *managerImpl) Log(throttlerName string) ([]result, error) { m.mu.Lock() defer m.mu.Unlock() t, ok := m.throttlers[throttlerName] if !ok { return nil, fmt.Errorf("throttler: %v does not exist", throttlerName) } return t.Log(), nil }
[ "func", "(", "m", "*", "managerImpl", ")", "Log", "(", "throttlerName", "string", ")", "(", "[", "]", "result", ",", "error", ")", "{", "m", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "t", ...
// Log returns the most recent changes of the MaxReplicationLag module. // There will be one result for each processed replication lag record.
[ "Log", "returns", "the", "most", "recent", "changes", "of", "the", "MaxReplicationLag", "module", ".", "There", "will", "be", "one", "result", "for", "each", "processed", "replication", "lag", "record", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/manager.go#L210-L220
135,905
vitessio/vitess
go/vt/vtgate/vindexes/binarymd5.go
NewBinaryMD5
func NewBinaryMD5(name string, _ map[string]string) (Vindex, error) { return &BinaryMD5{name: name}, nil }
go
func NewBinaryMD5(name string, _ map[string]string) (Vindex, error) { return &BinaryMD5{name: name}, nil }
[ "func", "NewBinaryMD5", "(", "name", "string", ",", "_", "map", "[", "string", "]", "string", ")", "(", "Vindex", ",", "error", ")", "{", "return", "&", "BinaryMD5", "{", "name", ":", "name", "}", ",", "nil", "\n", "}" ]
// NewBinaryMD5 creates a new BinaryMD5.
[ "NewBinaryMD5", "creates", "a", "new", "BinaryMD5", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vindexes/binarymd5.go#L37-L39
135,906
vitessio/vitess
go/vt/vttablet/tabletserver/tx_prep_pool.go
NewTxPreparedPool
func NewTxPreparedPool(capacity int) *TxPreparedPool { if capacity < 0 { // If capacity is 0 all prepares will fail. capacity = 0 } return &TxPreparedPool{ conns: make(map[string]*TxConnection, capacity), reserved: make(map[string]error), capacity: capacity, } }
go
func NewTxPreparedPool(capacity int) *TxPreparedPool { if capacity < 0 { // If capacity is 0 all prepares will fail. capacity = 0 } return &TxPreparedPool{ conns: make(map[string]*TxConnection, capacity), reserved: make(map[string]error), capacity: capacity, } }
[ "func", "NewTxPreparedPool", "(", "capacity", "int", ")", "*", "TxPreparedPool", "{", "if", "capacity", "<", "0", "{", "// If capacity is 0 all prepares will fail.", "capacity", "=", "0", "\n", "}", "\n", "return", "&", "TxPreparedPool", "{", "conns", ":", "make...
// NewTxPreparedPool creates a new TxPreparedPool.
[ "NewTxPreparedPool", "creates", "a", "new", "TxPreparedPool", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tx_prep_pool.go#L41-L51
135,907
vitessio/vitess
go/vt/vttablet/tabletserver/tx_prep_pool.go
Put
func (pp *TxPreparedPool) Put(c *TxConnection, dtid string) error { pp.mu.Lock() defer pp.mu.Unlock() if _, ok := pp.reserved[dtid]; ok { return errors.New("duplicate DTID in Prepare: " + dtid) } if _, ok := pp.conns[dtid]; ok { return errors.New("duplicate DTID in Prepare: " + dtid) } if len(pp.conns) >= pp...
go
func (pp *TxPreparedPool) Put(c *TxConnection, dtid string) error { pp.mu.Lock() defer pp.mu.Unlock() if _, ok := pp.reserved[dtid]; ok { return errors.New("duplicate DTID in Prepare: " + dtid) } if _, ok := pp.conns[dtid]; ok { return errors.New("duplicate DTID in Prepare: " + dtid) } if len(pp.conns) >= pp...
[ "func", "(", "pp", "*", "TxPreparedPool", ")", "Put", "(", "c", "*", "TxConnection", ",", "dtid", "string", ")", "error", "{", "pp", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "pp", ".", "mu", ".", "Unlock", "(", ")", "\n", "if", "_", ","...
// Put adds the connection to the pool. It returns an error // if the pool is full or on duplicate key.
[ "Put", "adds", "the", "connection", "to", "the", "pool", ".", "It", "returns", "an", "error", "if", "the", "pool", "is", "full", "or", "on", "duplicate", "key", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tx_prep_pool.go#L55-L69
135,908
vitessio/vitess
go/vt/vttablet/tabletserver/tx_prep_pool.go
FetchForRollback
func (pp *TxPreparedPool) FetchForRollback(dtid string) *TxConnection { pp.mu.Lock() defer pp.mu.Unlock() if _, ok := pp.reserved[dtid]; ok { delete(pp.reserved, dtid) return nil } c := pp.conns[dtid] delete(pp.conns, dtid) return c }
go
func (pp *TxPreparedPool) FetchForRollback(dtid string) *TxConnection { pp.mu.Lock() defer pp.mu.Unlock() if _, ok := pp.reserved[dtid]; ok { delete(pp.reserved, dtid) return nil } c := pp.conns[dtid] delete(pp.conns, dtid) return c }
[ "func", "(", "pp", "*", "TxPreparedPool", ")", "FetchForRollback", "(", "dtid", "string", ")", "*", "TxConnection", "{", "pp", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "pp", ".", "mu", ".", "Unlock", "(", ")", "\n", "if", "_", ",", "ok", ...
// FetchForRollback returns the connection and removes it from the pool. // If the connection is not found, it returns nil. If the dtid // is in the reserved list, it means that an operator is trying // to resolve a previously failed commit. So, it removes the entry // and returns nil.
[ "FetchForRollback", "returns", "the", "connection", "and", "removes", "it", "from", "the", "pool", ".", "If", "the", "connection", "is", "not", "found", "it", "returns", "nil", ".", "If", "the", "dtid", "is", "in", "the", "reserved", "list", "it", "means",...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tx_prep_pool.go#L76-L86
135,909
vitessio/vitess
go/vt/vttablet/tabletserver/tx_prep_pool.go
FetchForCommit
func (pp *TxPreparedPool) FetchForCommit(dtid string) (*TxConnection, error) { pp.mu.Lock() defer pp.mu.Unlock() if err, ok := pp.reserved[dtid]; ok { return nil, err } c, ok := pp.conns[dtid] if ok { delete(pp.conns, dtid) pp.reserved[dtid] = errPrepCommitting } return c, nil }
go
func (pp *TxPreparedPool) FetchForCommit(dtid string) (*TxConnection, error) { pp.mu.Lock() defer pp.mu.Unlock() if err, ok := pp.reserved[dtid]; ok { return nil, err } c, ok := pp.conns[dtid] if ok { delete(pp.conns, dtid) pp.reserved[dtid] = errPrepCommitting } return c, nil }
[ "func", "(", "pp", "*", "TxPreparedPool", ")", "FetchForCommit", "(", "dtid", "string", ")", "(", "*", "TxConnection", ",", "error", ")", "{", "pp", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "pp", ".", "mu", ".", "Unlock", "(", ")", "\n", ...
// FetchForCommit returns the connection for commit. Before returning, // it remembers the dtid in its reserved list as "committing". If // the dtid is already in the reserved list, it returns an error. // If the commit is successful, the dtid can be removed from the // reserved list by calling Forget. If the commit fa...
[ "FetchForCommit", "returns", "the", "connection", "for", "commit", ".", "Before", "returning", "it", "remembers", "the", "dtid", "in", "its", "reserved", "list", "as", "committing", ".", "If", "the", "dtid", "is", "already", "in", "the", "reserved", "list", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tx_prep_pool.go#L95-L107
135,910
vitessio/vitess
go/vt/vttablet/tabletserver/tx_prep_pool.go
SetFailed
func (pp *TxPreparedPool) SetFailed(dtid string) { pp.mu.Lock() defer pp.mu.Unlock() pp.reserved[dtid] = errPrepFailed }
go
func (pp *TxPreparedPool) SetFailed(dtid string) { pp.mu.Lock() defer pp.mu.Unlock() pp.reserved[dtid] = errPrepFailed }
[ "func", "(", "pp", "*", "TxPreparedPool", ")", "SetFailed", "(", "dtid", "string", ")", "{", "pp", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "pp", ".", "mu", ".", "Unlock", "(", ")", "\n", "pp", ".", "reserved", "[", "dtid", "]", "=", "e...
// SetFailed marks the reserved dtid as failed. // If there was no previous entry, one is created.
[ "SetFailed", "marks", "the", "reserved", "dtid", "as", "failed", ".", "If", "there", "was", "no", "previous", "entry", "one", "is", "created", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tx_prep_pool.go#L111-L115
135,911
vitessio/vitess
go/vt/vttablet/tabletserver/tx_prep_pool.go
Forget
func (pp *TxPreparedPool) Forget(dtid string) { pp.mu.Lock() defer pp.mu.Unlock() delete(pp.reserved, dtid) }
go
func (pp *TxPreparedPool) Forget(dtid string) { pp.mu.Lock() defer pp.mu.Unlock() delete(pp.reserved, dtid) }
[ "func", "(", "pp", "*", "TxPreparedPool", ")", "Forget", "(", "dtid", "string", ")", "{", "pp", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "pp", ".", "mu", ".", "Unlock", "(", ")", "\n", "delete", "(", "pp", ".", "reserved", ",", "dtid", ...
// Forget removes the dtid from the reserved list.
[ "Forget", "removes", "the", "dtid", "from", "the", "reserved", "list", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tx_prep_pool.go#L118-L122
135,912
vitessio/vitess
go/vt/vttablet/tabletserver/tx_prep_pool.go
FetchAll
func (pp *TxPreparedPool) FetchAll() []*TxConnection { pp.mu.Lock() defer pp.mu.Unlock() conns := make([]*TxConnection, 0, len(pp.conns)) for _, c := range pp.conns { conns = append(conns, c) } pp.conns = make(map[string]*TxConnection, pp.capacity) pp.reserved = make(map[string]error) return conns }
go
func (pp *TxPreparedPool) FetchAll() []*TxConnection { pp.mu.Lock() defer pp.mu.Unlock() conns := make([]*TxConnection, 0, len(pp.conns)) for _, c := range pp.conns { conns = append(conns, c) } pp.conns = make(map[string]*TxConnection, pp.capacity) pp.reserved = make(map[string]error) return conns }
[ "func", "(", "pp", "*", "TxPreparedPool", ")", "FetchAll", "(", ")", "[", "]", "*", "TxConnection", "{", "pp", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "pp", ".", "mu", ".", "Unlock", "(", ")", "\n", "conns", ":=", "make", "(", "[", "]"...
// FetchAll removes all connections and returns them as a list. // It also forgets all reserved dtids.
[ "FetchAll", "removes", "all", "connections", "and", "returns", "them", "as", "a", "list", ".", "It", "also", "forgets", "all", "reserved", "dtids", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tx_prep_pool.go#L126-L136
135,913
vitessio/vitess
go/vt/vttablet/tabletmanager/rpc_schema.go
GetSchema
func (agent *ActionAgent) GetSchema(ctx context.Context, tables, excludeTables []string, includeViews bool) (*tabletmanagerdatapb.SchemaDefinition, error) { return agent.MysqlDaemon.GetSchema(topoproto.TabletDbName(agent.Tablet()), tables, excludeTables, includeViews) }
go
func (agent *ActionAgent) GetSchema(ctx context.Context, tables, excludeTables []string, includeViews bool) (*tabletmanagerdatapb.SchemaDefinition, error) { return agent.MysqlDaemon.GetSchema(topoproto.TabletDbName(agent.Tablet()), tables, excludeTables, includeViews) }
[ "func", "(", "agent", "*", "ActionAgent", ")", "GetSchema", "(", "ctx", "context", ".", "Context", ",", "tables", ",", "excludeTables", "[", "]", "string", ",", "includeViews", "bool", ")", "(", "*", "tabletmanagerdatapb", ".", "SchemaDefinition", ",", "erro...
// GetSchema returns the schema.
[ "GetSchema", "returns", "the", "schema", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/rpc_schema.go#L33-L35
135,914
vitessio/vitess
go/vt/vttablet/tabletmanager/rpc_schema.go
ReloadSchema
func (agent *ActionAgent) ReloadSchema(ctx context.Context, waitPosition string) error { if agent.DBConfigs.IsZero() { // we skip this for test instances that can't connect to the DB anyway return nil } if waitPosition != "" { pos, err := mysql.DecodePosition(waitPosition) if err != nil { return vterrors...
go
func (agent *ActionAgent) ReloadSchema(ctx context.Context, waitPosition string) error { if agent.DBConfigs.IsZero() { // we skip this for test instances that can't connect to the DB anyway return nil } if waitPosition != "" { pos, err := mysql.DecodePosition(waitPosition) if err != nil { return vterrors...
[ "func", "(", "agent", "*", "ActionAgent", ")", "ReloadSchema", "(", "ctx", "context", ".", "Context", ",", "waitPosition", "string", ")", "error", "{", "if", "agent", ".", "DBConfigs", ".", "IsZero", "(", ")", "{", "// we skip this for test instances that can't ...
// ReloadSchema will reload the schema // This doesn't need the action mutex because periodic schema reloads happen // in the background anyway.
[ "ReloadSchema", "will", "reload", "the", "schema", "This", "doesn", "t", "need", "the", "action", "mutex", "because", "periodic", "schema", "reloads", "happen", "in", "the", "background", "anyway", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/rpc_schema.go#L40-L59
135,915
vitessio/vitess
go/vt/vttablet/tabletmanager/rpc_schema.go
PreflightSchema
func (agent *ActionAgent) PreflightSchema(ctx context.Context, changes []string) ([]*tabletmanagerdatapb.SchemaChangeResult, error) { if err := agent.lock(ctx); err != nil { return nil, err } defer agent.unlock() // get the db name from the tablet dbName := topoproto.TabletDbName(agent.Tablet()) // and prefli...
go
func (agent *ActionAgent) PreflightSchema(ctx context.Context, changes []string) ([]*tabletmanagerdatapb.SchemaChangeResult, error) { if err := agent.lock(ctx); err != nil { return nil, err } defer agent.unlock() // get the db name from the tablet dbName := topoproto.TabletDbName(agent.Tablet()) // and prefli...
[ "func", "(", "agent", "*", "ActionAgent", ")", "PreflightSchema", "(", "ctx", "context", ".", "Context", ",", "changes", "[", "]", "string", ")", "(", "[", "]", "*", "tabletmanagerdatapb", ".", "SchemaChangeResult", ",", "error", ")", "{", "if", "err", "...
// PreflightSchema will try out the schema changes in "changes".
[ "PreflightSchema", "will", "try", "out", "the", "schema", "changes", "in", "changes", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/rpc_schema.go#L62-L73
135,916
vitessio/vitess
go/vt/vttablet/tabletmanager/rpc_schema.go
ApplySchema
func (agent *ActionAgent) ApplySchema(ctx context.Context, change *tmutils.SchemaChange) (*tabletmanagerdatapb.SchemaChangeResult, error) { if err := agent.lock(ctx); err != nil { return nil, err } defer agent.unlock() // get the db name from the tablet dbName := topoproto.TabletDbName(agent.Tablet()) // appl...
go
func (agent *ActionAgent) ApplySchema(ctx context.Context, change *tmutils.SchemaChange) (*tabletmanagerdatapb.SchemaChangeResult, error) { if err := agent.lock(ctx); err != nil { return nil, err } defer agent.unlock() // get the db name from the tablet dbName := topoproto.TabletDbName(agent.Tablet()) // appl...
[ "func", "(", "agent", "*", "ActionAgent", ")", "ApplySchema", "(", "ctx", "context", ".", "Context", ",", "change", "*", "tmutils", ".", "SchemaChange", ")", "(", "*", "tabletmanagerdatapb", ".", "SchemaChangeResult", ",", "error", ")", "{", "if", "err", "...
// ApplySchema will apply a schema change
[ "ApplySchema", "will", "apply", "a", "schema", "change" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/rpc_schema.go#L76-L94
135,917
vitessio/vitess
go/vt/throttler/max_replication_lag_module.go
NewMaxReplicationLagModule
func NewMaxReplicationLagModule(config MaxReplicationLagModuleConfig, actualRatesHistory *aggregatedIntervalHistory, nowFunc func() time.Time) (*MaxReplicationLagModule, error) { if err := config.Verify(); err != nil { return nil, fmt.Errorf("invalid NewMaxReplicationLagModuleConfig: %v", err) } rate := int64(Repl...
go
func NewMaxReplicationLagModule(config MaxReplicationLagModuleConfig, actualRatesHistory *aggregatedIntervalHistory, nowFunc func() time.Time) (*MaxReplicationLagModule, error) { if err := config.Verify(); err != nil { return nil, fmt.Errorf("invalid NewMaxReplicationLagModuleConfig: %v", err) } rate := int64(Repl...
[ "func", "NewMaxReplicationLagModule", "(", "config", "MaxReplicationLagModuleConfig", ",", "actualRatesHistory", "*", "aggregatedIntervalHistory", ",", "nowFunc", "func", "(", ")", "time", ".", "Time", ")", "(", "*", "MaxReplicationLagModule", ",", "error", ")", "{", ...
// NewMaxReplicationLagModule will create a new module instance and set the // initial max replication lag limit to maxReplicationLag.
[ "NewMaxReplicationLagModule", "will", "create", "a", "new", "module", "instance", "and", "set", "the", "initial", "max", "replication", "lag", "limit", "to", "maxReplicationLag", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/max_replication_lag_module.go#L128-L161
135,918
vitessio/vitess
go/vt/throttler/max_replication_lag_module.go
Start
func (m *MaxReplicationLagModule) Start(rateUpdateChan chan<- struct{}) { m.rateUpdateChan = rateUpdateChan m.wg.Add(1) go m.ProcessRecords() }
go
func (m *MaxReplicationLagModule) Start(rateUpdateChan chan<- struct{}) { m.rateUpdateChan = rateUpdateChan m.wg.Add(1) go m.ProcessRecords() }
[ "func", "(", "m", "*", "MaxReplicationLagModule", ")", "Start", "(", "rateUpdateChan", "chan", "<-", "struct", "{", "}", ")", "{", "m", ".", "rateUpdateChan", "=", "rateUpdateChan", "\n", "m", ".", "wg", ".", "Add", "(", "1", ")", "\n", "go", "m", "....
// Start launches a Go routine which reacts on replication lag records. // It implements the Module interface.
[ "Start", "launches", "a", "Go", "routine", "which", "reacts", "on", "replication", "lag", "records", ".", "It", "implements", "the", "Module", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/max_replication_lag_module.go#L165-L169
135,919
vitessio/vitess
go/vt/throttler/max_replication_lag_module.go
RecordReplicationLag
func (m *MaxReplicationLagModule) RecordReplicationLag(t time.Time, ts *discovery.TabletStats) { m.mutableConfigMu.Lock() if m.mutableConfig.MaxReplicationLagSec == ReplicationLagModuleDisabled { m.mutableConfigMu.Unlock() return } m.mutableConfigMu.Unlock() // Buffer data point for now to unblock the HealthC...
go
func (m *MaxReplicationLagModule) RecordReplicationLag(t time.Time, ts *discovery.TabletStats) { m.mutableConfigMu.Lock() if m.mutableConfig.MaxReplicationLagSec == ReplicationLagModuleDisabled { m.mutableConfigMu.Unlock() return } m.mutableConfigMu.Unlock() // Buffer data point for now to unblock the HealthC...
[ "func", "(", "m", "*", "MaxReplicationLagModule", ")", "RecordReplicationLag", "(", "t", "time", ".", "Time", ",", "ts", "*", "discovery", ".", "TabletStats", ")", "{", "m", ".", "mutableConfigMu", ".", "Lock", "(", ")", "\n", "if", "m", ".", "mutableCon...
// RecordReplicationLag records the current replication lag for processing.
[ "RecordReplicationLag", "records", "the", "current", "replication", "lag", "for", "processing", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/max_replication_lag_module.go#L243-L254
135,920
vitessio/vitess
go/vt/throttler/max_replication_lag_module.go
stateGreater
func stateGreater(a, b state) bool { switch a { case stateIncreaseRate: return false case stateDecreaseAndGuessRate: return b == stateIncreaseRate case stateEmergency: return b == stateIncreaseRate || b == stateDecreaseAndGuessRate default: panic(fmt.Sprintf("BUG: cannot compare states: %v and %v", a, b)) ...
go
func stateGreater(a, b state) bool { switch a { case stateIncreaseRate: return false case stateDecreaseAndGuessRate: return b == stateIncreaseRate case stateEmergency: return b == stateIncreaseRate || b == stateDecreaseAndGuessRate default: panic(fmt.Sprintf("BUG: cannot compare states: %v and %v", a, b)) ...
[ "func", "stateGreater", "(", "a", ",", "b", "state", ")", "bool", "{", "switch", "a", "{", "case", "stateIncreaseRate", ":", "return", "false", "\n", "case", "stateDecreaseAndGuessRate", ":", "return", "b", "==", "stateIncreaseRate", "\n", "case", "stateEmerge...
// stateGreater returns true if a > b i.e. the state "a" is more severe than // "b". For example, "decrease" > "increase" returns true.
[ "stateGreater", "returns", "true", "if", "a", ">", "b", "i", ".", "e", ".", "the", "state", "a", "is", "more", "severe", "than", "b", ".", "For", "example", "decrease", ">", "increase", "returns", "true", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/max_replication_lag_module.go#L428-L439
135,921
vitessio/vitess
go/vt/throttler/max_replication_lag_module.go
markCurrentRateAsBadOrGood
func (m *MaxReplicationLagModule) markCurrentRateAsBadOrGood(r *result, now time.Time, newState state, replicationLagChange replicationLagChange) { if m.lastRateChange.IsZero() { // Module was just started. We don't have any data points yet. r.GoodOrBad = ignoredRate r.MemorySkipReason = "rate was never changed ...
go
func (m *MaxReplicationLagModule) markCurrentRateAsBadOrGood(r *result, now time.Time, newState state, replicationLagChange replicationLagChange) { if m.lastRateChange.IsZero() { // Module was just started. We don't have any data points yet. r.GoodOrBad = ignoredRate r.MemorySkipReason = "rate was never changed ...
[ "func", "(", "m", "*", "MaxReplicationLagModule", ")", "markCurrentRateAsBadOrGood", "(", "r", "*", "result", ",", "now", "time", ".", "Time", ",", "newState", "state", ",", "replicationLagChange", "replicationLagChange", ")", "{", "if", "m", ".", "lastRateChang...
// markCurrentRateAsBadOrGood determines the actual rate between the last rate // change and "now" and determines if that rate was bad or good.
[ "markCurrentRateAsBadOrGood", "determines", "the", "actual", "rate", "between", "the", "last", "rate", "change", "and", "now", "and", "determines", "if", "that", "rate", "was", "bad", "or", "good", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/max_replication_lag_module.go#L722-L794
135,922
vitessio/vitess
go/vt/vttablet/grpctmserver/server.go
SetReadOnly
func (s *server) SetReadOnly(ctx context.Context, request *tabletmanagerdatapb.SetReadOnlyRequest) (response *tabletmanagerdatapb.SetReadOnlyResponse, err error) { defer s.agent.HandleRPCPanic(ctx, "SetReadOnly", request, response, true /*verbose*/, &err) ctx = callinfo.GRPCCallInfo(ctx) response = &tabletmanagerdat...
go
func (s *server) SetReadOnly(ctx context.Context, request *tabletmanagerdatapb.SetReadOnlyRequest) (response *tabletmanagerdatapb.SetReadOnlyResponse, err error) { defer s.agent.HandleRPCPanic(ctx, "SetReadOnly", request, response, true /*verbose*/, &err) ctx = callinfo.GRPCCallInfo(ctx) response = &tabletmanagerdat...
[ "func", "(", "s", "*", "server", ")", "SetReadOnly", "(", "ctx", "context", ".", "Context", ",", "request", "*", "tabletmanagerdatapb", ".", "SetReadOnlyRequest", ")", "(", "response", "*", "tabletmanagerdatapb", ".", "SetReadOnlyResponse", ",", "err", "error", ...
// // Various read-write methods //
[ "Various", "read", "-", "write", "methods" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/grpctmserver/server.go#L102-L107
135,923
vitessio/vitess
go/vt/vttablet/grpctmserver/server.go
SlaveStatus
func (s *server) SlaveStatus(ctx context.Context, request *tabletmanagerdatapb.SlaveStatusRequest) (response *tabletmanagerdatapb.SlaveStatusResponse, err error) { defer s.agent.HandleRPCPanic(ctx, "SlaveStatus", request, response, false /*verbose*/, &err) ctx = callinfo.GRPCCallInfo(ctx) response = &tabletmanagerda...
go
func (s *server) SlaveStatus(ctx context.Context, request *tabletmanagerdatapb.SlaveStatusRequest) (response *tabletmanagerdatapb.SlaveStatusResponse, err error) { defer s.agent.HandleRPCPanic(ctx, "SlaveStatus", request, response, false /*verbose*/, &err) ctx = callinfo.GRPCCallInfo(ctx) response = &tabletmanagerda...
[ "func", "(", "s", "*", "server", ")", "SlaveStatus", "(", "ctx", "context", ".", "Context", ",", "request", "*", "tabletmanagerdatapb", ".", "SlaveStatusRequest", ")", "(", "response", "*", "tabletmanagerdatapb", ".", "SlaveStatusResponse", ",", "err", "error", ...
// // Replication related methods //
[ "Replication", "related", "methods" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/grpctmserver/server.go#L237-L246
135,924
vitessio/vitess
go/vt/vttablet/grpctmserver/server.go
ResetReplication
func (s *server) ResetReplication(ctx context.Context, request *tabletmanagerdatapb.ResetReplicationRequest) (response *tabletmanagerdatapb.ResetReplicationResponse, err error) { defer s.agent.HandleRPCPanic(ctx, "ResetReplication", request, response, true /*verbose*/, &err) ctx = callinfo.GRPCCallInfo(ctx) response...
go
func (s *server) ResetReplication(ctx context.Context, request *tabletmanagerdatapb.ResetReplicationRequest) (response *tabletmanagerdatapb.ResetReplicationResponse, err error) { defer s.agent.HandleRPCPanic(ctx, "ResetReplication", request, response, true /*verbose*/, &err) ctx = callinfo.GRPCCallInfo(ctx) response...
[ "func", "(", "s", "*", "server", ")", "ResetReplication", "(", "ctx", "context", ".", "Context", ",", "request", "*", "tabletmanagerdatapb", ".", "ResetReplicationRequest", ")", "(", "response", "*", "tabletmanagerdatapb", ".", "ResetReplicationResponse", ",", "er...
// // Reparenting related functions //
[ "Reparenting", "related", "functions" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/grpctmserver/server.go#L332-L337
135,925
vitessio/vitess
go/vt/wrangler/wrangler.go
New
func New(logger logutil.Logger, ts *topo.Server, tmc tmclient.TabletManagerClient) *Wrangler { return &Wrangler{ logger: logger, ts: ts, tmc: tmc, } }
go
func New(logger logutil.Logger, ts *topo.Server, tmc tmclient.TabletManagerClient) *Wrangler { return &Wrangler{ logger: logger, ts: ts, tmc: tmc, } }
[ "func", "New", "(", "logger", "logutil", ".", "Logger", ",", "ts", "*", "topo", ".", "Server", ",", "tmc", "tmclient", ".", "TabletManagerClient", ")", "*", "Wrangler", "{", "return", "&", "Wrangler", "{", "logger", ":", "logger", ",", "ts", ":", "ts",...
// New creates a new Wrangler object.
[ "New", "creates", "a", "new", "Wrangler", "object", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/wrangler.go#L48-L54
135,926
vitessio/vitess
go/vt/mysqlctl/cmd.go
CreateMysqldAndMycnf
func CreateMysqldAndMycnf(tabletUID uint32, mysqlSocket string, mysqlPort int32) (*Mysqld, *Mycnf, error) { mycnf := NewMycnf(tabletUID, mysqlPort) // Choose a random MySQL server-id, since this is a fresh data dir. // We don't want to use the tablet UID as the MySQL server-id, // because reusing server-ids is not ...
go
func CreateMysqldAndMycnf(tabletUID uint32, mysqlSocket string, mysqlPort int32) (*Mysqld, *Mycnf, error) { mycnf := NewMycnf(tabletUID, mysqlPort) // Choose a random MySQL server-id, since this is a fresh data dir. // We don't want to use the tablet UID as the MySQL server-id, // because reusing server-ids is not ...
[ "func", "CreateMysqldAndMycnf", "(", "tabletUID", "uint32", ",", "mysqlSocket", "string", ",", "mysqlPort", "int32", ")", "(", "*", "Mysqld", ",", "*", "Mycnf", ",", "error", ")", "{", "mycnf", ":=", "NewMycnf", "(", "tabletUID", ",", "mysqlPort", ")", "\n...
// CreateMysqldAndMycnf returns a Mysqld and a Mycnf object to use for working with a MySQL // installation that hasn't been set up yet.
[ "CreateMysqldAndMycnf", "returns", "a", "Mysqld", "and", "a", "Mycnf", "object", "to", "use", "for", "working", "with", "a", "MySQL", "installation", "that", "hasn", "t", "been", "set", "up", "yet", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/cmd.go#L31-L55
135,927
vitessio/vitess
go/vt/mysqlctl/cmd.go
OpenMysqldAndMycnf
func OpenMysqldAndMycnf(tabletUID uint32) (*Mysqld, *Mycnf, error) { // We pass a port of 0, this will be read and overwritten from the path on disk mycnf, err := ReadMycnf(NewMycnf(tabletUID, 0)) if err != nil { return nil, nil, fmt.Errorf("couldn't read my.cnf file: %v", err) } dbcfgs, err := dbconfigs.Init(m...
go
func OpenMysqldAndMycnf(tabletUID uint32) (*Mysqld, *Mycnf, error) { // We pass a port of 0, this will be read and overwritten from the path on disk mycnf, err := ReadMycnf(NewMycnf(tabletUID, 0)) if err != nil { return nil, nil, fmt.Errorf("couldn't read my.cnf file: %v", err) } dbcfgs, err := dbconfigs.Init(m...
[ "func", "OpenMysqldAndMycnf", "(", "tabletUID", "uint32", ")", "(", "*", "Mysqld", ",", "*", "Mycnf", ",", "error", ")", "{", "// We pass a port of 0, this will be read and overwritten from the path on disk", "mycnf", ",", "err", ":=", "ReadMycnf", "(", "NewMycnf", "(...
// OpenMysqldAndMycnf returns a Mysqld and a Mycnf object to use for working with a MySQL // installation that already exists. The Mycnf will be built based on the my.cnf file // of the MySQL instance.
[ "OpenMysqldAndMycnf", "returns", "a", "Mysqld", "and", "a", "Mycnf", "object", "to", "use", "for", "working", "with", "a", "MySQL", "installation", "that", "already", "exists", ".", "The", "Mycnf", "will", "be", "built", "based", "on", "the", "my", ".", "c...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/cmd.go#L60-L73
135,928
vitessio/vitess
go/vt/callinfo/callinfo.go
NewContext
func NewContext(ctx context.Context, ci CallInfo) context.Context { return context.WithValue(ctx, callInfoKey, ci) }
go
func NewContext(ctx context.Context, ci CallInfo) context.Context { return context.WithValue(ctx, callInfoKey, ci) }
[ "func", "NewContext", "(", "ctx", "context", ".", "Context", ",", "ci", "CallInfo", ")", "context", ".", "Context", "{", "return", "context", ".", "WithValue", "(", "ctx", ",", "callInfoKey", ",", "ci", ")", "\n", "}" ]
// NewContext adds the provided CallInfo to the context
[ "NewContext", "adds", "the", "provided", "CallInfo", "to", "the", "context" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/callinfo/callinfo.go#L48-L50
135,929
vitessio/vitess
go/vt/callinfo/callinfo.go
FromContext
func FromContext(ctx context.Context) (CallInfo, bool) { ci, ok := ctx.Value(callInfoKey).(CallInfo) return ci, ok }
go
func FromContext(ctx context.Context) (CallInfo, bool) { ci, ok := ctx.Value(callInfoKey).(CallInfo) return ci, ok }
[ "func", "FromContext", "(", "ctx", "context", ".", "Context", ")", "(", "CallInfo", ",", "bool", ")", "{", "ci", ",", "ok", ":=", "ctx", ".", "Value", "(", "callInfoKey", ")", ".", "(", "CallInfo", ")", "\n", "return", "ci", ",", "ok", "\n", "}" ]
// FromContext returns the CallInfo value stored in ctx, if any.
[ "FromContext", "returns", "the", "CallInfo", "value", "stored", "in", "ctx", "if", "any", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/callinfo/callinfo.go#L53-L56
135,930
vitessio/vitess
go/vt/vttablet/tabletserver/splitquery/split_params.go
getPrimaryKeyColumns
func getPrimaryKeyColumns(table *schema.Table) []*schema.TableColumn { result := make([]*schema.TableColumn, 0, len(table.PKColumns)) for _, pkColIndex := range table.PKColumns { result = append(result, &table.Columns[pkColIndex]) } return result }
go
func getPrimaryKeyColumns(table *schema.Table) []*schema.TableColumn { result := make([]*schema.TableColumn, 0, len(table.PKColumns)) for _, pkColIndex := range table.PKColumns { result = append(result, &table.Columns[pkColIndex]) } return result }
[ "func", "getPrimaryKeyColumns", "(", "table", "*", "schema", ".", "Table", ")", "[", "]", "*", "schema", ".", "TableColumn", "{", "result", ":=", "make", "(", "[", "]", "*", "schema", ".", "TableColumn", ",", "0", ",", "len", "(", "table", ".", "PKCo...
// getPrimaryKeyColumns returns the list of primary-key column names, in order, for the // given table.
[ "getPrimaryKeyColumns", "returns", "the", "list", "of", "primary", "-", "key", "column", "names", "in", "order", "for", "the", "given", "table", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/splitquery/split_params.go#L237-L243
135,931
vitessio/vitess
go/vt/vttablet/tabletserver/splitquery/split_params.go
areColumnsAPrefixOfAnIndex
func areColumnsAPrefixOfAnIndex(columns []*schema.TableColumn, table *schema.Table) bool { for _, index := range table.Indexes { if areColumnsAPrefixOfIndex(columns, index) { return true } } return false }
go
func areColumnsAPrefixOfAnIndex(columns []*schema.TableColumn, table *schema.Table) bool { for _, index := range table.Indexes { if areColumnsAPrefixOfIndex(columns, index) { return true } } return false }
[ "func", "areColumnsAPrefixOfAnIndex", "(", "columns", "[", "]", "*", "schema", ".", "TableColumn", ",", "table", "*", "schema", ".", "Table", ")", "bool", "{", "for", "_", ",", "index", ":=", "range", "table", ".", "Indexes", "{", "if", "areColumnsAPrefixO...
// areColumnsAPrefixOfAnIndex returns true if 'columns' form a prefix of the columns that // make up some index in 'table'.
[ "areColumnsAPrefixOfAnIndex", "returns", "true", "if", "columns", "form", "a", "prefix", "of", "the", "columns", "that", "make", "up", "some", "index", "in", "table", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/splitquery/split_params.go#L247-L254
135,932
vitessio/vitess
go/vt/vttablet/tabletserver/splitquery/split_params.go
areColumnsAPrefixOfIndex
func areColumnsAPrefixOfIndex(potentialPrefix []*schema.TableColumn, index *schema.Index) bool { if len(potentialPrefix) > len(index.Columns) { return false } for i := range potentialPrefix { if !potentialPrefix[i].Name.Equal(index.Columns[i]) { return false } } return true }
go
func areColumnsAPrefixOfIndex(potentialPrefix []*schema.TableColumn, index *schema.Index) bool { if len(potentialPrefix) > len(index.Columns) { return false } for i := range potentialPrefix { if !potentialPrefix[i].Name.Equal(index.Columns[i]) { return false } } return true }
[ "func", "areColumnsAPrefixOfIndex", "(", "potentialPrefix", "[", "]", "*", "schema", ".", "TableColumn", ",", "index", "*", "schema", ".", "Index", ")", "bool", "{", "if", "len", "(", "potentialPrefix", ")", ">", "len", "(", "index", ".", "Columns", ")", ...
// areColumnsAPrefixOfIndex returns true if 'potentialPrefix' forms a prefix of the columns // composing 'index'.
[ "areColumnsAPrefixOfIndex", "returns", "true", "if", "potentialPrefix", "forms", "a", "prefix", "of", "the", "columns", "composing", "index", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/splitquery/split_params.go#L258-L268
135,933
vitessio/vitess
go/vt/vttablet/tabletserver/splitquery/split_params.go
areSplitColumnsPrimaryKey
func (sp *SplitParams) areSplitColumnsPrimaryKey() bool { pkCols := getPrimaryKeyColumns(sp.splitTableSchema) if len(sp.splitColumns) != len(pkCols) { return false } // Compare the names of sp.splitColumns to the names of pkCols. for i := 0; i < len(sp.splitColumns); i++ { if !sp.splitColumns[i].Name.Equal(pkC...
go
func (sp *SplitParams) areSplitColumnsPrimaryKey() bool { pkCols := getPrimaryKeyColumns(sp.splitTableSchema) if len(sp.splitColumns) != len(pkCols) { return false } // Compare the names of sp.splitColumns to the names of pkCols. for i := 0; i < len(sp.splitColumns); i++ { if !sp.splitColumns[i].Name.Equal(pkC...
[ "func", "(", "sp", "*", "SplitParams", ")", "areSplitColumnsPrimaryKey", "(", ")", "bool", "{", "pkCols", ":=", "getPrimaryKeyColumns", "(", "sp", ".", "splitTableSchema", ")", "\n", "if", "len", "(", "sp", ".", "splitColumns", ")", "!=", "len", "(", "pkCo...
// areSplitColumnsPrimaryKey returns true if the splitColumns in 'splitParams' // are the primary key columns in order.
[ "areSplitColumnsPrimaryKey", "returns", "true", "if", "the", "splitColumns", "in", "splitParams", "are", "the", "primary", "key", "columns", "in", "order", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/splitquery/split_params.go#L272-L284
135,934
vitessio/vitess
go/bytes2/buffer.go
Write
func (buf *Buffer) Write(b []byte) (int, error) { buf.bytes = append(buf.bytes, b...) return len(b), nil }
go
func (buf *Buffer) Write(b []byte) (int, error) { buf.bytes = append(buf.bytes, b...) return len(b), nil }
[ "func", "(", "buf", "*", "Buffer", ")", "Write", "(", "b", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "buf", ".", "bytes", "=", "append", "(", "buf", ".", "bytes", ",", "b", "...", ")", "\n", "return", "len", "(", "b", ")", ...
// Write is equivalent to bytes.Buffer.Write.
[ "Write", "is", "equivalent", "to", "bytes", ".", "Buffer", ".", "Write", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/bytes2/buffer.go#L35-L38
135,935
vitessio/vitess
go/bytes2/buffer.go
WriteString
func (buf *Buffer) WriteString(s string) (int, error) { buf.bytes = append(buf.bytes, s...) return len(s), nil }
go
func (buf *Buffer) WriteString(s string) (int, error) { buf.bytes = append(buf.bytes, s...) return len(s), nil }
[ "func", "(", "buf", "*", "Buffer", ")", "WriteString", "(", "s", "string", ")", "(", "int", ",", "error", ")", "{", "buf", ".", "bytes", "=", "append", "(", "buf", ".", "bytes", ",", "s", "...", ")", "\n", "return", "len", "(", "s", ")", ",", ...
// WriteString is equivalent to bytes.Buffer.WriteString.
[ "WriteString", "is", "equivalent", "to", "bytes", ".", "Buffer", ".", "WriteString", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/bytes2/buffer.go#L41-L44
135,936
vitessio/vitess
go/bytes2/buffer.go
WriteByte
func (buf *Buffer) WriteByte(b byte) error { buf.bytes = append(buf.bytes, b) return nil }
go
func (buf *Buffer) WriteByte(b byte) error { buf.bytes = append(buf.bytes, b) return nil }
[ "func", "(", "buf", "*", "Buffer", ")", "WriteByte", "(", "b", "byte", ")", "error", "{", "buf", ".", "bytes", "=", "append", "(", "buf", ".", "bytes", ",", "b", ")", "\n", "return", "nil", "\n", "}" ]
// WriteByte is equivalent to bytes.Buffer.WriteByte.
[ "WriteByte", "is", "equivalent", "to", "bytes", ".", "Buffer", ".", "WriteByte", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/bytes2/buffer.go#L47-L50
135,937
vitessio/vitess
go/vt/vterrors/vterrors.go
NewWithoutCode
func NewWithoutCode(message string) error { return &fundamental{ msg: message, code: vtrpcpb.Code_UNKNOWN, stack: callers(), } }
go
func NewWithoutCode(message string) error { return &fundamental{ msg: message, code: vtrpcpb.Code_UNKNOWN, stack: callers(), } }
[ "func", "NewWithoutCode", "(", "message", "string", ")", "error", "{", "return", "&", "fundamental", "{", "msg", ":", "message", ",", "code", ":", "vtrpcpb", ".", "Code_UNKNOWN", ",", "stack", ":", "callers", "(", ")", ",", "}", "\n", "}" ]
// NewWithoutCode returns an error when no applicable error code is available // It will record the stack trace when creating the error
[ "NewWithoutCode", "returns", "an", "error", "when", "no", "applicable", "error", "code", "is", "available", "It", "will", "record", "the", "stack", "trace", "when", "creating", "the", "error" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vterrors/vterrors.go#L101-L107
135,938
vitessio/vitess
go/vt/vterrors/vterrors.go
Code
func Code(err error) vtrpcpb.Code { if err == nil { return vtrpcpb.Code_OK } if err, ok := err.(*fundamental); ok { return err.code } cause := Cause(err) if cause != err && cause != nil { // If we did not find an error code at the outer level, let's find the cause and check it's code return Code(cause) ...
go
func Code(err error) vtrpcpb.Code { if err == nil { return vtrpcpb.Code_OK } if err, ok := err.(*fundamental); ok { return err.code } cause := Cause(err) if cause != err && cause != nil { // If we did not find an error code at the outer level, let's find the cause and check it's code return Code(cause) ...
[ "func", "Code", "(", "err", "error", ")", "vtrpcpb", ".", "Code", "{", "if", "err", "==", "nil", "{", "return", "vtrpcpb", ".", "Code_OK", "\n", "}", "\n", "if", "err", ",", "ok", ":=", "err", ".", "(", "*", "fundamental", ")", ";", "ok", "{", ...
// Code returns the error code if it's a vtError. // If err is nil, it returns ok.
[ "Code", "returns", "the", "error", "code", "if", "it", "s", "a", "vtError", ".", "If", "err", "is", "nil", "it", "returns", "ok", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vterrors/vterrors.go#L147-L169
135,939
vitessio/vitess
go/vt/vtgate/engine/pullout_subquery.go
Execute
func (ps *PulloutSubquery) Execute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error) { combinedVars, err := ps.execSubquery(vcursor, bindVars) if err != nil { return nil, err } return ps.Underlying.Execute(vcursor, combinedVars, wantfields) }
go
func (ps *PulloutSubquery) Execute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error) { combinedVars, err := ps.execSubquery(vcursor, bindVars) if err != nil { return nil, err } return ps.Underlying.Execute(vcursor, combinedVars, wantfields) }
[ "func", "(", "ps", "*", "PulloutSubquery", ")", "Execute", "(", "vcursor", "VCursor", ",", "bindVars", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable", ",", "wantfields", "bool", ")", "(", "*", "sqltypes", ".", "Result", ",", "error", ")",...
// Execute satisfies the Primitive interface.
[ "Execute", "satisfies", "the", "Primitive", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/engine/pullout_subquery.go#L47-L53
135,940
vitessio/vitess
go/vt/schemamanager/schemaswap/schema_swap.go
Init
func (*SwapWorkflowFactory) Init(_ *workflow.Manager, workflowProto *workflowpb.Workflow, args []string) error { subFlags := flag.NewFlagSet(workflowFactoryName, flag.ContinueOnError) keyspace := subFlags.String("keyspace", "", "Name of a keyspace to perform schema swap on") sql := subFlags.String("sql", "", "Query...
go
func (*SwapWorkflowFactory) Init(_ *workflow.Manager, workflowProto *workflowpb.Workflow, args []string) error { subFlags := flag.NewFlagSet(workflowFactoryName, flag.ContinueOnError) keyspace := subFlags.String("keyspace", "", "Name of a keyspace to perform schema swap on") sql := subFlags.String("sql", "", "Query...
[ "func", "(", "*", "SwapWorkflowFactory", ")", "Init", "(", "_", "*", "workflow", ".", "Manager", ",", "workflowProto", "*", "workflowpb", ".", "Workflow", ",", "args", "[", "]", "string", ")", "error", "{", "subFlags", ":=", "flag", ".", "NewFlagSet", "(...
// Init is a part of workflow.Factory interface. It initializes a Workflow protobuf object.
[ "Init", "is", "a", "part", "of", "workflow", ".", "Factory", "interface", ".", "It", "initializes", "a", "Workflow", "protobuf", "object", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemaswap/schema_swap.go#L182-L205
135,941
vitessio/vitess
go/vt/schemamanager/schemaswap/schema_swap.go
Instantiate
func (*SwapWorkflowFactory) Instantiate(_ *workflow.Manager, workflowProto *workflowpb.Workflow, rootNode *workflow.Node) (workflow.Workflow, error) { data := &swapWorkflowData{} if err := json.Unmarshal(workflowProto.Data, data); err != nil { return nil, err } rootNode.Message = fmt.Sprintf("Schema swap is execu...
go
func (*SwapWorkflowFactory) Instantiate(_ *workflow.Manager, workflowProto *workflowpb.Workflow, rootNode *workflow.Node) (workflow.Workflow, error) { data := &swapWorkflowData{} if err := json.Unmarshal(workflowProto.Data, data); err != nil { return nil, err } rootNode.Message = fmt.Sprintf("Schema swap is execu...
[ "func", "(", "*", "SwapWorkflowFactory", ")", "Instantiate", "(", "_", "*", "workflow", ".", "Manager", ",", "workflowProto", "*", "workflowpb", ".", "Workflow", ",", "rootNode", "*", "workflow", ".", "Node", ")", "(", "workflow", ".", "Workflow", ",", "er...
// Instantiate is a part of workflow.Factory interface. It instantiates workflow.Workflow object from // workflowpb.Workflow protobuf object.
[ "Instantiate", "is", "a", "part", "of", "workflow", ".", "Factory", "interface", ".", "It", "instantiates", "workflow", ".", "Workflow", "object", "from", "workflowpb", ".", "Workflow", "protobuf", "object", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemaswap/schema_swap.go#L209-L222
135,942
vitessio/vitess
go/vt/schemamanager/schemaswap/schema_swap.go
Run
func (schemaSwap *Swap) Run(ctx context.Context, manager *workflow.Manager, workflowInfo *topo.WorkflowInfo) error { schemaSwap.ctx = ctx schemaSwap.workflowManager = manager schemaSwap.topoServer = manager.TopoServer() schemaSwap.tabletClient = tmclient.NewTabletManagerClient() log.Infof("Starting schema swap on...
go
func (schemaSwap *Swap) Run(ctx context.Context, manager *workflow.Manager, workflowInfo *topo.WorkflowInfo) error { schemaSwap.ctx = ctx schemaSwap.workflowManager = manager schemaSwap.topoServer = manager.TopoServer() schemaSwap.tabletClient = tmclient.NewTabletManagerClient() log.Infof("Starting schema swap on...
[ "func", "(", "schemaSwap", "*", "Swap", ")", "Run", "(", "ctx", "context", ".", "Context", ",", "manager", "*", "workflow", ".", "Manager", ",", "workflowInfo", "*", "topo", ".", "WorkflowInfo", ")", "error", "{", "schemaSwap", ".", "ctx", "=", "ctx", ...
// Run is a part of workflow.Workflow interface. This is the main entrance point of the schema swap workflow.
[ "Run", "is", "a", "part", "of", "workflow", ".", "Workflow", "interface", ".", "This", "is", "the", "main", "entrance", "point", "of", "the", "schema", "swap", "workflow", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemaswap/schema_swap.go#L225-L269
135,943
vitessio/vitess
go/vt/schemamanager/schemaswap/schema_swap.go
closeRetryChannel
func (schemaSwap *Swap) closeRetryChannel() { schemaSwap.retryMutex.Lock() defer schemaSwap.retryMutex.Unlock() if len(schemaSwap.rootUINode.Actions) != 0 { schemaSwap.rootUINode.Actions = []*workflow.Action{} close(schemaSwap.retryChannel) } }
go
func (schemaSwap *Swap) closeRetryChannel() { schemaSwap.retryMutex.Lock() defer schemaSwap.retryMutex.Unlock() if len(schemaSwap.rootUINode.Actions) != 0 { schemaSwap.rootUINode.Actions = []*workflow.Action{} close(schemaSwap.retryChannel) } }
[ "func", "(", "schemaSwap", "*", "Swap", ")", "closeRetryChannel", "(", ")", "{", "schemaSwap", ".", "retryMutex", ".", "Lock", "(", ")", "\n", "defer", "schemaSwap", ".", "retryMutex", ".", "Unlock", "(", ")", "\n\n", "if", "len", "(", "schemaSwap", ".",...
// closeRetryChannel closes the retryChannel and empties the Actions list in the rootUINode // to indicate that the channel is closed and Retry action is not waited for anymore.
[ "closeRetryChannel", "closes", "the", "retryChannel", "and", "empties", "the", "Actions", "list", "in", "the", "rootUINode", "to", "indicate", "that", "the", "channel", "is", "closed", "and", "Retry", "action", "is", "not", "waited", "for", "anymore", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemaswap/schema_swap.go#L273-L281
135,944
vitessio/vitess
go/vt/schemamanager/schemaswap/schema_swap.go
Action
func (schemaSwap *Swap) Action(ctx context.Context, path, name string) error { if name != "Retry" { return fmt.Errorf("unknown action on schema swap: %v", name) } schemaSwap.closeRetryChannel() schemaSwap.rootUINode.BroadcastChanges(false /* updateChildren */) return nil }
go
func (schemaSwap *Swap) Action(ctx context.Context, path, name string) error { if name != "Retry" { return fmt.Errorf("unknown action on schema swap: %v", name) } schemaSwap.closeRetryChannel() schemaSwap.rootUINode.BroadcastChanges(false /* updateChildren */) return nil }
[ "func", "(", "schemaSwap", "*", "Swap", ")", "Action", "(", "ctx", "context", ".", "Context", ",", "path", ",", "name", "string", ")", "error", "{", "if", "name", "!=", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "name", ...
// Action is a part of workflow.ActionListener interface. It registers "Retry" actions // from UI.
[ "Action", "is", "a", "part", "of", "workflow", ".", "ActionListener", "interface", ".", "It", "registers", "Retry", "actions", "from", "UI", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemaswap/schema_swap.go#L285-L292
135,945
vitessio/vitess
go/vt/schemamanager/schemaswap/schema_swap.go
executeSwap
func (schemaSwap *Swap) executeSwap() error { schemaSwap.setUIMessage("Initializing schema swap") if len(schemaSwap.allShards) == 0 { if err := schemaSwap.createShardObjects(); err != nil { return err } schemaSwap.rootUINode.BroadcastChanges(true /* updateChildren */) } if err := schemaSwap.initializeSwap(...
go
func (schemaSwap *Swap) executeSwap() error { schemaSwap.setUIMessage("Initializing schema swap") if len(schemaSwap.allShards) == 0 { if err := schemaSwap.createShardObjects(); err != nil { return err } schemaSwap.rootUINode.BroadcastChanges(true /* updateChildren */) } if err := schemaSwap.initializeSwap(...
[ "func", "(", "schemaSwap", "*", "Swap", ")", "executeSwap", "(", ")", "error", "{", "schemaSwap", ".", "setUIMessage", "(", "\"", "\"", ")", "\n", "if", "len", "(", "schemaSwap", ".", "allShards", ")", "==", "0", "{", "if", "err", ":=", "schemaSwap", ...
// executeSwap is the main entry point of the schema swap process. It drives the process from start // to finish, including possible restart of already started process. In the latter case the // method should be just called again and it will pick up already started process. The only // input argument is the SQL stateme...
[ "executeSwap", "is", "the", "main", "entry", "point", "of", "the", "schema", "swap", "process", ".", "It", "drives", "the", "process", "from", "start", "to", "finish", "including", "possible", "restart", "of", "already", "started", "process", ".", "In", "the...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemaswap/schema_swap.go#L299-L377
135,946
vitessio/vitess
go/vt/schemamanager/schemaswap/schema_swap.go
setUIMessage
func (schemaSwap *Swap) setUIMessage(message string) { log.Infof("Schema swap on keyspace %v: %v", schemaSwap.keyspace, message) schemaSwap.uiLogger.Infof(message) schemaSwap.rootUINode.Log = schemaSwap.uiLogger.String() schemaSwap.rootUINode.Message = message schemaSwap.rootUINode.BroadcastChanges(false /* update...
go
func (schemaSwap *Swap) setUIMessage(message string) { log.Infof("Schema swap on keyspace %v: %v", schemaSwap.keyspace, message) schemaSwap.uiLogger.Infof(message) schemaSwap.rootUINode.Log = schemaSwap.uiLogger.String() schemaSwap.rootUINode.Message = message schemaSwap.rootUINode.BroadcastChanges(false /* update...
[ "func", "(", "schemaSwap", "*", "Swap", ")", "setUIMessage", "(", "message", "string", ")", "{", "log", ".", "Infof", "(", "\"", "\"", ",", "schemaSwap", ".", "keyspace", ",", "message", ")", "\n", "schemaSwap", ".", "uiLogger", ".", "Infof", "(", "mes...
// setUIMessage updates message on the schema swap's root UI node and broadcasts changes.
[ "setUIMessage", "updates", "message", "on", "the", "schema", "swap", "s", "root", "UI", "node", "and", "broadcasts", "changes", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemaswap/schema_swap.go#L380-L386
135,947
vitessio/vitess
go/vt/schemamanager/schemaswap/schema_swap.go
runOnAllShards
func (schemaSwap *Swap) runOnAllShards(shardFunc func(shard *shardSchemaSwap) error) error { var errorRecorder concurrency.AllErrorRecorder var waitGroup sync.WaitGroup for _, shardSwap := range schemaSwap.allShards { waitGroup.Add(1) go func(shard *shardSchemaSwap) { defer waitGroup.Done() errorRecorder.R...
go
func (schemaSwap *Swap) runOnAllShards(shardFunc func(shard *shardSchemaSwap) error) error { var errorRecorder concurrency.AllErrorRecorder var waitGroup sync.WaitGroup for _, shardSwap := range schemaSwap.allShards { waitGroup.Add(1) go func(shard *shardSchemaSwap) { defer waitGroup.Done() errorRecorder.R...
[ "func", "(", "schemaSwap", "*", "Swap", ")", "runOnAllShards", "(", "shardFunc", "func", "(", "shard", "*", "shardSchemaSwap", ")", "error", ")", "error", "{", "var", "errorRecorder", "concurrency", ".", "AllErrorRecorder", "\n", "var", "waitGroup", "sync", "....
// runOnAllShards is a helper method that executes the passed function for all shards in parallel. // The method returns no error if the function succeeds on all shards. If on any of the shards // the function fails then the method returns error. If several shards return error then only one // of them is returned.
[ "runOnAllShards", "is", "a", "helper", "method", "that", "executes", "the", "passed", "function", "for", "all", "shards", "in", "parallel", ".", "The", "method", "returns", "no", "error", "if", "the", "function", "succeeds", "on", "all", "shards", ".", "If",...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemaswap/schema_swap.go#L392-L404
135,948
vitessio/vitess
go/vt/schemamanager/schemaswap/schema_swap.go
createShardObjects
func (schemaSwap *Swap) createShardObjects() error { shardsList, err := schemaSwap.topoServer.FindAllShardsInKeyspace(schemaSwap.ctx, schemaSwap.keyspace) if err != nil { return err } for _, shardInfo := range shardsList { shardSwap := &shardSchemaSwap{ parent: schemaSwap, shardName: shardInfo.ShardNam...
go
func (schemaSwap *Swap) createShardObjects() error { shardsList, err := schemaSwap.topoServer.FindAllShardsInKeyspace(schemaSwap.ctx, schemaSwap.keyspace) if err != nil { return err } for _, shardInfo := range shardsList { shardSwap := &shardSchemaSwap{ parent: schemaSwap, shardName: shardInfo.ShardNam...
[ "func", "(", "schemaSwap", "*", "Swap", ")", "createShardObjects", "(", ")", "error", "{", "shardsList", ",", "err", ":=", "schemaSwap", ".", "topoServer", ".", "FindAllShardsInKeyspace", "(", "schemaSwap", ".", "ctx", ",", "schemaSwap", ".", "keyspace", ")", ...
// createShardObjects creates per-shard swap objects for all shards in the keyspace.
[ "createShardObjects", "creates", "per", "-", "shard", "swap", "objects", "for", "all", "shards", "in", "the", "keyspace", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemaswap/schema_swap.go#L407-L450
135,949
vitessio/vitess
go/vt/schemamanager/schemaswap/schema_swap.go
stopAllHealthWatchers
func (schemaSwap *Swap) stopAllHealthWatchers() { schemaSwap.runOnAllShards( func(shard *shardSchemaSwap) error { shard.stopHealthWatchers() return nil }) }
go
func (schemaSwap *Swap) stopAllHealthWatchers() { schemaSwap.runOnAllShards( func(shard *shardSchemaSwap) error { shard.stopHealthWatchers() return nil }) }
[ "func", "(", "schemaSwap", "*", "Swap", ")", "stopAllHealthWatchers", "(", ")", "{", "schemaSwap", ".", "runOnAllShards", "(", "func", "(", "shard", "*", "shardSchemaSwap", ")", "error", "{", "shard", ".", "stopHealthWatchers", "(", ")", "\n", "return", "nil...
// stopAllHealthWatchers stops watching for health on each shard. It's separated into a separate // function mainly to make "defer" statement where it's used simpler.
[ "stopAllHealthWatchers", "stops", "watching", "for", "health", "on", "each", "shard", ".", "It", "s", "separated", "into", "a", "separate", "function", "mainly", "to", "make", "defer", "statement", "where", "it", "s", "used", "simpler", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemaswap/schema_swap.go#L454-L460
135,950
vitessio/vitess
go/vt/schemamanager/schemaswap/schema_swap.go
initializeSwap
func (schemaSwap *Swap) initializeSwap() error { var waitGroup sync.WaitGroup metadataList := make([]shardSwapMetadata, len(schemaSwap.allShards)) for i, shard := range schemaSwap.allShards { waitGroup.Add(1) go shard.readShardMetadata(&metadataList[i], &waitGroup) } waitGroup.Wait() var recorder concurrency...
go
func (schemaSwap *Swap) initializeSwap() error { var waitGroup sync.WaitGroup metadataList := make([]shardSwapMetadata, len(schemaSwap.allShards)) for i, shard := range schemaSwap.allShards { waitGroup.Add(1) go shard.readShardMetadata(&metadataList[i], &waitGroup) } waitGroup.Wait() var recorder concurrency...
[ "func", "(", "schemaSwap", "*", "Swap", ")", "initializeSwap", "(", ")", "error", "{", "var", "waitGroup", "sync", ".", "WaitGroup", "\n", "metadataList", ":=", "make", "(", "[", "]", "shardSwapMetadata", ",", "len", "(", "schemaSwap", ".", "allShards", ")...
// initializeSwap starts the schema swap process. If there is already a schema swap process started // the method just picks up that. Otherwise it starts a new one and writes into the database that // the process was started.
[ "initializeSwap", "starts", "the", "schema", "swap", "process", ".", "If", "there", "is", "already", "a", "schema", "swap", "process", "started", "the", "method", "just", "picks", "up", "that", ".", "Otherwise", "it", "starts", "a", "new", "one", "and", "w...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemaswap/schema_swap.go#L465-L532
135,951
vitessio/vitess
go/vt/schemamanager/schemaswap/schema_swap.go
finalizeSwap
func (schemaSwap *Swap) finalizeSwap() error { return schemaSwap.runOnAllShards( func(shard *shardSchemaSwap) error { return shard.writeFinishedSwap() }) }
go
func (schemaSwap *Swap) finalizeSwap() error { return schemaSwap.runOnAllShards( func(shard *shardSchemaSwap) error { return shard.writeFinishedSwap() }) }
[ "func", "(", "schemaSwap", "*", "Swap", ")", "finalizeSwap", "(", ")", "error", "{", "return", "schemaSwap", ".", "runOnAllShards", "(", "func", "(", "shard", "*", "shardSchemaSwap", ")", "error", "{", "return", "shard", ".", "writeFinishedSwap", "(", ")", ...
// finalizeSwap finishes the completed swap process by modifying the database to register the completion.
[ "finalizeSwap", "finishes", "the", "completed", "swap", "process", "by", "modifying", "the", "database", "to", "register", "the", "completion", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemaswap/schema_swap.go#L535-L540
135,952
vitessio/vitess
go/vt/schemamanager/schemaswap/schema_swap.go
markStepInProgress
func (shardSwap *shardSchemaSwap) markStepInProgress(uiNode *workflow.Node) { uiNode.Message = "" uiNode.State = workflowpb.WorkflowState_Running uiNode.Display = workflow.NodeDisplayIndeterminate uiNode.BroadcastChanges(false /* updateChildren */) }
go
func (shardSwap *shardSchemaSwap) markStepInProgress(uiNode *workflow.Node) { uiNode.Message = "" uiNode.State = workflowpb.WorkflowState_Running uiNode.Display = workflow.NodeDisplayIndeterminate uiNode.BroadcastChanges(false /* updateChildren */) }
[ "func", "(", "shardSwap", "*", "shardSchemaSwap", ")", "markStepInProgress", "(", "uiNode", "*", "workflow", ".", "Node", ")", "{", "uiNode", ".", "Message", "=", "\"", "\"", "\n", "uiNode", ".", "State", "=", "workflowpb", ".", "WorkflowState_Running", "\n"...
// markStepInProgress marks one step of the shard schema swap workflow as running.
[ "markStepInProgress", "marks", "one", "step", "of", "the", "shard", "schema", "swap", "workflow", "as", "running", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemaswap/schema_swap.go#L554-L559
135,953
vitessio/vitess
go/vt/schemamanager/schemaswap/schema_swap.go
addShardLog
func (shardSwap *shardSchemaSwap) addShardLog(message string) { log.Infof("Shard %v: %v", shardSwap.shardName, message) shardSwap.shardUILogger.Infof(message) shardSwap.shardUINode.Log = shardSwap.shardUILogger.String() shardSwap.shardUINode.BroadcastChanges(false /* updateChildren */) }
go
func (shardSwap *shardSchemaSwap) addShardLog(message string) { log.Infof("Shard %v: %v", shardSwap.shardName, message) shardSwap.shardUILogger.Infof(message) shardSwap.shardUINode.Log = shardSwap.shardUILogger.String() shardSwap.shardUINode.BroadcastChanges(false /* updateChildren */) }
[ "func", "(", "shardSwap", "*", "shardSchemaSwap", ")", "addShardLog", "(", "message", "string", ")", "{", "log", ".", "Infof", "(", "\"", "\"", ",", "shardSwap", ".", "shardName", ",", "message", ")", "\n", "shardSwap", ".", "shardUILogger", ".", "Infof", ...
// addShardLog prints the message into logs and adds it into logs displayed in UI on the // shard node.
[ "addShardLog", "prints", "the", "message", "into", "logs", "and", "adds", "it", "into", "logs", "displayed", "in", "UI", "on", "the", "shard", "node", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemaswap/schema_swap.go#L563-L568
135,954
vitessio/vitess
go/vt/schemamanager/schemaswap/schema_swap.go
markStepDone
func (shardSwap *shardSchemaSwap) markStepDone(uiNode *workflow.Node, err *error) { if *err != nil { msg := fmt.Sprintf("Error: %v", *err) shardSwap.addShardLog(msg) uiNode.Message = msg } uiNode.State = workflowpb.WorkflowState_Done uiNode.Display = workflow.NodeDisplayNone uiNode.BroadcastChanges(false /* ...
go
func (shardSwap *shardSchemaSwap) markStepDone(uiNode *workflow.Node, err *error) { if *err != nil { msg := fmt.Sprintf("Error: %v", *err) shardSwap.addShardLog(msg) uiNode.Message = msg } uiNode.State = workflowpb.WorkflowState_Done uiNode.Display = workflow.NodeDisplayNone uiNode.BroadcastChanges(false /* ...
[ "func", "(", "shardSwap", "*", "shardSchemaSwap", ")", "markStepDone", "(", "uiNode", "*", "workflow", ".", "Node", ",", "err", "*", "error", ")", "{", "if", "*", "err", "!=", "nil", "{", "msg", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "*...
// markStepDone marks one step of the shard schema swap workflow as finished successfully // or with an error.
[ "markStepDone", "marks", "one", "step", "of", "the", "shard", "schema", "swap", "workflow", "as", "finished", "successfully", "or", "with", "an", "error", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemaswap/schema_swap.go#L572-L581
135,955
vitessio/vitess
go/vt/schemamanager/schemaswap/schema_swap.go
getMasterTablet
func (shardSwap *shardSchemaSwap) getMasterTablet() (*topodatapb.Tablet, error) { topoServer := shardSwap.parent.topoServer shardInfo, err := topoServer.GetShard(shardSwap.parent.ctx, shardSwap.parent.keyspace, shardSwap.shardName) if err != nil { return nil, err } tabletInfo, err := topoServer.GetTablet(shardSw...
go
func (shardSwap *shardSchemaSwap) getMasterTablet() (*topodatapb.Tablet, error) { topoServer := shardSwap.parent.topoServer shardInfo, err := topoServer.GetShard(shardSwap.parent.ctx, shardSwap.parent.keyspace, shardSwap.shardName) if err != nil { return nil, err } tabletInfo, err := topoServer.GetTablet(shardSw...
[ "func", "(", "shardSwap", "*", "shardSchemaSwap", ")", "getMasterTablet", "(", ")", "(", "*", "topodatapb", ".", "Tablet", ",", "error", ")", "{", "topoServer", ":=", "shardSwap", ".", "parent", ".", "topoServer", "\n", "shardInfo", ",", "err", ":=", "topo...
// getMasterTablet returns the tablet that is currently master on the shard.
[ "getMasterTablet", "returns", "the", "tablet", "that", "is", "currently", "master", "on", "the", "shard", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemaswap/schema_swap.go#L584-L595
135,956
vitessio/vitess
go/vt/schemamanager/schemaswap/schema_swap.go
readShardMetadata
func (shardSwap *shardSchemaSwap) readShardMetadata(metadata *shardSwapMetadata, waitGroup *sync.WaitGroup) { defer waitGroup.Done() tablet, err := shardSwap.getMasterTablet() if err != nil { metadata.err = err return } query := fmt.Sprintf( "SELECT name, value FROM _vt.shard_metadata WHERE db_name = '%s' a...
go
func (shardSwap *shardSchemaSwap) readShardMetadata(metadata *shardSwapMetadata, waitGroup *sync.WaitGroup) { defer waitGroup.Done() tablet, err := shardSwap.getMasterTablet() if err != nil { metadata.err = err return } query := fmt.Sprintf( "SELECT name, value FROM _vt.shard_metadata WHERE db_name = '%s' a...
[ "func", "(", "shardSwap", "*", "shardSchemaSwap", ")", "readShardMetadata", "(", "metadata", "*", "shardSwapMetadata", ",", "waitGroup", "*", "sync", ".", "WaitGroup", ")", "{", "defer", "waitGroup", ".", "Done", "(", ")", "\n\n", "tablet", ",", "err", ":=",...
// readShardMetadata reads info about schema swaps on this shard from _vt.shard_metadata table.
[ "readShardMetadata", "reads", "info", "about", "schema", "swaps", "on", "this", "shard", "from", "_vt", ".", "shard_metadata", "table", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemaswap/schema_swap.go#L598-L634
135,957
vitessio/vitess
go/vt/schemamanager/schemaswap/schema_swap.go
writeStartedSwap
func (shardSwap *shardSchemaSwap) writeStartedSwap() error { tablet, err := shardSwap.getMasterTablet() if err != nil { return err } queryBuf := bytes.Buffer{} queryBuf.WriteString("INSERT INTO _vt.shard_metadata (db_name, name, value) VALUES ('") queryBuf.WriteString(topoproto.TabletDbName(tablet)) queryBuf.W...
go
func (shardSwap *shardSchemaSwap) writeStartedSwap() error { tablet, err := shardSwap.getMasterTablet() if err != nil { return err } queryBuf := bytes.Buffer{} queryBuf.WriteString("INSERT INTO _vt.shard_metadata (db_name, name, value) VALUES ('") queryBuf.WriteString(topoproto.TabletDbName(tablet)) queryBuf.W...
[ "func", "(", "shardSwap", "*", "shardSchemaSwap", ")", "writeStartedSwap", "(", ")", "error", "{", "tablet", ",", "err", ":=", "shardSwap", ".", "getMasterTablet", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "queryBuf...
// writeStartedSwap registers in the _vt.shard_metadata table in the database the information // about the new schema swap process being started.
[ "writeStartedSwap", "registers", "in", "the", "_vt", ".", "shard_metadata", "table", "in", "the", "database", "the", "information", "about", "the", "new", "schema", "swap", "process", "being", "started", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemaswap/schema_swap.go#L638-L662
135,958
vitessio/vitess
go/vt/schemamanager/schemaswap/schema_swap.go
writeFinishedSwap
func (shardSwap *shardSchemaSwap) writeFinishedSwap() error { tablet, err := shardSwap.getMasterTablet() if err != nil { return err } query := fmt.Sprintf( "INSERT INTO _vt.shard_metadata (db_name, name, value) VALUES ('%s', '%s', '%d') ON DUPLICATE KEY UPDATE value = '%d'", topoproto.TabletDbName(tablet), la...
go
func (shardSwap *shardSchemaSwap) writeFinishedSwap() error { tablet, err := shardSwap.getMasterTablet() if err != nil { return err } query := fmt.Sprintf( "INSERT INTO _vt.shard_metadata (db_name, name, value) VALUES ('%s', '%s', '%d') ON DUPLICATE KEY UPDATE value = '%d'", topoproto.TabletDbName(tablet), la...
[ "func", "(", "shardSwap", "*", "shardSchemaSwap", ")", "writeFinishedSwap", "(", ")", "error", "{", "tablet", ",", "err", ":=", "shardSwap", ".", "getMasterTablet", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "query",...
// writeFinishedSwap registers in the _vt.shard_metadata table in the database that the schema // swap process has finished.
[ "writeFinishedSwap", "registers", "in", "the", "_vt", ".", "shard_metadata", "table", "in", "the", "database", "that", "the", "schema", "swap", "process", "has", "finished", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemaswap/schema_swap.go#L666-L681
135,959
vitessio/vitess
go/vt/schemamanager/schemaswap/schema_swap.go
startHealthWatchers
func (shardSwap *shardSchemaSwap) startHealthWatchers(ctx context.Context) error { shardSwap.allTablets = make(map[string]*discovery.TabletStats) shardSwap.tabletHealthCheck = discovery.NewHealthCheck(*vtctl.HealthcheckRetryDelay, *vtctl.HealthCheckTimeout) shardSwap.tabletHealthCheck.SetListener(shardSwap, true /*...
go
func (shardSwap *shardSchemaSwap) startHealthWatchers(ctx context.Context) error { shardSwap.allTablets = make(map[string]*discovery.TabletStats) shardSwap.tabletHealthCheck = discovery.NewHealthCheck(*vtctl.HealthcheckRetryDelay, *vtctl.HealthCheckTimeout) shardSwap.tabletHealthCheck.SetListener(shardSwap, true /*...
[ "func", "(", "shardSwap", "*", "shardSchemaSwap", ")", "startHealthWatchers", "(", "ctx", "context", ".", "Context", ")", "error", "{", "shardSwap", ".", "allTablets", "=", "make", "(", "map", "[", "string", "]", "*", "discovery", ".", "TabletStats", ")", ...
// startHealthWatchers launches the topology watchers and health checking to monitor // all tablets on the shard. Function should be called before the start of the schema // swap process.
[ "startHealthWatchers", "launches", "the", "topology", "watchers", "and", "health", "checking", "to", "monitor", "all", "tablets", "on", "the", "shard", ".", "Function", "should", "be", "called", "before", "the", "start", "of", "the", "schema", "swap", "process",...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemaswap/schema_swap.go#L686-L733
135,960
vitessio/vitess
go/vt/schemamanager/schemaswap/schema_swap.go
isTabletHealthy
func isTabletHealthy(tabletStats *discovery.TabletStats) bool { return tabletStats.Stats.HealthError == "" && !discovery.IsReplicationLagHigh(tabletStats) }
go
func isTabletHealthy(tabletStats *discovery.TabletStats) bool { return tabletStats.Stats.HealthError == "" && !discovery.IsReplicationLagHigh(tabletStats) }
[ "func", "isTabletHealthy", "(", "tabletStats", "*", "discovery", ".", "TabletStats", ")", "bool", "{", "return", "tabletStats", ".", "Stats", ".", "HealthError", "==", "\"", "\"", "&&", "!", "discovery", ".", "IsReplicationLagHigh", "(", "tabletStats", ")", "\...
// isTabletHealthy verifies that the given TabletStats represents a healthy tablet that is // caught up with replication to a serving level.
[ "isTabletHealthy", "verifies", "that", "the", "given", "TabletStats", "represents", "a", "healthy", "tablet", "that", "is", "caught", "up", "with", "replication", "to", "a", "serving", "level", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemaswap/schema_swap.go#L751-L753
135,961
vitessio/vitess
go/vt/schemamanager/schemaswap/schema_swap.go
checkWaitingTabletHealthiness
func (shardSwap *shardSchemaSwap) checkWaitingTabletHealthiness(tabletStats *discovery.TabletStats) { if shardSwap.healthWaitingTablet == tabletStats.Key && isTabletHealthy(tabletStats) { close(*shardSwap.healthWaitingChannel) shardSwap.healthWaitingChannel = nil shardSwap.healthWaitingTablet = "" } }
go
func (shardSwap *shardSchemaSwap) checkWaitingTabletHealthiness(tabletStats *discovery.TabletStats) { if shardSwap.healthWaitingTablet == tabletStats.Key && isTabletHealthy(tabletStats) { close(*shardSwap.healthWaitingChannel) shardSwap.healthWaitingChannel = nil shardSwap.healthWaitingTablet = "" } }
[ "func", "(", "shardSwap", "*", "shardSchemaSwap", ")", "checkWaitingTabletHealthiness", "(", "tabletStats", "*", "discovery", ".", "TabletStats", ")", "{", "if", "shardSwap", ".", "healthWaitingTablet", "==", "tabletStats", ".", "Key", "&&", "isTabletHealthy", "(", ...
// checkWaitingTabletHealthiness verifies whether the provided TabletStats represent the // tablet that is being waited to become healthy, and notifies the waiting go routine if // it is the tablet and if it is healthy now. // The function should be called with shardSwap.allTabletsLock mutex locked.
[ "checkWaitingTabletHealthiness", "verifies", "whether", "the", "provided", "TabletStats", "represent", "the", "tablet", "that", "is", "being", "waited", "to", "become", "healthy", "and", "notifies", "the", "waiting", "go", "routine", "if", "it", "is", "the", "tabl...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemaswap/schema_swap.go#L783-L789
135,962
vitessio/vitess
go/vt/schemamanager/schemaswap/schema_swap.go
StatsUpdate
func (shardSwap *shardSchemaSwap) StatsUpdate(newTabletStats *discovery.TabletStats) { shardSwap.allTabletsLock.Lock() defer shardSwap.allTabletsLock.Unlock() existingStats, found := shardSwap.allTablets[newTabletStats.Key] if newTabletStats.Up { if found { *existingStats = *newTabletStats } else { shard...
go
func (shardSwap *shardSchemaSwap) StatsUpdate(newTabletStats *discovery.TabletStats) { shardSwap.allTabletsLock.Lock() defer shardSwap.allTabletsLock.Unlock() existingStats, found := shardSwap.allTablets[newTabletStats.Key] if newTabletStats.Up { if found { *existingStats = *newTabletStats } else { shard...
[ "func", "(", "shardSwap", "*", "shardSchemaSwap", ")", "StatsUpdate", "(", "newTabletStats", "*", "discovery", ".", "TabletStats", ")", "{", "shardSwap", ".", "allTabletsLock", ".", "Lock", "(", ")", "\n", "defer", "shardSwap", ".", "allTabletsLock", ".", "Unl...
// StatsUpdate is the part of discovery.HealthCheckStatsListener interface. It makes sure // that when a change of tablet health happens it's recorded in allTablets list, and if // this is the tablet that is being waited for after restore, the function wakes up the // waiting go routine.
[ "StatsUpdate", "is", "the", "part", "of", "discovery", ".", "HealthCheckStatsListener", "interface", ".", "It", "makes", "sure", "that", "when", "a", "change", "of", "tablet", "health", "happens", "it", "s", "recorded", "in", "allTablets", "list", "and", "if",...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemaswap/schema_swap.go#L795-L810
135,963
vitessio/vitess
go/vt/schemamanager/schemaswap/schema_swap.go
getTabletList
func (shardSwap *shardSchemaSwap) getTabletList() []discovery.TabletStats { shardSwap.allTabletsLock.RLock() defer shardSwap.allTabletsLock.RUnlock() tabletList := make([]discovery.TabletStats, 0, len(shardSwap.allTablets)) for _, tabletStats := range shardSwap.allTablets { tabletList = append(tabletList, *table...
go
func (shardSwap *shardSchemaSwap) getTabletList() []discovery.TabletStats { shardSwap.allTabletsLock.RLock() defer shardSwap.allTabletsLock.RUnlock() tabletList := make([]discovery.TabletStats, 0, len(shardSwap.allTablets)) for _, tabletStats := range shardSwap.allTablets { tabletList = append(tabletList, *table...
[ "func", "(", "shardSwap", "*", "shardSchemaSwap", ")", "getTabletList", "(", ")", "[", "]", "discovery", ".", "TabletStats", "{", "shardSwap", ".", "allTabletsLock", ".", "RLock", "(", ")", "\n", "defer", "shardSwap", ".", "allTabletsLock", ".", "RUnlock", "...
// getTabletList returns the list of all known tablets in the shard so that the caller // could operate with it without holding the allTabletsLock.
[ "getTabletList", "returns", "the", "list", "of", "all", "known", "tablets", "in", "the", "shard", "so", "that", "the", "caller", "could", "operate", "with", "it", "without", "holding", "the", "allTabletsLock", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemaswap/schema_swap.go#L814-L823
135,964
vitessio/vitess
go/vt/schemamanager/schemaswap/schema_swap.go
Swap
func (array orderTabletsForSwap) Swap(i, j int) { array[i], array[j] = array[j], array[i] }
go
func (array orderTabletsForSwap) Swap(i, j int) { array[i], array[j] = array[j], array[i] }
[ "func", "(", "array", "orderTabletsForSwap", ")", "Swap", "(", "i", ",", "j", "int", ")", "{", "array", "[", "i", "]", ",", "array", "[", "j", "]", "=", "array", "[", "j", "]", ",", "array", "[", "i", "]", "\n", "}" ]
// Swap is part of sort.Interface interface.
[ "Swap", "is", "part", "of", "sort", ".", "Interface", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemaswap/schema_swap.go#L836-L838
135,965
vitessio/vitess
go/vt/schemamanager/schemaswap/schema_swap.go
getTabletTypeFromStats
func getTabletTypeFromStats(tabletStats *discovery.TabletStats) topodatapb.TabletType { if tabletStats.Target == nil || tabletStats.Target.TabletType == topodatapb.TabletType_UNKNOWN { return tabletStats.Tablet.Type } return tabletStats.Target.TabletType }
go
func getTabletTypeFromStats(tabletStats *discovery.TabletStats) topodatapb.TabletType { if tabletStats.Target == nil || tabletStats.Target.TabletType == topodatapb.TabletType_UNKNOWN { return tabletStats.Tablet.Type } return tabletStats.Target.TabletType }
[ "func", "getTabletTypeFromStats", "(", "tabletStats", "*", "discovery", ".", "TabletStats", ")", "topodatapb", ".", "TabletType", "{", "if", "tabletStats", ".", "Target", "==", "nil", "||", "tabletStats", ".", "Target", ".", "TabletType", "==", "topodatapb", "."...
// getTabletTypeFromStats returns the tablet type saved in the TabletStats object. If there is Target // data in the TabletStats object then the function returns TabletType from it because it will be more // up-to-date. But if that's not available then it returns Tablet.Type which will contain data read // from the top...
[ "getTabletTypeFromStats", "returns", "the", "tablet", "type", "saved", "in", "the", "TabletStats", "object", ".", "If", "there", "is", "Target", "data", "in", "the", "TabletStats", "object", "then", "the", "function", "returns", "TabletType", "from", "it", "beca...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemaswap/schema_swap.go#L844-L849
135,966
vitessio/vitess
go/vt/schemamanager/schemaswap/schema_swap.go
Less
func (array orderTabletsForSwap) Less(i, j int) bool { return tabletSortIndex(&array[i]) < tabletSortIndex(&array[j]) }
go
func (array orderTabletsForSwap) Less(i, j int) bool { return tabletSortIndex(&array[i]) < tabletSortIndex(&array[j]) }
[ "func", "(", "array", "orderTabletsForSwap", ")", "Less", "(", "i", ",", "j", "int", ")", "bool", "{", "return", "tabletSortIndex", "(", "&", "array", "[", "i", "]", ")", "<", "tabletSortIndex", "(", "&", "array", "[", "j", "]", ")", "\n", "}" ]
// Less is part of sort.Interface interface. It should compare too elements of the array.
[ "Less", "is", "part", "of", "sort", ".", "Interface", "interface", ".", "It", "should", "compare", "too", "elements", "of", "the", "array", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemaswap/schema_swap.go#L875-L877
135,967
vitessio/vitess
go/vt/schemamanager/schemaswap/schema_swap.go
isSwapApplied
func (shardSwap *shardSchemaSwap) isSwapApplied(tablet *topodatapb.Tablet) (bool, error) { swapIDResult, err := shardSwap.executeAdminQuery( tablet, fmt.Sprintf("SELECT value FROM _vt.local_metadata WHERE db_name = '%s' AND name = '%s'", topoproto.TabletDbName(tablet), lastAppliedMetadataName), 1 /* maxRows */) ...
go
func (shardSwap *shardSchemaSwap) isSwapApplied(tablet *topodatapb.Tablet) (bool, error) { swapIDResult, err := shardSwap.executeAdminQuery( tablet, fmt.Sprintf("SELECT value FROM _vt.local_metadata WHERE db_name = '%s' AND name = '%s'", topoproto.TabletDbName(tablet), lastAppliedMetadataName), 1 /* maxRows */) ...
[ "func", "(", "shardSwap", "*", "shardSchemaSwap", ")", "isSwapApplied", "(", "tablet", "*", "topodatapb", ".", "Tablet", ")", "(", "bool", ",", "error", ")", "{", "swapIDResult", ",", "err", ":=", "shardSwap", ".", "executeAdminQuery", "(", "tablet", ",", ...
// isSwapApplied verifies whether the schema swap was already applied to the tablet. It's // considered to be applied if _vt.local_metadata table has the swap id in the row titled // 'LastAppliedSchemaSwap'.
[ "isSwapApplied", "verifies", "whether", "the", "schema", "swap", "was", "already", "applied", "to", "the", "tablet", ".", "It", "s", "considered", "to", "be", "applied", "if", "_vt", ".", "local_metadata", "table", "has", "the", "swap", "id", "in", "the", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemaswap/schema_swap.go#L900-L917
135,968
vitessio/vitess
go/vt/schemamanager/schemaswap/schema_swap.go
undrainSeedTablet
func (shardSwap *shardSchemaSwap) undrainSeedTablet(seedTablet *topodatapb.Tablet, tabletType topodatapb.TabletType) error { _, err := shardSwap.parent.topoServer.UpdateTabletFields(shardSwap.parent.ctx, seedTablet.Alias, func(tablet *topodatapb.Tablet) error { delete(tablet.Tags, "drain_reason") return nil ...
go
func (shardSwap *shardSchemaSwap) undrainSeedTablet(seedTablet *topodatapb.Tablet, tabletType topodatapb.TabletType) error { _, err := shardSwap.parent.topoServer.UpdateTabletFields(shardSwap.parent.ctx, seedTablet.Alias, func(tablet *topodatapb.Tablet) error { delete(tablet.Tags, "drain_reason") return nil ...
[ "func", "(", "shardSwap", "*", "shardSchemaSwap", ")", "undrainSeedTablet", "(", "seedTablet", "*", "topodatapb", ".", "Tablet", ",", "tabletType", "topodatapb", ".", "TabletType", ")", "error", "{", "_", ",", "err", ":=", "shardSwap", ".", "parent", ".", "t...
// undrainSeedTablet undrains the tablet that was used to apply seed schema change, // and returns it to the same type as it was before.
[ "undrainSeedTablet", "undrains", "the", "tablet", "that", "was", "used", "to", "apply", "seed", "schema", "change", "and", "returns", "it", "to", "the", "same", "type", "as", "it", "was", "before", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemaswap/schema_swap.go#L964-L979
135,969
vitessio/vitess
go/vt/schemamanager/schemaswap/schema_swap.go
takeSeedBackup
func (shardSwap *shardSchemaSwap) takeSeedBackup() (err error) { shardSwap.markStepInProgress(shardSwap.backupUINode) defer shardSwap.markStepDone(shardSwap.backupUINode, &err) tabletList := shardSwap.getTabletList() sort.Sort(orderTabletsForSwap(tabletList)) var seedTablet *topodatapb.Tablet for seedTablet == n...
go
func (shardSwap *shardSchemaSwap) takeSeedBackup() (err error) { shardSwap.markStepInProgress(shardSwap.backupUINode) defer shardSwap.markStepDone(shardSwap.backupUINode, &err) tabletList := shardSwap.getTabletList() sort.Sort(orderTabletsForSwap(tabletList)) var seedTablet *topodatapb.Tablet for seedTablet == n...
[ "func", "(", "shardSwap", "*", "shardSchemaSwap", ")", "takeSeedBackup", "(", ")", "(", "err", "error", ")", "{", "shardSwap", ".", "markStepInProgress", "(", "shardSwap", ".", "backupUINode", ")", "\n", "defer", "shardSwap", ".", "markStepDone", "(", "shardSw...
// takeSeedBackup takes backup on the seed tablet. The method assumes that the seed tablet is any tablet that // has info that schema swap was already applied on it. This way the function can be re-used if the seed backup // is lost somewhere half way through the schema swap process.
[ "takeSeedBackup", "takes", "backup", "on", "the", "seed", "tablet", ".", "The", "method", "assumes", "that", "the", "seed", "tablet", "is", "any", "tablet", "that", "has", "info", "that", "schema", "swap", "was", "already", "applied", "on", "it", ".", "Thi...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemaswap/schema_swap.go#L1072-L1118
135,970
vitessio/vitess
go/vt/schemamanager/schemaswap/schema_swap.go
swapOnTablet
func (shardSwap *shardSchemaSwap) swapOnTablet(tablet *topodatapb.Tablet) error { shardSwap.addPropagationLog(fmt.Sprintf("Restoring tablet %v from backup", tablet.Alias)) eventStream, err := shardSwap.parent.tabletClient.RestoreFromBackup(shardSwap.parent.ctx, tablet) if err != nil { return err } waitForRestore...
go
func (shardSwap *shardSchemaSwap) swapOnTablet(tablet *topodatapb.Tablet) error { shardSwap.addPropagationLog(fmt.Sprintf("Restoring tablet %v from backup", tablet.Alias)) eventStream, err := shardSwap.parent.tabletClient.RestoreFromBackup(shardSwap.parent.ctx, tablet) if err != nil { return err } waitForRestore...
[ "func", "(", "shardSwap", "*", "shardSchemaSwap", ")", "swapOnTablet", "(", "tablet", "*", "topodatapb", ".", "Tablet", ")", "error", "{", "shardSwap", ".", "addPropagationLog", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "tablet", ".", "Alias", ")",...
// swapOnTablet performs the schema swap on the provided tablet and then waits for it // to become healthy and to catch up with replication.
[ "swapOnTablet", "performs", "the", "schema", "swap", "on", "the", "provided", "tablet", "and", "then", "waits", "for", "it", "to", "become", "healthy", "and", "to", "catch", "up", "with", "replication", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemaswap/schema_swap.go#L1122-L1153
135,971
vitessio/vitess
go/vt/schemamanager/schemaswap/schema_swap.go
waitForTabletToBeHealthy
func (shardSwap *shardSchemaSwap) waitForTabletToBeHealthy(tablet *topodatapb.Tablet) error { waitChannel, err := shardSwap.startWaitingOnUnhealthyTablet(tablet) if err != nil { return err } if waitChannel != nil { select { case <-shardSwap.parent.ctx.Done(): return shardSwap.parent.ctx.Err() case <-*wai...
go
func (shardSwap *shardSchemaSwap) waitForTabletToBeHealthy(tablet *topodatapb.Tablet) error { waitChannel, err := shardSwap.startWaitingOnUnhealthyTablet(tablet) if err != nil { return err } if waitChannel != nil { select { case <-shardSwap.parent.ctx.Done(): return shardSwap.parent.ctx.Err() case <-*wai...
[ "func", "(", "shardSwap", "*", "shardSchemaSwap", ")", "waitForTabletToBeHealthy", "(", "tablet", "*", "topodatapb", ".", "Tablet", ")", "error", "{", "waitChannel", ",", "err", ":=", "shardSwap", ".", "startWaitingOnUnhealthyTablet", "(", "tablet", ")", "\n", "...
// waitForTabletToBeHealthy waits until the given tablet becomes healthy and caught up with // replication. If the tablet is already healthy and caught up when this method is called then // it returns immediately.
[ "waitForTabletToBeHealthy", "waits", "until", "the", "given", "tablet", "becomes", "healthy", "and", "caught", "up", "with", "replication", ".", "If", "the", "tablet", "is", "already", "healthy", "and", "caught", "up", "when", "this", "method", "is", "called", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemaswap/schema_swap.go#L1158-L1172
135,972
vitessio/vitess
go/vt/schemamanager/schemaswap/schema_swap.go
updatePropagationProgressUI
func (shardSwap *shardSchemaSwap) updatePropagationProgressUI() { shardSwap.propagationUINode.ProgressMessage = fmt.Sprintf("%v/%v", shardSwap.numTabletsSwapped, shardSwap.numTabletsTotal) if shardSwap.numTabletsTotal == 0 { shardSwap.propagationUINode.Progress = 0 } else { shardSwap.propagationUINode.Progress =...
go
func (shardSwap *shardSchemaSwap) updatePropagationProgressUI() { shardSwap.propagationUINode.ProgressMessage = fmt.Sprintf("%v/%v", shardSwap.numTabletsSwapped, shardSwap.numTabletsTotal) if shardSwap.numTabletsTotal == 0 { shardSwap.propagationUINode.Progress = 0 } else { shardSwap.propagationUINode.Progress =...
[ "func", "(", "shardSwap", "*", "shardSchemaSwap", ")", "updatePropagationProgressUI", "(", ")", "{", "shardSwap", ".", "propagationUINode", ".", "ProgressMessage", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "shardSwap", ".", "numTabletsSwapped", ",", "sha...
// updatePropagationProgressUI updates the progress bar in the workflow UI to reflect appropriate // percentage in line with how many tablets have schema swapped already.
[ "updatePropagationProgressUI", "updates", "the", "progress", "bar", "in", "the", "workflow", "UI", "to", "reflect", "appropriate", "percentage", "in", "line", "with", "how", "many", "tablets", "have", "schema", "swapped", "already", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemaswap/schema_swap.go#L1176-L1184
135,973
vitessio/vitess
go/vt/schemamanager/schemaswap/schema_swap.go
markPropagationInProgress
func (shardSwap *shardSchemaSwap) markPropagationInProgress() { shardSwap.propagationUINode.Message = "" shardSwap.propagationUINode.State = workflowpb.WorkflowState_Running shardSwap.propagationUINode.Display = workflow.NodeDisplayDeterminate shardSwap.propagationUINode.BroadcastChanges(false /* updateChildren */)...
go
func (shardSwap *shardSchemaSwap) markPropagationInProgress() { shardSwap.propagationUINode.Message = "" shardSwap.propagationUINode.State = workflowpb.WorkflowState_Running shardSwap.propagationUINode.Display = workflow.NodeDisplayDeterminate shardSwap.propagationUINode.BroadcastChanges(false /* updateChildren */)...
[ "func", "(", "shardSwap", "*", "shardSchemaSwap", ")", "markPropagationInProgress", "(", ")", "{", "shardSwap", ".", "propagationUINode", ".", "Message", "=", "\"", "\"", "\n", "shardSwap", ".", "propagationUINode", ".", "State", "=", "workflowpb", ".", "Workflo...
// markPropagationInProgress marks the propagation step of the shard schema swap workflow as running.
[ "markPropagationInProgress", "marks", "the", "propagation", "step", "of", "the", "shard", "schema", "swap", "workflow", "as", "running", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemaswap/schema_swap.go#L1187-L1192
135,974
vitessio/vitess
go/vt/schemamanager/schemaswap/schema_swap.go
addPropagationLog
func (shardSwap *shardSchemaSwap) addPropagationLog(message string) { shardSwap.propagationUILogger.Infof(message) shardSwap.propagationUINode.Log = shardSwap.propagationUILogger.String() shardSwap.propagationUINode.Message = message shardSwap.propagationUINode.BroadcastChanges(false /* updateChildren */) shardSwa...
go
func (shardSwap *shardSchemaSwap) addPropagationLog(message string) { shardSwap.propagationUILogger.Infof(message) shardSwap.propagationUINode.Log = shardSwap.propagationUILogger.String() shardSwap.propagationUINode.Message = message shardSwap.propagationUINode.BroadcastChanges(false /* updateChildren */) shardSwa...
[ "func", "(", "shardSwap", "*", "shardSchemaSwap", ")", "addPropagationLog", "(", "message", "string", ")", "{", "shardSwap", ".", "propagationUILogger", ".", "Infof", "(", "message", ")", "\n", "shardSwap", ".", "propagationUINode", ".", "Log", "=", "shardSwap",...
// addPropagationLog prints the message to logs, adds it to logs displayed in the UI on the "Propagate to all tablets" // node and adds the message to the logs displayed on the overall shard node, so that everything happening to this // shard was visible in one log.
[ "addPropagationLog", "prints", "the", "message", "to", "logs", "adds", "it", "to", "logs", "displayed", "in", "the", "UI", "on", "the", "Propagate", "to", "all", "tablets", "node", "and", "adds", "the", "message", "to", "the", "logs", "displayed", "on", "t...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemaswap/schema_swap.go#L1197-L1203
135,975
vitessio/vitess
go/vt/schemamanager/schemaswap/schema_swap.go
markPropagationDone
func (shardSwap *shardSchemaSwap) markPropagationDone(err *error) { if *err != nil { msg := fmt.Sprintf("Error: %v", *err) shardSwap.addPropagationLog(msg) shardSwap.propagationUINode.Message = msg shardSwap.propagationUINode.State = workflowpb.WorkflowState_Done } else if shardSwap.numTabletsSwapped == shard...
go
func (shardSwap *shardSchemaSwap) markPropagationDone(err *error) { if *err != nil { msg := fmt.Sprintf("Error: %v", *err) shardSwap.addPropagationLog(msg) shardSwap.propagationUINode.Message = msg shardSwap.propagationUINode.State = workflowpb.WorkflowState_Done } else if shardSwap.numTabletsSwapped == shard...
[ "func", "(", "shardSwap", "*", "shardSchemaSwap", ")", "markPropagationDone", "(", "err", "*", "error", ")", "{", "if", "*", "err", "!=", "nil", "{", "msg", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "*", "err", ")", "\n", "shardSwap", ".", ...
// markPropagationDone marks the propagation step of the shard schema swap workflow as finished successfully // or with an error.
[ "markPropagationDone", "marks", "the", "propagation", "step", "of", "the", "shard", "schema", "swap", "workflow", "as", "finished", "successfully", "or", "with", "an", "error", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemaswap/schema_swap.go#L1207-L1217
135,976
vitessio/vitess
go/vt/schemamanager/schemaswap/schema_swap.go
propagateToAllTablets
func (shardSwap *shardSchemaSwap) propagateToAllTablets(withMasterReparent bool) (err error) { shardSwap.markPropagationInProgress() defer shardSwap.markPropagationDone(&err) for { shardSwap.updatePropagationProgressUI() tablet, err := shardSwap.findNextTabletToSwap() // Update UI immediately after finding ne...
go
func (shardSwap *shardSchemaSwap) propagateToAllTablets(withMasterReparent bool) (err error) { shardSwap.markPropagationInProgress() defer shardSwap.markPropagationDone(&err) for { shardSwap.updatePropagationProgressUI() tablet, err := shardSwap.findNextTabletToSwap() // Update UI immediately after finding ne...
[ "func", "(", "shardSwap", "*", "shardSchemaSwap", ")", "propagateToAllTablets", "(", "withMasterReparent", "bool", ")", "(", "err", "error", ")", "{", "shardSwap", ".", "markPropagationInProgress", "(", ")", "\n", "defer", "shardSwap", ".", "markPropagationDone", ...
// propagateToNonMasterTablets propagates the schema change to all non-master tablets // in the shard. When it returns nil it means that only master can remain left with the // old schema, everything else is verified to have schema swap applied.
[ "propagateToNonMasterTablets", "propagates", "the", "schema", "change", "to", "all", "non", "-", "master", "tablets", "in", "the", "shard", ".", "When", "it", "returns", "nil", "it", "means", "that", "only", "master", "can", "remain", "left", "with", "the", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemaswap/schema_swap.go#L1222-L1275
135,977
vitessio/vitess
go/vt/schemamanager/schemaswap/schema_swap.go
reparentFromMaster
func (shardSwap *shardSchemaSwap) reparentFromMaster(masterTablet *topodatapb.Tablet) (err error) { shardSwap.markStepInProgress(shardSwap.reparentUINode) defer shardSwap.markStepDone(shardSwap.reparentUINode, &err) shardSwap.addShardLog(fmt.Sprintf("Reparenting away from master %v", masterTablet.Alias)) if *mysql...
go
func (shardSwap *shardSchemaSwap) reparentFromMaster(masterTablet *topodatapb.Tablet) (err error) { shardSwap.markStepInProgress(shardSwap.reparentUINode) defer shardSwap.markStepDone(shardSwap.reparentUINode, &err) shardSwap.addShardLog(fmt.Sprintf("Reparenting away from master %v", masterTablet.Alias)) if *mysql...
[ "func", "(", "shardSwap", "*", "shardSchemaSwap", ")", "reparentFromMaster", "(", "masterTablet", "*", "topodatapb", ".", "Tablet", ")", "(", "err", "error", ")", "{", "shardSwap", ".", "markStepInProgress", "(", "shardSwap", ".", "reparentUINode", ")", "\n", ...
// propagateToMaster propagates the schema change to the master. If the master already has // the schema change applied then the method does nothing.
[ "propagateToMaster", "propagates", "the", "schema", "change", "to", "the", "master", ".", "If", "the", "master", "already", "has", "the", "schema", "change", "applied", "then", "the", "method", "does", "nothing", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemaswap/schema_swap.go#L1279-L1309
135,978
vitessio/vitess
go/vt/binlog/slave_connection.go
connectForReplication
func connectForReplication(cp *mysql.ConnParams) (*mysql.Conn, error) { params, err := dbconfigs.WithCredentials(cp) if err != nil { return nil, err } ctx := context.Background() conn, err := mysql.Connect(ctx, params) if err != nil { return nil, err } // Tell the server that we understand the format of e...
go
func connectForReplication(cp *mysql.ConnParams) (*mysql.Conn, error) { params, err := dbconfigs.WithCredentials(cp) if err != nil { return nil, err } ctx := context.Background() conn, err := mysql.Connect(ctx, params) if err != nil { return nil, err } // Tell the server that we understand the format of e...
[ "func", "connectForReplication", "(", "cp", "*", "mysql", ".", "ConnParams", ")", "(", "*", "mysql", ".", "Conn", ",", "error", ")", "{", "params", ",", "err", ":=", "dbconfigs", ".", "WithCredentials", "(", "cp", ")", "\n", "if", "err", "!=", "nil", ...
// connectForReplication create a MySQL connection ready to use for replication.
[ "connectForReplication", "create", "a", "MySQL", "connection", "ready", "to", "use", "for", "replication", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/binlog/slave_connection.go#L72-L91
135,979
vitessio/vitess
go/vt/binlog/slave_connection.go
StartBinlogDumpFromCurrent
func (sc *SlaveConnection) StartBinlogDumpFromCurrent(ctx context.Context) (mysql.Position, <-chan mysql.BinlogEvent, error) { ctx, sc.cancel = context.WithCancel(ctx) masterPosition, err := sc.Conn.MasterPosition() if err != nil { return mysql.Position{}, nil, fmt.Errorf("failed to get master position: %v", err)...
go
func (sc *SlaveConnection) StartBinlogDumpFromCurrent(ctx context.Context) (mysql.Position, <-chan mysql.BinlogEvent, error) { ctx, sc.cancel = context.WithCancel(ctx) masterPosition, err := sc.Conn.MasterPosition() if err != nil { return mysql.Position{}, nil, fmt.Errorf("failed to get master position: %v", err)...
[ "func", "(", "sc", "*", "SlaveConnection", ")", "StartBinlogDumpFromCurrent", "(", "ctx", "context", ".", "Context", ")", "(", "mysql", ".", "Position", ",", "<-", "chan", "mysql", ".", "BinlogEvent", ",", "error", ")", "{", "ctx", ",", "sc", ".", "cance...
// StartBinlogDumpFromCurrent requests a replication binlog dump from // the current position.
[ "StartBinlogDumpFromCurrent", "requests", "a", "replication", "binlog", "dump", "from", "the", "current", "position", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/binlog/slave_connection.go#L98-L108
135,980
vitessio/vitess
go/vt/binlog/slave_connection.go
StartBinlogDumpFromPosition
func (sc *SlaveConnection) StartBinlogDumpFromPosition(ctx context.Context, startPos mysql.Position) (<-chan mysql.BinlogEvent, error) { ctx, sc.cancel = context.WithCancel(ctx) log.Infof("sending binlog dump command: startPos=%v, slaveID=%v", startPos, sc.slaveID) if err := sc.SendBinlogDumpCommand(sc.slaveID, sta...
go
func (sc *SlaveConnection) StartBinlogDumpFromPosition(ctx context.Context, startPos mysql.Position) (<-chan mysql.BinlogEvent, error) { ctx, sc.cancel = context.WithCancel(ctx) log.Infof("sending binlog dump command: startPos=%v, slaveID=%v", startPos, sc.slaveID) if err := sc.SendBinlogDumpCommand(sc.slaveID, sta...
[ "func", "(", "sc", "*", "SlaveConnection", ")", "StartBinlogDumpFromPosition", "(", "ctx", "context", ".", "Context", ",", "startPos", "mysql", ".", "Position", ")", "(", "<-", "chan", "mysql", ".", "BinlogEvent", ",", "error", ")", "{", "ctx", ",", "sc", ...
// StartBinlogDumpFromPosition requests a replication binlog dump from // the master mysqld at the given Position and then sends binlog // events to the provided channel. // The stream will continue in the background, waiting for new events if // necessary, until the connection is closed, either by the master or // by ...
[ "StartBinlogDumpFromPosition", "requests", "a", "replication", "binlog", "dump", "from", "the", "master", "mysqld", "at", "the", "given", "Position", "and", "then", "sends", "binlog", "events", "to", "the", "provided", "channel", ".", "The", "stream", "will", "c...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/binlog/slave_connection.go#L118-L128
135,981
vitessio/vitess
go/vt/binlog/slave_connection.go
streamEvents
func (sc *SlaveConnection) streamEvents(ctx context.Context) chan mysql.BinlogEvent { // FIXME(alainjobart) I think we can use a buffered channel for better performance. eventChan := make(chan mysql.BinlogEvent) // Start reading events. sc.wg.Add(1) go func() { defer func() { close(eventChan) sc.wg.Done()...
go
func (sc *SlaveConnection) streamEvents(ctx context.Context) chan mysql.BinlogEvent { // FIXME(alainjobart) I think we can use a buffered channel for better performance. eventChan := make(chan mysql.BinlogEvent) // Start reading events. sc.wg.Add(1) go func() { defer func() { close(eventChan) sc.wg.Done()...
[ "func", "(", "sc", "*", "SlaveConnection", ")", "streamEvents", "(", "ctx", "context", ".", "Context", ")", "chan", "mysql", ".", "BinlogEvent", "{", "// FIXME(alainjobart) I think we can use a buffered channel for better performance.", "eventChan", ":=", "make", "(", "...
// streamEvents returns a channel on which events are streamed.
[ "streamEvents", "returns", "a", "channel", "on", "which", "events", "are", "streamed", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/binlog/slave_connection.go#L131-L164
135,982
vitessio/vitess
go/vt/throttler/interval_history.go
average
func (h *intervalHistory) average(from, to time.Time) float64 { // Search only entries whose time of observation is in [start, end). // Example: [from, to) = [1.5s, 2.5s) => [start, end) = [1s, 2s) start := from.Truncate(h.interval) end := to.Truncate(h.interval) sum := 0.0 count := 0.0 var nextIntervalStart ti...
go
func (h *intervalHistory) average(from, to time.Time) float64 { // Search only entries whose time of observation is in [start, end). // Example: [from, to) = [1.5s, 2.5s) => [start, end) = [1s, 2s) start := from.Truncate(h.interval) end := to.Truncate(h.interval) sum := 0.0 count := 0.0 var nextIntervalStart ti...
[ "func", "(", "h", "*", "intervalHistory", ")", "average", "(", "from", ",", "to", "time", ".", "Time", ")", "float64", "{", "// Search only entries whose time of observation is in [start, end).", "// Example: [from, to) = [1.5s, 2.5s) => [start, end) = [1s, 2s)", "start", ":=...
// average returns the average value across all observations which span // the range [from, to). // Partially included observations are accounted by their included fraction. // Missing observations are assumed with the value zero.
[ "average", "returns", "the", "average", "value", "across", "all", "observations", "which", "span", "the", "range", "[", "from", "to", ")", ".", "Partially", "included", "observations", "are", "accounted", "by", "their", "included", "fraction", ".", "Missing", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/interval_history.go#L64-L106
135,983
vitessio/vitess
go/vt/vttime/time_clock.go
Now
func (t TimeClock) Now() (Interval, error) { now := time.Now() return NewInterval(now.Add(-(*uncertainty)), now.Add(*uncertainty)) }
go
func (t TimeClock) Now() (Interval, error) { now := time.Now() return NewInterval(now.Add(-(*uncertainty)), now.Add(*uncertainty)) }
[ "func", "(", "t", "TimeClock", ")", "Now", "(", ")", "(", "Interval", ",", "error", ")", "{", "now", ":=", "time", ".", "Now", "(", ")", "\n", "return", "NewInterval", "(", "now", ".", "Add", "(", "-", "(", "*", "uncertainty", ")", ")", ",", "n...
// Now is part of the Clock interface.
[ "Now", "is", "part", "of", "the", "Clock", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttime/time_clock.go#L33-L36
135,984
vitessio/vitess
go/vt/vttablet/tabletmanager/rpc_replication.go
SlaveStatus
func (agent *ActionAgent) SlaveStatus(ctx context.Context) (*replicationdatapb.Status, error) { status, err := agent.MysqlDaemon.SlaveStatus() if err != nil { return nil, err } return mysql.SlaveStatusToProto(status), nil }
go
func (agent *ActionAgent) SlaveStatus(ctx context.Context) (*replicationdatapb.Status, error) { status, err := agent.MysqlDaemon.SlaveStatus() if err != nil { return nil, err } return mysql.SlaveStatusToProto(status), nil }
[ "func", "(", "agent", "*", "ActionAgent", ")", "SlaveStatus", "(", "ctx", "context", ".", "Context", ")", "(", "*", "replicationdatapb", ".", "Status", ",", "error", ")", "{", "status", ",", "err", ":=", "agent", ".", "MysqlDaemon", ".", "SlaveStatus", "...
// SlaveStatus returns the replication status
[ "SlaveStatus", "returns", "the", "replication", "status" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/rpc_replication.go#L45-L51
135,985
vitessio/vitess
go/vt/vttablet/tabletmanager/rpc_replication.go
MasterPosition
func (agent *ActionAgent) MasterPosition(ctx context.Context) (string, error) { pos, err := agent.MysqlDaemon.MasterPosition() if err != nil { return "", err } return mysql.EncodePosition(pos), nil }
go
func (agent *ActionAgent) MasterPosition(ctx context.Context) (string, error) { pos, err := agent.MysqlDaemon.MasterPosition() if err != nil { return "", err } return mysql.EncodePosition(pos), nil }
[ "func", "(", "agent", "*", "ActionAgent", ")", "MasterPosition", "(", "ctx", "context", ".", "Context", ")", "(", "string", ",", "error", ")", "{", "pos", ",", "err", ":=", "agent", ".", "MysqlDaemon", ".", "MasterPosition", "(", ")", "\n", "if", "err"...
// MasterPosition returns the master position
[ "MasterPosition", "returns", "the", "master", "position" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/rpc_replication.go#L54-L60
135,986
vitessio/vitess
go/vt/vttablet/tabletmanager/rpc_replication.go
StartSlaveUntilAfter
func (agent *ActionAgent) StartSlaveUntilAfter(ctx context.Context, position string, waitTime time.Duration) error { if err := agent.lock(ctx); err != nil { return err } defer agent.unlock() waitCtx, cancel := context.WithTimeout(ctx, waitTime) defer cancel() pos, err := mysql.DecodePosition(position) if err...
go
func (agent *ActionAgent) StartSlaveUntilAfter(ctx context.Context, position string, waitTime time.Duration) error { if err := agent.lock(ctx); err != nil { return err } defer agent.unlock() waitCtx, cancel := context.WithTimeout(ctx, waitTime) defer cancel() pos, err := mysql.DecodePosition(position) if err...
[ "func", "(", "agent", "*", "ActionAgent", ")", "StartSlaveUntilAfter", "(", "ctx", "context", ".", "Context", ",", "position", "string", ",", "waitTime", "time", ".", "Duration", ")", "error", "{", "if", "err", ":=", "agent", ".", "lock", "(", "ctx", ")"...
// StartSlaveUntilAfter will start the replication and let it catch up // until and including the transactions in `position`
[ "StartSlaveUntilAfter", "will", "start", "the", "replication", "and", "let", "it", "catch", "up", "until", "and", "including", "the", "transactions", "in", "position" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/rpc_replication.go#L150-L165
135,987
vitessio/vitess
go/vt/vttablet/tabletmanager/rpc_replication.go
GetSlaves
func (agent *ActionAgent) GetSlaves(ctx context.Context) ([]string, error) { return mysqlctl.FindSlaves(agent.MysqlDaemon) }
go
func (agent *ActionAgent) GetSlaves(ctx context.Context) ([]string, error) { return mysqlctl.FindSlaves(agent.MysqlDaemon) }
[ "func", "(", "agent", "*", "ActionAgent", ")", "GetSlaves", "(", "ctx", "context", ".", "Context", ")", "(", "[", "]", "string", ",", "error", ")", "{", "return", "mysqlctl", ".", "FindSlaves", "(", "agent", ".", "MysqlDaemon", ")", "\n", "}" ]
// GetSlaves returns the address of all the slaves
[ "GetSlaves", "returns", "the", "address", "of", "all", "the", "slaves" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/rpc_replication.go#L168-L170
135,988
vitessio/vitess
go/vt/vttablet/tabletmanager/rpc_replication.go
ResetReplication
func (agent *ActionAgent) ResetReplication(ctx context.Context) error { if err := agent.lock(ctx); err != nil { return err } defer agent.unlock() agent.setSlaveStopped(true) return agent.MysqlDaemon.ResetReplication(ctx) }
go
func (agent *ActionAgent) ResetReplication(ctx context.Context) error { if err := agent.lock(ctx); err != nil { return err } defer agent.unlock() agent.setSlaveStopped(true) return agent.MysqlDaemon.ResetReplication(ctx) }
[ "func", "(", "agent", "*", "ActionAgent", ")", "ResetReplication", "(", "ctx", "context", ".", "Context", ")", "error", "{", "if", "err", ":=", "agent", ".", "lock", "(", "ctx", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "...
// ResetReplication completely resets the replication on the host. // All binary and relay logs are flushed. All replication positions are reset.
[ "ResetReplication", "completely", "resets", "the", "replication", "on", "the", "host", ".", "All", "binary", "and", "relay", "logs", "are", "flushed", ".", "All", "replication", "positions", "are", "reset", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/rpc_replication.go#L174-L182
135,989
vitessio/vitess
go/vt/vttablet/tabletmanager/rpc_replication.go
InitMaster
func (agent *ActionAgent) InitMaster(ctx context.Context) (string, error) { if err := agent.lock(ctx); err != nil { return "", err } defer agent.unlock() // Initializing as master implies undoing any previous "do not replicate". agent.setSlaveStopped(false) // we need to insert something in the binlogs, so we...
go
func (agent *ActionAgent) InitMaster(ctx context.Context) (string, error) { if err := agent.lock(ctx); err != nil { return "", err } defer agent.unlock() // Initializing as master implies undoing any previous "do not replicate". agent.setSlaveStopped(false) // we need to insert something in the binlogs, so we...
[ "func", "(", "agent", "*", "ActionAgent", ")", "InitMaster", "(", "ctx", "context", ".", "Context", ")", "(", "string", ",", "error", ")", "{", "if", "err", ":=", "agent", ".", "lock", "(", "ctx", ")", ";", "err", "!=", "nil", "{", "return", "\"", ...
// InitMaster enables writes and returns the replication position.
[ "InitMaster", "enables", "writes", "and", "returns", "the", "replication", "position", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/rpc_replication.go#L185-L235
135,990
vitessio/vitess
go/vt/vttablet/tabletmanager/rpc_replication.go
PopulateReparentJournal
func (agent *ActionAgent) PopulateReparentJournal(ctx context.Context, timeCreatedNS int64, actionName string, masterAlias *topodatapb.TabletAlias, position string) error { pos, err := mysql.DecodePosition(position) if err != nil { return err } cmds := mysqlctl.CreateReparentJournal() cmds = append(cmds, mysqlct...
go
func (agent *ActionAgent) PopulateReparentJournal(ctx context.Context, timeCreatedNS int64, actionName string, masterAlias *topodatapb.TabletAlias, position string) error { pos, err := mysql.DecodePosition(position) if err != nil { return err } cmds := mysqlctl.CreateReparentJournal() cmds = append(cmds, mysqlct...
[ "func", "(", "agent", "*", "ActionAgent", ")", "PopulateReparentJournal", "(", "ctx", "context", ".", "Context", ",", "timeCreatedNS", "int64", ",", "actionName", "string", ",", "masterAlias", "*", "topodatapb", ".", "TabletAlias", ",", "position", "string", ")"...
// PopulateReparentJournal adds an entry into the reparent_journal table.
[ "PopulateReparentJournal", "adds", "an", "entry", "into", "the", "reparent_journal", "table", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/rpc_replication.go#L238-L247
135,991
vitessio/vitess
go/vt/vttablet/tabletmanager/rpc_replication.go
InitSlave
func (agent *ActionAgent) InitSlave(ctx context.Context, parent *topodatapb.TabletAlias, position string, timeCreatedNS int64) error { if err := agent.lock(ctx); err != nil { return err } defer agent.unlock() pos, err := mysql.DecodePosition(position) if err != nil { return err } ti, err := agent.TopoServer...
go
func (agent *ActionAgent) InitSlave(ctx context.Context, parent *topodatapb.TabletAlias, position string, timeCreatedNS int64) error { if err := agent.lock(ctx); err != nil { return err } defer agent.unlock() pos, err := mysql.DecodePosition(position) if err != nil { return err } ti, err := agent.TopoServer...
[ "func", "(", "agent", "*", "ActionAgent", ")", "InitSlave", "(", "ctx", "context", ".", "Context", ",", "parent", "*", "topodatapb", ".", "TabletAlias", ",", "position", "string", ",", "timeCreatedNS", "int64", ")", "error", "{", "if", "err", ":=", "agent"...
// InitSlave sets replication master and position, and waits for the // reparent_journal table entry up to context timeout
[ "InitSlave", "sets", "replication", "master", "and", "position", "and", "waits", "for", "the", "reparent_journal", "table", "entry", "up", "to", "context", "timeout" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/rpc_replication.go#L251-L302
135,992
vitessio/vitess
go/vt/vttablet/tabletmanager/rpc_replication.go
DemoteMaster
func (agent *ActionAgent) DemoteMaster(ctx context.Context) (string, error) { if err := agent.lock(ctx); err != nil { return "", err } defer agent.unlock() // Tell Orchestrator we're stopped on purpose the demotion. // This is a best effort task, so run it in a goroutine. go func() { if agent.orc == nil { ...
go
func (agent *ActionAgent) DemoteMaster(ctx context.Context) (string, error) { if err := agent.lock(ctx); err != nil { return "", err } defer agent.unlock() // Tell Orchestrator we're stopped on purpose the demotion. // This is a best effort task, so run it in a goroutine. go func() { if agent.orc == nil { ...
[ "func", "(", "agent", "*", "ActionAgent", ")", "DemoteMaster", "(", "ctx", "context", ".", "Context", ")", "(", "string", ",", "error", ")", "{", "if", "err", ":=", "agent", ".", "lock", "(", "ctx", ")", ";", "err", "!=", "nil", "{", "return", "\""...
// DemoteMaster marks the server read-only, wait until it is done with // its current transactions, and returns its master position.
[ "DemoteMaster", "marks", "the", "server", "read", "-", "only", "wait", "until", "it", "is", "done", "with", "its", "current", "transactions", "and", "returns", "its", "master", "position", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/rpc_replication.go#L306-L390
135,993
vitessio/vitess
go/vt/vttablet/tabletmanager/rpc_replication.go
UndoDemoteMaster
func (agent *ActionAgent) UndoDemoteMaster(ctx context.Context) error { if err := agent.lock(ctx); err != nil { return err } defer agent.unlock() // If using semi-sync, we need to enable master-side. if err := agent.fixSemiSync(topodatapb.TabletType_MASTER); err != nil { return err } // Now, set the server...
go
func (agent *ActionAgent) UndoDemoteMaster(ctx context.Context) error { if err := agent.lock(ctx); err != nil { return err } defer agent.unlock() // If using semi-sync, we need to enable master-side. if err := agent.fixSemiSync(topodatapb.TabletType_MASTER); err != nil { return err } // Now, set the server...
[ "func", "(", "agent", "*", "ActionAgent", ")", "UndoDemoteMaster", "(", "ctx", "context", ".", "Context", ")", "error", "{", "if", "err", ":=", "agent", ".", "lock", "(", "ctx", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "...
// UndoDemoteMaster reverts a previous call to DemoteMaster // it sets read-only to false, fixes semi-sync // and returns its master position.
[ "UndoDemoteMaster", "reverts", "a", "previous", "call", "to", "DemoteMaster", "it", "sets", "read", "-", "only", "to", "false", "fixes", "semi", "-", "sync", "and", "returns", "its", "master", "position", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/rpc_replication.go#L395-L419
135,994
vitessio/vitess
go/vt/vttablet/tabletmanager/rpc_replication.go
SlaveWasPromoted
func (agent *ActionAgent) SlaveWasPromoted(ctx context.Context) error { if err := agent.lock(ctx); err != nil { return err } defer agent.unlock() if _, err := topotools.ChangeType(ctx, agent.TopoServer, agent.TabletAlias, topodatapb.TabletType_MASTER); err != nil { return err } if err := agent.refreshTablet...
go
func (agent *ActionAgent) SlaveWasPromoted(ctx context.Context) error { if err := agent.lock(ctx); err != nil { return err } defer agent.unlock() if _, err := topotools.ChangeType(ctx, agent.TopoServer, agent.TabletAlias, topodatapb.TabletType_MASTER); err != nil { return err } if err := agent.refreshTablet...
[ "func", "(", "agent", "*", "ActionAgent", ")", "SlaveWasPromoted", "(", "ctx", "context", ".", "Context", ")", "error", "{", "if", "err", ":=", "agent", ".", "lock", "(", "ctx", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "...
// SlaveWasPromoted promotes a slave to master, no questions asked.
[ "SlaveWasPromoted", "promotes", "a", "slave", "to", "master", "no", "questions", "asked", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/rpc_replication.go#L467-L482
135,995
vitessio/vitess
go/vt/vttablet/tabletmanager/rpc_replication.go
SetMaster
func (agent *ActionAgent) SetMaster(ctx context.Context, parentAlias *topodatapb.TabletAlias, timeCreatedNS int64, forceStartSlave bool) error { if err := agent.lock(ctx); err != nil { return err } defer agent.unlock() return agent.setMasterLocked(ctx, parentAlias, timeCreatedNS, forceStartSlave) }
go
func (agent *ActionAgent) SetMaster(ctx context.Context, parentAlias *topodatapb.TabletAlias, timeCreatedNS int64, forceStartSlave bool) error { if err := agent.lock(ctx); err != nil { return err } defer agent.unlock() return agent.setMasterLocked(ctx, parentAlias, timeCreatedNS, forceStartSlave) }
[ "func", "(", "agent", "*", "ActionAgent", ")", "SetMaster", "(", "ctx", "context", ".", "Context", ",", "parentAlias", "*", "topodatapb", ".", "TabletAlias", ",", "timeCreatedNS", "int64", ",", "forceStartSlave", "bool", ")", "error", "{", "if", "err", ":=",...
// SetMaster sets replication master, and waits for the // reparent_journal table entry up to context timeout
[ "SetMaster", "sets", "replication", "master", "and", "waits", "for", "the", "reparent_journal", "table", "entry", "up", "to", "context", "timeout" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/rpc_replication.go#L486-L493
135,996
vitessio/vitess
go/vt/vttablet/tabletmanager/rpc_replication.go
SlaveWasRestarted
func (agent *ActionAgent) SlaveWasRestarted(ctx context.Context, parent *topodatapb.TabletAlias) error { if err := agent.lock(ctx); err != nil { return err } defer agent.unlock() typeChanged := false // Once this action completes, update authoritative tablet node first. if _, err := agent.TopoServer.UpdateTab...
go
func (agent *ActionAgent) SlaveWasRestarted(ctx context.Context, parent *topodatapb.TabletAlias) error { if err := agent.lock(ctx); err != nil { return err } defer agent.unlock() typeChanged := false // Once this action completes, update authoritative tablet node first. if _, err := agent.TopoServer.UpdateTab...
[ "func", "(", "agent", "*", "ActionAgent", ")", "SlaveWasRestarted", "(", "ctx", "context", ".", "Context", ",", "parent", "*", "topodatapb", ".", "TabletAlias", ")", "error", "{", "if", "err", ":=", "agent", ".", "lock", "(", "ctx", ")", ";", "err", "!...
// SlaveWasRestarted updates the parent record for a tablet.
[ "SlaveWasRestarted", "updates", "the", "parent", "record", "for", "a", "tablet", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/rpc_replication.go#L590-L617
135,997
vitessio/vitess
go/vt/vttablet/tabletmanager/rpc_replication.go
StopReplicationAndGetStatus
func (agent *ActionAgent) StopReplicationAndGetStatus(ctx context.Context) (*replicationdatapb.Status, error) { if err := agent.lock(ctx); err != nil { return nil, err } defer agent.unlock() // get the status before we stop replication rs, err := agent.MysqlDaemon.SlaveStatus() if err != nil { return nil, vt...
go
func (agent *ActionAgent) StopReplicationAndGetStatus(ctx context.Context) (*replicationdatapb.Status, error) { if err := agent.lock(ctx); err != nil { return nil, err } defer agent.unlock() // get the status before we stop replication rs, err := agent.MysqlDaemon.SlaveStatus() if err != nil { return nil, vt...
[ "func", "(", "agent", "*", "ActionAgent", ")", "StopReplicationAndGetStatus", "(", "ctx", "context", ".", "Context", ")", "(", "*", "replicationdatapb", ".", "Status", ",", "error", ")", "{", "if", "err", ":=", "agent", ".", "lock", "(", "ctx", ")", ";",...
// StopReplicationAndGetStatus stops MySQL replication, and returns the // current status.
[ "StopReplicationAndGetStatus", "stops", "MySQL", "replication", "and", "returns", "the", "current", "status", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/rpc_replication.go#L621-L645
135,998
vitessio/vitess
go/vt/vttablet/tabletmanager/rpc_replication.go
PromoteSlave
func (agent *ActionAgent) PromoteSlave(ctx context.Context) (string, error) { if err := agent.lock(ctx); err != nil { return "", err } defer agent.unlock() pos, err := agent.MysqlDaemon.PromoteSlave(agent.hookExtraEnv()) if err != nil { return "", err } // If using semi-sync, we need to enable it before go...
go
func (agent *ActionAgent) PromoteSlave(ctx context.Context) (string, error) { if err := agent.lock(ctx); err != nil { return "", err } defer agent.unlock() pos, err := agent.MysqlDaemon.PromoteSlave(agent.hookExtraEnv()) if err != nil { return "", err } // If using semi-sync, we need to enable it before go...
[ "func", "(", "agent", "*", "ActionAgent", ")", "PromoteSlave", "(", "ctx", "context", ".", "Context", ")", "(", "string", ",", "error", ")", "{", "if", "err", ":=", "agent", ".", "lock", "(", "ctx", ")", ";", "err", "!=", "nil", "{", "return", "\""...
// PromoteSlave makes the current tablet the master
[ "PromoteSlave", "makes", "the", "current", "tablet", "the", "master" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/rpc_replication.go#L648-L680
135,999
vitessio/vitess
go/vt/wrangler/reparent.go
ShardReplicationStatuses
func (wr *Wrangler) ShardReplicationStatuses(ctx context.Context, keyspace, shard string) ([]*topo.TabletInfo, []*replicationdatapb.Status, error) { tabletMap, err := wr.ts.GetTabletMapForShard(ctx, keyspace, shard) if err != nil { return nil, nil, err } tablets := topotools.CopyMapValues(tabletMap, []*topo.Table...
go
func (wr *Wrangler) ShardReplicationStatuses(ctx context.Context, keyspace, shard string) ([]*topo.TabletInfo, []*replicationdatapb.Status, error) { tabletMap, err := wr.ts.GetTabletMapForShard(ctx, keyspace, shard) if err != nil { return nil, nil, err } tablets := topotools.CopyMapValues(tabletMap, []*topo.Table...
[ "func", "(", "wr", "*", "Wrangler", ")", "ShardReplicationStatuses", "(", "ctx", "context", ".", "Context", ",", "keyspace", ",", "shard", "string", ")", "(", "[", "]", "*", "topo", ".", "TabletInfo", ",", "[", "]", "*", "replicationdatapb", ".", "Status...
// ShardReplicationStatuses returns the ReplicationStatus for each tablet in a shard.
[ "ShardReplicationStatuses", "returns", "the", "ReplicationStatus", "for", "each", "tablet", "in", "a", "shard", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/reparent.go#L50-L93