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,800 | vitessio/vitess | go/vt/binlog/binlogplayer/binlog_player.go | SetLastPosition | func (bps *Stats) SetLastPosition(pos mysql.Position) {
bps.lastPositionMutex.Lock()
defer bps.lastPositionMutex.Unlock()
bps.lastPosition = pos
} | go | func (bps *Stats) SetLastPosition(pos mysql.Position) {
bps.lastPositionMutex.Lock()
defer bps.lastPositionMutex.Unlock()
bps.lastPosition = pos
} | [
"func",
"(",
"bps",
"*",
"Stats",
")",
"SetLastPosition",
"(",
"pos",
"mysql",
".",
"Position",
")",
"{",
"bps",
".",
"lastPositionMutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"bps",
".",
"lastPositionMutex",
".",
"Unlock",
"(",
")",
"\n",
"bps",
".",... | // SetLastPosition sets the last replication position. | [
"SetLastPosition",
"sets",
"the",
"last",
"replication",
"position",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/binlog/binlogplayer/binlog_player.go#L85-L89 |
135,801 | vitessio/vitess | go/vt/binlog/binlogplayer/binlog_player.go | LastPosition | func (bps *Stats) LastPosition() mysql.Position {
bps.lastPositionMutex.Lock()
defer bps.lastPositionMutex.Unlock()
return bps.lastPosition
} | go | func (bps *Stats) LastPosition() mysql.Position {
bps.lastPositionMutex.Lock()
defer bps.lastPositionMutex.Unlock()
return bps.lastPosition
} | [
"func",
"(",
"bps",
"*",
"Stats",
")",
"LastPosition",
"(",
")",
"mysql",
".",
"Position",
"{",
"bps",
".",
"lastPositionMutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"bps",
".",
"lastPositionMutex",
".",
"Unlock",
"(",
")",
"\n",
"return",
"bps",
".",... | // LastPosition gets the last replication position. | [
"LastPosition",
"gets",
"the",
"last",
"replication",
"position",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/binlog/binlogplayer/binlog_player.go#L92-L96 |
135,802 | vitessio/vitess | go/vt/binlog/binlogplayer/binlog_player.go | MessageHistory | func (bps *Stats) MessageHistory() []string {
strs := make([]string, 0, 3)
for _, h := range bps.History.Records() {
h1, _ := h.(*StatsHistoryRecord)
if h1 != nil {
strs = append(strs, h1.Message)
}
}
return strs
} | go | func (bps *Stats) MessageHistory() []string {
strs := make([]string, 0, 3)
for _, h := range bps.History.Records() {
h1, _ := h.(*StatsHistoryRecord)
if h1 != nil {
strs = append(strs, h1.Message)
}
}
return strs
} | [
"func",
"(",
"bps",
"*",
"Stats",
")",
"MessageHistory",
"(",
")",
"[",
"]",
"string",
"{",
"strs",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"3",
")",
"\n",
"for",
"_",
",",
"h",
":=",
"range",
"bps",
".",
"History",
".",
"Records"... | // MessageHistory gets all the messages, we store 3 at a time | [
"MessageHistory",
"gets",
"all",
"the",
"messages",
"we",
"store",
"3",
"at",
"a",
"time"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/binlog/binlogplayer/binlog_player.go#L99-L108 |
135,803 | vitessio/vitess | go/vt/binlog/binlogplayer/binlog_player.go | NewStats | func NewStats() *Stats {
bps := &Stats{}
bps.Timings = stats.NewTimings("", "", "")
bps.Rates = stats.NewRates("", bps.Timings, 15, 60e9)
bps.History = history.New(3)
bps.SecondsBehindMaster.Set(math.MaxInt64)
return bps
} | go | func NewStats() *Stats {
bps := &Stats{}
bps.Timings = stats.NewTimings("", "", "")
bps.Rates = stats.NewRates("", bps.Timings, 15, 60e9)
bps.History = history.New(3)
bps.SecondsBehindMaster.Set(math.MaxInt64)
return bps
} | [
"func",
"NewStats",
"(",
")",
"*",
"Stats",
"{",
"bps",
":=",
"&",
"Stats",
"{",
"}",
"\n",
"bps",
".",
"Timings",
"=",
"stats",
".",
"NewTimings",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"bps",
".",
"Rates",
"=",
"stats",... | // NewStats creates a new Stats structure. | [
"NewStats",
"creates",
"a",
"new",
"Stats",
"structure",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/binlog/binlogplayer/binlog_player.go#L111-L118 |
135,804 | vitessio/vitess | go/vt/binlog/binlogplayer/binlog_player.go | ApplyBinlogEvents | func (blp *BinlogPlayer) ApplyBinlogEvents(ctx context.Context) error {
if err := SetVReplicationState(blp.dbClient, blp.uid, BlpRunning, ""); err != nil {
log.Errorf("Error writing Running state: %v", err)
}
if err := blp.applyEvents(ctx); err != nil {
msg := err.Error()
blp.blplStats.History.Add(&StatsHisto... | go | func (blp *BinlogPlayer) ApplyBinlogEvents(ctx context.Context) error {
if err := SetVReplicationState(blp.dbClient, blp.uid, BlpRunning, ""); err != nil {
log.Errorf("Error writing Running state: %v", err)
}
if err := blp.applyEvents(ctx); err != nil {
msg := err.Error()
blp.blplStats.History.Add(&StatsHisto... | [
"func",
"(",
"blp",
"*",
"BinlogPlayer",
")",
"ApplyBinlogEvents",
"(",
"ctx",
"context",
".",
"Context",
")",
"error",
"{",
"if",
"err",
":=",
"SetVReplicationState",
"(",
"blp",
".",
"dbClient",
",",
"blp",
".",
"uid",
",",
"BlpRunning",
",",
"\"",
"\"... | // ApplyBinlogEvents makes an RPC request to BinlogServer
// and processes the events. It returns nil if the provided context
// was canceled, or if we reached the stopping point.
// If an error is encountered, it updates the vreplication state to "Error".
// If a stop position was specifed, and reached, the state is u... | [
"ApplyBinlogEvents",
"makes",
"an",
"RPC",
"request",
"to",
"BinlogServer",
"and",
"processes",
"the",
"events",
".",
"It",
"returns",
"nil",
"if",
"the",
"provided",
"context",
"was",
"canceled",
"or",
"if",
"we",
"reached",
"the",
"stopping",
"point",
".",
... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/binlog/binlogplayer/binlog_player.go#L178-L195 |
135,805 | vitessio/vitess | go/vt/binlog/binlogplayer/binlog_player.go | SetVReplicationState | func SetVReplicationState(dbClient DBClient, uid uint32, state, message string) error {
query := fmt.Sprintf("update _vt.vreplication set state='%v', message=%v where id=%v", state, encodeString(message), uid)
if _, err := dbClient.ExecuteFetch(query, 1); err != nil {
return fmt.Errorf("could not set state: %v: %v"... | go | func SetVReplicationState(dbClient DBClient, uid uint32, state, message string) error {
query := fmt.Sprintf("update _vt.vreplication set state='%v', message=%v where id=%v", state, encodeString(message), uid)
if _, err := dbClient.ExecuteFetch(query, 1); err != nil {
return fmt.Errorf("could not set state: %v: %v"... | [
"func",
"SetVReplicationState",
"(",
"dbClient",
"DBClient",
",",
"uid",
"uint32",
",",
"state",
",",
"message",
"string",
")",
"error",
"{",
"query",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"state",
",",
"encodeString",
"(",
"message",
")",
"... | // SetVReplicationState updates the state in the _vt.vreplication table. | [
"SetVReplicationState",
"updates",
"the",
"state",
"in",
"the",
"_vt",
".",
"vreplication",
"table",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/binlog/binlogplayer/binlog_player.go#L510-L516 |
135,806 | vitessio/vitess | go/vt/binlog/binlogplayer/binlog_player.go | ReadVRSettings | func ReadVRSettings(dbClient DBClient, uid uint32) (VRSettings, error) {
query := fmt.Sprintf("select pos, stop_pos, max_tps, max_replication_lag, state from _vt.vreplication where id=%v", uid)
qr, err := dbClient.ExecuteFetch(query, 1)
if err != nil {
return VRSettings{}, fmt.Errorf("error %v in selecting vreplic... | go | func ReadVRSettings(dbClient DBClient, uid uint32) (VRSettings, error) {
query := fmt.Sprintf("select pos, stop_pos, max_tps, max_replication_lag, state from _vt.vreplication where id=%v", uid)
qr, err := dbClient.ExecuteFetch(query, 1)
if err != nil {
return VRSettings{}, fmt.Errorf("error %v in selecting vreplic... | [
"func",
"ReadVRSettings",
"(",
"dbClient",
"DBClient",
",",
"uid",
"uint32",
")",
"(",
"VRSettings",
",",
"error",
")",
"{",
"query",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"uid",
")",
"\n",
"qr",
",",
"err",
":=",
"dbClient",
".",
"Execu... | // ReadVRSettings retrieves the throttler settings for
// vreplication from the checkpoint table. | [
"ReadVRSettings",
"retrieves",
"the",
"throttler",
"settings",
"for",
"vreplication",
"from",
"the",
"checkpoint",
"table",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/binlog/binlogplayer/binlog_player.go#L529-L565 |
135,807 | vitessio/vitess | go/vt/binlog/binlogplayer/binlog_player.go | CreateVReplication | func CreateVReplication(workflow string, source *binlogdatapb.BinlogSource, position string, maxTPS, maxReplicationLag, timeUpdated int64, dbName string) string {
return fmt.Sprintf("insert into _vt.vreplication "+
"(workflow, source, pos, max_tps, max_replication_lag, time_updated, transaction_timestamp, state, db_... | go | func CreateVReplication(workflow string, source *binlogdatapb.BinlogSource, position string, maxTPS, maxReplicationLag, timeUpdated int64, dbName string) string {
return fmt.Sprintf("insert into _vt.vreplication "+
"(workflow, source, pos, max_tps, max_replication_lag, time_updated, transaction_timestamp, state, db_... | [
"func",
"CreateVReplication",
"(",
"workflow",
"string",
",",
"source",
"*",
"binlogdatapb",
".",
"BinlogSource",
",",
"position",
"string",
",",
"maxTPS",
",",
"maxReplicationLag",
",",
"timeUpdated",
"int64",
",",
"dbName",
"string",
")",
"string",
"{",
"retur... | // CreateVReplication returns a statement to populate the first value into
// the _vt.vreplication table. | [
"CreateVReplication",
"returns",
"a",
"statement",
"to",
"populate",
"the",
"first",
"value",
"into",
"the",
"_vt",
".",
"vreplication",
"table",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/binlog/binlogplayer/binlog_player.go#L569-L574 |
135,808 | vitessio/vitess | go/vt/binlog/binlogplayer/binlog_player.go | CreateVReplicationState | func CreateVReplicationState(workflow string, source *binlogdatapb.BinlogSource, position, state string, dbName string) string {
return fmt.Sprintf("insert into _vt.vreplication "+
"(workflow, source, pos, max_tps, max_replication_lag, time_updated, transaction_timestamp, state, db_name) "+
"values (%v, %v, %v, %v... | go | func CreateVReplicationState(workflow string, source *binlogdatapb.BinlogSource, position, state string, dbName string) string {
return fmt.Sprintf("insert into _vt.vreplication "+
"(workflow, source, pos, max_tps, max_replication_lag, time_updated, transaction_timestamp, state, db_name) "+
"values (%v, %v, %v, %v... | [
"func",
"CreateVReplicationState",
"(",
"workflow",
"string",
",",
"source",
"*",
"binlogdatapb",
".",
"BinlogSource",
",",
"position",
",",
"state",
"string",
",",
"dbName",
"string",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
"+"... | // CreateVReplicationState returns a statement to create a stopped vreplication. | [
"CreateVReplicationState",
"returns",
"a",
"statement",
"to",
"create",
"a",
"stopped",
"vreplication",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/binlog/binlogplayer/binlog_player.go#L577-L582 |
135,809 | vitessio/vitess | go/vt/binlog/binlogplayer/binlog_player.go | GenerateUpdatePos | func GenerateUpdatePos(uid uint32, pos mysql.Position, timeUpdated int64, txTimestamp int64) string {
if txTimestamp != 0 {
return fmt.Sprintf(
"update _vt.vreplication set pos=%v, time_updated=%v, transaction_timestamp=%v, message='' where id=%v",
encodeString(mysql.EncodePosition(pos)), timeUpdated, txTimest... | go | func GenerateUpdatePos(uid uint32, pos mysql.Position, timeUpdated int64, txTimestamp int64) string {
if txTimestamp != 0 {
return fmt.Sprintf(
"update _vt.vreplication set pos=%v, time_updated=%v, transaction_timestamp=%v, message='' where id=%v",
encodeString(mysql.EncodePosition(pos)), timeUpdated, txTimest... | [
"func",
"GenerateUpdatePos",
"(",
"uid",
"uint32",
",",
"pos",
"mysql",
".",
"Position",
",",
"timeUpdated",
"int64",
",",
"txTimestamp",
"int64",
")",
"string",
"{",
"if",
"txTimestamp",
"!=",
"0",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
... | // GenerateUpdatePos returns a statement to update a value in the
// _vt.vreplication table. | [
"GenerateUpdatePos",
"returns",
"a",
"statement",
"to",
"update",
"a",
"value",
"in",
"the",
"_vt",
".",
"vreplication",
"table",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/binlog/binlogplayer/binlog_player.go#L586-L596 |
135,810 | vitessio/vitess | go/vt/binlog/binlogplayer/binlog_player.go | StartVReplicationUntil | func StartVReplicationUntil(uid uint32, pos string) string {
return fmt.Sprintf(
"update _vt.vreplication set state='%v', stop_pos=%v where id=%v",
BlpRunning, encodeString(pos), uid)
} | go | func StartVReplicationUntil(uid uint32, pos string) string {
return fmt.Sprintf(
"update _vt.vreplication set state='%v', stop_pos=%v where id=%v",
BlpRunning, encodeString(pos), uid)
} | [
"func",
"StartVReplicationUntil",
"(",
"uid",
"uint32",
",",
"pos",
"string",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"BlpRunning",
",",
"encodeString",
"(",
"pos",
")",
",",
"uid",
")",
"\n",
"}"
] | // StartVReplicationUntil returns a statement to start the replication with a stop position. | [
"StartVReplicationUntil",
"returns",
"a",
"statement",
"to",
"start",
"the",
"replication",
"with",
"a",
"stop",
"position",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/binlog/binlogplayer/binlog_player.go#L606-L610 |
135,811 | vitessio/vitess | go/vt/binlog/binlogplayer/binlog_player.go | StopVReplication | func StopVReplication(uid uint32, message string) string {
return fmt.Sprintf(
"update _vt.vreplication set state='%v', message=%v where id=%v",
BlpStopped, encodeString(message), uid)
} | go | func StopVReplication(uid uint32, message string) string {
return fmt.Sprintf(
"update _vt.vreplication set state='%v', message=%v where id=%v",
BlpStopped, encodeString(message), uid)
} | [
"func",
"StopVReplication",
"(",
"uid",
"uint32",
",",
"message",
"string",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"BlpStopped",
",",
"encodeString",
"(",
"message",
")",
",",
"uid",
")",
"\n",
"}"
] | // StopVReplication returns a statement to stop the replication. | [
"StopVReplication",
"returns",
"a",
"statement",
"to",
"stop",
"the",
"replication",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/binlog/binlogplayer/binlog_player.go#L613-L617 |
135,812 | vitessio/vitess | go/vt/vtctld/action_repository.go | NewActionRepository | func NewActionRepository(ts *topo.Server) *ActionRepository {
return &ActionRepository{
keyspaceActions: make(map[string]actionKeyspaceMethod),
shardActions: make(map[string]actionShardMethod),
tabletActions: make(map[string]actionTabletRecord),
ts: ts,
}
} | go | func NewActionRepository(ts *topo.Server) *ActionRepository {
return &ActionRepository{
keyspaceActions: make(map[string]actionKeyspaceMethod),
shardActions: make(map[string]actionShardMethod),
tabletActions: make(map[string]actionTabletRecord),
ts: ts,
}
} | [
"func",
"NewActionRepository",
"(",
"ts",
"*",
"topo",
".",
"Server",
")",
"*",
"ActionRepository",
"{",
"return",
"&",
"ActionRepository",
"{",
"keyspaceActions",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"actionKeyspaceMethod",
")",
",",
"shardActions",
"... | // NewActionRepository creates and returns a new ActionRepository,
// with no actions. | [
"NewActionRepository",
"creates",
"and",
"returns",
"a",
"new",
"ActionRepository",
"with",
"no",
"actions",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtctld/action_repository.go#L81-L88 |
135,813 | vitessio/vitess | go/vt/vtctld/action_repository.go | RegisterKeyspaceAction | func (ar *ActionRepository) RegisterKeyspaceAction(name string, method actionKeyspaceMethod) {
ar.keyspaceActions[name] = method
} | go | func (ar *ActionRepository) RegisterKeyspaceAction(name string, method actionKeyspaceMethod) {
ar.keyspaceActions[name] = method
} | [
"func",
"(",
"ar",
"*",
"ActionRepository",
")",
"RegisterKeyspaceAction",
"(",
"name",
"string",
",",
"method",
"actionKeyspaceMethod",
")",
"{",
"ar",
".",
"keyspaceActions",
"[",
"name",
"]",
"=",
"method",
"\n",
"}"
] | // RegisterKeyspaceAction registers a new action on a keyspace. | [
"RegisterKeyspaceAction",
"registers",
"a",
"new",
"action",
"on",
"a",
"keyspace",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtctld/action_repository.go#L91-L93 |
135,814 | vitessio/vitess | go/vt/vtctld/action_repository.go | RegisterShardAction | func (ar *ActionRepository) RegisterShardAction(name string, method actionShardMethod) {
ar.shardActions[name] = method
} | go | func (ar *ActionRepository) RegisterShardAction(name string, method actionShardMethod) {
ar.shardActions[name] = method
} | [
"func",
"(",
"ar",
"*",
"ActionRepository",
")",
"RegisterShardAction",
"(",
"name",
"string",
",",
"method",
"actionShardMethod",
")",
"{",
"ar",
".",
"shardActions",
"[",
"name",
"]",
"=",
"method",
"\n",
"}"
] | // RegisterShardAction registers a new action on a shard. | [
"RegisterShardAction",
"registers",
"a",
"new",
"action",
"on",
"a",
"shard",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtctld/action_repository.go#L96-L98 |
135,815 | vitessio/vitess | go/vt/vtctld/action_repository.go | RegisterTabletAction | func (ar *ActionRepository) RegisterTabletAction(name, role string, method actionTabletMethod) {
ar.tabletActions[name] = actionTabletRecord{
role: role,
method: method,
}
} | go | func (ar *ActionRepository) RegisterTabletAction(name, role string, method actionTabletMethod) {
ar.tabletActions[name] = actionTabletRecord{
role: role,
method: method,
}
} | [
"func",
"(",
"ar",
"*",
"ActionRepository",
")",
"RegisterTabletAction",
"(",
"name",
",",
"role",
"string",
",",
"method",
"actionTabletMethod",
")",
"{",
"ar",
".",
"tabletActions",
"[",
"name",
"]",
"=",
"actionTabletRecord",
"{",
"role",
":",
"role",
","... | // RegisterTabletAction registers a new action on a tablet. | [
"RegisterTabletAction",
"registers",
"a",
"new",
"action",
"on",
"a",
"tablet",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtctld/action_repository.go#L101-L106 |
135,816 | vitessio/vitess | go/vt/vtctld/action_repository.go | ApplyKeyspaceAction | func (ar *ActionRepository) ApplyKeyspaceAction(ctx context.Context, actionName, keyspace string, r *http.Request) *ActionResult {
result := &ActionResult{Name: actionName, Parameters: keyspace}
action, ok := ar.keyspaceActions[actionName]
if !ok {
result.error("Unknown keyspace action")
return result
}
ctx,... | go | func (ar *ActionRepository) ApplyKeyspaceAction(ctx context.Context, actionName, keyspace string, r *http.Request) *ActionResult {
result := &ActionResult{Name: actionName, Parameters: keyspace}
action, ok := ar.keyspaceActions[actionName]
if !ok {
result.error("Unknown keyspace action")
return result
}
ctx,... | [
"func",
"(",
"ar",
"*",
"ActionRepository",
")",
"ApplyKeyspaceAction",
"(",
"ctx",
"context",
".",
"Context",
",",
"actionName",
",",
"keyspace",
"string",
",",
"r",
"*",
"http",
".",
"Request",
")",
"*",
"ActionResult",
"{",
"result",
":=",
"&",
"ActionR... | // ApplyKeyspaceAction applies the provided action to the keyspace. | [
"ApplyKeyspaceAction",
"applies",
"the",
"provided",
"action",
"to",
"the",
"keyspace",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtctld/action_repository.go#L109-L128 |
135,817 | vitessio/vitess | go/vt/vtctld/action_repository.go | ApplyTabletAction | func (ar *ActionRepository) ApplyTabletAction(ctx context.Context, actionName string, tabletAlias *topodatapb.TabletAlias, r *http.Request) *ActionResult {
result := &ActionResult{
Name: actionName,
Parameters: topoproto.TabletAliasString(tabletAlias),
}
action, ok := ar.tabletActions[actionName]
if !ok ... | go | func (ar *ActionRepository) ApplyTabletAction(ctx context.Context, actionName string, tabletAlias *topodatapb.TabletAlias, r *http.Request) *ActionResult {
result := &ActionResult{
Name: actionName,
Parameters: topoproto.TabletAliasString(tabletAlias),
}
action, ok := ar.tabletActions[actionName]
if !ok ... | [
"func",
"(",
"ar",
"*",
"ActionRepository",
")",
"ApplyTabletAction",
"(",
"ctx",
"context",
".",
"Context",
",",
"actionName",
"string",
",",
"tabletAlias",
"*",
"topodatapb",
".",
"TabletAlias",
",",
"r",
"*",
"http",
".",
"Request",
")",
"*",
"ActionResul... | // ApplyTabletAction applies the provided action to the tablet. | [
"ApplyTabletAction",
"applies",
"the",
"provided",
"action",
"to",
"the",
"tablet",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtctld/action_repository.go#L158-L189 |
135,818 | vitessio/vitess | go/vt/worker/worker.go | resetVars | func resetVars() {
statsState.Set("")
statsRetryCount.Reset()
statsRetryCounters.ResetAll()
statsOnlineInsertsCounters.ResetAll()
statsOnlineUpdatesCounters.ResetAll()
statsOnlineDeletesCounters.ResetAll()
statsOnlineEqualRowsCounters.ResetAll()
statsOfflineInsertsCounters.ResetAll()
statsOfflineUpdatesCount... | go | func resetVars() {
statsState.Set("")
statsRetryCount.Reset()
statsRetryCounters.ResetAll()
statsOnlineInsertsCounters.ResetAll()
statsOnlineUpdatesCounters.ResetAll()
statsOnlineDeletesCounters.ResetAll()
statsOnlineEqualRowsCounters.ResetAll()
statsOfflineInsertsCounters.ResetAll()
statsOfflineUpdatesCount... | [
"func",
"resetVars",
"(",
")",
"{",
"statsState",
".",
"Set",
"(",
"\"",
"\"",
")",
"\n",
"statsRetryCount",
".",
"Reset",
"(",
")",
"\n",
"statsRetryCounters",
".",
"ResetAll",
"(",
")",
"\n\n",
"statsOnlineInsertsCounters",
".",
"ResetAll",
"(",
")",
"\n... | // resetVars resets the debug variables that are meant to provide information on a
// per-run basis. This should be called at the beginning of each worker run. | [
"resetVars",
"resets",
"the",
"debug",
"variables",
"that",
"are",
"meant",
"to",
"provide",
"information",
"on",
"a",
"per",
"-",
"run",
"basis",
".",
"This",
"should",
"be",
"called",
"at",
"the",
"beginning",
"of",
"each",
"worker",
"run",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/worker.go#L132-L149 |
135,819 | vitessio/vitess | go/vt/vtgate/engine/route.go | NewSimpleRoute | func NewSimpleRoute(opcode RouteOpcode, keyspace *vindexes.Keyspace) *Route {
return &Route{
Opcode: opcode,
Keyspace: keyspace,
}
} | go | func NewSimpleRoute(opcode RouteOpcode, keyspace *vindexes.Keyspace) *Route {
return &Route{
Opcode: opcode,
Keyspace: keyspace,
}
} | [
"func",
"NewSimpleRoute",
"(",
"opcode",
"RouteOpcode",
",",
"keyspace",
"*",
"vindexes",
".",
"Keyspace",
")",
"*",
"Route",
"{",
"return",
"&",
"Route",
"{",
"Opcode",
":",
"opcode",
",",
"Keyspace",
":",
"keyspace",
",",
"}",
"\n",
"}"
] | // NewSimpleRoute creates a Route with the bare minimum of parameters. | [
"NewSimpleRoute",
"creates",
"a",
"Route",
"with",
"the",
"bare",
"minimum",
"of",
"parameters",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/engine/route.go#L87-L92 |
135,820 | vitessio/vitess | go/vt/vtgate/engine/route.go | NewRoute | func NewRoute(opcode RouteOpcode, keyspace *vindexes.Keyspace, query, fieldQuery string) *Route {
return &Route{
Opcode: opcode,
Keyspace: keyspace,
Query: query,
FieldQuery: fieldQuery,
}
} | go | func NewRoute(opcode RouteOpcode, keyspace *vindexes.Keyspace, query, fieldQuery string) *Route {
return &Route{
Opcode: opcode,
Keyspace: keyspace,
Query: query,
FieldQuery: fieldQuery,
}
} | [
"func",
"NewRoute",
"(",
"opcode",
"RouteOpcode",
",",
"keyspace",
"*",
"vindexes",
".",
"Keyspace",
",",
"query",
",",
"fieldQuery",
"string",
")",
"*",
"Route",
"{",
"return",
"&",
"Route",
"{",
"Opcode",
":",
"opcode",
",",
"Keyspace",
":",
"keyspace",
... | // NewRoute creates a Route. | [
"NewRoute",
"creates",
"a",
"Route",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/engine/route.go#L95-L102 |
135,821 | vitessio/vitess | go/vt/vtgate/engine/route.go | MarshalJSON | func (route *Route) MarshalJSON() ([]byte, error) {
var vindexName string
if route.Vindex != nil {
vindexName = route.Vindex.String()
}
marshalRoute := struct {
Opcode RouteOpcode
Keyspace *vindexes.Keyspace `json:",omitempty"`
Query string `... | go | func (route *Route) MarshalJSON() ([]byte, error) {
var vindexName string
if route.Vindex != nil {
vindexName = route.Vindex.String()
}
marshalRoute := struct {
Opcode RouteOpcode
Keyspace *vindexes.Keyspace `json:",omitempty"`
Query string `... | [
"func",
"(",
"route",
"*",
"Route",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"var",
"vindexName",
"string",
"\n",
"if",
"route",
".",
"Vindex",
"!=",
"nil",
"{",
"vindexName",
"=",
"route",
".",
"Vindex",
".",
"S... | // MarshalJSON serializes the Route into a JSON representation.
// It's used for testing and diagnostics. | [
"MarshalJSON",
"serializes",
"the",
"Route",
"into",
"a",
"JSON",
"representation",
".",
"It",
"s",
"used",
"for",
"testing",
"and",
"diagnostics",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/engine/route.go#L113-L142 |
135,822 | vitessio/vitess | go/stats/duration.go | NewCounterDuration | func NewCounterDuration(name, help string) *CounterDuration {
cd := &CounterDuration{
help: help,
}
publish(name, cd)
return cd
} | go | func NewCounterDuration(name, help string) *CounterDuration {
cd := &CounterDuration{
help: help,
}
publish(name, cd)
return cd
} | [
"func",
"NewCounterDuration",
"(",
"name",
",",
"help",
"string",
")",
"*",
"CounterDuration",
"{",
"cd",
":=",
"&",
"CounterDuration",
"{",
"help",
":",
"help",
",",
"}",
"\n",
"publish",
"(",
"name",
",",
"cd",
")",
"\n",
"return",
"cd",
"\n",
"}"
] | // NewCounterDuration returns a new CounterDuration. | [
"NewCounterDuration",
"returns",
"a",
"new",
"CounterDuration",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/duration.go#L33-L39 |
135,823 | vitessio/vitess | go/stats/duration.go | String | func (cd CounterDuration) String() string {
return strconv.FormatInt(int64(cd.i.Get()), 10)
} | go | func (cd CounterDuration) String() string {
return strconv.FormatInt(int64(cd.i.Get()), 10)
} | [
"func",
"(",
"cd",
"CounterDuration",
")",
"String",
"(",
")",
"string",
"{",
"return",
"strconv",
".",
"FormatInt",
"(",
"int64",
"(",
"cd",
".",
"i",
".",
"Get",
"(",
")",
")",
",",
"10",
")",
"\n",
"}"
] | // String is the implementation of expvar.var. | [
"String",
"is",
"the",
"implementation",
"of",
"expvar",
".",
"var",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/duration.go#L47-L49 |
135,824 | vitessio/vitess | go/stats/duration.go | Add | func (cd *CounterDuration) Add(delta time.Duration) {
cd.i.Add(delta)
} | go | func (cd *CounterDuration) Add(delta time.Duration) {
cd.i.Add(delta)
} | [
"func",
"(",
"cd",
"*",
"CounterDuration",
")",
"Add",
"(",
"delta",
"time",
".",
"Duration",
")",
"{",
"cd",
".",
"i",
".",
"Add",
"(",
"delta",
")",
"\n",
"}"
] | // Add adds the provided value to the CounterDuration. | [
"Add",
"adds",
"the",
"provided",
"value",
"to",
"the",
"CounterDuration",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/duration.go#L52-L54 |
135,825 | vitessio/vitess | go/stats/duration.go | NewGaugeDuration | func NewGaugeDuration(name, help string) *GaugeDuration {
gd := &GaugeDuration{
CounterDuration: CounterDuration{
help: help,
},
}
publish(name, gd)
return gd
} | go | func NewGaugeDuration(name, help string) *GaugeDuration {
gd := &GaugeDuration{
CounterDuration: CounterDuration{
help: help,
},
}
publish(name, gd)
return gd
} | [
"func",
"NewGaugeDuration",
"(",
"name",
",",
"help",
"string",
")",
"*",
"GaugeDuration",
"{",
"gd",
":=",
"&",
"GaugeDuration",
"{",
"CounterDuration",
":",
"CounterDuration",
"{",
"help",
":",
"help",
",",
"}",
",",
"}",
"\n",
"publish",
"(",
"name",
... | // NewGaugeDuration returns a new GaugeDuration. | [
"NewGaugeDuration",
"returns",
"a",
"new",
"GaugeDuration",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/duration.go#L69-L77 |
135,826 | vitessio/vitess | go/stats/duration.go | Set | func (gd *GaugeDuration) Set(value time.Duration) {
gd.i.Set(value)
} | go | func (gd *GaugeDuration) Set(value time.Duration) {
gd.i.Set(value)
} | [
"func",
"(",
"gd",
"*",
"GaugeDuration",
")",
"Set",
"(",
"value",
"time",
".",
"Duration",
")",
"{",
"gd",
".",
"i",
".",
"Set",
"(",
"value",
")",
"\n",
"}"
] | // Set sets the value. | [
"Set",
"sets",
"the",
"value",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/duration.go#L80-L82 |
135,827 | vitessio/vitess | go/stats/duration.go | NewCounterDurationFunc | func NewCounterDurationFunc(name string, help string, f func() time.Duration) *CounterDurationFunc {
cf := &CounterDurationFunc{
F: f,
help: help,
}
if name != "" {
publish(name, cf)
}
return cf
} | go | func NewCounterDurationFunc(name string, help string, f func() time.Duration) *CounterDurationFunc {
cf := &CounterDurationFunc{
F: f,
help: help,
}
if name != "" {
publish(name, cf)
}
return cf
} | [
"func",
"NewCounterDurationFunc",
"(",
"name",
"string",
",",
"help",
"string",
",",
"f",
"func",
"(",
")",
"time",
".",
"Duration",
")",
"*",
"CounterDurationFunc",
"{",
"cf",
":=",
"&",
"CounterDurationFunc",
"{",
"F",
":",
"f",
",",
"help",
":",
"help... | // NewCounterDurationFunc creates a new CounterDurationFunc instance and
// publishes it if name is set. | [
"NewCounterDurationFunc",
"creates",
"a",
"new",
"CounterDurationFunc",
"instance",
"and",
"publishes",
"it",
"if",
"name",
"is",
"set",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/duration.go#L92-L102 |
135,828 | vitessio/vitess | go/stats/duration.go | NewGaugeDurationFunc | func NewGaugeDurationFunc(name string, help string, f func() time.Duration) *GaugeDurationFunc {
gf := &GaugeDurationFunc{
CounterDurationFunc: CounterDurationFunc{
F: f,
help: help,
},
}
if name != "" {
publish(name, gf)
}
return gf
} | go | func NewGaugeDurationFunc(name string, help string, f func() time.Duration) *GaugeDurationFunc {
gf := &GaugeDurationFunc{
CounterDurationFunc: CounterDurationFunc{
F: f,
help: help,
},
}
if name != "" {
publish(name, gf)
}
return gf
} | [
"func",
"NewGaugeDurationFunc",
"(",
"name",
"string",
",",
"help",
"string",
",",
"f",
"func",
"(",
")",
"time",
".",
"Duration",
")",
"*",
"GaugeDurationFunc",
"{",
"gf",
":=",
"&",
"GaugeDurationFunc",
"{",
"CounterDurationFunc",
":",
"CounterDurationFunc",
... | // NewGaugeDurationFunc creates a new GaugeDurationFunc instance and
// publishes it if name is set. | [
"NewGaugeDurationFunc",
"creates",
"a",
"new",
"GaugeDurationFunc",
"instance",
"and",
"publishes",
"it",
"if",
"name",
"is",
"set",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/duration.go#L121-L133 |
135,829 | vitessio/vitess | go/vt/vttablet/tabletserver/replication_watcher.go | NewReplicationWatcher | func NewReplicationWatcher(se *schema.Engine, config tabletenv.TabletConfig) *ReplicationWatcher {
rpw := &ReplicationWatcher{
watchReplication: config.WatchReplication,
se: se,
}
replOnce.Do(func() {
stats.Publish("EventTokenPosition", stats.StringFunc(func() string {
if e := rpw.EventToken()... | go | func NewReplicationWatcher(se *schema.Engine, config tabletenv.TabletConfig) *ReplicationWatcher {
rpw := &ReplicationWatcher{
watchReplication: config.WatchReplication,
se: se,
}
replOnce.Do(func() {
stats.Publish("EventTokenPosition", stats.StringFunc(func() string {
if e := rpw.EventToken()... | [
"func",
"NewReplicationWatcher",
"(",
"se",
"*",
"schema",
".",
"Engine",
",",
"config",
"tabletenv",
".",
"TabletConfig",
")",
"*",
"ReplicationWatcher",
"{",
"rpw",
":=",
"&",
"ReplicationWatcher",
"{",
"watchReplication",
":",
"config",
".",
"WatchReplication",... | // NewReplicationWatcher creates a new ReplicationWatcher. | [
"NewReplicationWatcher",
"creates",
"a",
"new",
"ReplicationWatcher",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/replication_watcher.go#L59-L82 |
135,830 | vitessio/vitess | go/vt/vttablet/tabletserver/replication_watcher.go | Open | func (rpw *ReplicationWatcher) Open() {
if rpw.isOpen || !rpw.watchReplication {
return
}
ctx, cancel := context.WithCancel(tabletenv.LocalContext())
rpw.cancel = cancel
rpw.wg.Add(1)
go rpw.Process(ctx, rpw.dbconfigs)
rpw.isOpen = true
} | go | func (rpw *ReplicationWatcher) Open() {
if rpw.isOpen || !rpw.watchReplication {
return
}
ctx, cancel := context.WithCancel(tabletenv.LocalContext())
rpw.cancel = cancel
rpw.wg.Add(1)
go rpw.Process(ctx, rpw.dbconfigs)
rpw.isOpen = true
} | [
"func",
"(",
"rpw",
"*",
"ReplicationWatcher",
")",
"Open",
"(",
")",
"{",
"if",
"rpw",
".",
"isOpen",
"||",
"!",
"rpw",
".",
"watchReplication",
"{",
"return",
"\n",
"}",
"\n",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithCancel",
"(",
"tabletenv"... | // Open starts the ReplicationWatcher service. | [
"Open",
"starts",
"the",
"ReplicationWatcher",
"service",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/replication_watcher.go#L90-L99 |
135,831 | vitessio/vitess | go/vt/vttablet/tabletserver/replication_watcher.go | Close | func (rpw *ReplicationWatcher) Close() {
if !rpw.isOpen {
return
}
rpw.cancel()
rpw.wg.Wait()
rpw.isOpen = false
} | go | func (rpw *ReplicationWatcher) Close() {
if !rpw.isOpen {
return
}
rpw.cancel()
rpw.wg.Wait()
rpw.isOpen = false
} | [
"func",
"(",
"rpw",
"*",
"ReplicationWatcher",
")",
"Close",
"(",
")",
"{",
"if",
"!",
"rpw",
".",
"isOpen",
"{",
"return",
"\n",
"}",
"\n",
"rpw",
".",
"cancel",
"(",
")",
"\n",
"rpw",
".",
"wg",
".",
"Wait",
"(",
")",
"\n",
"rpw",
".",
"isOpe... | // Close stops the ReplicationWatcher service. | [
"Close",
"stops",
"the",
"ReplicationWatcher",
"service",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/replication_watcher.go#L102-L109 |
135,832 | vitessio/vitess | go/vt/vttablet/tabletserver/replication_watcher.go | Process | func (rpw *ReplicationWatcher) Process(ctx context.Context, dbconfigs *dbconfigs.DBConfigs) {
defer func() {
tabletenv.LogError()
rpw.wg.Done()
}()
for {
log.Infof("Starting a binlog Streamer from current replication position to monitor binlogs")
streamer := binlog.NewStreamer(dbconfigs.DbaWithDB(), rpw.se, ... | go | func (rpw *ReplicationWatcher) Process(ctx context.Context, dbconfigs *dbconfigs.DBConfigs) {
defer func() {
tabletenv.LogError()
rpw.wg.Done()
}()
for {
log.Infof("Starting a binlog Streamer from current replication position to monitor binlogs")
streamer := binlog.NewStreamer(dbconfigs.DbaWithDB(), rpw.se, ... | [
"func",
"(",
"rpw",
"*",
"ReplicationWatcher",
")",
"Process",
"(",
"ctx",
"context",
".",
"Context",
",",
"dbconfigs",
"*",
"dbconfigs",
".",
"DBConfigs",
")",
"{",
"defer",
"func",
"(",
")",
"{",
"tabletenv",
".",
"LogError",
"(",
")",
"\n",
"rpw",
"... | // Process processes the replication stream. | [
"Process",
"processes",
"the",
"replication",
"stream",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/replication_watcher.go#L112-L148 |
135,833 | vitessio/vitess | go/vt/vttablet/tabletserver/replication_watcher.go | ComputeExtras | func (rpw *ReplicationWatcher) ComputeExtras(options *querypb.ExecuteOptions) *querypb.ResultExtras {
if options == nil {
// No options passed in.
return nil
}
if !options.IncludeEventToken && options.CompareEventToken == nil {
// The flags that make extras exist are not there.
return nil
}
et := rpw.Eve... | go | func (rpw *ReplicationWatcher) ComputeExtras(options *querypb.ExecuteOptions) *querypb.ResultExtras {
if options == nil {
// No options passed in.
return nil
}
if !options.IncludeEventToken && options.CompareEventToken == nil {
// The flags that make extras exist are not there.
return nil
}
et := rpw.Eve... | [
"func",
"(",
"rpw",
"*",
"ReplicationWatcher",
")",
"ComputeExtras",
"(",
"options",
"*",
"querypb",
".",
"ExecuteOptions",
")",
"*",
"querypb",
".",
"ResultExtras",
"{",
"if",
"options",
"==",
"nil",
"{",
"// No options passed in.",
"return",
"nil",
"\n",
"}"... | // ComputeExtras returns the requested ResultExtras based on the supplied options. | [
"ComputeExtras",
"returns",
"the",
"requested",
"ResultExtras",
"based",
"on",
"the",
"supplied",
"options",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/replication_watcher.go#L151-L191 |
135,834 | vitessio/vitess | go/vt/vttablet/tabletserver/replication_watcher.go | EventToken | func (rpw *ReplicationWatcher) EventToken() *querypb.EventToken {
rpw.mu.Lock()
defer rpw.mu.Unlock()
return rpw.eventToken
} | go | func (rpw *ReplicationWatcher) EventToken() *querypb.EventToken {
rpw.mu.Lock()
defer rpw.mu.Unlock()
return rpw.eventToken
} | [
"func",
"(",
"rpw",
"*",
"ReplicationWatcher",
")",
"EventToken",
"(",
")",
"*",
"querypb",
".",
"EventToken",
"{",
"rpw",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"rpw",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"rpw",
".",
"even... | // EventToken returns the current event token. | [
"EventToken",
"returns",
"the",
"current",
"event",
"token",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/replication_watcher.go#L194-L198 |
135,835 | vitessio/vitess | go/vt/vttablet/tabletserver/vstreamer/planbuilder.go | fields | func (plan *Plan) fields() []*querypb.Field {
fields := make([]*querypb.Field, len(plan.ColExprs))
for i, ce := range plan.ColExprs {
fields[i] = &querypb.Field{
Name: ce.Alias.String(),
Type: ce.Type,
}
}
return fields
} | go | func (plan *Plan) fields() []*querypb.Field {
fields := make([]*querypb.Field, len(plan.ColExprs))
for i, ce := range plan.ColExprs {
fields[i] = &querypb.Field{
Name: ce.Alias.String(),
Type: ce.Type,
}
}
return fields
} | [
"func",
"(",
"plan",
"*",
"Plan",
")",
"fields",
"(",
")",
"[",
"]",
"*",
"querypb",
".",
"Field",
"{",
"fields",
":=",
"make",
"(",
"[",
"]",
"*",
"querypb",
".",
"Field",
",",
"len",
"(",
"plan",
".",
"ColExprs",
")",
")",
"\n",
"for",
"i",
... | // fields returns the fields for the plan. | [
"fields",
"returns",
"the",
"fields",
"for",
"the",
"plan",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/vstreamer/planbuilder.go#L59-L68 |
135,836 | vitessio/vitess | go/vt/vttablet/tabletserver/vstreamer/planbuilder.go | filter | func (plan *Plan) filter(values []sqltypes.Value) (bool, []sqltypes.Value, error) {
result := make([]sqltypes.Value, len(plan.ColExprs))
for i, colExpr := range plan.ColExprs {
result[i] = values[colExpr.ColNum]
}
if plan.Vindex == nil {
return true, result, nil
}
// Filter by Vindex.
destinations, err := p... | go | func (plan *Plan) filter(values []sqltypes.Value) (bool, []sqltypes.Value, error) {
result := make([]sqltypes.Value, len(plan.ColExprs))
for i, colExpr := range plan.ColExprs {
result[i] = values[colExpr.ColNum]
}
if plan.Vindex == nil {
return true, result, nil
}
// Filter by Vindex.
destinations, err := p... | [
"func",
"(",
"plan",
"*",
"Plan",
")",
"filter",
"(",
"values",
"[",
"]",
"sqltypes",
".",
"Value",
")",
"(",
"bool",
",",
"[",
"]",
"sqltypes",
".",
"Value",
",",
"error",
")",
"{",
"result",
":=",
"make",
"(",
"[",
"]",
"sqltypes",
".",
"Value"... | // filter filters the row against the plan. It returns false if the row did not match.
// If the row matched, it returns the columns to be sent. | [
"filter",
"filters",
"the",
"row",
"against",
"the",
"plan",
".",
"It",
"returns",
"false",
"if",
"the",
"row",
"did",
"not",
"match",
".",
"If",
"the",
"row",
"matched",
"it",
"returns",
"the",
"columns",
"to",
"be",
"sent",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/vstreamer/planbuilder.go#L72-L97 |
135,837 | vitessio/vitess | go/sync2/consolidator.go | Create | func (co *Consolidator) Create(query string) (r *Result, created bool) {
co.mu.Lock()
defer co.mu.Unlock()
if r, ok := co.queries[query]; ok {
return r, false
}
r = &Result{consolidator: co, query: query}
r.executing.Lock()
co.queries[query] = r
return r, true
} | go | func (co *Consolidator) Create(query string) (r *Result, created bool) {
co.mu.Lock()
defer co.mu.Unlock()
if r, ok := co.queries[query]; ok {
return r, false
}
r = &Result{consolidator: co, query: query}
r.executing.Lock()
co.queries[query] = r
return r, true
} | [
"func",
"(",
"co",
"*",
"Consolidator",
")",
"Create",
"(",
"query",
"string",
")",
"(",
"r",
"*",
"Result",
",",
"created",
"bool",
")",
"{",
"co",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"co",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n"... | // Create adds a query to currently executing queries and acquires a
// lock on its Result if it is not already present. If the query is
// a duplicate, Create returns false. | [
"Create",
"adds",
"a",
"query",
"to",
"currently",
"executing",
"queries",
"and",
"acquires",
"a",
"lock",
"on",
"its",
"Result",
"if",
"it",
"is",
"not",
"already",
"present",
".",
"If",
"the",
"query",
"is",
"a",
"duplicate",
"Create",
"returns",
"false"... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sync2/consolidator.go#L58-L68 |
135,838 | vitessio/vitess | go/sync2/consolidator.go | Broadcast | func (rs *Result) Broadcast() {
rs.consolidator.mu.Lock()
defer rs.consolidator.mu.Unlock()
delete(rs.consolidator.queries, rs.query)
rs.executing.Unlock()
} | go | func (rs *Result) Broadcast() {
rs.consolidator.mu.Lock()
defer rs.consolidator.mu.Unlock()
delete(rs.consolidator.queries, rs.query)
rs.executing.Unlock()
} | [
"func",
"(",
"rs",
"*",
"Result",
")",
"Broadcast",
"(",
")",
"{",
"rs",
".",
"consolidator",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"rs",
".",
"consolidator",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"delete",
"(",
"rs",
".",
"consoli... | // Broadcast removes the entry from current queries and releases the
// lock on its Result. Broadcast should be invoked when original
// query completes execution. | [
"Broadcast",
"removes",
"the",
"entry",
"from",
"current",
"queries",
"and",
"releases",
"the",
"lock",
"on",
"its",
"Result",
".",
"Broadcast",
"should",
"be",
"invoked",
"when",
"original",
"query",
"completes",
"execution",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sync2/consolidator.go#L73-L78 |
135,839 | vitessio/vitess | go/sync2/consolidator.go | Wait | func (rs *Result) Wait() {
rs.consolidator.Record(rs.query)
rs.executing.RLock()
} | go | func (rs *Result) Wait() {
rs.consolidator.Record(rs.query)
rs.executing.RLock()
} | [
"func",
"(",
"rs",
"*",
"Result",
")",
"Wait",
"(",
")",
"{",
"rs",
".",
"consolidator",
".",
"Record",
"(",
"rs",
".",
"query",
")",
"\n",
"rs",
".",
"executing",
".",
"RLock",
"(",
")",
"\n",
"}"
] | // Wait waits for the original query to complete execution. Wait should
// be invoked for duplicate queries. | [
"Wait",
"waits",
"for",
"the",
"original",
"query",
"to",
"complete",
"execution",
".",
"Wait",
"should",
"be",
"invoked",
"for",
"duplicate",
"queries",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sync2/consolidator.go#L82-L85 |
135,840 | vitessio/vitess | go/sync2/consolidator.go | Record | func (cc *ConsolidatorCache) Record(query string) {
if v, ok := cc.Get(query); ok {
v.(*ccount).add(1)
} else {
c := ccount(1)
cc.Set(query, &c)
}
} | go | func (cc *ConsolidatorCache) Record(query string) {
if v, ok := cc.Get(query); ok {
v.(*ccount).add(1)
} else {
c := ccount(1)
cc.Set(query, &c)
}
} | [
"func",
"(",
"cc",
"*",
"ConsolidatorCache",
")",
"Record",
"(",
"query",
"string",
")",
"{",
"if",
"v",
",",
"ok",
":=",
"cc",
".",
"Get",
"(",
"query",
")",
";",
"ok",
"{",
"v",
".",
"(",
"*",
"ccount",
")",
".",
"add",
"(",
"1",
")",
"\n",... | // Record increments the count for "query" by 1.
// If it's not in the cache yet, it will be added. | [
"Record",
"increments",
"the",
"count",
"for",
"query",
"by",
"1",
".",
"If",
"it",
"s",
"not",
"in",
"the",
"cache",
"yet",
"it",
"will",
"be",
"added",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sync2/consolidator.go#L102-L109 |
135,841 | vitessio/vitess | go/sync2/consolidator.go | Items | func (cc *ConsolidatorCache) Items() []ConsolidatorCacheItem {
items := cc.LRUCache.Items()
ret := make([]ConsolidatorCacheItem, len(items))
for i, v := range items {
ret[i] = ConsolidatorCacheItem{Query: v.Key, Count: v.Value.(*ccount).get()}
}
return ret
} | go | func (cc *ConsolidatorCache) Items() []ConsolidatorCacheItem {
items := cc.LRUCache.Items()
ret := make([]ConsolidatorCacheItem, len(items))
for i, v := range items {
ret[i] = ConsolidatorCacheItem{Query: v.Key, Count: v.Value.(*ccount).get()}
}
return ret
} | [
"func",
"(",
"cc",
"*",
"ConsolidatorCache",
")",
"Items",
"(",
")",
"[",
"]",
"ConsolidatorCacheItem",
"{",
"items",
":=",
"cc",
".",
"LRUCache",
".",
"Items",
"(",
")",
"\n",
"ret",
":=",
"make",
"(",
"[",
"]",
"ConsolidatorCacheItem",
",",
"len",
"(... | // Items returns the items in the cache as an array of String, int64 structs | [
"Items",
"returns",
"the",
"items",
"in",
"the",
"cache",
"as",
"an",
"array",
"of",
"String",
"int64",
"structs"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sync2/consolidator.go#L118-L125 |
135,842 | vitessio/vitess | go/vt/vtgate/planbuilder/postprocess.go | pushGroupBy | func (pb *primitiveBuilder) pushGroupBy(sel *sqlparser.Select, grouper groupByHandler) error {
if sel.Distinct != "" {
// We can be here only if the builder could handle a group by.
if err := grouper.MakeDistinct(); err != nil {
return err
}
}
if len(sel.GroupBy) == 0 {
return nil
}
if err := pb.st.Res... | go | func (pb *primitiveBuilder) pushGroupBy(sel *sqlparser.Select, grouper groupByHandler) error {
if sel.Distinct != "" {
// We can be here only if the builder could handle a group by.
if err := grouper.MakeDistinct(); err != nil {
return err
}
}
if len(sel.GroupBy) == 0 {
return nil
}
if err := pb.st.Res... | [
"func",
"(",
"pb",
"*",
"primitiveBuilder",
")",
"pushGroupBy",
"(",
"sel",
"*",
"sqlparser",
".",
"Select",
",",
"grouper",
"groupByHandler",
")",
"error",
"{",
"if",
"sel",
".",
"Distinct",
"!=",
"\"",
"\"",
"{",
"// We can be here only if the builder could ha... | // pushGroupBy processes the group by clause. It resolves all symbols,
// and ensures that there are no subqueries. | [
"pushGroupBy",
"processes",
"the",
"group",
"by",
"clause",
".",
"It",
"resolves",
"all",
"symbols",
"and",
"ensures",
"that",
"there",
"are",
"no",
"subqueries",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/postprocess.go#L42-L59 |
135,843 | vitessio/vitess | go/vt/vtgate/planbuilder/postprocess.go | pushOrderBy | func (pb *primitiveBuilder) pushOrderBy(orderBy sqlparser.OrderBy) error {
if oa, ok := pb.bldr.(*orderedAggregate); ok {
return oa.PushOrderBy(pb, orderBy)
}
switch len(orderBy) {
case 0:
return nil
case 1:
// Special handling for ORDER BY NULL. Push it everywhere.
if _, ok := orderBy[0].Expr.(*sqlparser... | go | func (pb *primitiveBuilder) pushOrderBy(orderBy sqlparser.OrderBy) error {
if oa, ok := pb.bldr.(*orderedAggregate); ok {
return oa.PushOrderBy(pb, orderBy)
}
switch len(orderBy) {
case 0:
return nil
case 1:
// Special handling for ORDER BY NULL. Push it everywhere.
if _, ok := orderBy[0].Expr.(*sqlparser... | [
"func",
"(",
"pb",
"*",
"primitiveBuilder",
")",
"pushOrderBy",
"(",
"orderBy",
"sqlparser",
".",
"OrderBy",
")",
"error",
"{",
"if",
"oa",
",",
"ok",
":=",
"pb",
".",
"bldr",
".",
"(",
"*",
"orderedAggregate",
")",
";",
"ok",
"{",
"return",
"oa",
".... | // pushOrderBy pushes the order by clause to the appropriate route.
// In the case of a join, it's only possible to push down if the
// order by references columns of the left-most route. Otherwise, the
// function returns an unsupported error. | [
"pushOrderBy",
"pushes",
"the",
"order",
"by",
"clause",
"to",
"the",
"appropriate",
"route",
".",
"In",
"the",
"case",
"of",
"a",
"join",
"it",
"s",
"only",
"possible",
"to",
"push",
"down",
"if",
"the",
"order",
"by",
"references",
"columns",
"of",
"th... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/postprocess.go#L65-L131 |
135,844 | vitessio/vitess | go/vt/throttler/memory.go | touchBadRateAge | func (m *memory) touchBadRateAge(now time.Time) {
m.nextBadRateAging = now.Add(m.ageBadRateAfter)
} | go | func (m *memory) touchBadRateAge(now time.Time) {
m.nextBadRateAging = now.Add(m.ageBadRateAfter)
} | [
"func",
"(",
"m",
"*",
"memory",
")",
"touchBadRateAge",
"(",
"now",
"time",
".",
"Time",
")",
"{",
"m",
".",
"nextBadRateAging",
"=",
"now",
".",
"Add",
"(",
"m",
".",
"ageBadRateAfter",
")",
"\n",
"}"
] | // touchBadRateAge records that the bad rate was changed and the aging should be
// further delayed. | [
"touchBadRateAge",
"records",
"that",
"the",
"bad",
"rate",
"was",
"changed",
"and",
"the",
"aging",
"should",
"be",
"further",
"delayed",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/memory.go#L142-L144 |
135,845 | vitessio/vitess | go/vt/worker/diff_utils.go | RollbackTransaction | func RollbackTransaction(ctx context.Context, ts *topo.Server, tabletAlias *topodatapb.TabletAlias, txID int64) error {
shortCtx, cancel := context.WithTimeout(ctx, *remoteActionsTimeout)
tablet, err := ts.GetTablet(shortCtx, tabletAlias)
cancel()
if err != nil {
return err
}
conn, err := tabletconn.GetDialer(... | go | func RollbackTransaction(ctx context.Context, ts *topo.Server, tabletAlias *topodatapb.TabletAlias, txID int64) error {
shortCtx, cancel := context.WithTimeout(ctx, *remoteActionsTimeout)
tablet, err := ts.GetTablet(shortCtx, tabletAlias)
cancel()
if err != nil {
return err
}
conn, err := tabletconn.GetDialer(... | [
"func",
"RollbackTransaction",
"(",
"ctx",
"context",
".",
"Context",
",",
"ts",
"*",
"topo",
".",
"Server",
",",
"tabletAlias",
"*",
"topodatapb",
".",
"TabletAlias",
",",
"txID",
"int64",
")",
"error",
"{",
"shortCtx",
",",
"cancel",
":=",
"context",
"."... | // RollbackTransaction rolls back the transaction | [
"RollbackTransaction",
"rolls",
"back",
"the",
"transaction"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/diff_utils.go#L132-L150 |
135,846 | vitessio/vitess | go/vt/worker/diff_utils.go | Recv | func (f *v3KeyRangeFilter) Recv() (*sqltypes.Result, error) {
r, err := f.input.Recv()
if err != nil {
return nil, err
}
rows := make([][]sqltypes.Value, 0, len(r.Rows))
for _, row := range r.Rows {
ksid, err := f.resolver.keyspaceID(row)
if err != nil {
return nil, err
}
if key.KeyRangeContains(f.k... | go | func (f *v3KeyRangeFilter) Recv() (*sqltypes.Result, error) {
r, err := f.input.Recv()
if err != nil {
return nil, err
}
rows := make([][]sqltypes.Value, 0, len(r.Rows))
for _, row := range r.Rows {
ksid, err := f.resolver.keyspaceID(row)
if err != nil {
return nil, err
}
if key.KeyRangeContains(f.k... | [
"func",
"(",
"f",
"*",
"v3KeyRangeFilter",
")",
"Recv",
"(",
")",
"(",
"*",
"sqltypes",
".",
"Result",
",",
"error",
")",
"{",
"r",
",",
"err",
":=",
"f",
".",
"input",
".",
"Recv",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil"... | // Recv is part of sqltypes.ResultStream interface. | [
"Recv",
"is",
"part",
"of",
"sqltypes",
".",
"ResultStream",
"interface",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/diff_utils.go#L176-L195 |
135,847 | vitessio/vitess | go/vt/worker/diff_utils.go | uint64FromKeyspaceID | func uint64FromKeyspaceID(keyspaceID []byte) uint64 {
// Copy into 8 bytes because keyspaceID could be shorter.
bits := make([]byte, 8)
copy(bits, keyspaceID)
return binary.BigEndian.Uint64(bits)
} | go | func uint64FromKeyspaceID(keyspaceID []byte) uint64 {
// Copy into 8 bytes because keyspaceID could be shorter.
bits := make([]byte, 8)
copy(bits, keyspaceID)
return binary.BigEndian.Uint64(bits)
} | [
"func",
"uint64FromKeyspaceID",
"(",
"keyspaceID",
"[",
"]",
"byte",
")",
"uint64",
"{",
"// Copy into 8 bytes because keyspaceID could be shorter.",
"bits",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"8",
")",
"\n",
"copy",
"(",
"bits",
",",
"keyspaceID",
")",
... | // uint64FromKeyspaceID returns the 64 bit number representation
// of the keyspaceID. | [
"uint64FromKeyspaceID",
"returns",
"the",
"64",
"bit",
"number",
"representation",
"of",
"the",
"keyspaceID",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/diff_utils.go#L243-L248 |
135,848 | vitessio/vitess | go/vt/worker/diff_utils.go | TableScan | func TableScan(ctx context.Context, log logutil.Logger, ts *topo.Server, tabletAlias *topodatapb.TabletAlias, td *tabletmanagerdatapb.TableDefinition) (*QueryResultReader, error) {
sql := fmt.Sprintf("SELECT %v FROM %v", strings.Join(escapeAll(orderedColumns(td)), ", "), sqlescape.EscapeID(td.Name))
if len(td.Primary... | go | func TableScan(ctx context.Context, log logutil.Logger, ts *topo.Server, tabletAlias *topodatapb.TabletAlias, td *tabletmanagerdatapb.TableDefinition) (*QueryResultReader, error) {
sql := fmt.Sprintf("SELECT %v FROM %v", strings.Join(escapeAll(orderedColumns(td)), ", "), sqlescape.EscapeID(td.Name))
if len(td.Primary... | [
"func",
"TableScan",
"(",
"ctx",
"context",
".",
"Context",
",",
"log",
"logutil",
".",
"Logger",
",",
"ts",
"*",
"topo",
".",
"Server",
",",
"tabletAlias",
"*",
"topodatapb",
".",
"TabletAlias",
",",
"td",
"*",
"tabletmanagerdatapb",
".",
"TableDefinition",... | // TableScan returns a QueryResultReader that gets all the rows from a
// table, ordered by Primary Key. The returned columns are ordered
// with the Primary Key columns in front. | [
"TableScan",
"returns",
"a",
"QueryResultReader",
"that",
"gets",
"all",
"the",
"rows",
"from",
"a",
"table",
"ordered",
"by",
"Primary",
"Key",
".",
"The",
"returned",
"columns",
"are",
"ordered",
"with",
"the",
"Primary",
"Key",
"columns",
"in",
"front",
"... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/diff_utils.go#L253-L260 |
135,849 | vitessio/vitess | go/vt/worker/diff_utils.go | CreateTargetFrom | func CreateTargetFrom(tablet *topodatapb.Tablet) *query.Target {
return &query.Target{
Cell: tablet.Alias.Cell,
Keyspace: tablet.Keyspace,
Shard: tablet.Shard,
TabletType: tablet.Type,
}
} | go | func CreateTargetFrom(tablet *topodatapb.Tablet) *query.Target {
return &query.Target{
Cell: tablet.Alias.Cell,
Keyspace: tablet.Keyspace,
Shard: tablet.Shard,
TabletType: tablet.Type,
}
} | [
"func",
"CreateTargetFrom",
"(",
"tablet",
"*",
"topodatapb",
".",
"Tablet",
")",
"*",
"query",
".",
"Target",
"{",
"return",
"&",
"query",
".",
"Target",
"{",
"Cell",
":",
"tablet",
".",
"Alias",
".",
"Cell",
",",
"Keyspace",
":",
"tablet",
".",
"Keys... | // CreateTargetFrom is a helper function | [
"CreateTargetFrom",
"is",
"a",
"helper",
"function"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/diff_utils.go#L273-L280 |
135,850 | vitessio/vitess | go/vt/worker/diff_utils.go | Drain | func (rr *RowReader) Drain() (int, error) {
count := 0
for {
row, err := rr.Next()
if err != nil {
return 0, err
}
if row == nil {
return count, nil
}
count++
}
} | go | func (rr *RowReader) Drain() (int, error) {
count := 0
for {
row, err := rr.Next()
if err != nil {
return 0, err
}
if row == nil {
return count, nil
}
count++
}
} | [
"func",
"(",
"rr",
"*",
"RowReader",
")",
"Drain",
"(",
")",
"(",
"int",
",",
"error",
")",
"{",
"count",
":=",
"0",
"\n",
"for",
"{",
"row",
",",
"err",
":=",
"rr",
".",
"Next",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
... | // Drain will empty the RowReader and return how many rows we got | [
"Drain",
"will",
"empty",
"the",
"RowReader",
"and",
"return",
"how",
"many",
"rows",
"we",
"got"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/diff_utils.go#L407-L419 |
135,851 | vitessio/vitess | go/vt/worker/diff_utils.go | HasDifferences | func (dr *DiffReport) HasDifferences() bool {
return dr.mismatchedRows > 0 || dr.extraRowsLeft > 0 || dr.extraRowsRight > 0
} | go | func (dr *DiffReport) HasDifferences() bool {
return dr.mismatchedRows > 0 || dr.extraRowsLeft > 0 || dr.extraRowsRight > 0
} | [
"func",
"(",
"dr",
"*",
"DiffReport",
")",
"HasDifferences",
"(",
")",
"bool",
"{",
"return",
"dr",
".",
"mismatchedRows",
">",
"0",
"||",
"dr",
".",
"extraRowsLeft",
">",
"0",
"||",
"dr",
".",
"extraRowsRight",
">",
"0",
"\n",
"}"
] | // HasDifferences returns true if the diff job recorded any difference | [
"HasDifferences",
"returns",
"true",
"if",
"the",
"diff",
"job",
"recorded",
"any",
"difference"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/diff_utils.go#L448-L450 |
135,852 | vitessio/vitess | go/vt/worker/diff_utils.go | ComputeQPS | func (dr *DiffReport) ComputeQPS() {
if dr.processedRows > 0 {
dr.processingQPS = int(time.Duration(dr.processedRows) * time.Second / time.Since(dr.startingTime))
}
} | go | func (dr *DiffReport) ComputeQPS() {
if dr.processedRows > 0 {
dr.processingQPS = int(time.Duration(dr.processedRows) * time.Second / time.Since(dr.startingTime))
}
} | [
"func",
"(",
"dr",
"*",
"DiffReport",
")",
"ComputeQPS",
"(",
")",
"{",
"if",
"dr",
".",
"processedRows",
">",
"0",
"{",
"dr",
".",
"processingQPS",
"=",
"int",
"(",
"time",
".",
"Duration",
"(",
"dr",
".",
"processedRows",
")",
"*",
"time",
".",
"... | // ComputeQPS fills in processingQPS | [
"ComputeQPS",
"fills",
"in",
"processingQPS"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/diff_utils.go#L453-L457 |
135,853 | vitessio/vitess | go/vt/worker/diff_utils.go | RowsEqual | func RowsEqual(left, right []sqltypes.Value) int {
for i, l := range left {
if !bytes.Equal(l.Raw(), right[i].Raw()) {
return i
}
}
return -1
} | go | func RowsEqual(left, right []sqltypes.Value) int {
for i, l := range left {
if !bytes.Equal(l.Raw(), right[i].Raw()) {
return i
}
}
return -1
} | [
"func",
"RowsEqual",
"(",
"left",
",",
"right",
"[",
"]",
"sqltypes",
".",
"Value",
")",
"int",
"{",
"for",
"i",
",",
"l",
":=",
"range",
"left",
"{",
"if",
"!",
"bytes",
".",
"Equal",
"(",
"l",
".",
"Raw",
"(",
")",
",",
"right",
"[",
"i",
"... | // RowsEqual returns the index of the first different column, or -1 if
// both rows are the same. | [
"RowsEqual",
"returns",
"the",
"index",
"of",
"the",
"first",
"different",
"column",
"or",
"-",
"1",
"if",
"both",
"rows",
"are",
"the",
"same",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/diff_utils.go#L465-L472 |
135,854 | vitessio/vitess | go/vt/worker/diff_utils.go | NewRowDiffer | func NewRowDiffer(left, right ResultReader, tableDefinition *tabletmanagerdatapb.TableDefinition) (*RowDiffer, error) {
leftFields := left.Fields()
rightFields := right.Fields()
if len(leftFields) != len(rightFields) {
return nil, vterrors.Errorf(vtrpc.Code_FAILED_PRECONDITION, "[table=%v] Cannot diff inputs with ... | go | func NewRowDiffer(left, right ResultReader, tableDefinition *tabletmanagerdatapb.TableDefinition) (*RowDiffer, error) {
leftFields := left.Fields()
rightFields := right.Fields()
if len(leftFields) != len(rightFields) {
return nil, vterrors.Errorf(vtrpc.Code_FAILED_PRECONDITION, "[table=%v] Cannot diff inputs with ... | [
"func",
"NewRowDiffer",
"(",
"left",
",",
"right",
"ResultReader",
",",
"tableDefinition",
"*",
"tabletmanagerdatapb",
".",
"TableDefinition",
")",
"(",
"*",
"RowDiffer",
",",
"error",
")",
"{",
"leftFields",
":=",
"left",
".",
"Fields",
"(",
")",
"\n",
"rig... | // NewRowDiffer returns a new RowDiffer | [
"NewRowDiffer",
"returns",
"a",
"new",
"RowDiffer"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/diff_utils.go#L527-L543 |
135,855 | vitessio/vitess | go/vt/worker/diff_utils.go | createTransactions | func createTransactions(ctx context.Context, numberOfScanners int, wr *wrangler.Wrangler, cleaner *wrangler.Cleaner, queryService queryservice.QueryService, target *query.Target, tabletInfo *topodatapb.Tablet) ([]int64, error) {
scanners := make([]int64, numberOfScanners)
for i := 0; i < numberOfScanners; i++ {
tx... | go | func createTransactions(ctx context.Context, numberOfScanners int, wr *wrangler.Wrangler, cleaner *wrangler.Cleaner, queryService queryservice.QueryService, target *query.Target, tabletInfo *topodatapb.Tablet) ([]int64, error) {
scanners := make([]int64, numberOfScanners)
for i := 0; i < numberOfScanners; i++ {
tx... | [
"func",
"createTransactions",
"(",
"ctx",
"context",
".",
"Context",
",",
"numberOfScanners",
"int",
",",
"wr",
"*",
"wrangler",
".",
"Wrangler",
",",
"cleaner",
"*",
"wrangler",
".",
"Cleaner",
",",
"queryService",
"queryservice",
".",
"QueryService",
",",
"t... | // createTransactions returns an array of transactions that all share the same view of the data.
// It will check that no new transactions have been seen between the creation of the underlying transactions,
// to guarantee that all TransactionalTableScanner are pointing to the same point | [
"createTransactions",
"returns",
"an",
"array",
"of",
"transactions",
"that",
"all",
"share",
"the",
"same",
"view",
"of",
"the",
"data",
".",
"It",
"will",
"check",
"that",
"no",
"new",
"transactions",
"have",
"been",
"seen",
"between",
"the",
"creation",
"... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/diff_utils.go#L657-L683 |
135,856 | vitessio/vitess | go/vt/worker/diff_utils.go | CreateConsistentTableScanners | func CreateConsistentTableScanners(ctx context.Context, tablet *topo.TabletInfo, wr *wrangler.Wrangler, cleaner *wrangler.Cleaner, numberOfScanners int) ([]TableScanner, string, error) {
txs, gtid, err := CreateConsistentTransactions(ctx, tablet, wr, cleaner, numberOfScanners)
if err != nil {
return nil, "", err
}... | go | func CreateConsistentTableScanners(ctx context.Context, tablet *topo.TabletInfo, wr *wrangler.Wrangler, cleaner *wrangler.Cleaner, numberOfScanners int) ([]TableScanner, string, error) {
txs, gtid, err := CreateConsistentTransactions(ctx, tablet, wr, cleaner, numberOfScanners)
if err != nil {
return nil, "", err
}... | [
"func",
"CreateConsistentTableScanners",
"(",
"ctx",
"context",
".",
"Context",
",",
"tablet",
"*",
"topo",
".",
"TabletInfo",
",",
"wr",
"*",
"wrangler",
".",
"Wrangler",
",",
"cleaner",
"*",
"wrangler",
".",
"Cleaner",
",",
"numberOfScanners",
"int",
")",
... | // CreateConsistentTableScanners will momentarily stop updates on the tablet, and then create connections that are all
// consistent snapshots of the same point in the transaction history | [
"CreateConsistentTableScanners",
"will",
"momentarily",
"stop",
"updates",
"on",
"the",
"tablet",
"and",
"then",
"create",
"connections",
"that",
"are",
"all",
"consistent",
"snapshots",
"of",
"the",
"same",
"point",
"in",
"the",
"transaction",
"history"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/diff_utils.go#L720-L741 |
135,857 | vitessio/vitess | go/vt/worker/diff_utils.go | CreateConsistentTransactions | func CreateConsistentTransactions(ctx context.Context, tablet *topo.TabletInfo, wr *wrangler.Wrangler, cleaner *wrangler.Cleaner, numberOfScanners int) ([]int64, string, error) {
if numberOfScanners < 1 {
return nil, "", vterrors.Errorf(vtrpc.Code_INVALID_ARGUMENT, "need more than zero scanners: %d", numberOfScanner... | go | func CreateConsistentTransactions(ctx context.Context, tablet *topo.TabletInfo, wr *wrangler.Wrangler, cleaner *wrangler.Cleaner, numberOfScanners int) ([]int64, string, error) {
if numberOfScanners < 1 {
return nil, "", vterrors.Errorf(vtrpc.Code_INVALID_ARGUMENT, "need more than zero scanners: %d", numberOfScanner... | [
"func",
"CreateConsistentTransactions",
"(",
"ctx",
"context",
".",
"Context",
",",
"tablet",
"*",
"topo",
".",
"TabletInfo",
",",
"wr",
"*",
"wrangler",
".",
"Wrangler",
",",
"cleaner",
"*",
"wrangler",
".",
"Cleaner",
",",
"numberOfScanners",
"int",
")",
"... | // CreateConsistentTransactions creates a number of consistent snapshot transactions,
// all starting from the same spot in the tx log | [
"CreateConsistentTransactions",
"creates",
"a",
"number",
"of",
"consistent",
"snapshot",
"transactions",
"all",
"starting",
"from",
"the",
"same",
"spot",
"in",
"the",
"tx",
"log"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/diff_utils.go#L745-L782 |
135,858 | vitessio/vitess | go/vt/worker/ping.go | NewPingWorker | func NewPingWorker(wr *wrangler.Wrangler, message string) (Worker, error) {
return &PingWorker{
StatusWorker: NewStatusWorker(),
wr: wr,
message: message,
}, nil
} | go | func NewPingWorker(wr *wrangler.Wrangler, message string) (Worker, error) {
return &PingWorker{
StatusWorker: NewStatusWorker(),
wr: wr,
message: message,
}, nil
} | [
"func",
"NewPingWorker",
"(",
"wr",
"*",
"wrangler",
".",
"Wrangler",
",",
"message",
"string",
")",
"(",
"Worker",
",",
"error",
")",
"{",
"return",
"&",
"PingWorker",
"{",
"StatusWorker",
":",
"NewStatusWorker",
"(",
")",
",",
"wr",
":",
"wr",
",",
"... | // NewPingWorker returns a new PingWorker object. | [
"NewPingWorker",
"returns",
"a",
"new",
"PingWorker",
"object",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/ping.go#L37-L43 |
135,859 | vitessio/vitess | go/vt/vtctl/backup.go | execBackup | func execBackup(ctx context.Context, wr *wrangler.Wrangler, tablet *topodatapb.Tablet, concurrency int, allowMaster bool) error {
stream, err := wr.TabletManagerClient().Backup(ctx, tablet, concurrency, allowMaster)
if err != nil {
return err
}
for {
e, err := stream.Recv()
switch err {
case nil:
logutil... | go | func execBackup(ctx context.Context, wr *wrangler.Wrangler, tablet *topodatapb.Tablet, concurrency int, allowMaster bool) error {
stream, err := wr.TabletManagerClient().Backup(ctx, tablet, concurrency, allowMaster)
if err != nil {
return err
}
for {
e, err := stream.Recv()
switch err {
case nil:
logutil... | [
"func",
"execBackup",
"(",
"ctx",
"context",
".",
"Context",
",",
"wr",
"*",
"wrangler",
".",
"Wrangler",
",",
"tablet",
"*",
"topodatapb",
".",
"Tablet",
",",
"concurrency",
"int",
",",
"allowMaster",
"bool",
")",
"error",
"{",
"stream",
",",
"err",
":=... | // execBackup is shared by Backup and BackupShard | [
"execBackup",
"is",
"shared",
"by",
"Backup",
"and",
"BackupShard"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtctl/backup.go#L153-L169 |
135,860 | vitessio/vitess | go/vt/vttablet/customrule/filecustomrule/filecustomrule.go | NewFileCustomRule | func NewFileCustomRule() (fcr *FileCustomRule) {
fcr = new(FileCustomRule)
fcr.path = ""
fcr.currentRuleSet = rules.New()
return fcr
} | go | func NewFileCustomRule() (fcr *FileCustomRule) {
fcr = new(FileCustomRule)
fcr.path = ""
fcr.currentRuleSet = rules.New()
return fcr
} | [
"func",
"NewFileCustomRule",
"(",
")",
"(",
"fcr",
"*",
"FileCustomRule",
")",
"{",
"fcr",
"=",
"new",
"(",
"FileCustomRule",
")",
"\n",
"fcr",
".",
"path",
"=",
"\"",
"\"",
"\n",
"fcr",
".",
"currentRuleSet",
"=",
"rules",
".",
"New",
"(",
")",
"\n"... | // NewFileCustomRule returns pointer to new FileCustomRule structure | [
"NewFileCustomRule",
"returns",
"pointer",
"to",
"new",
"FileCustomRule",
"structure"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/customrule/filecustomrule/filecustomrule.go#L49-L54 |
135,861 | vitessio/vitess | go/vt/vttablet/customrule/filecustomrule/filecustomrule.go | Open | func (fcr *FileCustomRule) Open(qsc tabletserver.Controller, rulePath string) error {
fcr.path = rulePath
if fcr.path == "" {
// Don't go further if path is empty
return nil
}
data, err := ioutil.ReadFile(fcr.path)
if err != nil {
log.Warningf("Error reading file %v: %v", fcr.path, err)
// Don't update any... | go | func (fcr *FileCustomRule) Open(qsc tabletserver.Controller, rulePath string) error {
fcr.path = rulePath
if fcr.path == "" {
// Don't go further if path is empty
return nil
}
data, err := ioutil.ReadFile(fcr.path)
if err != nil {
log.Warningf("Error reading file %v: %v", fcr.path, err)
// Don't update any... | [
"func",
"(",
"fcr",
"*",
"FileCustomRule",
")",
"Open",
"(",
"qsc",
"tabletserver",
".",
"Controller",
",",
"rulePath",
"string",
")",
"error",
"{",
"fcr",
".",
"path",
"=",
"rulePath",
"\n",
"if",
"fcr",
".",
"path",
"==",
"\"",
"\"",
"{",
"// Don't g... | // Open try to build query rules from local file and push the rules to vttablet | [
"Open",
"try",
"to",
"build",
"query",
"rules",
"from",
"local",
"file",
"and",
"push",
"the",
"rules",
"to",
"vttablet"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/customrule/filecustomrule/filecustomrule.go#L57-L81 |
135,862 | vitessio/vitess | go/vt/vttablet/customrule/filecustomrule/filecustomrule.go | GetRules | func (fcr *FileCustomRule) GetRules() (qrs *rules.Rules, version int64, err error) {
return fcr.currentRuleSet.Copy(), fcr.currentRuleSetTimestamp, nil
} | go | func (fcr *FileCustomRule) GetRules() (qrs *rules.Rules, version int64, err error) {
return fcr.currentRuleSet.Copy(), fcr.currentRuleSetTimestamp, nil
} | [
"func",
"(",
"fcr",
"*",
"FileCustomRule",
")",
"GetRules",
"(",
")",
"(",
"qrs",
"*",
"rules",
".",
"Rules",
",",
"version",
"int64",
",",
"err",
"error",
")",
"{",
"return",
"fcr",
".",
"currentRuleSet",
".",
"Copy",
"(",
")",
",",
"fcr",
".",
"c... | // GetRules returns query rules built from local file | [
"GetRules",
"returns",
"query",
"rules",
"built",
"from",
"local",
"file"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/customrule/filecustomrule/filecustomrule.go#L84-L86 |
135,863 | vitessio/vitess | go/vt/vttablet/customrule/filecustomrule/filecustomrule.go | ActivateFileCustomRules | func ActivateFileCustomRules(qsc tabletserver.Controller) {
if *fileRulePath != "" {
qsc.RegisterQueryRuleSource(FileCustomRuleSource)
fileCustomRule.Open(qsc, *fileRulePath)
}
} | go | func ActivateFileCustomRules(qsc tabletserver.Controller) {
if *fileRulePath != "" {
qsc.RegisterQueryRuleSource(FileCustomRuleSource)
fileCustomRule.Open(qsc, *fileRulePath)
}
} | [
"func",
"ActivateFileCustomRules",
"(",
"qsc",
"tabletserver",
".",
"Controller",
")",
"{",
"if",
"*",
"fileRulePath",
"!=",
"\"",
"\"",
"{",
"qsc",
".",
"RegisterQueryRuleSource",
"(",
"FileCustomRuleSource",
")",
"\n",
"fileCustomRule",
".",
"Open",
"(",
"qsc"... | // ActivateFileCustomRules activates this static file based custom rule mechanism | [
"ActivateFileCustomRules",
"activates",
"this",
"static",
"file",
"based",
"custom",
"rule",
"mechanism"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/customrule/filecustomrule/filecustomrule.go#L89-L94 |
135,864 | vitessio/vitess | go/vt/topotools/rebuild_keyspace.go | RebuildKeyspace | func RebuildKeyspace(ctx context.Context, log logutil.Logger, ts *topo.Server, keyspace string, cells []string) (err error) {
ctx, unlock, lockErr := ts.LockKeyspace(ctx, keyspace, "RebuildKeyspace")
if lockErr != nil {
return lockErr
}
defer unlock(&err)
return RebuildKeyspaceLocked(ctx, log, ts, keyspace, cel... | go | func RebuildKeyspace(ctx context.Context, log logutil.Logger, ts *topo.Server, keyspace string, cells []string) (err error) {
ctx, unlock, lockErr := ts.LockKeyspace(ctx, keyspace, "RebuildKeyspace")
if lockErr != nil {
return lockErr
}
defer unlock(&err)
return RebuildKeyspaceLocked(ctx, log, ts, keyspace, cel... | [
"func",
"RebuildKeyspace",
"(",
"ctx",
"context",
".",
"Context",
",",
"log",
"logutil",
".",
"Logger",
",",
"ts",
"*",
"topo",
".",
"Server",
",",
"keyspace",
"string",
",",
"cells",
"[",
"]",
"string",
")",
"(",
"err",
"error",
")",
"{",
"ctx",
","... | // RebuildKeyspace rebuilds the serving graph data while locking out other changes. | [
"RebuildKeyspace",
"rebuilds",
"the",
"serving",
"graph",
"data",
"while",
"locking",
"out",
"other",
"changes",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topotools/rebuild_keyspace.go#L33-L41 |
135,865 | vitessio/vitess | go/vt/vttablet/tabletmanager/vreplication/controller_plan.go | buildControllerPlan | func buildControllerPlan(query string) (*controllerPlan, error) {
stmt, err := sqlparser.Parse(query)
if err != nil {
return nil, err
}
switch stmt := stmt.(type) {
case *sqlparser.Insert:
return buildInsertPlan(stmt)
case *sqlparser.Update:
return buildUpdatePlan(stmt)
case *sqlparser.Delete:
return bui... | go | func buildControllerPlan(query string) (*controllerPlan, error) {
stmt, err := sqlparser.Parse(query)
if err != nil {
return nil, err
}
switch stmt := stmt.(type) {
case *sqlparser.Insert:
return buildInsertPlan(stmt)
case *sqlparser.Update:
return buildUpdatePlan(stmt)
case *sqlparser.Delete:
return bui... | [
"func",
"buildControllerPlan",
"(",
"query",
"string",
")",
"(",
"*",
"controllerPlan",
",",
"error",
")",
"{",
"stmt",
",",
"err",
":=",
"sqlparser",
".",
"Parse",
"(",
"query",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
... | // buildControllerPlan parses the input query and returns an appropriate plan. | [
"buildControllerPlan",
"parses",
"the",
"input",
"query",
"and",
"returns",
"an",
"appropriate",
"plan",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/vreplication/controller_plan.go#L41-L58 |
135,866 | vitessio/vitess | go/vt/vttablet/tabletserver/tabletenv/tabletenv.go | RecordUserQuery | func RecordUserQuery(ctx context.Context, tableName sqlparser.TableIdent, queryType string, duration int64) {
username := callerid.GetPrincipal(callerid.EffectiveCallerIDFromContext(ctx))
if username == "" {
username = callerid.GetUsername(callerid.ImmediateCallerIDFromContext(ctx))
}
UserTableQueryCount.Add([]st... | go | func RecordUserQuery(ctx context.Context, tableName sqlparser.TableIdent, queryType string, duration int64) {
username := callerid.GetPrincipal(callerid.EffectiveCallerIDFromContext(ctx))
if username == "" {
username = callerid.GetUsername(callerid.ImmediateCallerIDFromContext(ctx))
}
UserTableQueryCount.Add([]st... | [
"func",
"RecordUserQuery",
"(",
"ctx",
"context",
".",
"Context",
",",
"tableName",
"sqlparser",
".",
"TableIdent",
",",
"queryType",
"string",
",",
"duration",
"int64",
")",
"{",
"username",
":=",
"callerid",
".",
"GetPrincipal",
"(",
"callerid",
".",
"Effect... | // RecordUserQuery records the query data against the user. | [
"RecordUserQuery",
"records",
"the",
"query",
"data",
"against",
"the",
"user",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletenv/tabletenv.go#L123-L130 |
135,867 | vitessio/vitess | go/vt/vttablet/tabletserver/tabletenv/tabletenv.go | LogError | func LogError() {
if x := recover(); x != nil {
log.Errorf("Uncaught panic:\n%v\n%s", x, tb.Stack(4))
InternalErrors.Add("Panic", 1)
}
} | go | func LogError() {
if x := recover(); x != nil {
log.Errorf("Uncaught panic:\n%v\n%s", x, tb.Stack(4))
InternalErrors.Add("Panic", 1)
}
} | [
"func",
"LogError",
"(",
")",
"{",
"if",
"x",
":=",
"recover",
"(",
")",
";",
"x",
"!=",
"nil",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\\n",
"\\n",
"\"",
",",
"x",
",",
"tb",
".",
"Stack",
"(",
"4",
")",
")",
"\n",
"InternalErrors",
".",
"Add... | // LogError logs panics and increments InternalErrors. | [
"LogError",
"logs",
"panics",
"and",
"increments",
"InternalErrors",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletenv/tabletenv.go#L133-L138 |
135,868 | vitessio/vitess | go/vt/vttablet/tabletservermock/controller.go | NewController | func NewController() *Controller {
return &Controller{
queryServiceEnabled: false,
BroadcastData: make(chan *BroadcastData, 10),
StateChanges: make(chan *StateChange, 10),
queryRulesMap: make(map[string]*rules.Rules),
}
} | go | func NewController() *Controller {
return &Controller{
queryServiceEnabled: false,
BroadcastData: make(chan *BroadcastData, 10),
StateChanges: make(chan *StateChange, 10),
queryRulesMap: make(map[string]*rules.Rules),
}
} | [
"func",
"NewController",
"(",
")",
"*",
"Controller",
"{",
"return",
"&",
"Controller",
"{",
"queryServiceEnabled",
":",
"false",
",",
"BroadcastData",
":",
"make",
"(",
"chan",
"*",
"BroadcastData",
",",
"10",
")",
",",
"StateChanges",
":",
"make",
"(",
"... | // NewController returns a mock of tabletserver.Controller | [
"NewController",
"returns",
"a",
"mock",
"of",
"tabletserver",
".",
"Controller"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletservermock/controller.go#L94-L101 |
135,869 | vitessio/vitess | go/vt/vttablet/tabletservermock/controller.go | InitDBConfig | func (tqsc *Controller) InitDBConfig(target querypb.Target, dbcfgs *dbconfigs.DBConfigs) error {
tqsc.mu.Lock()
defer tqsc.mu.Unlock()
tqsc.CurrentTarget = target
return nil
} | go | func (tqsc *Controller) InitDBConfig(target querypb.Target, dbcfgs *dbconfigs.DBConfigs) error {
tqsc.mu.Lock()
defer tqsc.mu.Unlock()
tqsc.CurrentTarget = target
return nil
} | [
"func",
"(",
"tqsc",
"*",
"Controller",
")",
"InitDBConfig",
"(",
"target",
"querypb",
".",
"Target",
",",
"dbcfgs",
"*",
"dbconfigs",
".",
"DBConfigs",
")",
"error",
"{",
"tqsc",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"tqsc",
".",
"mu",
".... | // InitDBConfig is part of the tabletserver.Controller interface | [
"InitDBConfig",
"is",
"part",
"of",
"the",
"tabletserver",
".",
"Controller",
"interface"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletservermock/controller.go#L112-L118 |
135,870 | vitessio/vitess | go/vt/vttablet/tabletservermock/controller.go | SetServingType | func (tqsc *Controller) SetServingType(tabletType topodatapb.TabletType, serving bool, alsoAllow []topodatapb.TabletType) (bool, error) {
tqsc.mu.Lock()
defer tqsc.mu.Unlock()
stateChanged := false
if tqsc.SetServingTypeError == nil {
stateChanged = tqsc.queryServiceEnabled != serving || tqsc.CurrentTarget.Table... | go | func (tqsc *Controller) SetServingType(tabletType topodatapb.TabletType, serving bool, alsoAllow []topodatapb.TabletType) (bool, error) {
tqsc.mu.Lock()
defer tqsc.mu.Unlock()
stateChanged := false
if tqsc.SetServingTypeError == nil {
stateChanged = tqsc.queryServiceEnabled != serving || tqsc.CurrentTarget.Table... | [
"func",
"(",
"tqsc",
"*",
"Controller",
")",
"SetServingType",
"(",
"tabletType",
"topodatapb",
".",
"TabletType",
",",
"serving",
"bool",
",",
"alsoAllow",
"[",
"]",
"topodatapb",
".",
"TabletType",
")",
"(",
"bool",
",",
"error",
")",
"{",
"tqsc",
".",
... | // SetServingType is part of the tabletserver.Controller interface | [
"SetServingType",
"is",
"part",
"of",
"the",
"tabletserver",
".",
"Controller",
"interface"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletservermock/controller.go#L121-L139 |
135,871 | vitessio/vitess | go/vt/vttablet/tabletservermock/controller.go | IsServing | func (tqsc *Controller) IsServing() bool {
tqsc.mu.Lock()
defer tqsc.mu.Unlock()
return tqsc.queryServiceEnabled
} | go | func (tqsc *Controller) IsServing() bool {
tqsc.mu.Lock()
defer tqsc.mu.Unlock()
return tqsc.queryServiceEnabled
} | [
"func",
"(",
"tqsc",
"*",
"Controller",
")",
"IsServing",
"(",
")",
"bool",
"{",
"tqsc",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"tqsc",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"return",
"tqsc",
".",
"queryServiceEnabled",
"\n",
"}"
] | // IsServing is part of the tabletserver.Controller interface | [
"IsServing",
"is",
"part",
"of",
"the",
"tabletserver",
".",
"Controller",
"interface"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletservermock/controller.go#L142-L147 |
135,872 | vitessio/vitess | go/vt/vttablet/tabletservermock/controller.go | SetQueryRules | func (tqsc *Controller) SetQueryRules(ruleSource string, qrs *rules.Rules) error {
tqsc.mu.Lock()
defer tqsc.mu.Unlock()
tqsc.queryRulesMap[ruleSource] = qrs
return nil
} | go | func (tqsc *Controller) SetQueryRules(ruleSource string, qrs *rules.Rules) error {
tqsc.mu.Lock()
defer tqsc.mu.Unlock()
tqsc.queryRulesMap[ruleSource] = qrs
return nil
} | [
"func",
"(",
"tqsc",
"*",
"Controller",
")",
"SetQueryRules",
"(",
"ruleSource",
"string",
",",
"qrs",
"*",
"rules",
".",
"Rules",
")",
"error",
"{",
"tqsc",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"tqsc",
".",
"mu",
".",
"Unlock",
"(",
")... | // SetQueryRules is part of the tabletserver.Controller interface | [
"SetQueryRules",
"is",
"part",
"of",
"the",
"tabletserver",
".",
"Controller",
"interface"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletservermock/controller.go#L172-L177 |
135,873 | vitessio/vitess | go/vt/vttablet/tabletservermock/controller.go | BroadcastHealth | func (tqsc *Controller) BroadcastHealth(terTimestamp int64, stats *querypb.RealtimeStats, maxCache time.Duration) {
tqsc.mu.Lock()
defer tqsc.mu.Unlock()
tqsc.BroadcastData <- &BroadcastData{
TERTimestamp: terTimestamp,
RealtimeStats: *stats,
Serving: tqsc.queryServiceEnabled && (!tqsc.isInLameduck),
... | go | func (tqsc *Controller) BroadcastHealth(terTimestamp int64, stats *querypb.RealtimeStats, maxCache time.Duration) {
tqsc.mu.Lock()
defer tqsc.mu.Unlock()
tqsc.BroadcastData <- &BroadcastData{
TERTimestamp: terTimestamp,
RealtimeStats: *stats,
Serving: tqsc.queryServiceEnabled && (!tqsc.isInLameduck),
... | [
"func",
"(",
"tqsc",
"*",
"Controller",
")",
"BroadcastHealth",
"(",
"terTimestamp",
"int64",
",",
"stats",
"*",
"querypb",
".",
"RealtimeStats",
",",
"maxCache",
"time",
".",
"Duration",
")",
"{",
"tqsc",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",... | // BroadcastHealth is part of the tabletserver.Controller interface | [
"BroadcastHealth",
"is",
"part",
"of",
"the",
"tabletserver",
".",
"Controller",
"interface"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletservermock/controller.go#L190-L199 |
135,874 | vitessio/vitess | go/vt/vttablet/tabletservermock/controller.go | EnterLameduck | func (tqsc *Controller) EnterLameduck() {
tqsc.mu.Lock()
defer tqsc.mu.Unlock()
tqsc.isInLameduck = true
} | go | func (tqsc *Controller) EnterLameduck() {
tqsc.mu.Lock()
defer tqsc.mu.Unlock()
tqsc.isInLameduck = true
} | [
"func",
"(",
"tqsc",
"*",
"Controller",
")",
"EnterLameduck",
"(",
")",
"{",
"tqsc",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"tqsc",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"tqsc",
".",
"isInLameduck",
"=",
"true",
"\n",
"}"
] | // EnterLameduck implements tabletserver.Controller. | [
"EnterLameduck",
"implements",
"tabletserver",
".",
"Controller",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletservermock/controller.go#L212-L217 |
135,875 | vitessio/vitess | go/vt/vttablet/tabletservermock/controller.go | GetQueryRules | func (tqsc *Controller) GetQueryRules(ruleSource string) *rules.Rules {
tqsc.mu.Lock()
defer tqsc.mu.Unlock()
return tqsc.queryRulesMap[ruleSource]
} | go | func (tqsc *Controller) GetQueryRules(ruleSource string) *rules.Rules {
tqsc.mu.Lock()
defer tqsc.mu.Unlock()
return tqsc.queryRulesMap[ruleSource]
} | [
"func",
"(",
"tqsc",
"*",
"Controller",
")",
"GetQueryRules",
"(",
"ruleSource",
"string",
")",
"*",
"rules",
".",
"Rules",
"{",
"tqsc",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"tqsc",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"t... | // GetQueryRules allows a test to check what was set. | [
"GetQueryRules",
"allows",
"a",
"test",
"to",
"check",
"what",
"was",
"set",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletservermock/controller.go#L228-L232 |
135,876 | vitessio/vitess | go/vt/vttablet/tabletserver/txthrottler/tx_throttler.go | CreateTxThrottlerFromTabletConfig | func CreateTxThrottlerFromTabletConfig(topoServer *topo.Server) *TxThrottler {
txThrottler, err := tryCreateTxThrottler(topoServer)
if err != nil {
log.Errorf("Error creating transaction throttler. Transaction throttling will"+
" be disabled. Error: %v", err)
txThrottler, err = newTxThrottler(&txThrottlerConfi... | go | func CreateTxThrottlerFromTabletConfig(topoServer *topo.Server) *TxThrottler {
txThrottler, err := tryCreateTxThrottler(topoServer)
if err != nil {
log.Errorf("Error creating transaction throttler. Transaction throttling will"+
" be disabled. Error: %v", err)
txThrottler, err = newTxThrottler(&txThrottlerConfi... | [
"func",
"CreateTxThrottlerFromTabletConfig",
"(",
"topoServer",
"*",
"topo",
".",
"Server",
")",
"*",
"TxThrottler",
"{",
"txThrottler",
",",
"err",
":=",
"tryCreateTxThrottler",
"(",
"topoServer",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Errorf"... | // CreateTxThrottlerFromTabletConfig tries to construct a TxThrottler from the
// relevant fields in the tabletenv.Config object. It returns a disabled TxThrottler if
// any error occurs.
// This function calls tryCreateTxThrottler that does the actual creation work
// and returns an error if one occurred. | [
"CreateTxThrottlerFromTabletConfig",
"tries",
"to",
"construct",
"a",
"TxThrottler",
"from",
"the",
"relevant",
"fields",
"in",
"the",
"tabletenv",
".",
"Config",
"object",
".",
"It",
"returns",
"a",
"disabled",
"TxThrottler",
"if",
"any",
"error",
"occurs",
".",
... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/txthrottler/tx_throttler.go#L79-L92 |
135,877 | vitessio/vitess | go/vt/vttablet/tabletserver/txthrottler/tx_throttler.go | Open | func (t *TxThrottler) Open(keyspace, shard string) error {
if !t.config.enabled {
return nil
}
if t.state != nil {
return fmt.Errorf("transaction throttler already opened")
}
var err error
t.state, err = newTxThrottlerState(t.config, keyspace, shard)
return err
} | go | func (t *TxThrottler) Open(keyspace, shard string) error {
if !t.config.enabled {
return nil
}
if t.state != nil {
return fmt.Errorf("transaction throttler already opened")
}
var err error
t.state, err = newTxThrottlerState(t.config, keyspace, shard)
return err
} | [
"func",
"(",
"t",
"*",
"TxThrottler",
")",
"Open",
"(",
"keyspace",
",",
"shard",
"string",
")",
"error",
"{",
"if",
"!",
"t",
".",
"config",
".",
"enabled",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"if",
"t",
".",
"state",
"!=",
"nil",
"{",
"retur... | // Open opens the transaction throttler. It must be called prior to 'Throttle'. | [
"Open",
"opens",
"the",
"transaction",
"throttler",
".",
"It",
"must",
"be",
"called",
"prior",
"to",
"Throttle",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/txthrottler/tx_throttler.go#L213-L223 |
135,878 | vitessio/vitess | go/vt/vitessdriver/driver.go | toJSON | func (c Configuration) toJSON() (string, error) {
c.setDefaults()
jsonBytes, err := json.Marshal(c)
if err != nil {
return "", err
}
return string(jsonBytes), nil
} | go | func (c Configuration) toJSON() (string, error) {
c.setDefaults()
jsonBytes, err := json.Marshal(c)
if err != nil {
return "", err
}
return string(jsonBytes), nil
} | [
"func",
"(",
"c",
"Configuration",
")",
"toJSON",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"c",
".",
"setDefaults",
"(",
")",
"\n",
"jsonBytes",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"c",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",... | // toJSON converts Configuration to the JSON string which is required by the
// Vitess driver. Default values for empty fields will be set. | [
"toJSON",
"converts",
"Configuration",
"to",
"the",
"JSON",
"string",
"which",
"is",
"required",
"by",
"the",
"Vitess",
"driver",
".",
"Default",
"values",
"for",
"empty",
"fields",
"will",
"be",
"set",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vitessdriver/driver.go#L146-L153 |
135,879 | vitessio/vitess | go/acl/fallback_policy.go | CheckAccessHTTP | func (fp FallbackPolicy) CheckAccessHTTP(req *http.Request, role string) error {
return errFallback
} | go | func (fp FallbackPolicy) CheckAccessHTTP(req *http.Request, role string) error {
return errFallback
} | [
"func",
"(",
"fp",
"FallbackPolicy",
")",
"CheckAccessHTTP",
"(",
"req",
"*",
"http",
".",
"Request",
",",
"role",
"string",
")",
"error",
"{",
"return",
"errFallback",
"\n",
"}"
] | // CheckAccessHTTP disallows all HTTP access. | [
"CheckAccessHTTP",
"disallows",
"all",
"HTTP",
"access",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/acl/fallback_policy.go#L37-L39 |
135,880 | vitessio/vitess | go/vt/logutil/console_logger.go | WarningDepth | func (cl *ConsoleLogger) WarningDepth(depth int, s string) {
log.WarningDepth(1+depth, s)
} | go | func (cl *ConsoleLogger) WarningDepth(depth int, s string) {
log.WarningDepth(1+depth, s)
} | [
"func",
"(",
"cl",
"*",
"ConsoleLogger",
")",
"WarningDepth",
"(",
"depth",
"int",
",",
"s",
"string",
")",
"{",
"log",
".",
"WarningDepth",
"(",
"1",
"+",
"depth",
",",
"s",
")",
"\n",
"}"
] | // WarningDepth is part of the Logger interface. | [
"WarningDepth",
"is",
"part",
"of",
"the",
"Logger",
"interface",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/logutil/console_logger.go#L74-L76 |
135,881 | vitessio/vitess | go/vt/logutil/console_logger.go | ErrorDepth | func (cl *ConsoleLogger) ErrorDepth(depth int, s string) {
log.ErrorDepth(1+depth, s)
} | go | func (cl *ConsoleLogger) ErrorDepth(depth int, s string) {
log.ErrorDepth(1+depth, s)
} | [
"func",
"(",
"cl",
"*",
"ConsoleLogger",
")",
"ErrorDepth",
"(",
"depth",
"int",
",",
"s",
"string",
")",
"{",
"log",
".",
"ErrorDepth",
"(",
"1",
"+",
"depth",
",",
"s",
")",
"\n",
"}"
] | // ErrorDepth is part of the Logger interface. | [
"ErrorDepth",
"is",
"part",
"of",
"the",
"Logger",
"interface",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/logutil/console_logger.go#L79-L81 |
135,882 | vitessio/vitess | go/vt/topo/srv_keyspace.go | WatchSrvKeyspace | func (ts *Server) WatchSrvKeyspace(ctx context.Context, cell, keyspace string) (*WatchSrvKeyspaceData, <-chan *WatchSrvKeyspaceData, CancelFunc) {
conn, err := ts.ConnForCell(ctx, cell)
if err != nil {
return &WatchSrvKeyspaceData{Err: err}, nil, nil
}
filePath := srvKeyspaceFileName(keyspace)
current, wdChanne... | go | func (ts *Server) WatchSrvKeyspace(ctx context.Context, cell, keyspace string) (*WatchSrvKeyspaceData, <-chan *WatchSrvKeyspaceData, CancelFunc) {
conn, err := ts.ConnForCell(ctx, cell)
if err != nil {
return &WatchSrvKeyspaceData{Err: err}, nil, nil
}
filePath := srvKeyspaceFileName(keyspace)
current, wdChanne... | [
"func",
"(",
"ts",
"*",
"Server",
")",
"WatchSrvKeyspace",
"(",
"ctx",
"context",
".",
"Context",
",",
"cell",
",",
"keyspace",
"string",
")",
"(",
"*",
"WatchSrvKeyspaceData",
",",
"<-",
"chan",
"*",
"WatchSrvKeyspaceData",
",",
"CancelFunc",
")",
"{",
"c... | // WatchSrvKeyspace will set a watch on the SrvKeyspace object.
// It has the same contract as Conn.Watch, but it also unpacks the
// contents into a SrvKeyspace object. | [
"WatchSrvKeyspace",
"will",
"set",
"a",
"watch",
"on",
"the",
"SrvKeyspace",
"object",
".",
"It",
"has",
"the",
"same",
"contract",
"as",
"Conn",
".",
"Watch",
"but",
"it",
"also",
"unpacks",
"the",
"contents",
"into",
"a",
"SrvKeyspace",
"object",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/srv_keyspace.go#L54-L107 |
135,883 | vitessio/vitess | go/vt/topo/srv_keyspace.go | GetSrvKeyspaceNames | func (ts *Server) GetSrvKeyspaceNames(ctx context.Context, cell string) ([]string, error) {
conn, err := ts.ConnForCell(ctx, cell)
if err != nil {
return nil, err
}
children, err := conn.ListDir(ctx, KeyspacesPath, false /*full*/)
switch {
case err == nil:
return DirEntriesToStringArray(children), nil
case ... | go | func (ts *Server) GetSrvKeyspaceNames(ctx context.Context, cell string) ([]string, error) {
conn, err := ts.ConnForCell(ctx, cell)
if err != nil {
return nil, err
}
children, err := conn.ListDir(ctx, KeyspacesPath, false /*full*/)
switch {
case err == nil:
return DirEntriesToStringArray(children), nil
case ... | [
"func",
"(",
"ts",
"*",
"Server",
")",
"GetSrvKeyspaceNames",
"(",
"ctx",
"context",
".",
"Context",
",",
"cell",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"conn",
",",
"err",
":=",
"ts",
".",
"ConnForCell",
"(",
"ctx",
",",
"... | // GetSrvKeyspaceNames returns the SrvKeyspace objects for a cell. | [
"GetSrvKeyspaceNames",
"returns",
"the",
"SrvKeyspace",
"objects",
"for",
"a",
"cell",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/srv_keyspace.go#L110-L125 |
135,884 | vitessio/vitess | go/vt/topo/srv_keyspace.go | GetShardServingCells | func (ts *Server) GetShardServingCells(ctx context.Context, si *ShardInfo) (servingCells []string, err error) {
cells, err := ts.GetCellInfoNames(ctx)
if err != nil {
return nil, err
}
wg := sync.WaitGroup{}
rec := concurrency.AllErrorRecorder{}
servingCells = make([]string, 0)
var mu sync.Mutex
for _, cell ... | go | func (ts *Server) GetShardServingCells(ctx context.Context, si *ShardInfo) (servingCells []string, err error) {
cells, err := ts.GetCellInfoNames(ctx)
if err != nil {
return nil, err
}
wg := sync.WaitGroup{}
rec := concurrency.AllErrorRecorder{}
servingCells = make([]string, 0)
var mu sync.Mutex
for _, cell ... | [
"func",
"(",
"ts",
"*",
"Server",
")",
"GetShardServingCells",
"(",
"ctx",
"context",
".",
"Context",
",",
"si",
"*",
"ShardInfo",
")",
"(",
"servingCells",
"[",
"]",
"string",
",",
"err",
"error",
")",
"{",
"cells",
",",
"err",
":=",
"ts",
".",
"Get... | // GetShardServingCells returns cells where this shard is serving | [
"GetShardServingCells",
"returns",
"cells",
"where",
"this",
"shard",
"is",
"serving"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/srv_keyspace.go#L128-L176 |
135,885 | vitessio/vitess | go/vt/topo/srv_keyspace.go | GetShardServingTypes | func (ts *Server) GetShardServingTypes(ctx context.Context, si *ShardInfo) (servingTypes []topodatapb.TabletType, err error) {
cells, err := ts.GetCellInfoNames(ctx)
if err != nil {
return nil, err
}
wg := sync.WaitGroup{}
rec := concurrency.AllErrorRecorder{}
servingTypes = make([]topodatapb.TabletType, 0)
v... | go | func (ts *Server) GetShardServingTypes(ctx context.Context, si *ShardInfo) (servingTypes []topodatapb.TabletType, err error) {
cells, err := ts.GetCellInfoNames(ctx)
if err != nil {
return nil, err
}
wg := sync.WaitGroup{}
rec := concurrency.AllErrorRecorder{}
servingTypes = make([]topodatapb.TabletType, 0)
v... | [
"func",
"(",
"ts",
"*",
"Server",
")",
"GetShardServingTypes",
"(",
"ctx",
"context",
".",
"Context",
",",
"si",
"*",
"ShardInfo",
")",
"(",
"servingTypes",
"[",
"]",
"topodatapb",
".",
"TabletType",
",",
"err",
"error",
")",
"{",
"cells",
",",
"err",
... | // GetShardServingTypes returns served types for given shard across all cells | [
"GetShardServingTypes",
"returns",
"served",
"types",
"for",
"given",
"shard",
"across",
"all",
"cells"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/srv_keyspace.go#L179-L233 |
135,886 | vitessio/vitess | go/vt/topo/srv_keyspace.go | AddSrvKeyspacePartitions | func (ts *Server) AddSrvKeyspacePartitions(ctx context.Context, keyspace string, shards []*ShardInfo, tabletType topodatapb.TabletType, cells []string) (err error) {
if err = CheckKeyspaceLocked(ctx, keyspace); err != nil {
return err
}
// The caller intents to update all cells in this case
if len(cells) == 0 {
... | go | func (ts *Server) AddSrvKeyspacePartitions(ctx context.Context, keyspace string, shards []*ShardInfo, tabletType topodatapb.TabletType, cells []string) (err error) {
if err = CheckKeyspaceLocked(ctx, keyspace); err != nil {
return err
}
// The caller intents to update all cells in this case
if len(cells) == 0 {
... | [
"func",
"(",
"ts",
"*",
"Server",
")",
"AddSrvKeyspacePartitions",
"(",
"ctx",
"context",
".",
"Context",
",",
"keyspace",
"string",
",",
"shards",
"[",
"]",
"*",
"ShardInfo",
",",
"tabletType",
"topodatapb",
".",
"TabletType",
",",
"cells",
"[",
"]",
"str... | // AddSrvKeyspacePartitions adds partitions to srvKeyspace | [
"AddSrvKeyspacePartitions",
"adds",
"partitions",
"to",
"srvKeyspace"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/srv_keyspace.go#L236-L323 |
135,887 | vitessio/vitess | go/vt/topo/srv_keyspace.go | UpdateDisableQueryService | func (ts *Server) UpdateDisableQueryService(ctx context.Context, keyspace string, shards []*ShardInfo, tabletType topodatapb.TabletType, cells []string, disableQueryService bool) (err error) {
if err = CheckKeyspaceLocked(ctx, keyspace); err != nil {
return err
}
// The caller intents to update all cells in this ... | go | func (ts *Server) UpdateDisableQueryService(ctx context.Context, keyspace string, shards []*ShardInfo, tabletType topodatapb.TabletType, cells []string, disableQueryService bool) (err error) {
if err = CheckKeyspaceLocked(ctx, keyspace); err != nil {
return err
}
// The caller intents to update all cells in this ... | [
"func",
"(",
"ts",
"*",
"Server",
")",
"UpdateDisableQueryService",
"(",
"ctx",
"context",
".",
"Context",
",",
"keyspace",
"string",
",",
"shards",
"[",
"]",
"*",
"ShardInfo",
",",
"tabletType",
"topodatapb",
".",
"TabletType",
",",
"cells",
"[",
"]",
"st... | // UpdateDisableQueryService will make sure the disableQueryService is
// set appropriately in tablet controls in srvKeyspace. | [
"UpdateDisableQueryService",
"will",
"make",
"sure",
"the",
"disableQueryService",
"is",
"set",
"appropriately",
"in",
"tablet",
"controls",
"in",
"srvKeyspace",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/srv_keyspace.go#L395-L480 |
135,888 | vitessio/vitess | go/vt/topo/srv_keyspace.go | UpdateSrvKeyspace | func (ts *Server) UpdateSrvKeyspace(ctx context.Context, cell, keyspace string, srvKeyspace *topodatapb.SrvKeyspace) error {
conn, err := ts.ConnForCell(ctx, cell)
if err != nil {
return err
}
nodePath := srvKeyspaceFileName(keyspace)
data, err := proto.Marshal(srvKeyspace)
if err != nil {
return err
}
_, ... | go | func (ts *Server) UpdateSrvKeyspace(ctx context.Context, cell, keyspace string, srvKeyspace *topodatapb.SrvKeyspace) error {
conn, err := ts.ConnForCell(ctx, cell)
if err != nil {
return err
}
nodePath := srvKeyspaceFileName(keyspace)
data, err := proto.Marshal(srvKeyspace)
if err != nil {
return err
}
_, ... | [
"func",
"(",
"ts",
"*",
"Server",
")",
"UpdateSrvKeyspace",
"(",
"ctx",
"context",
".",
"Context",
",",
"cell",
",",
"keyspace",
"string",
",",
"srvKeyspace",
"*",
"topodatapb",
".",
"SrvKeyspace",
")",
"error",
"{",
"conn",
",",
"err",
":=",
"ts",
".",
... | // UpdateSrvKeyspace saves a new SrvKeyspace. It is a blind write. | [
"UpdateSrvKeyspace",
"saves",
"a",
"new",
"SrvKeyspace",
".",
"It",
"is",
"a",
"blind",
"write",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/srv_keyspace.go#L582-L595 |
135,889 | vitessio/vitess | go/vt/topo/srv_keyspace.go | DeleteSrvKeyspace | func (ts *Server) DeleteSrvKeyspace(ctx context.Context, cell, keyspace string) error {
conn, err := ts.ConnForCell(ctx, cell)
if err != nil {
return err
}
nodePath := srvKeyspaceFileName(keyspace)
return conn.Delete(ctx, nodePath, nil)
} | go | func (ts *Server) DeleteSrvKeyspace(ctx context.Context, cell, keyspace string) error {
conn, err := ts.ConnForCell(ctx, cell)
if err != nil {
return err
}
nodePath := srvKeyspaceFileName(keyspace)
return conn.Delete(ctx, nodePath, nil)
} | [
"func",
"(",
"ts",
"*",
"Server",
")",
"DeleteSrvKeyspace",
"(",
"ctx",
"context",
".",
"Context",
",",
"cell",
",",
"keyspace",
"string",
")",
"error",
"{",
"conn",
",",
"err",
":=",
"ts",
".",
"ConnForCell",
"(",
"ctx",
",",
"cell",
")",
"\n",
"if"... | // DeleteSrvKeyspace deletes a SrvKeyspace. | [
"DeleteSrvKeyspace",
"deletes",
"a",
"SrvKeyspace",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/srv_keyspace.go#L598-L606 |
135,890 | vitessio/vitess | go/vt/topo/srv_keyspace.go | GetSrvKeyspaceAllCells | func (ts *Server) GetSrvKeyspaceAllCells(ctx context.Context, keyspace string) ([]*topodatapb.SrvKeyspace, error) {
cells, err := ts.GetCellInfoNames(ctx)
if err != nil {
return nil, err
}
srvKeyspaces := make([]*topodatapb.SrvKeyspace, len(cells))
for _, cell := range cells {
srvKeyspace, err := ts.GetSrvKey... | go | func (ts *Server) GetSrvKeyspaceAllCells(ctx context.Context, keyspace string) ([]*topodatapb.SrvKeyspace, error) {
cells, err := ts.GetCellInfoNames(ctx)
if err != nil {
return nil, err
}
srvKeyspaces := make([]*topodatapb.SrvKeyspace, len(cells))
for _, cell := range cells {
srvKeyspace, err := ts.GetSrvKey... | [
"func",
"(",
"ts",
"*",
"Server",
")",
"GetSrvKeyspaceAllCells",
"(",
"ctx",
"context",
".",
"Context",
",",
"keyspace",
"string",
")",
"(",
"[",
"]",
"*",
"topodatapb",
".",
"SrvKeyspace",
",",
"error",
")",
"{",
"cells",
",",
"err",
":=",
"ts",
".",
... | // GetSrvKeyspaceAllCells returns the SrvKeyspace for all cells | [
"GetSrvKeyspaceAllCells",
"returns",
"the",
"SrvKeyspace",
"for",
"all",
"cells"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/srv_keyspace.go#L609-L628 |
135,891 | vitessio/vitess | go/vt/topo/srv_keyspace.go | OrderAndCheckPartitions | func OrderAndCheckPartitions(cell string, srvKeyspace *topodatapb.SrvKeyspace) error {
// now check them all
for _, partition := range srvKeyspace.Partitions {
tabletType := partition.ServedType
topoproto.ShardReferenceArray(partition.ShardReferences).Sort()
// check the first Start is MinKey, the last End is ... | go | func OrderAndCheckPartitions(cell string, srvKeyspace *topodatapb.SrvKeyspace) error {
// now check them all
for _, partition := range srvKeyspace.Partitions {
tabletType := partition.ServedType
topoproto.ShardReferenceArray(partition.ShardReferences).Sort()
// check the first Start is MinKey, the last End is ... | [
"func",
"OrderAndCheckPartitions",
"(",
"cell",
"string",
",",
"srvKeyspace",
"*",
"topodatapb",
".",
"SrvKeyspace",
")",
"error",
"{",
"// now check them all",
"for",
"_",
",",
"partition",
":=",
"range",
"srvKeyspace",
".",
"Partitions",
"{",
"tabletType",
":=",... | // OrderAndCheckPartitions will re-order the partition list, and check
// it's correct. | [
"OrderAndCheckPartitions",
"will",
"re",
"-",
"order",
"the",
"partition",
"list",
"and",
"check",
"it",
"s",
"correct",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/srv_keyspace.go#L651-L686 |
135,892 | vitessio/vitess | go/vt/topo/srv_keyspace.go | ShardIsServing | func ShardIsServing(srvKeyspace *topodatapb.SrvKeyspace, shard *topodatapb.Shard) bool {
for _, partition := range srvKeyspace.GetPartitions() {
for _, shardReference := range partition.GetShardReferences() {
if key.KeyRangeEqual(shardReference.GetKeyRange(), shard.GetKeyRange()) {
return true
}
}
}
re... | go | func ShardIsServing(srvKeyspace *topodatapb.SrvKeyspace, shard *topodatapb.Shard) bool {
for _, partition := range srvKeyspace.GetPartitions() {
for _, shardReference := range partition.GetShardReferences() {
if key.KeyRangeEqual(shardReference.GetKeyRange(), shard.GetKeyRange()) {
return true
}
}
}
re... | [
"func",
"ShardIsServing",
"(",
"srvKeyspace",
"*",
"topodatapb",
".",
"SrvKeyspace",
",",
"shard",
"*",
"topodatapb",
".",
"Shard",
")",
"bool",
"{",
"for",
"_",
",",
"partition",
":=",
"range",
"srvKeyspace",
".",
"GetPartitions",
"(",
")",
"{",
"for",
"_... | // ShardIsServing returns true if this shard is found in any of the partitions in the srvKeyspace | [
"ShardIsServing",
"returns",
"true",
"if",
"this",
"shard",
"is",
"found",
"in",
"any",
"of",
"the",
"partitions",
"in",
"the",
"srvKeyspace"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/srv_keyspace.go#L689-L698 |
135,893 | vitessio/vitess | go/vt/topo/cell_info.go | GetCellInfoNames | func (ts *Server) GetCellInfoNames(ctx context.Context) ([]string, error) {
entries, err := ts.globalCell.ListDir(ctx, CellsPath, false /*full*/)
switch {
case IsErrType(err, NoNode):
return nil, nil
case err == nil:
return DirEntriesToStringArray(entries), nil
default:
return nil, err
}
} | go | func (ts *Server) GetCellInfoNames(ctx context.Context) ([]string, error) {
entries, err := ts.globalCell.ListDir(ctx, CellsPath, false /*full*/)
switch {
case IsErrType(err, NoNode):
return nil, nil
case err == nil:
return DirEntriesToStringArray(entries), nil
default:
return nil, err
}
} | [
"func",
"(",
"ts",
"*",
"Server",
")",
"GetCellInfoNames",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"entries",
",",
"err",
":=",
"ts",
".",
"globalCell",
".",
"ListDir",
"(",
"ctx",
",",
"CellsPath"... | // GetCellInfoNames returns the names of the existing cells. They are
// sorted by name. | [
"GetCellInfoNames",
"returns",
"the",
"names",
"of",
"the",
"existing",
"cells",
".",
"They",
"are",
"sorted",
"by",
"name",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/cell_info.go#L47-L57 |
135,894 | vitessio/vitess | go/vt/topo/cell_info.go | GetCellInfo | func (ts *Server) GetCellInfo(ctx context.Context, cell string, strongRead bool) (*topodatapb.CellInfo, error) {
conn := ts.globalCell
if !strongRead {
conn = ts.globalReadOnlyCell
}
// Read the file.
filePath := pathForCellInfo(cell)
contents, _, err := conn.Get(ctx, filePath)
if err != nil {
return nil, er... | go | func (ts *Server) GetCellInfo(ctx context.Context, cell string, strongRead bool) (*topodatapb.CellInfo, error) {
conn := ts.globalCell
if !strongRead {
conn = ts.globalReadOnlyCell
}
// Read the file.
filePath := pathForCellInfo(cell)
contents, _, err := conn.Get(ctx, filePath)
if err != nil {
return nil, er... | [
"func",
"(",
"ts",
"*",
"Server",
")",
"GetCellInfo",
"(",
"ctx",
"context",
".",
"Context",
",",
"cell",
"string",
",",
"strongRead",
"bool",
")",
"(",
"*",
"topodatapb",
".",
"CellInfo",
",",
"error",
")",
"{",
"conn",
":=",
"ts",
".",
"globalCell",
... | // GetCellInfo reads a CellInfo from the global Conn. | [
"GetCellInfo",
"reads",
"a",
"CellInfo",
"from",
"the",
"global",
"Conn",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/cell_info.go#L60-L78 |
135,895 | vitessio/vitess | go/vt/topo/cell_info.go | CreateCellInfo | func (ts *Server) CreateCellInfo(ctx context.Context, cell string, ci *topodatapb.CellInfo) error {
// Pack the content.
contents, err := proto.Marshal(ci)
if err != nil {
return err
}
// Save it.
filePath := pathForCellInfo(cell)
_, err = ts.globalCell.Create(ctx, filePath, contents)
return err
} | go | func (ts *Server) CreateCellInfo(ctx context.Context, cell string, ci *topodatapb.CellInfo) error {
// Pack the content.
contents, err := proto.Marshal(ci)
if err != nil {
return err
}
// Save it.
filePath := pathForCellInfo(cell)
_, err = ts.globalCell.Create(ctx, filePath, contents)
return err
} | [
"func",
"(",
"ts",
"*",
"Server",
")",
"CreateCellInfo",
"(",
"ctx",
"context",
".",
"Context",
",",
"cell",
"string",
",",
"ci",
"*",
"topodatapb",
".",
"CellInfo",
")",
"error",
"{",
"// Pack the content.",
"contents",
",",
"err",
":=",
"proto",
".",
"... | // CreateCellInfo creates a new CellInfo with the provided content. | [
"CreateCellInfo",
"creates",
"a",
"new",
"CellInfo",
"with",
"the",
"provided",
"content",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/cell_info.go#L81-L92 |
135,896 | vitessio/vitess | go/vt/topo/cell_info.go | UpdateCellInfoFields | func (ts *Server) UpdateCellInfoFields(ctx context.Context, cell string, update func(*topodatapb.CellInfo) error) error {
filePath := pathForCellInfo(cell)
for {
ci := &topodatapb.CellInfo{}
// Read the file, unpack the contents.
contents, version, err := ts.globalCell.Get(ctx, filePath)
switch {
case err ... | go | func (ts *Server) UpdateCellInfoFields(ctx context.Context, cell string, update func(*topodatapb.CellInfo) error) error {
filePath := pathForCellInfo(cell)
for {
ci := &topodatapb.CellInfo{}
// Read the file, unpack the contents.
contents, version, err := ts.globalCell.Get(ctx, filePath)
switch {
case err ... | [
"func",
"(",
"ts",
"*",
"Server",
")",
"UpdateCellInfoFields",
"(",
"ctx",
"context",
".",
"Context",
",",
"cell",
"string",
",",
"update",
"func",
"(",
"*",
"topodatapb",
".",
"CellInfo",
")",
"error",
")",
"error",
"{",
"filePath",
":=",
"pathForCellInfo... | // UpdateCellInfoFields is a high level helper method to read a CellInfo
// object, update its fields, and then write it back. If the write fails due to
// a version mismatch, it will re-read the record and retry the update.
// If the update method returns ErrNoUpdateNeeded, nothing is written,
// and nil is returned. | [
"UpdateCellInfoFields",
"is",
"a",
"high",
"level",
"helper",
"method",
"to",
"read",
"a",
"CellInfo",
"object",
"update",
"its",
"fields",
"and",
"then",
"write",
"it",
"back",
".",
"If",
"the",
"write",
"fails",
"due",
"to",
"a",
"version",
"mismatch",
"... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/cell_info.go#L99-L135 |
135,897 | vitessio/vitess | go/vt/topo/cell_info.go | DeleteCellInfo | func (ts *Server) DeleteCellInfo(ctx context.Context, cell string) error {
srvKeyspaces, err := ts.GetSrvKeyspaceNames(ctx, cell)
switch {
case err == nil:
if len(srvKeyspaces) != 0 {
return vterrors.Wrap(err, fmt.Sprintf("cell %v has serving keyspaces. Before deleting, delete keyspace with: DeleteKeyspace", ce... | go | func (ts *Server) DeleteCellInfo(ctx context.Context, cell string) error {
srvKeyspaces, err := ts.GetSrvKeyspaceNames(ctx, cell)
switch {
case err == nil:
if len(srvKeyspaces) != 0 {
return vterrors.Wrap(err, fmt.Sprintf("cell %v has serving keyspaces. Before deleting, delete keyspace with: DeleteKeyspace", ce... | [
"func",
"(",
"ts",
"*",
"Server",
")",
"DeleteCellInfo",
"(",
"ctx",
"context",
".",
"Context",
",",
"cell",
"string",
")",
"error",
"{",
"srvKeyspaces",
",",
"err",
":=",
"ts",
".",
"GetSrvKeyspaceNames",
"(",
"ctx",
",",
"cell",
")",
"\n",
"switch",
... | // DeleteCellInfo deletes the specified CellInfo.
// We first make sure no Shard record points to the cell. | [
"DeleteCellInfo",
"deletes",
"the",
"specified",
"CellInfo",
".",
"We",
"first",
"make",
"sure",
"no",
"Shard",
"record",
"points",
"to",
"the",
"cell",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/cell_info.go#L139-L154 |
135,898 | vitessio/vitess | go/vt/throttler/manager.go | MaxRates | func (m *managerImpl) MaxRates() map[string]int64 {
m.mu.Lock()
defer m.mu.Unlock()
rates := make(map[string]int64, len(m.throttlers))
for name, t := range m.throttlers {
rates[name] = t.MaxRate()
}
return rates
} | go | func (m *managerImpl) MaxRates() map[string]int64 {
m.mu.Lock()
defer m.mu.Unlock()
rates := make(map[string]int64, len(m.throttlers))
for name, t := range m.throttlers {
rates[name] = t.MaxRate()
}
return rates
} | [
"func",
"(",
"m",
"*",
"managerImpl",
")",
"MaxRates",
"(",
")",
"map",
"[",
"string",
"]",
"int64",
"{",
"m",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"m",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"rates",
":=",
"make",
"(",
"map",
... | // MaxRates returns the max rate of all known throttlers. | [
"MaxRates",
"returns",
"the",
"max",
"rate",
"of",
"all",
"known",
"throttlers",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/manager.go#L99-L108 |
135,899 | vitessio/vitess | go/vt/throttler/manager.go | SetMaxRate | func (m *managerImpl) SetMaxRate(rate int64) []string {
m.mu.Lock()
defer m.mu.Unlock()
for _, t := range m.throttlers {
t.SetMaxRate(rate)
}
return m.throttlerNamesLocked()
} | go | func (m *managerImpl) SetMaxRate(rate int64) []string {
m.mu.Lock()
defer m.mu.Unlock()
for _, t := range m.throttlers {
t.SetMaxRate(rate)
}
return m.throttlerNamesLocked()
} | [
"func",
"(",
"m",
"*",
"managerImpl",
")",
"SetMaxRate",
"(",
"rate",
"int64",
")",
"[",
"]",
"string",
"{",
"m",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"m",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"for",
"_",
",",
"t",
":=",
"r... | // SetMaxRate sets the max rate on all known throttlers. | [
"SetMaxRate",
"sets",
"the",
"max",
"rate",
"on",
"all",
"known",
"throttlers",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/manager.go#L111-L119 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.