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

Commit 14eae68

Browse files
authored
relay: retry for upstream bad connection (#265)
1 parent 9ce7f0e commit 14eae68

File tree

11 files changed

+342
-198
lines changed

11 files changed

+342
-198
lines changed

dm/worker/relay.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828
"github.com/pingcap/dm/pkg/terror"
2929
"github.com/pingcap/dm/relay"
3030
"github.com/pingcap/dm/relay/purger"
31+
rr "github.com/pingcap/dm/relay/retry"
3132
)
3233

3334
// RelayHolder for relay unit
@@ -96,6 +97,13 @@ func NewRealRelayHolder(cfg *Config) RelayHolder {
9697
},
9798
BinLogName: clone.RelayBinLogName,
9899
BinlogGTID: clone.RelayBinlogGTID,
100+
ReaderRetry: rr.ReaderRetryConfig{ // we use config from TaskChecker now
101+
BackoffRollback: cfg.Checker.BackoffRollback,
102+
BackoffMax: cfg.Checker.BackoffMax,
103+
BackoffMin: cfg.Checker.BackoffMin,
104+
BackoffJitter: cfg.Checker.BackoffJitter,
105+
BackoffFactor: cfg.Checker.BackoffFactor,
106+
},
99107
}
100108

101109
h := &realRelayHolder{
@@ -320,6 +328,13 @@ func (h *realRelayHolder) Update(ctx context.Context, cfg *Config) error {
320328
User: cfg.From.User,
321329
Password: cfg.From.Password,
322330
},
331+
ReaderRetry: rr.ReaderRetryConfig{ // we use config from TaskChecker now
332+
BackoffRollback: cfg.Checker.BackoffRollback,
333+
BackoffMax: cfg.Checker.BackoffMax,
334+
BackoffMin: cfg.Checker.BackoffMin,
335+
BackoffJitter: cfg.Checker.BackoffJitter,
336+
BackoffFactor: cfg.Checker.BackoffFactor,
337+
},
323338
}
324339

325340
stage := h.Stage()

dm/worker/server_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func (t *testServer) TestServer(c *C) {
5555
c.Assert(err1, IsNil)
5656
}()
5757

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

go.mod

Lines changed: 10 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,97 +1,76 @@
11
module github.com/pingcap/dm
22

