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

rule_checker: fix the issue of not being able to achieve the better RegionFit #7219

Merged
merged 3 commits into from
Oct 23, 2023

Conversation

nolouch
Copy link
Contributor

@nolouch nolouch commented Oct 17, 2023

What problem does this PR solve?

Issue Number: Close #7185

What is changed and how does it work?

fix the issue of not being able to achieve the better RegionFit
- try to replace the existing peer in another rulefit

Check List

Tests

  • Unit test
  • Integration test

Release note

None.

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Oct 17, 2023

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • CabinfeverB
  • bufferflies

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 release-note-none Denotes a PR that doesn't merit a release note. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. labels Oct 17, 2023
@ti-chi-bot ti-chi-bot bot requested review from disksing and Yisaer October 17, 2023 13:06
@ti-chi-bot ti-chi-bot bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 17, 2023
@nolouch nolouch requested review from lhy1024, CabinfeverB and rleungx and removed request for disksing and Yisaer October 17, 2023 13:08
@nolouch nolouch force-pushed the fix-placement-rule branch from 0700d50 to e6664b8 Compare October 17, 2023 13:10
@nolouch nolouch changed the title placement: fix the issue of not being able to achieve the best RegionFit rule_checker: fix the issue of not being able to achieve the best RegionFit Oct 17, 2023
@codecov
Copy link

codecov bot commented Oct 17, 2023

Codecov Report

Merging #7219 (859d708) into master (1899f41) will increase coverage by 0.02%.
The diff coverage is 83.33%.

❗ Current head 859d708 differs from pull request most recent head 583a4fc. Consider uploading reports for the commit 583a4fc to get more accurate results

@@            Coverage Diff             @@
##           master    #7219      +/-   ##
==========================================
+ Coverage   74.35%   74.37%   +0.02%     
==========================================
  Files         446      442       -4     
  Lines       48159    47908     -251     
==========================================
- Hits        35810    35633     -177     
+ Misses       9191     9107      -84     
- Partials     3158     3168      +10     
Flag Coverage Δ
unittests 74.37% <83.33%> (+0.02%) ⬆️

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

@nolouch nolouch force-pushed the fix-placement-rule branch from a51fb5e to 859d708 Compare October 18, 2023 03:44
@nolouch nolouch changed the title rule_checker: fix the issue of not being able to achieve the best RegionFit rule_checker: fix the issue of not being able to achieve the better RegionFit Oct 18, 2023
@ti-chi-bot ti-chi-bot bot added the needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. label Oct 18, 2023
@nolouch
Copy link
Contributor Author

nolouch commented Oct 20, 2023

ptal @CabinfeverB @rleungx

rules []string
opStr string
}{
{"111_leader,211,311", []string{"3/voter//", "3/learner/type=read/"}, "replace-rule-swap-fit-peer {mv peer: store [111] to"},
Copy link
Member

Choose a reason for hiding this comment

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

mv peer: store [111] to pls add target into op desc?

Copy link
Member

Choose a reason for hiding this comment

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

And IMO, no need to remove the old peer, just add voter and demote old peer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

mv peer: store [111] to pls add target into op desc?

The target is random here.

continue
}
ruleCheckerNoStoreThenTryReplace.Inc()
op, err := c.replaceUnexpectRulePeer(region, oldPeerRuleFit, fit, p, "swap-fit")
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@nolouch nolouch Oct 23, 2023

Choose a reason for hiding this comment

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

I want to reuse the old function and make it right first, it needs to be picked to 7.5. maybe improve it after this pr.

BTW, I think in most situations, there should be enough stores to add learners.

@ti-chi-bot ti-chi-bot bot added the status/LGT1 Indicates that a PR has LGTM 1. label Oct 23, 2023

// example: "3/voter/zone=zone1+zone2,rack=rack2/zone,rack,host"
// count role constraints location_labels
func makeRule(def string) *placement.Rule {
Copy link
Contributor

@bufferflies bufferflies Oct 23, 2023

Choose a reason for hiding this comment

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

how about use this method

func makeRule(def string) *Rule {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, it's a copy of that because not in the same package, do not let the test have dependence first. maybe extract to unit package later.

}

// example: "1111_leader,1234,2111_learner"
func makeRegion(def string) *core.RegionInfo {
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

@bufferflies bufferflies left a comment

Choose a reason for hiding this comment

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

rest LGTM

@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 23, 2023
@nolouch
Copy link
Contributor Author

nolouch commented Oct 23, 2023

/merge

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Oct 23, 2023

@nolouch: 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 23, 2023

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

Commit hash: 859d708

@ti-chi-bot ti-chi-bot bot added the status/can-merge Indicates a PR has been approved by a committer. label Oct 23, 2023
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Oct 23, 2023

@nolouch: Your PR was out of date, I have automatically updated it for you.

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.

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 ti-chi-bot bot merged commit 3f1a688 into tikv:master Oct 23, 2023
19 checks passed
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.1: #7244.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.5: #7245.

ti-chi-bot bot added a commit that referenced this pull request Oct 25, 2023
…egionFit (#7219) (#7245)

close #7185

fix the issue of not being able to achieve the better RegionFit
- try to replace the existing peer in another rulefit

Signed-off-by: nolouch <[email protected]>

Co-authored-by: nolouch <[email protected]>
Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
ti-chi-bot bot added a commit that referenced this pull request Oct 26, 2023
…egionFit (#7219) (#7244)

close #7185

fix the issue of not being able to achieve the better RegionFit
- try to replace the existing peer in another rulefit

Signed-off-by: nolouch <[email protected]>

Co-authored-by: nolouch <[email protected]>
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
needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 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.

Placement cannot add learner with the rule
4 participants