Skip to content

Commit

Permalink
*: update linter (#48252)
Browse files Browse the repository at this point in the history
ref #40786
  • Loading branch information
hawkingrei authored Nov 6, 2023
1 parent 4979e99 commit 0d9a4ce
Show file tree
Hide file tree
Showing 37 changed files with 579 additions and 523 deletions.
551 changes: 321 additions & 230 deletions DEPS.bzl

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ tools/bin/gotestsum:
GOBIN=$(shell pwd)/tools/bin $(GO) install gotest.tools/[email protected]

tools/bin/mockgen:
GOBIN=$(shell pwd)/tools/bin $(GO) install go.uber.org/mock/mockgen@v0.2.0
GOBIN=$(shell pwd)/tools/bin $(GO) install go.uber.org/mock/mockgen@v0.3.0

# Usage:
#
Expand Down
71 changes: 35 additions & 36 deletions br/pkg/restore/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1827,49 +1827,48 @@ func (rc *Client) GoWaitTiFlashReady(ctx context.Context, inCh <-chan *CreatedTa
updateCh.Inc()
return nil
}
if rc.dom != nil {
log.Info("table has tiflash replica, start sync..",
zap.Stringer("table", tbl.OldTable.Info.Name),
zap.Stringer("db", tbl.OldTable.DB.Name))
for {
var progress float64
if pi := tbl.Table.GetPartitionInfo(); pi != nil && len(pi.Definitions) > 0 {
for _, p := range pi.Definitions {
progressOfPartition, err := infosync.MustGetTiFlashProgress(p.ID, tbl.Table.TiFlashReplica.Count, &tiFlashStores)
if err != nil {
log.Warn("failed to get progress for tiflash partition replica, retry it",
zap.Int64("tableID", tbl.Table.ID), zap.Int64("partitionID", p.ID), zap.Error(err))
time.Sleep(time.Second)
continue
}
progress += progressOfPartition
}
progress = progress / float64(len(pi.Definitions))
} else {
var err error
progress, err = infosync.MustGetTiFlashProgress(tbl.Table.ID, tbl.Table.TiFlashReplica.Count, &tiFlashStores)
if rc.dom == nil {
// unreachable, current we have initial domain in mgr.
log.Fatal("unreachable, domain is nil")
}
log.Info("table has tiflash replica, start sync..",
zap.Stringer("table", tbl.OldTable.Info.Name),
zap.Stringer("db", tbl.OldTable.DB.Name))
for {
var progress float64
if pi := tbl.Table.GetPartitionInfo(); pi != nil && len(pi.Definitions) > 0 {
for _, p := range pi.Definitions {
progressOfPartition, err := infosync.MustGetTiFlashProgress(p.ID, tbl.Table.TiFlashReplica.Count, &tiFlashStores)
if err != nil {
log.Warn("failed to get progress for tiflash replica, retry it",
zap.Int64("tableID", tbl.Table.ID), zap.Error(err))
log.Warn("failed to get progress for tiflash partition replica, retry it",
zap.Int64("tableID", tbl.Table.ID), zap.Int64("partitionID", p.ID), zap.Error(err))
time.Sleep(time.Second)
continue
}
progress += progressOfPartition
}
// check until progress is 1
if progress == 1 {
log.Info("tiflash replica synced",
zap.Stringer("table", tbl.OldTable.Info.Name),
zap.Stringer("db", tbl.OldTable.DB.Name))
break
progress = progress / float64(len(pi.Definitions))
} else {
var err error
progress, err = infosync.MustGetTiFlashProgress(tbl.Table.ID, tbl.Table.TiFlashReplica.Count, &tiFlashStores)
if err != nil {
log.Warn("failed to get progress for tiflash replica, retry it",
zap.Int64("tableID", tbl.Table.ID), zap.Error(err))
time.Sleep(time.Second)
continue
}
// just wait for next check
// tiflash check the progress every 2s
// we can wait 2.5x times
time.Sleep(5 * time.Second)
}
} else {
// unreachable, current we have initial domain in mgr.
log.Fatal("unreachable, domain is nil")
// check until progress is 1
if progress == 1 {
log.Info("tiflash replica synced",
zap.Stringer("table", tbl.OldTable.Info.Name),
zap.Stringer("db", tbl.OldTable.DB.Name))
break
}
// just wait for next check
// tiflash check the progress every 2s
// we can wait 2.5x times
time.Sleep(5 * time.Second)
}
updateCh.Inc()
return nil
Expand Down
3 changes: 1 addition & 2 deletions br/pkg/restore/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -490,9 +490,8 @@ func GetExistedUserDBs(dom *domain.Domain) []*model.DBInfo {
// tidb create test db on fresh cluster
// if it's empty we don't take it as user db
continue
} else {
existedDatabases = append(existedDatabases, db)
}
existedDatabases = append(existedDatabases, db)
}

return existedDatabases
Expand Down
3 changes: 1 addition & 2 deletions cmd/ddltest/random_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ func randomNum(args ...int) int {
return args[0] + randomIntn(args[1]-args[0])
} else if len(args) == 1 {
return randomIntn(args[0])
} else {
return randomInt()
}
return randomInt()
}
22 changes: 11 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ require (
github.com/coocood/freecache v1.2.1
github.com/coreos/go-semver v0.3.1
github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548
github.com/daixiang0/gci v0.11.0
github.com/daixiang0/gci v0.11.2
github.com/danjacques/gofslock v0.0.0-20191023191349-0a45f885bc37
github.com/dgraph-io/ristretto v0.1.1
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13
Expand All @@ -45,10 +45,10 @@ require (
github.com/gogo/protobuf v1.3.2
github.com/golang/protobuf v1.5.3
github.com/golang/snappy v0.0.4
github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2
github.com/golangci/golangci-lint v1.53.3
github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e
github.com/golangci/golangci-lint v1.55.2
github.com/golangci/gosec v0.0.0-20180901114220-8afd9cbb6cfb
github.com/golangci/misspell v0.4.0
github.com/golangci/misspell v0.4.1
github.com/golangci/prealloc v0.0.0-20180630174525-215b22d4de21
github.com/google/btree v1.1.2
github.com/google/pprof v0.0.0-20211122183932-1daafda22083
Expand All @@ -70,7 +70,7 @@ require (
github.com/ks3sdklib/aws-sdk-go v1.2.6
github.com/kyoh86/exportloopref v0.1.11
github.com/lestrrat-go/jwx/v2 v2.0.11
github.com/mgechev/revive v1.3.2
github.com/mgechev/revive v1.3.4
github.com/ngaut/pools v0.0.0-20180318154953-b7bc8c42aac7
github.com/ngaut/sync2 v0.0.0-20141008032647-7a24ed77b2ef
github.com/nishanths/predeclared v0.2.2
Expand All @@ -92,7 +92,7 @@ require (
github.com/prometheus/prometheus v0.0.0-20190525122359-d20e84d0fb64
github.com/robfig/cron/v3 v3.0.1
github.com/sasha-s/go-deadlock v0.2.0
github.com/shirou/gopsutil/v3 v3.23.5
github.com/shirou/gopsutil/v3 v3.23.10
github.com/shurcooL/httpgzip v0.0.0-20190720172056-320755c1c1b0
github.com/soheilhy/cmux v0.1.5
github.com/spf13/cobra v1.7.0
Expand Down Expand Up @@ -135,7 +135,7 @@ require (
google.golang.org/api v0.128.0
google.golang.org/grpc v1.59.0
gopkg.in/yaml.v2 v2.4.0
honnef.co/go/tools v0.4.5
honnef.co/go/tools v0.4.6
k8s.io/api v0.27.2
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0
sourcegraph.com/sourcegraph/appdash-data v0.0.0-20151005221446-73f23eafcf67
Expand Down Expand Up @@ -180,7 +180,7 @@ require (
github.com/bmatcuk/doublestar/v2 v2.0.4 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/chavacava/garif v0.0.0-20230519080132-4752330f72df // indirect
github.com/chavacava/garif v0.1.0 // indirect
github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f // indirect
github.com/cockroachdb/redact v1.0.8 // indirect
github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2 // indirect
Expand Down Expand Up @@ -273,8 +273,8 @@ require (
github.com/spf13/cast v1.5.0 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/tiancaiamao/gp v0.0.0-20221230034425-4025bc8a4d4a
github.com/tklauser/go-sysconf v0.3.11 // indirect
github.com/tklauser/numcpus v0.6.0 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802 // indirect
github.com/uber/jaeger-lib v2.4.1+incompatible // indirect
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect
Expand All @@ -289,7 +289,7 @@ require (
go.opentelemetry.io/otel/trace v1.0.1 // indirect
go.opentelemetry.io/proto/otlp v0.9.0 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/exp/typeparams v0.0.0-20230224173230-c95f2b4c22f2 // indirect
golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 // indirect
golang.org/x/mod v0.13.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
gonum.org/v1/gonum v0.8.2 // indirect
Expand Down
Loading

0 comments on commit 0d9a4ce

Please sign in to comment.