Skip to content

Commit

Permalink
Merge pull request #4467 from tinyspeck/gofmt-for-go1.11
Browse files Browse the repository at this point in the history
reformat using go 1.11 formatter
  • Loading branch information
sougou authored Dec 21, 2018
2 parents 524f4c2 + b0c3523 commit af4a648
Show file tree
Hide file tree
Showing 21 changed files with 179 additions and 179 deletions.
4 changes: 2 additions & 2 deletions go/mysql/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,8 @@ func ShowIndexFromTableRow(table string, unique bool, keyName string, seqInIndex
sqltypes.MakeTrusted(sqltypes.VarChar, []byte(columnName)),
sqltypes.MakeTrusted(sqltypes.VarChar, []byte("A")), // Collation
sqltypes.MakeTrusted(sqltypes.Int64, []byte("0")), // Cardinality
sqltypes.NULL, // Sub_part
sqltypes.NULL, // Packed
sqltypes.NULL, // Sub_part
sqltypes.NULL, // Packed
sqltypes.MakeTrusted(sqltypes.VarChar, []byte(nullableStr)),
sqltypes.MakeTrusted(sqltypes.VarChar, []byte("BTREE")), // Index_type
sqltypes.MakeTrusted(sqltypes.VarChar, []byte("")), // Comment
Expand Down
10 changes: 5 additions & 5 deletions go/vt/automation/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ func NewScheduler() (*Scheduler, error) {
registeredClusterOperations: defaultClusterOperations,
idGenerator: IDGenerator{},
toBeScheduledClusterOperations: make(chan ClusterOperationInstance, 10),
state: stateNotRunning,
taskCreator: defaultTaskCreator,
pendingOpsWg: &sync.WaitGroup{},
activeClusterOperations: make(map[string]ClusterOperationInstance),
finishedClusterOperations: make(map[string]ClusterOperationInstance),
state: stateNotRunning,
taskCreator: defaultTaskCreator,
pendingOpsWg: &sync.WaitGroup{},
activeClusterOperations: make(map[string]ClusterOperationInstance),
finishedClusterOperations: make(map[string]ClusterOperationInstance),
}

return s, nil
Expand Down
4 changes: 2 additions & 2 deletions go/vt/binlog/binlogplayer/binlog_player_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ var (
InsertID: 0,
Rows: [][]sqltypes.Value{
{
sqltypes.NewVarBinary("MariaDB/0-1-1083"), // pos
sqltypes.NULL, // stop_pos
sqltypes.NewVarBinary("MariaDB/0-1-1083"), // pos
sqltypes.NULL, // stop_pos
sqltypes.NewVarBinary("9223372036854775807"), // max_tps
sqltypes.NewVarBinary("9223372036854775807"), // max_replication_lag
},
Expand Down
196 changes: 98 additions & 98 deletions go/vt/discovery/healthcheck_test.go

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions go/vt/discovery/tablet_stats_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ func MakeAggregateMapDiff(keyspace, shard string, tabletType topodatapb.TabletTy
TabletType: tabletType,
Cell: cell,
},
Stats: newValue,
Stats: newValue,
TabletExternallyReparentedTimestamp: ter,
})
} else {
Expand Down Expand Up @@ -347,7 +347,7 @@ func MakeAggregateMapDiff(keyspace, shard string, tabletType topodatapb.TabletTy
TabletType: tabletType,
Cell: cell,
},
Stats: newValue,
Stats: newValue,
TabletExternallyReparentedTimestamp: ter,
})
}
Expand Down Expand Up @@ -460,7 +460,7 @@ func (tc *TabletStatsCache) Subscribe() (int, []srvtopo.TargetStatsEntry, <-chan
TabletType: tabletType,
Cell: cell,
},
Stats: agg,
Stats: agg,
TabletExternallyReparentedTimestamp: ter,
})
}
Expand Down
12 changes: 6 additions & 6 deletions go/vt/srvtopo/keyspace_filtering_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ var (
stockCtx = context.Background()
stockFilters = []string{"bar", "baz"}
stockKeyspaces = map[string]*topodatapb.SrvKeyspace{
"foo": &topodatapb.SrvKeyspace{ShardingColumnName: "foo"},
"bar": &topodatapb.SrvKeyspace{ShardingColumnName: "bar"},
"baz": &topodatapb.SrvKeyspace{ShardingColumnName: "baz"},
"foo": {ShardingColumnName: "foo"},
"bar": {ShardingColumnName: "bar"},
"baz": {ShardingColumnName: "baz"},
}
stockVSchema = &vschemapb.SrvVSchema{
Keyspaces: map[string]*vschemapb.Keyspace{
"foo": &vschemapb.Keyspace{Sharded: true},
"bar": &vschemapb.Keyspace{Sharded: true},
"baz": &vschemapb.Keyspace{Sharded: false},
"foo": {Sharded: true},
"bar": {Sharded: true},
"baz": {Sharded: false},
},
}
)
Expand Down
56 changes: 28 additions & 28 deletions go/vt/vtgate/buffer/buffer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ func TestBuffer(t *testing.T) {
// an external failover tool, the timestamp will be increased (even though
// the master did not change.)
b.StatsUpdate(&discovery.TabletStats{
Tablet: oldMaster,
Target: &querypb.Target{Keyspace: keyspace, Shard: shard, TabletType: topodatapb.TabletType_MASTER},
Tablet: oldMaster,
Target: &querypb.Target{Keyspace: keyspace, Shard: shard, TabletType: topodatapb.TabletType_MASTER},
TabletExternallyReparentedTimestamp: now.Unix(),
})

Expand Down Expand Up @@ -124,8 +124,8 @@ func TestBuffer(t *testing.T) {
// Mimic the failover end.
now = now.Add(1 * time.Second)
b.StatsUpdate(&discovery.TabletStats{
Tablet: newMaster,
Target: &querypb.Target{Keyspace: keyspace, Shard: shard, TabletType: topodatapb.TabletType_MASTER},
Tablet: newMaster,
Target: &querypb.Target{Keyspace: keyspace, Shard: shard, TabletType: topodatapb.TabletType_MASTER},
TabletExternallyReparentedTimestamp: now.Unix(),
})

Expand Down Expand Up @@ -185,8 +185,8 @@ func TestBuffer(t *testing.T) {
}
// Stop buffering.
b.StatsUpdate(&discovery.TabletStats{
Tablet: oldMaster,
Target: &querypb.Target{Keyspace: keyspace, Shard: shard, TabletType: topodatapb.TabletType_MASTER},
Tablet: oldMaster,
Target: &querypb.Target{Keyspace: keyspace, Shard: shard, TabletType: topodatapb.TabletType_MASTER},
TabletExternallyReparentedTimestamp: now.Unix(),
})
if err := <-stopped4; err != nil {
Expand Down Expand Up @@ -322,8 +322,8 @@ func TestDryRun(t *testing.T) {

// End of failover is tracked as well.
b.StatsUpdate(&discovery.TabletStats{
Tablet: newMaster,
Target: &querypb.Target{Keyspace: keyspace, Shard: shard, TabletType: topodatapb.TabletType_MASTER},
Tablet: newMaster,
Target: &querypb.Target{Keyspace: keyspace, Shard: shard, TabletType: topodatapb.TabletType_MASTER},
TabletExternallyReparentedTimestamp: 1, // Use any value > 0.
})
if err := waitForState(b, stateIdle); err != nil {
Expand Down Expand Up @@ -374,17 +374,17 @@ func TestLastReparentTooRecent_BufferingSkipped(t *testing.T) {
// very recently (time.Now()).
// vtgate should see this immediately after the start.
b.StatsUpdate(&discovery.TabletStats{
Tablet: oldMaster,
Target: &querypb.Target{Keyspace: keyspace, Shard: shard, TabletType: topodatapb.TabletType_MASTER},
Tablet: oldMaster,
Target: &querypb.Target{Keyspace: keyspace, Shard: shard, TabletType: topodatapb.TabletType_MASTER},
TabletExternallyReparentedTimestamp: now.Unix(),
})

// Failover to new master. Its end is detected faster than the beginning.
// Do not start buffering.
now = now.Add(1 * time.Second)
b.StatsUpdate(&discovery.TabletStats{
Tablet: newMaster,
Target: &querypb.Target{Keyspace: keyspace, Shard: shard, TabletType: topodatapb.TabletType_MASTER},
Tablet: newMaster,
Target: &querypb.Target{Keyspace: keyspace, Shard: shard, TabletType: topodatapb.TabletType_MASTER},
TabletExternallyReparentedTimestamp: now.Unix(),
})

Expand Down Expand Up @@ -418,17 +418,17 @@ func TestLastReparentTooRecent_Buffering(t *testing.T) {
// very recently (time.Now()).
// vtgate should see this immediately after the start.
b.StatsUpdate(&discovery.TabletStats{
Tablet: oldMaster,
Target: &querypb.Target{Keyspace: keyspace, Shard: shard, TabletType: topodatapb.TabletType_MASTER},
Tablet: oldMaster,
Target: &querypb.Target{Keyspace: keyspace, Shard: shard, TabletType: topodatapb.TabletType_MASTER},
TabletExternallyReparentedTimestamp: now.Unix(),
})

// Failover to new master. Do not issue any requests before or after i.e.
// there was 0 QPS traffic and no buffering was started.
now = now.Add(1 * time.Second)
b.StatsUpdate(&discovery.TabletStats{
Tablet: newMaster,
Target: &querypb.Target{Keyspace: keyspace, Shard: shard, TabletType: topodatapb.TabletType_MASTER},
Tablet: newMaster,
Target: &querypb.Target{Keyspace: keyspace, Shard: shard, TabletType: topodatapb.TabletType_MASTER},
TabletExternallyReparentedTimestamp: now.Unix(),
})

Expand All @@ -442,8 +442,8 @@ func TestLastReparentTooRecent_Buffering(t *testing.T) {
}
// And then the failover end.
b.StatsUpdate(&discovery.TabletStats{
Tablet: newMaster,
Target: &querypb.Target{Keyspace: keyspace, Shard: shard, TabletType: topodatapb.TabletType_MASTER},
Tablet: newMaster,
Target: &querypb.Target{Keyspace: keyspace, Shard: shard, TabletType: topodatapb.TabletType_MASTER},
TabletExternallyReparentedTimestamp: now.Unix(),
})

Expand Down Expand Up @@ -481,8 +481,8 @@ func TestPassthroughDuringDrain(t *testing.T) {

// Stop buffering and trigger drain.
b.StatsUpdate(&discovery.TabletStats{
Tablet: newMaster,
Target: &querypb.Target{Keyspace: keyspace, Shard: shard, TabletType: topodatapb.TabletType_MASTER},
Tablet: newMaster,
Target: &querypb.Target{Keyspace: keyspace, Shard: shard, TabletType: topodatapb.TabletType_MASTER},
TabletExternallyReparentedTimestamp: 1, // Use any value > 0.
})
if got, want := b.getOrCreateBuffer(keyspace, shard).state, stateDraining; got != want {
Expand Down Expand Up @@ -596,8 +596,8 @@ func testRequestCanceled(t *testing.T, explicitEnd bool) {

if explicitEnd {
b.StatsUpdate(&discovery.TabletStats{
Tablet: newMaster,
Target: &querypb.Target{Keyspace: keyspace, Shard: shard, TabletType: topodatapb.TabletType_MASTER},
Tablet: newMaster,
Target: &querypb.Target{Keyspace: keyspace, Shard: shard, TabletType: topodatapb.TabletType_MASTER},
TabletExternallyReparentedTimestamp: 1, // Use any value > 0.
})
}
Expand All @@ -615,8 +615,8 @@ func testRequestCanceled(t *testing.T, explicitEnd bool) {
// shortly after. In that case, the buffer should ignore it.
if !explicitEnd {
b.StatsUpdate(&discovery.TabletStats{
Tablet: newMaster,
Target: &querypb.Target{Keyspace: keyspace, Shard: shard, TabletType: topodatapb.TabletType_MASTER},
Tablet: newMaster,
Target: &querypb.Target{Keyspace: keyspace, Shard: shard, TabletType: topodatapb.TabletType_MASTER},
TabletExternallyReparentedTimestamp: 1, // Use any value > 0.
})
}
Expand Down Expand Up @@ -661,8 +661,8 @@ func TestEviction(t *testing.T) {

// End of failover. Stop buffering.
b.StatsUpdate(&discovery.TabletStats{
Tablet: newMaster,
Target: &querypb.Target{Keyspace: keyspace, Shard: shard, TabletType: topodatapb.TabletType_MASTER},
Tablet: newMaster,
Target: &querypb.Target{Keyspace: keyspace, Shard: shard, TabletType: topodatapb.TabletType_MASTER},
TabletExternallyReparentedTimestamp: 1, // Use any value > 0.
})

Expand Down Expand Up @@ -744,8 +744,8 @@ func TestEvictionNotPossible(t *testing.T) {

// End of failover. Stop buffering.
b.StatsUpdate(&discovery.TabletStats{
Tablet: newMaster,
Target: &querypb.Target{Keyspace: keyspace, Shard: shard, TabletType: topodatapb.TabletType_MASTER},
Tablet: newMaster,
Target: &querypb.Target{Keyspace: keyspace, Shard: shard, TabletType: topodatapb.TabletType_MASTER},
TabletExternallyReparentedTimestamp: 1, // Use any value > 0.
})
if err := <-stoppedFirstFailover; err != nil {
Expand Down
4 changes: 2 additions & 2 deletions go/vt/vtgate/gateway/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func StreamHealthFromTargetStatsListener(ctx context.Context, l srvtopo.TargetSt
// Send all current entries.
for _, e := range entries {
shr := &querypb.StreamHealthResponse{
Target: e.Target,
Target: e.Target,
TabletExternallyReparentedTimestamp: e.TabletExternallyReparentedTimestamp,
AggregateStats: e.Stats,
}
Expand All @@ -168,7 +168,7 @@ func StreamHealthFromTargetStatsListener(ctx context.Context, l srvtopo.TargetSt
return fmt.Errorf("channel closed")
}
shr := &querypb.StreamHealthResponse{
Target: e.Target,
Target: e.Target,
TabletExternallyReparentedTimestamp: e.TabletExternallyReparentedTimestamp,
AggregateStats: e.Stats,
}
Expand Down
4 changes: 2 additions & 2 deletions go/vt/vtgate/gatewaytest/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ func CreateFakeServers(t *testing.T) (*tabletconntest.FakeQueryService, *topo.Se
f := tabletconntest.CreateFakeServer(t)
f.TestingGateway = true
f.StreamHealthResponse = &querypb.StreamHealthResponse{
Target: tabletconntest.TestTarget,
Serving: true,
Target: tabletconntest.TestTarget,
Serving: true,
TabletExternallyReparentedTimestamp: 1234589,
RealtimeStats: &querypb.RealtimeStats{
SecondsBehindMaster: 1,
Expand Down
4 changes: 2 additions & 2 deletions go/vt/vttablet/tabletconntest/fakequeryservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -751,14 +751,14 @@ var TestStreamHealthStreamHealthResponse = &querypb.StreamHealthResponse{
Shard: "test_shard",
TabletType: topodatapb.TabletType_RDONLY,
},
Serving: true,
Serving: true,
TabletExternallyReparentedTimestamp: 1234589,
RealtimeStats: &querypb.RealtimeStats{
HealthError: "random error",
SecondsBehindMaster: 234,
BinlogPlayersCount: 1,
SecondsBehindMasterFilteredReplication: 2,
CpuUsage: 1.0,
CpuUsage: 1.0,
},
}

Expand Down
4 changes: 2 additions & 2 deletions go/vt/vttablet/tabletmanager/vreplication/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ var (
InsertID: 0,
Rows: [][]sqltypes.Value{
{
sqltypes.NewVarBinary("MariaDB/0-1-1083"), // pos
sqltypes.NULL, // stop_pos
sqltypes.NewVarBinary("MariaDB/0-1-1083"), // pos
sqltypes.NULL, // stop_pos
sqltypes.NewVarBinary("9223372036854775807"), // max_tps
sqltypes.NewVarBinary("9223372036854775807"), // max_replication_lag
},
Expand Down
6 changes: 3 additions & 3 deletions go/vt/vttablet/tabletserver/splitquery/splitter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ func TestSplitWithExistingBindVariables(t *testing.T) {
" (id < :_splitquery_end_id or" +
" (id = :_splitquery_end_id and user_id < :_splitquery_end_user_id))",
BindVariables: map[string]*querypb.BindVariable{
"foo": sqltypes.Int64BindVariable(100),
"foo": sqltypes.Int64BindVariable(100),
"_splitquery_start_id": sqltypes.Int64BindVariable(1),
"_splitquery_start_user_id": sqltypes.Int64BindVariable(2),
"_splitquery_end_id": sqltypes.Int64BindVariable(1),
Expand All @@ -476,7 +476,7 @@ func TestSplitWithExistingBindVariables(t *testing.T) {
" (id < :_splitquery_end_id or" +
" (id = :_splitquery_end_id and user_id < :_splitquery_end_user_id))",
BindVariables: map[string]*querypb.BindVariable{
"foo": sqltypes.Int64BindVariable(100),
"foo": sqltypes.Int64BindVariable(100),
"_splitquery_start_id": sqltypes.Int64BindVariable(1),
"_splitquery_start_user_id": sqltypes.Int64BindVariable(3),
"_splitquery_end_id": sqltypes.Int64BindVariable(5),
Expand All @@ -490,7 +490,7 @@ func TestSplitWithExistingBindVariables(t *testing.T) {
" :_splitquery_start_id < id or" +
" (:_splitquery_start_id = id and :_splitquery_start_user_id <= user_id)",
BindVariables: map[string]*querypb.BindVariable{
"foo": sqltypes.Int64BindVariable(100),
"foo": sqltypes.Int64BindVariable(100),
"_splitquery_start_user_id": sqltypes.Int64BindVariable(1),
"_splitquery_start_id": sqltypes.Int64BindVariable(5),
},
Expand Down
6 changes: 3 additions & 3 deletions go/vt/vttablet/tabletserver/tabletserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -1770,9 +1770,9 @@ func (tsv *TabletServer) BroadcastHealth(terTimestamp int64, stats *querypb.Real
target := tsv.target
tsv.mu.Unlock()
shr := &querypb.StreamHealthResponse{
Target: &target,
TabletAlias: &tsv.alias,
Serving: tsv.IsServing(),
Target: &target,
TabletAlias: &tsv.alias,
Serving: tsv.IsServing(),
TabletExternallyReparentedTimestamp: terTimestamp,
RealtimeStats: stats,
}
Expand Down
4 changes: 2 additions & 2 deletions go/vt/vttablet/tabletserver/tabletserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2497,8 +2497,8 @@ func TestTabletServerSplitQueryEqualSplitsOnStringColumn(t *testing.T) {
&querypb.BoundQuery{Sql: sql},
// EQUAL_SPLITS should not work on a string column.
[]string{"name_string"}, /* splitColumns */
10, /* splitCount */
0, /* numRowsPerQueryPart */
10, /* splitCount */
0, /* numRowsPerQueryPart */
querypb.SplitQueryRequest_EQUAL_SPLITS)
want :=
"using the EQUAL_SPLITS algorithm in SplitQuery" +
Expand Down
12 changes: 6 additions & 6 deletions go/vt/vttablet/tabletserver/txserializer/tx_serializer.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,17 @@ type TxSerializer struct {
// New returns a TxSerializer object.
func New(dryRun bool, maxQueueSize, maxGlobalQueueSize, concurrentTransactions int) *TxSerializer {
return &TxSerializer{
ConsolidatorCache: sync2.NewConsolidatorCache(1000),
dryRun: dryRun,
maxQueueSize: maxQueueSize,
maxGlobalQueueSize: maxGlobalQueueSize,
concurrentTransactions: concurrentTransactions,
ConsolidatorCache: sync2.NewConsolidatorCache(1000),
dryRun: dryRun,
maxQueueSize: maxQueueSize,
maxGlobalQueueSize: maxGlobalQueueSize,
concurrentTransactions: concurrentTransactions,
log: logutil.NewThrottledLogger("HotRowProtection", 5*time.Second),
logDryRun: logutil.NewThrottledLogger("HotRowProtection DryRun", 5*time.Second),
logWaitsDryRun: logutil.NewThrottledLogger("HotRowProtection Waits DryRun", 5*time.Second),
logQueueExceededDryRun: logutil.NewThrottledLogger("HotRowProtection QueueExceeded DryRun", 5*time.Second),
logGlobalQueueExceededDryRun: logutil.NewThrottledLogger("HotRowProtection GlobalQueueExceeded DryRun", 5*time.Second),
queues: make(map[string]*queue),
queues: make(map[string]*queue),
}
}

Expand Down
4 changes: 2 additions & 2 deletions go/vt/vttablet/tabletserver/txthrottler/tx_throttler.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ func newTxThrottlerState(config *txThrottlerConfig, keyspace, shard string,
) (*txThrottlerState, error) {
t, err := throttlerFactory(
TxThrottlerName,
"TPS", /* unit */
1, /* threadCount */
"TPS", /* unit */
1, /* threadCount */
throttler.MaxRateModuleDisabled, /* maxRate */
config.throttlerConfig.MaxReplicationLagSec /* maxReplicationLag */)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion go/vt/worker/legacy_split_clone_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ func (tc *legacySplitCloneTestCase) setUp(v3 bool) {
qs := fakes.NewStreamHealthQueryService(sourceRdonly.Target())
qs.AddDefaultHealthResponse()
grpcqueryservice.Register(sourceRdonly.RPCServer, &legacyTestQueryService{
t: tc.t,
t: tc.t,
StreamHealthQueryService: qs,
})
}
Expand Down
Loading

0 comments on commit af4a648

Please sign in to comment.