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: let default rule fit the region at last #2626

Closed
wants to merge 1 commit into from

Conversation

Yisaer
Copy link
Contributor

@Yisaer Yisaer commented Jul 10, 2020

What problem does this PR solve?

Given region and store with following status:

// Stores:     1    2    3    4
// Leaders:    1    0    0    0
// Region1:    L    F    F    F

Then post a rule like following:

  {
    "group_id": "test",
    "id": "test-leader",
    "index": 1,
    "start_key": "",
    "end_key": "",
    "role": "leader",
    "count": 1,
    "label_constraints": [
      {
        "key": "role",
        "op": "in",
        "values": [
          "leader"
        ]
      }
    ],
    "location_labels": [
      "host"
    ]
  }

Then label store 1 as "role": "leader"

The expected RegionFit is:

For rule "test", the peers are peer-1 in store 1
For rule "pd", the peers are [peer-2,peer-3,peer-4] in store2/3/4

What we got is:

For rule "test", the peers are empty.
For rule "pd", the peers are [peer-1,peer-2,peer-3] in store 1/2/3

What is changed and how it works?

One possible solution is to let default rule fit the region at last.

Check List

Tests

  • Unit test

Release note

@Yisaer Yisaer added the component/placement Placement rule. label Jul 10, 2020
@Yisaer Yisaer requested a review from disksing July 10, 2020 05:55
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.

LGTM

@ti-srebot ti-srebot added the status/LGT1 Indicates that a PR has LGTM 1. label Jul 13, 2020
@disksing
Copy link
Contributor

I've composed another fix so closing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/placement Placement rule. status/LGT1 Indicates that a PR has LGTM 1.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants