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

mcs: fix the scatter error #7241

Merged
merged 5 commits into from
Oct 25, 2023
Merged

Conversation

rleungx
Copy link
Member

@rleungx rleungx commented Oct 20, 2023

What problem does this PR solve?

Issue Number: Close #7234.

What is changed and how does it work?

Check List

Tests

  • Integration test

https://tcms.pingcap.net/dashboard/executions/plan/3450271

Release note

None.

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Oct 20, 2023

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • JmPotato
  • lhy1024

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-triage-completed release-note-none Denotes a PR that doesn't merit a release note. labels Oct 20, 2023
@ti-chi-bot ti-chi-bot bot requested review from disksing and Yisaer October 20, 2023 09:06
@ti-chi-bot ti-chi-bot bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Oct 20, 2023
@rleungx rleungx requested review from JmPotato and lhy1024 and removed request for disksing and Yisaer October 23, 2023 02:28
@codecov
Copy link

codecov bot commented Oct 23, 2023

Codecov Report

Merging #7241 (ee05b8c) into master (1899f41) will increase coverage by 0.01%.
Report is 2 commits behind head on master.
The diff coverage is 29.16%.

@@            Coverage Diff             @@
##           master    #7241      +/-   ##
==========================================
+ Coverage   74.35%   74.37%   +0.01%     
==========================================
  Files         446      446              
  Lines       48159    48198      +39     
==========================================
+ Hits        35810    35846      +36     
+ Misses       9191     9189       -2     
- Partials     3158     3163       +5     
Flag Coverage Δ
unittests 74.37% <29.16%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

@rleungx
Copy link
Member Author

rleungx commented Oct 23, 2023

/check-issue-triage-complete

Signed-off-by: Ryan Leung <rleungx@gmail.com>
@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Oct 23, 2023
@ti-chi-bot ti-chi-bot bot added the status/LGT1 Indicates that a PR has LGTM 1. label Oct 23, 2023
Signed-off-by: Ryan Leung <rleungx@gmail.com>
Copy link
Contributor

@lhy1024 lhy1024 left a comment

Choose a reason for hiding this comment

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

the rest LGTM

Comment on lines 195 to 197
if len(regionsID) == 1 {
return 0, nil, errors.New("region not found")
}
Copy link
Contributor

Choose a reason for hiding this comment

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

how about moving it to L188

                        if len(regionsID) == 1 {
                                if r.cluster.GetRegion(regionsID[0])==nil{
                                           scatterSkipNoRegionCounter.Inc()
				           return 0, nil, errors.New("region not found")
                                }
			}

Comment on lines +1816 to +1823
var regionsID []uint64
// nolint
if request.GetRegionId() != 0 {
// nolint
regionsID = []uint64{request.GetRegionId()}
} else {
regionsID = request.GetRegionsId()
}
Copy link
Contributor

Choose a reason for hiding this comment

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

why need nolint?

Copy link
Member Author

Choose a reason for hiding this comment

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

GetRegionId is deprecated

@@ -2134,6 +2152,15 @@ func (s *GrpcServer) invalidValue(msg string) *pdpb.ResponseHeader {
func (s *GrpcServer) convertHeader(header *schedulingpb.ResponseHeader) *pdpb.ResponseHeader {
switch header.GetError().GetType() {
case schedulingpb.ErrorType_UNKNOWN:
if strings.Contains(header.GetError().GetMessage(), "region not found") {
Copy link
Contributor

Choose a reason for hiding this comment

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

how about using const value for "region not found"

Signed-off-by: Ryan Leung <rleungx@gmail.com>
return 0, nil, errors.New("empty region")
return 0, nil, errEmptyRegion
}
if len(regionsID) == 1 {
Copy link
Contributor

Choose a reason for hiding this comment

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

It's different from previous, do we need to check whether it is nil?

Signed-off-by: Ryan Leung <rleungx@gmail.com>
@ti-chi-bot ti-chi-bot bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Oct 25, 2023
@lhy1024
Copy link
Contributor

lhy1024 commented Oct 25, 2023

/merge

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Oct 25, 2023

@lhy1024: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

You only need to trigger /merge once, and if the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

If you have any questions about the PR merge process, please refer to pr process.

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.

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Oct 25, 2023

This pull request has been accepted and is ready to merge.

Commit hash: 7e28af7

@ti-chi-bot ti-chi-bot bot added the status/can-merge Indicates a PR has been approved by a committer. label Oct 25, 2023
@ti-chi-bot ti-chi-bot bot merged commit 35b2719 into tikv:master Oct 25, 2023
19 checks passed
@rleungx rleungx deleted the fix-scatter-issue branch October 25, 2023 04:16
rleungx added a commit to rleungx/pd that referenced this pull request Dec 1, 2023
close tikv#7234

Signed-off-by: Ryan Leung <rleungx@gmail.com>

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The error of region not found is not properly convert to response
3 participants