Skip to content

Conversation

bufferflies
Copy link
Contributor

@bufferflies bufferflies commented Apr 7, 2023

What problem does this PR solve?

Issue Number: Ref #6328,Close tikv/tikv#14333, ref #tikv/tikv#14214, ref tikv/tikv#14135

What is changed and how does it work?

If the moved region's size is bigger than the max-movable-hot-peer-size, it will be splited by hot buckets.
It will brings two benefits:

  1. bucket split will not be always happened, so the total region count is reasonable
  2. bucket split is on time, not depends on split-bucket-scheduler

The split-bucket-scheduler will be removed from the default list

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)

This PR:
img_v2_76d62145-dc58-497c-b07f-51cdc03d96fg

master:
img_v2_e3e332eb-b7e3-4668-a2ea-49d61716482g

Code changes

Side effects

Related changes

Release note

move hot region should be splitted if it's size is too large .

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Apr 7, 2023

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • lhy1024
  • rleungx

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

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ti-chi-bot ti-chi-bot added do-not-merge/needs-linked-issue do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesn't merit a release note. labels Apr 7, 2023
@ti-chi-bot ti-chi-bot requested review from nolouch and rleungx April 7, 2023 01:54
Signed-off-by: bufferflies <1045931706@qq.com>
Signed-off-by: bufferflies <1045931706@qq.com>
@codecov
Copy link

codecov bot commented Apr 13, 2023

Codecov Report

Patch coverage: 58.97% and project coverage change: -0.16 ⚠️

Comparison is base (dbec11e) 75.18% compared to head (aedad83) 75.02%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6281      +/-   ##
==========================================
- Coverage   75.18%   75.02%   -0.16%     
==========================================
  Files         408      408              
  Lines       40532    40598      +66     
==========================================
- Hits        30475    30460      -15     
- Misses       7417     7488      +71     
- Partials     2640     2650      +10     
Flag Coverage Δ
unittests 75.02% <58.97%> (-0.16%) ⬇️

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

Impacted Files Coverage Δ
server/cluster/cluster.go 81.44% <0.00%> (-0.72%) ⬇️
server/config/config.go 75.76% <ø> (ø)
pkg/schedule/schedulers/hot_region.go 82.45% <44.64%> (-2.04%) ⬇️
client/client.go 63.42% <100.00%> (+0.05%) ⬆️
pkg/mock/mockcluster/mockcluster.go 94.71% <100.00%> (+0.45%) ⬆️
pkg/schedule/operator/operator.go 92.85% <100.00%> (+0.04%) ⬆️
pkg/statistics/buckets/bucket_stat_informer.go 94.28% <100.00%> (ø)
pkg/statistics/buckets/hot_bucket_cache.go 90.74% <100.00%> (+0.54%) ⬆️
pkg/statistics/buckets/hot_bucket_task.go 86.36% <100.00%> (+0.64%) ⬆️
pkg/utils/keyutil/util.go 100.00% <100.00%> (ø)

... and 26 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Signed-off-by: bufferflies <1045931706@qq.com>
@bufferflies bufferflies marked this pull request as ready for review April 13, 2023 08:41
@ti-chi-bot ti-chi-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 13, 2023
Signed-off-by: bufferflies <1045931706@qq.com>
@bufferflies bufferflies changed the title draft: move hot region should be splited if it's size is too large . scheduler: move hot region should be splited if it's size is too large . Apr 13, 2023
@bufferflies bufferflies force-pushed the split_bucket_v2 branch 4 times, most recently from 71eed8c to 7c9ecfd Compare April 13, 2023 11:22
Signed-off-by: bufferflies <1045931706@qq.com>
Comment on lines +1359 to +1373
splitRegions := make([]*core.RegionInfo, 0)
if bs.opTy == movePeer {
for _, region := range []*core.RegionInfo{bs.cur.region, bs.cur.revertRegion} {
if region == nil {
continue
}
if region.GetApproximateSize() > bs.GetOpts().GetMaxMovableHotPeerSize() {
hotSchedulerNeedSplitBeforeScheduleCounter.Inc()
splitRegions = append(splitRegions, region)
}
}
}
if len(splitRegions) > 0 {
return bs.createSplitOperator(splitRegions)
}
Copy link
Member

Choose a reason for hiding this comment

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

Should we move it to the beginning of this function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good suggestion.

rleungx and others added 2 commits April 23, 2023 17:40
@bufferflies
Copy link
Contributor Author

/merge

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Apr 23, 2023

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

/run-all-tests

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 Apr 23, 2023

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

Commit hash: 942804b

