Skip to content

Commit

Permalink
kafka.go: Refine log (#778) (#782)
Browse files Browse the repository at this point in the history
  • Loading branch information
july2993 authored and sre-bot committed Oct 30, 2019
1 parent 4df4334 commit 65a1f87
Show file tree
Hide file tree
Showing 6 changed files with 251 additions and 130 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ TEST_DIR := /tmp/tidb_binlog_test
GO := GO111MODULE=on go
GOBUILD := CGO_ENABLED=0 $(GO) build $(BUILD_FLAG)
GOTEST := CGO_ENABLED=1 $(GO) test -p 3
GOVERSION := "`go version`"

ARCH := "`uname -s`"
LINUX := "Linux"
Expand Down Expand Up @@ -77,6 +78,7 @@ integration_test: build
tests/run.sh

fmt:
@echo "${GOVERSION}"
@echo "gofmt (simplify)"
@gofmt -s -l -w $(FILES) 2>&1 | $(FAIL_ON_STDOUT)

Expand Down
2 changes: 1 addition & 1 deletion drainer/executor/kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func (p *kafkaExecutor) run() {
}
p.toBeAckCommitTSMu.Unlock()
case err := <-p.producer.Errors():
panic(err)
log.Fatal("fail to produce message to kafka, please check the state of kafka server", err)
case <-checkTick.C:
p.toBeAckCommitTSMu.Lock()
if len(p.toBeAckCommitTS) > 0 && time.Since(p.lastSuccessTime) > maxWaitTimeToSendMSG {
Expand Down
2 changes: 1 addition & 1 deletion drainer/translator/flash.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ func analyzeColumnDef(colDef *ast.ColumnDef, pkColumn string) (string, error) {
cName := colDef.Name.Name.L

tp := colDef.Tp
var typeStr = ""
var typeStr string
var typeStrFormat = "%s"
unsigned := mysql.HasUnsignedFlag(tp.Flag)
nullable := cName != pkColumn && isNullable(colDef)
Expand Down
4 changes: 3 additions & 1 deletion reparo/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ func NewConfig() *Config {
}

func (c *Config) String() string {
cfgBytes, err := json.Marshal(c)
// reparo/config.go:94:31: SA1026: trying to marshal chan or func value, field *github.com/pingcap/tidb-binlog/reparo.Config.FlagSet.Usage (staticcheck)
// but we omit the field `*flag.FlagSet`, it should be ok.
cfgBytes, err := json.Marshal(c) //nolint:staticcheck
if err != nil {
log.Errorf("marshal config failed %v", err)
}
Expand Down
17 changes: 2 additions & 15 deletions tools/check/go.mod
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
module github.com/pingcap/tidb-binlog/_tools

require (
github.com/go-critic/go-critic v0.0.0-20181204210945-ee9bf5809ead // indirect
github.com/golangci/golangci-lint v1.16.1-0.20190425135923-692dacb773b7
github.com/mattn/go-colorable v0.1.1 // indirect
github.com/mattn/go-isatty v0.0.7 // indirect
github.com/mattn/go-runewidth v0.0.4 // indirect
github.com/mgechev/dots v0.0.0-20181228164730-18fa4c4b71cc // indirect
github.com/mgechev/revive v0.0.0-20190422175802-e8c1baf8ac0e
github.com/olekukonko/tablewriter v0.0.1 // indirect
github.com/pkg/errors v0.8.1 // indirect
golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734 // indirect
golang.org/x/net v0.0.0-20190424112056-4829fb13d2c6 // indirect
golang.org/x/sys v0.0.0-20190426135247-a129542de9ae // indirect
golang.org/x/text v0.3.2 // indirect
golang.org/x/tools v0.0.0-20190425222832-ad9eeb80039a // indirect
sourcegraph.com/sourcegraph/go-diff v0.5.1-0.20190210232911-dee78e514455 // indirect
github.com/golangci/golangci-lint v1.21.0 // indirect
github.com/mgechev/revive v0.0.0-20191017201419-88015ccf8e97 // indirect
)

go 1.13
Loading

0 comments on commit 65a1f87

Please sign in to comment.