-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
owner: add recover panic in owner campaignLoop. #5904
Conversation
owner/manager.go
Outdated
@@ -172,7 +173,23 @@ func (m *ownerManager) CampaignOwner(ctx context.Context) error { | |||
return nil | |||
} | |||
|
|||
func recoverInOwner(funcName string, quit bool) { | |||
r := recover() |
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.
Please use if assignment pattern.
@ngaut PTAL |
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
owner/manager.go
Outdated
func (m *ownerManager) campaignLoop(ctx context.Context, etcdSession *concurrency.Session) { | ||
defer recoverInOwner("campaignLoop", true) |
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.
We don't need to quit if ddl doesn't work.
owner/manager.go
Outdated
@@ -172,7 +173,21 @@ func (m *ownerManager) CampaignOwner(ctx context.Context) error { | |||
return nil | |||
} | |||
|
|||
func recoverInOwner(funcName string, quit bool) { |
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.
The function acts like graceful exit process, the function name is not consistent with the behavior.
@coocood PTAL |
owner/manager.go
Outdated
buf := util.GetStack() | ||
log.Errorf("%s, %v, %s", funcName, r, buf) | ||
metrics.PanicCounter.WithLabelValues(metrics.LabelDDLOwner).Inc() | ||
if quit { |
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 remove the quit code block which would make it a real recover function?
@ngaut PTAL |
LGTM |
/run-all-tests |
/run-all-tests |
No description provided.