@ti-chi-bot ti-chi-bot bot added the status/can-merge Indicates a PR has been approved by a committer. label Apr 23, 2023
@ti-chi-bot ti-chi-bot bot merged commit 1b75108 into tikv:master Apr 23, 2023
@bufferflies bufferflies deleted the split_bucket_v2 branch April 23, 2023 10:37
@bufferflies
Copy link
Contributor Author

/cherry-pick release-7.1

@bufferflies bufferflies added needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. and removed affects-7.1 This bug affects the 7.1.x(LTS) versions. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. labels Apr 23, 2023
@bufferflies
Copy link
Contributor Author

/cherry-pick release-7.1

@bufferflies bufferflies removed the needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. label Apr 24, 2023
@bufferflies bufferflies restored the split_bucket_v2 branch April 24, 2023 02:14
@bufferflies bufferflies added the needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. label Apr 24, 2023
@bufferflies
Copy link
Contributor Author

/cherry-pick-release-7.1

@wuhuizuo
Copy link
Contributor

/cherry-pick release-7.1

3 similar comments
@wuhuizuo
Copy link
Contributor

/cherry-pick release-7.1

@wuhuizuo
Copy link
Contributor

/cherry-pick release-7.1

@wuhuizuo
Copy link
Contributor

/cherry-pick release-7.1

@ti-chi-bot
Copy link
Member

@wuhuizuo: new pull request created to branch release-7.1: #6371.

In response to this:

/cherry-pick release-7.1

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 pushed a commit to ti-chi-bot/pd that referenced this pull request Apr 24, 2023
…ge . (tikv#6281)

* add createSplitOperator

Signed-off-by: bufferflies <1045931706@qq.com>

* consider string nil

Signed-off-by: bufferflies <1045931706@qq.com>

* add unit test for split buckets

Signed-off-by: bufferflies <1045931706@qq.com>

* enable split in hot region

Signed-off-by: bufferflies <1045931706@qq.com>

* lint

Signed-off-by: bufferflies <1045931706@qq.com>

* add stringer for resourceTy

Signed-off-by: bufferflies <1045931706@qq.com>

* remove region keys and hot split keys in additional info

Signed-off-by: bufferflies <1045931706@qq.com>

* pass unit test

Signed-off-by: bufferflies <1045931706@qq.com>

* address comments

Signed-off-by: bufferflies <1045931706@qq.com>

* remove one case from TestLoadKeyspaceGroupsAssignment

Signed-off-by: bufferflies <1045931706@qq.com>

* revert TestLoadKeyspaceGroupsAssignment

Signed-off-by: bufferflies <1045931706@qq.com>

---------

Signed-off-by: bufferflies <1045931706@qq.com>
Co-authored-by: Ryan Leung <rleungx@gmail.com>
Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
bufferflies added a commit to bufferflies/pd that referenced this pull request Apr 24, 2023
…ge . (tikv#6281)

* add createSplitOperator

Signed-off-by: bufferflies <1045931706@qq.com>

* consider string nil

Signed-off-by: bufferflies <1045931706@qq.com>

* add unit test for split buckets

Signed-off-by: bufferflies <1045931706@qq.com>

* enable split in hot region

Signed-off-by: bufferflies <1045931706@qq.com>

* lint

Signed-off-by: bufferflies <1045931706@qq.com>

* add stringer for resourceTy

Signed-off-by: bufferflies <1045931706@qq.com>

* remove region keys and hot split keys in additional info

Signed-off-by: bufferflies <1045931706@qq.com>

* pass unit test

Signed-off-by: bufferflies <1045931706@qq.com>

* address comments

Signed-off-by: bufferflies <1045931706@qq.com>

* remove one case from TestLoadKeyspaceGroupsAssignment

Signed-off-by: bufferflies <1045931706@qq.com>

* revert TestLoadKeyspaceGroupsAssignment

Signed-off-by: bufferflies <1045931706@qq.com>

---------

Signed-off-by: bufferflies <1045931706@qq.com>
Co-authored-by: Ryan Leung <rleungx@gmail.com>
Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>

fix flaky key for TestLoadKeyspaceGroupsAssignment

Signed-off-by: bufferflies <1045931706@qq.com>
ti-chi-bot bot pushed a commit that referenced this pull request Apr 27, 2023
…ge . (#6281) (#6371)

ref #6281, ref #6328, ref tikv/tikv#14135, ref tikv/tikv#14214, close tikv/tikv#14333

Signed-off-by: bufferflies <1045931706@qq.com>

Co-authored-by: buffer <1045931706@qq.com>
Co-authored-by: Ryan Leung <rleungx@gmail.com>
@ti-chi-bot ti-chi-bot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels May 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.

[Dynamic Regions] Bucket flow report triggers much faster region split than before.
5 participants