Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

Commit

Permalink
relay: retry for upstream bad connection (#265)
Browse files Browse the repository at this point in the history
  • Loading branch information
csuzhangxc authored Sep 3, 2019
1 parent 9ce7f0e commit 14eae68
Show file tree
Hide file tree
Showing 11 changed files with 342 additions and 198 deletions.
15 changes: 15 additions & 0 deletions dm/worker/relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"github.com/pingcap/dm/pkg/terror"
"github.com/pingcap/dm/relay"
"github.com/pingcap/dm/relay/purger"
rr "github.com/pingcap/dm/relay/retry"
)

// RelayHolder for relay unit
Expand Down Expand Up @@ -96,6 +97,13 @@ func NewRealRelayHolder(cfg *Config) RelayHolder {
},
BinLogName: clone.RelayBinLogName,
BinlogGTID: clone.RelayBinlogGTID,
ReaderRetry: rr.ReaderRetryConfig{ // we use config from TaskChecker now
BackoffRollback: cfg.Checker.BackoffRollback,
BackoffMax: cfg.Checker.BackoffMax,
BackoffMin: cfg.Checker.BackoffMin,
BackoffJitter: cfg.Checker.BackoffJitter,
BackoffFactor: cfg.Checker.BackoffFactor,
},
}

h := &realRelayHolder{
Expand Down Expand Up @@ -320,6 +328,13 @@ func (h *realRelayHolder) Update(ctx context.Context, cfg *Config) error {
User: cfg.From.User,
Password: cfg.From.Password,
},
ReaderRetry: rr.ReaderRetryConfig{ // we use config from TaskChecker now
BackoffRollback: cfg.Checker.BackoffRollback,
BackoffMax: cfg.Checker.BackoffMax,
BackoffMin: cfg.Checker.BackoffMin,
BackoffJitter: cfg.Checker.BackoffJitter,
BackoffFactor: cfg.Checker.BackoffFactor,
},
}

stage := h.Stage()
Expand Down
2 changes: 1 addition & 1 deletion dm/worker/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (t *testServer) TestServer(c *C) {
c.Assert(err1, IsNil)
}()

