-
Notifications
You must be signed in to change notification settings - Fork 188
relay: retry for upstream bad connection #265
Conversation
…24f4b6f38e3e4ed1037a1a05acd GO111MODULE=on go mod tidy
Codecov Report
@@ Coverage Diff @@
## master #265 +/- ##
================================================
- Coverage 60.2806% 59.9918% -0.2888%
================================================
Files 134 134
Lines 14965 14742 -223
================================================
- Hits 9021 8844 -177
+ Misses 5099 5052 -47
- Partials 845 846 +1 |
/run-all-tests |
1 similar comment
/run-all-tests |
@GregoryIan @amyangfei PTAL |
@@ -83,11 +83,7 @@ func (t *testParserSuite) TestParser(c *C) { | |||
} | |||
|
|||
unsupportedSQLs := []string{ | |||
"alter table bar ADD FULLTEXT INDEX `fulltext` (`name`) WITH PARSER ngram", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove two supported cases handy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
YES, because parser also updated when executing
GO111MODULE=on go get -u github.com/siddontang/go-mysql@f52d30c9fcb7824f4b6f38e3e4ed1037a1a05acd
return false | ||
} | ||
|
||
for lrt := rr.lastRetryTime; time.Since(lrt) > rr.cfg.BackoffRollback; lrt = lrt.Add(rr.cfg.BackoffRollback) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we this logic code into backoff pkg? but not now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and a function like func (b *Backoff) Adjust()
to adjust/rollback cwnd
?
If so, maybe too many things backoff
can do?
what your opinion? @amyangfei
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer not to add this logic into backoff
pkg, but maybe we can add a function like RollbackN
?
} | ||
|
||
r.tctx.L().Info("receive retryable error for binlog reader", log.ShortError(err)) | ||
err = reader2.Close() // close the previous reader |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we close reader2
twice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
YES, we can close Reader
any times, but it will return a can not close
error except the first one.
In this place, we only close a reader2
instance once. this L298 close the previous one, and in the defer
in L260 ~ L265, it may close the first one (without retry) or the latest one (with retry).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check reader2 != nil
in c6baaab.
Rest LGTM |
LGTM |
dm/worker/relay.go
Outdated
@@ -96,6 +97,13 @@ func NewRealRelayHolder(cfg *Config) RelayHolder { | |||
}, | |||
BinLogName: clone.RelayBinLogName, | |||
BinlogGTID: clone.RelayBinlogGTID, | |||
ReaderRetry: rr.ReaderRetryConfig{ // we use config for TaskChecker now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ReaderRetry: rr.ReaderRetryConfig{ // we use config for TaskChecker now | |
ReaderRetry: rr.ReaderRetryConfig{ // we use config from TaskChecker now |
dm/worker/relay.go
Outdated
@@ -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 for TaskChecker now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
What problem does this PR solve?
What is changed and how it works?
Check List
Tests
KILL
connection for the relay unitSide effects