Skip to content
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

Merged
merged 8 commits into from
Feb 26, 2018
Merged

owner: add recover panic in owner campaignLoop. #5904

merged 8 commits into from
Feb 26, 2018

Conversation

winkyao
Copy link
Contributor

@winkyao winkyao commented Feb 26, 2018

No description provided.

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()
Copy link
Member

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.

@winkyao
Copy link
Contributor Author

winkyao commented Feb 26, 2018

@ngaut PTAL

Copy link
Member

@zz-jason zz-jason left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zz-jason zz-jason added the status/LGT1 Indicates that a PR has LGTM 1. label Feb 26, 2018
owner/manager.go Outdated
func (m *ownerManager) campaignLoop(ctx context.Context, etcdSession *concurrency.Session) {
defer recoverInOwner("campaignLoop", true)
Copy link
Member

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) {
Copy link
Member

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.

@winkyao
Copy link
Contributor Author

winkyao commented Feb 26, 2018

@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 {
Copy link
Member

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?

@winkyao
Copy link
Contributor Author

winkyao commented Feb 26, 2018

@ngaut PTAL

@ngaut
Copy link
Member

ngaut commented Feb 26, 2018

LGTM

@ngaut ngaut added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Feb 26, 2018
@zz-jason
Copy link
Member

/run-all-tests

@iamxy
Copy link
Member

iamxy commented Feb 26, 2018

/run-all-tests

@winkyao winkyao merged commit d2709af into pingcap:master Feb 26, 2018
@winkyao winkyao deleted the refine_ddl_log branch February 26, 2018 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants