-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
drainer: exit with non-zero code for some errors #1012
Conversation
/run-all-tests |
1 similar comment
/run-all-tests |
/run-all-tests tidb=release-4.0 tikv=release-4.0 pd=release-4.0 |
@@ -287,6 +292,7 @@ func (s *Server) Start() error { | |||
defer func() { go s.Close() }() |
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.
there's race here and
go func() {
err2 := <-bs.Errors()
log.Error("drainer reported error", zap.Error(err2))
bs.Close()
os.Exit(2)
}()
both close server and if later one gets called later it may return and exit before the first one finishes.
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.
how about just make Server.Start()
return the the error of s.syncer.Start()
if it returns error
drainer/server.go
Outdated
@@ -269,6 +273,7 @@ func (s *Server) Start() error { | |||
go func() { | |||
for err := range errc { | |||
log.Error("send heart failed", zap.Error(err)) | |||
s.reportError(err) |
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.
it seems no need to quit once it failed to update the statue here, the replication can still work.
how about only failed and quit it failed to update status for a long time?
/run-all-tests tidb=release-4.0 tikv=release-4.0 pd=release-4.0 |
/run-all-tests tidb=release-4.0 tikv=release-4.0 pd=release-4.0 |
2 similar comments
/run-all-tests tidb=release-4.0 tikv=release-4.0 pd=release-4.0 |
/run-all-tests tidb=release-4.0 tikv=release-4.0 pd=release-4.0 |
/run-all-tests tidb=release-4.0 tikv=release-4.0 pd=release-4.0 |
@july2993 PTAL again |
/run-all-tests tidb=release-4.0 tikv=release-4.0 pd=release-4.0 |
What problem does this PR solve?
fix #1010
fix #1011
What is changed and how it works?
exit with non-zero code if
s.syncer.Start
ors.heartbeat
returned errors.Check List
Tests
s.syncer.Start
failedCode changes
Side effects
Related changes
Release note