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

placement: add peer healthy factor when comparing region fit #6822

Closed
wants to merge 3 commits into from

Conversation

nolouch
Copy link
Contributor

@nolouch nolouch commented Jul 18, 2023

What problem does this PR solve?

Issue Number: Close #6559

When Region looks like:

{
  "id": 55929554,
  "start_key": "748000000000000BFF065F728000000042FFEF8B7A0000000000FA",
  "end_key": "748000000000000BFF065F728000000042FFF07AFD0000000000FA",
  "epoch": {
    "conf_ver": 6,
    "version": 109399
  },
  "peers": [
    {
      "id": 55929555,
      "store_id": 1,
      "role_name": "Voter"
    },
    {
      "id": 55929556,
      "store_id": 4,
      "role_name": "Voter"
    },
    {
      "id": 55929557,
      "store_id": 5,
      "role_name": "Voter"
    },
    {
      "id": 55929558,
      "store_id": 2751139,
      "role": 1,
      "role_name": "Learner",
      "is_learner": true
    }
  ],
  "leader": {
    "id": 55929555,
    "store_id": 1,
    "role_name": "Voter"
  },
  "down_peers": [
    {
      "down_seconds": 40307,
      "peer": {
        "id": 55929556,
        "store_id": 4,
        "role_name": "Voter"
      }
    }
  ],
  "pending_peers": [
    {
      "id": 55929556,
      "store_id": 4,
      "role_name": "Voter"
    }
  ],
  "cpu_usage": 0,
  "written_bytes": 0,
  "read_bytes": 0,
  "written_keys": 0,
  "read_keys": 0,
  "approximate_size": 1,
  "approximate_keys": 40960
}

and the region fit likes:

{
  "rule-fits": [
    {
      "rule": {
        "group_id": "pd",
        "id": "default",
        "start_key": "",
        "end_key": "",
        "role": "voter",
        "is_witness": false,
        "count": 3,
        "location_labels": [
          "region",
          "zone",
          "host"
        ]
      },
      "peers": [
        {
          "id": 55929555,
          "store_id": 1
        },
        {
          "id": 55929557,
          "store_id": 5
        },
        {
          "id": 55929556,
          "store_id": 4
        }
      ],
      "peers-different-role": null,
      "isolation-score": 300
    }
  ],
  "orphan-peers": [
    {
      "id": 55929558,
      "store_id": 2751139,
      "role": 1
    }
  ]
}

cannot fix the region, always report as an unhealthy region. and store 4 is gone.

What is changed and how does it work?

 add peer healthy factor when comparing region fit

Check List

Tests

  • Unit test

Release note

None.

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Jul 18, 2023

[REVIEW NOTIFICATION]

This pull request has not been approved.

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 Jul 18, 2023
@ti-chi-bot ti-chi-bot bot requested review from lhy1024 and rleungx July 18, 2023 09:06
@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. and removed do-not-merge/needs-triage-completed labels Jul 18, 2023
Signed-off-by: nolouch <[email protected]>
@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 19, 2023
@codecov
Copy link

codecov bot commented Jul 19, 2023

Codecov Report

Merging #6822 (8e4aeb6) into master (40eaa35) will increase coverage by 0.02%.
The diff coverage is 89.18%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6822      +/-   ##
==========================================
+ Coverage   74.15%   74.18%   +0.02%     
==========================================
  Files         413      413              
  Lines       43303    43309       +6     
==========================================
+ Hits        32112    32128      +16     
+ Misses       8324     8318       -6     
+ Partials     2867     2863       -4     
Flag Coverage Δ
unittests 74.18% <89.18%> (+0.02%) ⬆️

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

Signed-off-by: nolouch <[email protected]>
@nolouch nolouch requested review from CabinfeverB and removed request for lhy1024 July 19, 2023 08:15
@nolouch
Copy link
Contributor Author

nolouch commented Jul 21, 2023

#6831 is another way that introduces fewer changes, so close this one.

@nolouch nolouch closed this Jul 21, 2023
@nolouch nolouch deleted the fix-unhealthy branch July 21, 2023 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regions get stuck in 2 voters, 1 down peer, 1 learner state
1 participant