33
require (
4-
cloud.google.com/go v0.44.3 // indirect
54
github.com/BurntSushi/toml v0.3.1
65
github.com/DATA-DOG/go-sqlmock v1.3.3
76
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect
8-
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4 // indirect
97
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e
108
github.com/coreos/etcd v3.3.15+incompatible // indirect
119
github.com/coreos/go-semver v0.3.0 // indirect
1210
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f // indirect
1311
github.com/cznic/sortutil v0.0.0-20181122101858-f5f958428db8 // indirect
1412
github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 // indirect
1513
github.com/dustin/go-humanize v1.0.0
16-
github.com/go-kit/kit v0.9.0 // indirect
1714
github.com/go-ole/go-ole v1.2.4 // indirect
1815
github.com/go-sql-driver/mysql v1.4.1
1916
github.com/gogo/protobuf v1.2.1
2017
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 // indirect
2118
github.com/golang/mock v1.3.1
2219
github.com/golang/protobuf v1.3.2
20+
github.com/google/btree v1.0.0 // indirect
2321
github.com/google/go-cmp v0.3.1 // indirect
24-
github.com/google/pprof v0.0.0-20190723021845-34ac40c74b70 // indirect
2522
github.com/gorilla/mux v1.7.3 // indirect
2623
github.com/gorilla/websocket v1.4.1 // indirect
2724
github.com/grpc-ecosystem/grpc-gateway v1.9.6
28-
github.com/hashicorp/golang-lru v0.5.3 // indirect
2925
github.com/kami-zh/go-capturer v0.0.0-20171211120116-e492ea43421d
30-
github.com/kisielk/errcheck v1.2.0 // indirect
3126
github.com/klauspost/cpuid v1.2.1 // indirect
3227
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
33-
github.com/kr/pty v1.1.8 // indirect
34-
github.com/magiconair/properties v1.8.1 // indirect
35-
github.com/mattn/go-shellwords v1.0.6 // indirect
3628
github.com/montanaflynn/stats v0.5.0 // indirect
37-
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
38-
github.com/nicksnyder/go-i18n v2.0.2+incompatible // indirect
3929
github.com/onsi/ginkgo v1.9.0 // indirect
4030
github.com/onsi/gomega v1.6.0 // indirect
4131
github.com/opentracing/opentracing-go v1.1.0 // indirect
42-
github.com/pelletier/go-toml v1.4.0 // indirect
4332
github.com/pingcap/check v0.0.0-20190102082844-67f458068fc8
4433
github.com/pingcap/errcode v0.3.0 // indirect
4534
github.com/pingcap/errors v0.11.4
4635
github.com/pingcap/failpoint v0.0.0-20190708053854-e7b1061e6e81
4736
github.com/pingcap/kvproto v0.0.0-20190827032240-9696cd0c6acb // indirect
4837
github.com/pingcap/log v0.0.0-20190715063458-479153f07ebd
49-
github.com/pingcap/parser v0.0.0-20190827021345-87e7a137ab41
38+
github.com/pingcap/parser v0.0.0-20190902030720-275a827cf4e3
5039
github.com/pingcap/tidb v0.0.0-20190827060935-cc07b110825e
5140
github.com/pingcap/tidb-tools v3.0.0-beta.1.0.20190821032033-e6ccf3994944+incompatible
5241
github.com/pingcap/tipb v0.0.0-20190823055122-55a45ba82a79 // indirect
5342
github.com/prometheus/client_golang v1.1.0
5443
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 // indirect
5544
github.com/prometheus/procfs v0.0.4 // indirect
5645
github.com/remyoudompheng/bigfft v0.0.0-20190728182440-6a916e37a237 // indirect
57-
github.com/rogpeppe/fastuuid v1.2.0 // indirect
58-
github.com/rogpeppe/go-internal v1.3.1 // indirect
59-
github.com/russross/blackfriday v2.0.0+incompatible // indirect
6046
github.com/satori/go.uuid v1.2.0
6147
github.com/shirou/gopsutil v2.18.12+incompatible // indirect
6248
github.com/siddontang/go v0.0.0-20180604090527-bdc77568d726
6349
github.com/siddontang/go-log v0.0.0-20190221022429-1e957dd83bed // indirect
64-
github.com/siddontang/go-mysql v0.0.0-20190823102627-d34ccf107dfd
50+
github.com/siddontang/go-mysql v0.0.0-20190902035209-f52d30c9fcb7
6551
github.com/sirupsen/logrus v1.4.2 // indirect
6652
github.com/soheilhy/cmux v0.1.4
6753
github.com/spaolacci/murmur3 v1.1.0 // indirect
68-
github.com/spf13/afero v1.2.2 // indirect
6954
github.com/spf13/cobra v0.0.5
70-
github.com/spf13/jwalterweatherman v1.1.0 // indirect
71-
github.com/spf13/viper v1.4.0 // indirect
72-
github.com/stretchr/objx v0.2.0 // indirect
7355
github.com/stretchr/testify v1.4.0 // indirect
7456
github.com/syndtr/goleveldb v1.0.1-0.20190318030020-c3a204f8e965
57+
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 // indirect
7558
github.com/uber-go/atomic v1.4.0 // indirect
7659
github.com/uber/jaeger-client-go v2.16.0+incompatible // indirect
7760
github.com/uber/jaeger-lib v2.0.0+incompatible // indirect
78-
github.com/ugorji/go v1.1.7 // indirect
7961
github.com/unrolled/render v1.0.1 // indirect
80-
github.com/urfave/negroni v1.0.0 // indirect
8162
go.etcd.io/etcd v3.3.15+incompatible // indirect
63+
go.uber.org/atomic v1.4.0 // indirect
8264
go.uber.org/zap v1.10.0
83-
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586 // indirect
84-
golang.org/x/image v0.0.0-20190823064033-3a9bac650e44 // indirect
85-
golang.org/x/mobile v0.0.0-20190826170111-cafc553e1ac5 // indirect
86-
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7
87-
golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456
65+
golang.org/x/crypto v0.0.0-20190829043050-9756ffdc2472 // indirect
66+
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297
67+
golang.org/x/sys v0.0.0-20190830142957-1e83adbbebd0
8868
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4
89-
golang.org/x/tools v0.0.0-20190826234050-71894ab67ee3 // indirect
90-
google.golang.org/api v0.9.0 // indirect
69+
golang.org/x/tools v0.0.0-20190830223141-573d9926052a // indirect
70+
google.golang.org/appengine v1.6.1 // indirect
9171
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55
9272
google.golang.org/grpc v1.23.0
9373
gopkg.in/yaml.v2 v2.2.2
94-
honnef.co/go/tools v0.0.1-2019.2.2 // indirect
9574
sigs.k8s.io/yaml v1.1.0 // indirect
9675
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0 // indirect
9776
)

0 commit comments

Comments
 (0)