-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
lightning: fix "context cancel" overwrites the real error #44734
Conversation
Signed-off-by: lance6716 <lance6716@gmail.com>
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
select { | ||
case <-egCtx.Done(): | ||
if egCtx.Err() != nil { | ||
return nil | ||
default: | ||
} |
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.
any difference?
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.
select {}
will lock the channel to read the value so performance is better. And code becomes shorter
jobs, err := local.generateJobForRange(egCtx, engine, r, regionSplitSize, regionSplitKeys) | ||
if err != nil { | ||
if common.IsContextCanceledError(err) { | ||
return nil |
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.
if we return nil here, caller will continue running
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's expected? because context is egCtx
and in line 1148 they will fail fast.
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.
will this happen:
- parent ctx cancelled,
generateAndSendJob
returns nil - all workers returns nil on ctx.Done()
- then we log that engine import success
maybe add ctx.Err into firstErr before return
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.
/retest |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: D3Hunter, GMHDBJD The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/hold |
Signed-off-by: lance6716 <lance6716@gmail.com>
/unhold |
/retest |
1 similar comment
/retest |
In response to a cherrypick label: new pull request created to branch |
/cherry-pick release-7.2 |
In response to a cherrypick label: new pull request created to branch |
@lance6716: new pull request could not be created: failed to create pull request against pingcap/tidb#release-7.2 from head ti-chi-bot:cherry-pick-44734-to-release-7.2: status code 422 not one of [201], body: {"message":"Validation Failed","errors":[{"resource":"PullRequest","code":"custom","message":"A pull request already exists for ti-chi-bot:cherry-pick-44734-to-release-7.2."}],"documentation_url":"https://docs.github.com/rest/reference/pulls#create-a-pull-request"} In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
What problem does this PR solve?
Issue Number: close #44733
Problem Summary:
What is changed and how it works?
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.