c.Assert(utils.WaitSomething(30, 10*time.Millisecond, func() bool {
c.Assert(utils.WaitSomething(30, 100*time.Millisecond, func() bool {
return !s.closed.Get()
}), IsTrue)

Expand Down
41 changes: 10 additions & 31 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,97 +1,76 @@
module github.com/pingcap/dm

require (
cloud.google.com/go v0.44.3 // indirect
github.com/BurntSushi/toml v0.3.1
github.com/DATA-DOG/go-sqlmock v1.3.3
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4 // indirect
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e
github.com/coreos/etcd v3.3.15+incompatible // indirect
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f // indirect
github.com/cznic/sortutil v0.0.0-20181122101858-f5f958428db8 // indirect
github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 // indirect
github.com/dustin/go-humanize v1.0.0
github.com/go-kit/kit v0.9.0 // indirect
github.com/go-ole/go-ole v1.2.4 // indirect
github.com/go-sql-driver/mysql v1.4.1
github.com/gogo/protobuf v1.2.1
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 // indirect
github.com/golang/mock v1.3.1
github.com/golang/protobuf v1.3.2
github.com/google/btree v1.0.0 // indirect
github.com/google/go-cmp v0.3.1 // indirect
github.com/google/pprof v0.0.0-20190723021845-34ac40c74b70 // indirect
github.com/gorilla/mux v1.7.3 // indirect
github.com/gorilla/websocket v1.4.1 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.9.6
github.com/hashicorp/golang-lru v0.5.3 // indirect
github.com/kami-zh/go-capturer v0.0.0-20171211120116-e492ea43421d
github.com/kisielk/errcheck v1.2.0 // indirect
github.com/klauspost/cpuid v1.2.1 // indirect
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
github.com/kr/pty v1.1.8 // indirect
github.com/magiconair/properties v1.8.1 // indirect
github.com/mattn/go-shellwords v1.0.6 // indirect
github.com/montanaflynn/stats v0.5.0 // indirect
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
github.com/nicksnyder/go-i18n v2.0.2+incompatible // indirect
github.com/onsi/ginkgo v1.9.0 // indirect
github.com/onsi/gomega v1.6.0 // indirect
github.com/opentracing/opentracing-go v1.1.0 // indirect
github.com/pelletier/go-toml v1.4.0 // indirect
github.com/pingcap/check v0.0.0-20190102082844-67f458068fc8
github.com/pingcap/errcode v0.3.0 // indirect
github.com/pingcap/errors v0.11.4
github.com/pingcap/failpoint v0.0.0-20190708053854-e7b1061e6e81
github.com/pingcap/kvproto v0.0.0-20190827032240-9696cd0c6acb // indirect
github.com/pingcap/log v0.0.0-20190715063458-479153f07ebd
github.com/pingcap/parser v0.0.0-20190827021345-87e7a137ab41
github.com/pingcap/parser v0.0.0-20190902030720-275a827cf4e3
github.com/pingcap/tidb v0.0.0-20190827060935-cc07b110825e
github.com/pingcap/tidb-tools v3.0.0-beta.1.0.20190821032033-e6ccf3994944+incompatible
github.com/pingcap/tipb v0.0.0-20190823055122-55a45ba82a79 // indirect
github.com/prometheus/client_golang v1.1.0
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 // indirect
github.com/prometheus/procfs v0.0.4 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20190728182440-6a916e37a237 // indirect
github.com/rogpeppe/fastuuid v1.2.0 // indirect
github.com/rogpeppe/go-internal v1.3.1 // indirect
github.com/russross/blackfriday v2.0.0+incompatible // indirect
github.com/satori/go.uuid v1.2.0
github.com/shirou/gopsutil v2.18.12+incompatible // indirect
github.com/siddontang/go v0.0.0-20180604090527-bdc77568d726
github.com/siddontang/go-log v0.0.0-20190221022429-1e957dd83bed // indirect
github.com/siddontang/go-mysql v0.0.0-20190823102627-d34ccf107dfd
github.com/siddontang/go-mysql v0.0.0-20190902035209-f52d30c9fcb7
github.com/sirupsen/logrus v1.4.2 // indirect
github.com/soheilhy/cmux v0.1.4
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/spf13/afero v1.2.2 // indirect
github.com/spf13/cobra v0.0.5
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/viper v1.4.0 // indirect
github.com/stretchr/objx v0.2.0 // indirect
github.com/stretchr/testify v1.4.0 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20190318030020-c3a204f8e965
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 // indirect
github.com/uber-go/atomic v1.4.0 // indirect
github.com/uber/jaeger-client-go v2.16.0+incompatible // indirect
github.com/uber/jaeger-lib v2.0.0+incompatible // indirect
github.com/ugorji/go v1.1.7 // indirect
github.com/unrolled/render v1.0.1 // indirect
github.com/urfave/negroni v1.0.0 // indirect
go.etcd.io/etcd v3.3.15+incompatible // indirect
go.uber.org/atomic v1.4.0 // indirect
go.uber.org/zap v1.10.0
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586 // indirect
golang.org/x/image v0.0.0-20190823064033-3a9bac650e44 // indirect
golang.org/x/mobile v0.0.0-20190826170111-cafc553e1ac5 // indirect
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7
golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456
golang.org/x/crypto v0.0.0-20190829043050-9756ffdc2472 // indirect
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297
golang.org/x/sys v0.0.0-20190830142957-1e83adbbebd0
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4
golang.org/x/tools v0.0.0-20190826234050-71894ab67ee3 // indirect
google.golang.org/api v0.9.0 // indirect
golang.org/x/tools v0.0.0-20190830223141-573d9926052a // indirect
google.golang.org/appengine v1.6.1 // indirect
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55
google.golang.org/grpc v1.23.0
gopkg.in/yaml.v2 v2.2.2
honnef.co/go/tools v0.0.1-2019.2.2 // indirect
sigs.k8s.io/yaml v1.1.0 // indirect
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0 // indirect
)
Expand Down
Loading

0 comments on commit 14eae68

Please sign in to comment.