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

store/copr: balance region for batch cop task (#24521) #24724

Merged
merged 5 commits into from
Jun 17, 2021

Conversation

ti-srebot
Copy link
Contributor

@ti-srebot ti-srebot commented May 18, 2021

cherry-pick #24521 to release-5.0
You can switch your code base to this Pull Request by using git-extras:

# In tidb repo:
git pr https://github.com/pingcap/tidb/pull/24724

After apply modifications, you can push your change to this PR via:

git push git@github.com:ti-srebot/tidb.git pr/24724:release-5.0-66c8cd96b0ea

What problem does this PR solve?

Issue Number: close pingcap/tiflash#1854

Problem Summary:

For mpp queries, if a table has more than 1 replicas, the table scan task of this table does not balance the scan region between the TiFlash nodes, so it is possible that although the regions are evenly distributed on several TiFlash nodes, the
scanned regions on each TiFlash nodes for a specific mpp query is very uneven

What is changed and how it works?

Proposal: xxx

What's Changed:

How it Works:
In buildBatchCopTasks, when all the regions to be read is collected, it will call balanceBatchCopTask to balance region for batch cop task.

Related changes

  • PR to update pingcap/docs/pingcap/docs-cn:
  • Need to cherry-pick to the release branch

Check List

Tests

  • Manual test (add detailed scripts or steps below)
    By add some extra log in TiDB, the balance result looks like this:
[2021/05/10 17:48:03.318 +08:00] [INFO] [batch_coprocessor.go:293] ["before task balance store 172.16.5.59:7640 : 527 regions,  store 172.16.5.85:7640 : 359 regions,  store 172.16.5.81:7640 : 243 regions, "]
[2021/05/10 17:48:03.320 +08:00] [INFO] [batch_coprocessor.go:299] ["after task balance store 172.16.5.81:7640 : 376 regions,  store 172.16.5.59:7640 : 377 regions,  store 172.16.5.85:7640 : 376 regions, "]
[2021/05/10 17:48:03.320 +08:00] [INFO] [batch_coprocessor.go:293] ["before task balance store 172.16.5.81:7640 : 1 regions, "]
[2021/05/10 17:48:03.320 +08:00] [INFO] [batch_coprocessor.go:299] ["after task balance store 172.16.5.81:7640 : 1 regions, "]
[2021/05/10 17:48:03.321 +08:00] [INFO] [batch_coprocessor.go:293] ["before task balance store 172.16.5.85:7640 : 80 regions,  store 172.16.5.81:7640 : 227 regions,  store 172.16.5.59:7640 : 66 regions, "]
[2021/05/10 17:48:03.322 +08:00] [INFO] [batch_coprocessor.go:299] ["after task balance store 172.16.5.81:7640 : 135 regions,  store 172.16.5.59:7640 : 103 regions,  store 172.16.5.85:7640 : 135 regions, "]

Side effects

  • Performance regression
    • Consumes more CPU

Release note

  • balance region for batch cop task

Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-chi-bot
Copy link
Member

@ti-srebot: This cherry pick PR is for a release branch and has not yet been approved by release team.
Adding the do-not-merge/cherry-pick-not-approved label.

To merge this cherry pick, it must first be approved (/lgtm + /merge) by the collaborators.

AFTER it has been approved by collaborators, please ping the release team in a comment to request a cherry pick review.

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 kubernetes/test-infra repository.

@ti-srebot
Copy link
Contributor Author

/run-all-tests

@ti-srebot ti-srebot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. type/5.0-cherry-pick labels May 18, 2021
@ti-srebot ti-srebot added this to the v5.0.1 milestone May 18, 2021
@ti-srebot
Copy link
Contributor Author

@windtalker you're already a collaborator in bot's repo.

@windtalker
Copy link
Contributor

/run-all-tests

@windtalker
Copy link
Contributor

/run-unit-test

@fzhedu
Copy link
Contributor

fzhedu commented May 19, 2021

/LGTM

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label May 19, 2021
@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • fzhedu
  • hanfei1991

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 added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jun 17, 2021
func (c *RegionCache) OnSendFailForBatchRegions(bo *Backoffer, store *Store, regionInfos []RegionInfo, scheduleReload bool, err error) {
metrics.RegionCacheCounterWithSendFail.Add(float64(len(regionInfos)))
if store.storeType != TiFlash {
logutil.Logger(bo.GetCtx()).Info("Should not reach here, OnSendFailForBatchRegions only support TiFlash")
Copy link
Member

Choose a reason for hiding this comment

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

The level should be warn or error

@windtalker
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: 9ebdbbb

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jun 17, 2021
@windtalker
Copy link
Contributor

/run-common-test

@ti-chi-bot ti-chi-bot merged commit 943d82c into pingcap:release-5.0 Jun 17, 2021
@zhouqiang-cl zhouqiang-cl modified the milestones: v5.0.1, v5.0.3 Jun 28, 2021
@LittleFall LittleFall deleted the release-5.0-66c8cd96b0ea branch October 11, 2022 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick-approved Cherry pick PR approved by release team. size/XL Denotes a PR that changes 500-999 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. type/5.0-cherry-pick
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants